Skip to content

Commit

Permalink
cleanup(smart_autocomplete): remove smart autocomplete mv (#6867)
Browse files Browse the repository at this point in the history
* Takes up too much space
* full table scan if the attribute doesn't exist
  • Loading branch information
volokluev authored Feb 10, 2025
1 parent a975d0e commit 34e78bb
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from typing import Sequence

from snuba.clusters.storage_sets import StorageSetKey
from snuba.migrations import migration, operations
from snuba.migrations.operations import OperationTarget, SqlOperation


class Migration(migration.ClickhouseNodeMigration):

blocking = False
storage_set_key = StorageSetKey.EVENTS_ANALYTICS_PLATFORM

local_table_name = "eap_trace_item_attrs_local"
dist_table_name = "eap_trace_item_attrs_dist"
mv_name = "eap_trace_item_attrs_mv"

def forwards_ops(self) -> Sequence[SqlOperation]:
return [
operations.DropTable(
storage_set=self.storage_set_key,
table_name=self.mv_name,
target=OperationTarget.LOCAL,
),
operations.DropTable(
storage_set=self.storage_set_key,
table_name=self.local_table_name,
target=OperationTarget.LOCAL,
),
operations.DropTable(
storage_set=self.storage_set_key,
table_name=self.dist_table_name,
target=OperationTarget.DISTRIBUTED,
),
]

def backwards_ops(self) -> Sequence[SqlOperation]:
# we won't go back!
return []

0 comments on commit 34e78bb

Please sign in to comment.