Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup(smart_autocomplete): only remove dist table and mv #6922

Merged
merged 3 commits into from
Feb 28, 2025

Conversation

volokluev
Copy link
Member

we can't truncate a table this large so we'll just let TTL take care of it and stop populating it

@volokluev volokluev requested review from a team as code owners February 27, 2025 22:37
Copy link

github-actions bot commented Feb 27, 2025

This PR has a migration; here is the generated SQL for ./snuba/migrations/groups.py ()

-- start migrations

-- forward migration events_analytics_platform : 0029_remove_smart_autocomplete_experimental
Local op: DROP TABLE IF EXISTS eap_trace_item_attrs_mv;
Distributed op: DROP TABLE IF EXISTS eap_trace_item_attrs_dist;
-- end forward migration events_analytics_platform : 0029_remove_smart_autocomplete_experimental




-- backward migration events_analytics_platform : 0029_remove_smart_autocomplete_experimental
Distributed op: CREATE TABLE IF NOT EXISTS eap_trace_item_attrs_dist (project_id UInt64, item_type String, date Date CODEC (DoubleDelta, ZSTD(1)), retention_days UInt16, attrs_string Map(String, String), attrs_bool Array(String), attrs_int64 Array(String), attrs_float64 Array(String), key_val_hash UInt64) ENGINE Distributed(`cluster_one_sh`, default, eap_trace_item_attrs_local);
Local op: CREATE MATERIALIZED VIEW IF NOT EXISTS eap_trace_item_attrs_mv TO eap_trace_item_attrs_local (project_id UInt64, item_type String, date Date CODEC (DoubleDelta, ZSTD(1)), retention_days UInt16, attrs_string Map(String, String), attrs_bool Array(String), attrs_int64 Array(String), attrs_float64 Array(String), key_val_hash UInt64) AS 
SELECT
    project_id,
    'span',
    toDate(_sort_timestamp) AS date,
    retention_days as retention_days,
    mapConcat(attr_str_0, attr_str_1, attr_str_2, attr_str_3, attr_str_4, attr_str_5, attr_str_6, attr_str_7, attr_str_8, attr_str_9, attr_str_10, attr_str_11, attr_str_12, attr_str_13, attr_str_14, attr_str_15, attr_str_16, attr_str_17, attr_str_18, attr_str_19) AS attrs_string, -- `attrs_string` Map(String, String),
    array() AS attrs_bool, -- bool
    array() AS attrs_int64, -- int64
    arrayConcat(mapKeys(attr_num_0), mapKeys(attr_num_1), mapKeys(attr_num_2), mapKeys(attr_num_3), mapKeys(attr_num_4), mapKeys(attr_num_5), mapKeys(attr_num_6), mapKeys(attr_num_7), mapKeys(attr_num_8), mapKeys(attr_num_9), mapKeys(attr_num_10), mapKeys(attr_num_11), mapKeys(attr_num_12), mapKeys(attr_num_13), mapKeys(attr_num_14), mapKeys(attr_num_15), mapKeys(attr_num_16), mapKeys(attr_num_17), mapKeys(attr_num_18), mapKeys(attr_num_19)) AS attrs_float64, -- float
    -- a hash of all the attribute key,val pairs of the item in sorted order
    -- this lets us deduplicate rows with merges
    cityHash64(mapSort(
        mapConcat(
            mapApply((k, v) -> (k, ''), attr_num_0),
            mapApply((k, v) -> (k, ''), attr_num_1),
            mapApply((k, v) -> (k, ''), attr_num_2),
            mapApply((k, v) -> (k, ''), attr_num_3),
            mapApply((k, v) -> (k, ''), attr_num_4),
            mapApply((k, v) -> (k, ''), attr_num_5),
            mapApply((k, v) -> (k, ''), attr_num_6),
            mapApply((k, v) -> (k, ''), attr_num_7),
            mapApply((k, v) -> (k, ''), attr_num_8),
            mapApply((k, v) -> (k, ''), attr_num_9),
            mapApply((k, v) -> (k, ''), attr_num_10),
            mapApply((k, v) -> (k, ''), attr_num_11),
            mapApply((k, v) -> (k, ''), attr_num_12),
            mapApply((k, v) -> (k, ''), attr_num_13),
            mapApply((k, v) -> (k, ''), attr_num_14),
            mapApply((k, v) -> (k, ''), attr_num_15),
            mapApply((k, v) -> (k, ''), attr_num_16),
            mapApply((k, v) -> (k, ''), attr_num_17),
            mapApply((k, v) -> (k, ''), attr_num_18),
            mapApply((k, v) -> (k, ''), attr_num_19),
            attr_str_0,
            attr_str_1,
            attr_str_2,
            attr_str_3,
            attr_str_4,
            attr_str_5,
            attr_str_6,
            attr_str_7,
            attr_str_8,
            attr_str_9,
            attr_str_10,
            attr_str_11,
            attr_str_12,
            attr_str_13,
            attr_str_14,
            attr_str_15,
            attr_str_16,
            attr_str_17,
            attr_str_18,
            attr_str_19
        )
    )) AS key_val_hash
FROM eap_spans_2_local


;
-- end backward migration events_analytics_platform : 0029_remove_smart_autocomplete_experimental

@volokluev volokluev enabled auto-merge (squash) February 27, 2025 22:42
Copy link

codecov bot commented Feb 27, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
1172 1 1171 10
View the top 1 failed test(s) by shortest run time
tests.manual_jobs.test_scrub_ips_from_eap_spans::test_span_is_scrubbed
Stack Traces | 0.251s run time
Traceback (most recent call last):
  File ".../tests/manual_jobs/test_scrub_ips_from_eap_spans.py", line 266, in test_span_is_scrubbed
    write_raw_unprocessed_events(spans_storage, messages)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../snuba/tests/helpers.py", line 61, in write_raw_unprocessed_events
    write_processed_messages(storage, processed_messages)
  File ".../snuba/tests/helpers.py", line 29, in write_processed_messages
    ).write(rows)
      ^^^^^^^^^^^
  File ".../snuba/snuba/writer.py", line 31, in write
    return self.__writer.write(map(self.__encoder.encode, values))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../snuba/clickhouse/http.py", line 371, in write
    batch.join(timeout=batch_join_timeout)
  File ".../snuba/clickhouse/http.py", line 282, in join
    raise ClickhouseWriterError(message, code=code, row=row)
snuba.clickhouse.errors.ClickhouseWriterError: DB::Exception: Table default.eap_trace_item_attrs_local does not exist. Maybe you meant eap_trace_item_attrs_mv?. (UNKNOWN_TABLE) (version 23.8.11.29.altinitystable (altinity build))

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@volokluev volokluev merged commit 0fed6a7 into master Feb 28, 2025
32 checks passed
@volokluev volokluev deleted the volo/update_migration branch February 28, 2025 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants