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

feat(errors): Add migration adding features column #6723

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

cmanallen
Copy link
Member

@cmanallen cmanallen commented Jan 8, 2025

Adds migration for the new features columns and index. These columns will allow us to search for errors by feature flag.

DACI: https://www.notion.so/sentry/DACI-Search-for-Errors-by-Feature-Flag-1288b10e4b5d8014976dcbfbf335bc37?pvs=4#1288b10e4b5d805eb476d313eecae009
Closes: https://github.com/getsentry/team-replay/issues/519

Copy link

github-actions bot commented Jan 8, 2025

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

-- start migrations

-- forward migration events : 0025_add_features_column
Local op: ALTER TABLE errors_local ADD COLUMN IF NOT EXISTS features Nested(key String, value String) AFTER _tags_hash_map;
Local op: ALTER TABLE errors_local ADD COLUMN IF NOT EXISTS _features_hash_map Array(UInt64) MATERIALIZED arrayMap((k, v) -> cityHash64(concat(replaceRegexpAll(k, '(\\=|\\\\)', '\\\\\\1'), '=', v)), features.key, features.value) AFTER features.value;
Distributed op: ALTER TABLE errors_dist ADD COLUMN IF NOT EXISTS features Nested(key String, value String) AFTER _tags_hash_map;
Distributed op: ALTER TABLE errors_dist ADD COLUMN IF NOT EXISTS _features_hash_map Array(UInt64) MATERIALIZED arrayMap((k, v) -> cityHash64(concat(replaceRegexpAll(k, '(\\=|\\\\)', '\\\\\\1'), '=', v)), features.key, features.value) AFTER features.value;
Distributed op: ALTER TABLE errors_dist_ro ADD COLUMN IF NOT EXISTS features Nested(key String, value String) AFTER _tags_hash_map;
Distributed op: ALTER TABLE errors_dist_ro ADD COLUMN IF NOT EXISTS _features_hash_map Array(UInt64) MATERIALIZED arrayMap((k, v) -> cityHash64(concat(replaceRegexpAll(k, '(\\=|\\\\)', '\\\\\\1'), '=', v)), features.key, features.value) AFTER features.value;
Local op: ALTER TABLE errors_local ADD INDEX IF NOT EXISTS bf_features_hash_map _features_hash_map TYPE bloom_filter GRANULARITY 1;
-- end forward migration events : 0025_add_features_column




-- backward migration events : 0025_add_features_column
Local op: ALTER TABLE errors_local DROP INDEX IF EXISTS bf_features_hash_map;
Distributed op: ALTER TABLE errors_dist_ro DROP COLUMN IF EXISTS _features_hash_map;
Distributed op: ALTER TABLE errors_dist_ro DROP COLUMN IF EXISTS features;
Distributed op: ALTER TABLE errors_dist DROP COLUMN IF EXISTS _features_hash_map;
Distributed op: ALTER TABLE errors_dist DROP COLUMN IF EXISTS features;
Local op: ALTER TABLE errors_local DROP COLUMN IF EXISTS _features_hash_map;
Local op: ALTER TABLE errors_local DROP COLUMN IF EXISTS features;
-- end backward migration events : 0025_add_features_column

Copy link

codecov bot commented Jan 8, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
2824 1 2823 5
View the top 1 failed tests by shortest run time
tests.migrations.test_validator::test_validate_all_migrations[0025_add_features_column]
Stack Traces | 0.42s run time
Traceback (most recent call last):
  File ".../tests/migrations/test_validator.py", line 55, in test_validate_all_migrations
    validate_migration_order(snuba_migration)
  File ".../snuba/migrations/validator.py", line 143, in validate_migration_order
    _validate_order_new(forward_ops, backward_ops)
  File ".../snuba/migrations/validator.py", line 117, in _validate_order_new
    _validate_drop_col(op, local_ops_before)
  File ".../snuba/migrations/validator.py", line 76, in _validate_drop_col
    raise InvalidMigrationOrderError(
snuba.migrations.validator.InvalidMigrationOrderError: DropColumn errors_dist._features_hash_map operation must be applied on dist table before local

To view more test analytics, go to the Test Analytics Dashboard
📢 Thoughts on this report? Let us know!

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.

1 participant