Skip to content

Commit

Permalink
fix random column problems
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-sentry committed Sep 17, 2024
1 parent 6c65df0 commit 27bc118
Showing 1 changed file with 6 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class Migration(migration.ClickhouseNodeMigration):
granularity = "8192"

str_mv = "spans_str_attrs_mv"
str_local_table = "spans_str_attrs_local"
str_dist_table = "spans_str_attrs_dist"
str_local_table = "spans_str_attrs_2_local"
str_dist_table = "spans_str_attrs_2_dist"
str_columns: Sequence[Column[Modifiers]] = [
Column("organization_id", UInt(64)),
Column("project_id", UInt(64)),
Expand All @@ -41,8 +41,8 @@ class Migration(migration.ClickhouseNodeMigration):
]

num_mv = "spans_num_attrs_mv"
num_local_table = "spans_num_attrs_local"
num_dist_table = "spans_num_attrs_dist"
num_local_table = "spans_num_attrs_2_local"
num_dist_table = "spans_num_attrs_2_dist"
num_columns: Sequence[Column[Modifiers]] = [
Column("organization_id", UInt(64)),
Column("project_id", UInt(64)),
Expand Down Expand Up @@ -78,17 +78,7 @@ def forwards_ops(self) -> Sequence[SqlOperation]:
table_name=self.num_dist_table,
target=OperationTarget.DISTRIBUTED,
),
# next, truncate/drop the local tables
operations.TruncateTable(
storage_set=self.storage_set_key,
table_name=self.str_local_table,
target=OperationTarget.LOCAL,
),
operations.TruncateTable(
storage_set=self.storage_set_key,
table_name=self.num_local_table,
target=OperationTarget.LOCAL,
),
# next, drop the local tables
operations.DropTable(
storage_set=self.storage_set_key,
table_name=self.str_local_table,
Expand Down Expand Up @@ -165,7 +155,7 @@ def forwards_ops(self) -> Sequence[SqlOperation]:
engine=table_engines.AggregatingMergeTree(
storage_set=self.storage_set_key,
primary_key="(organization_id, attr_key)",
order_by="(organization_id, attr_key, attr_value, timestamp, project_id, retention_days)",
order_by="(organization_id, attr_key, attr_min_value, attr_max_value, timestamp, project_id, retention_days)",
partition_by="toMonday(timestamp)",
settings={
"index_granularity": self.granularity,
Expand Down

0 comments on commit 27bc118

Please sign in to comment.