-
Notifications
You must be signed in to change notification settings - Fork 2k
chore: move non-sharded ingestion to the ingestion layer #38790
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c4875f4
chore: move groups ingestion to the ingestion layer
Daesgar aa76d8f
fix: create tables on ingestion cluster
Daesgar 11041f0
chore: move non-sharded table ingestion to ingestion layer
Daesgar e6cb088
Merge branch 'master' into move-all-ingestion-layer
Daesgar 00d7314
chore: rename migration
Daesgar 4f36043
Merge remote-tracking branch 'origin/master' into move-all-ingestion-…
Daesgar d4d998f
Update query snapshots
github-actions[bot] 726da1d
Merge branch 'master' into move-all-ingestion-layer
Daesgar 76e65e6
fix: duplicated migration
Daesgar 83c74fb
Merge branch 'master' into move-all-ingestion-layer
Daesgar 3b28958
fix: node_role
Daesgar 431807c
Merge branch 'move-all-ingestion-layer' of github.com:PostHog/posthog…
Daesgar adf3a6b
Merge branch 'master' into move-all-ingestion-layer
Daesgar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,13 @@ | ||
| from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions | ||
| from posthog.clickhouse.plugin_log_entries import ( | ||
| KAFKA_PLUGIN_LOG_ENTRIES_TABLE_SQL, | ||
| PLUGIN_LOG_ENTRIES_TABLE, | ||
| PLUGIN_LOG_ENTRIES_TABLE_MV_SQL, | ||
| PLUGIN_LOG_ENTRIES_TABLE_SQL, | ||
| ) | ||
|
|
||
| operations = [ | ||
| run_sql_with_exceptions(PLUGIN_LOG_ENTRIES_TABLE_SQL()), | ||
| run_sql_with_exceptions(KAFKA_PLUGIN_LOG_ENTRIES_TABLE_SQL()), | ||
| run_sql_with_exceptions(PLUGIN_LOG_ENTRIES_TABLE_MV_SQL), | ||
| run_sql_with_exceptions(PLUGIN_LOG_ENTRIES_TABLE_MV_SQL(target_table=PLUGIN_LOG_ENTRIES_TABLE)), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
posthog/clickhouse/migrations/0014_persons_distinct_ids_column_remove.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions | ||
| from posthog.models.person.sql import KAFKA_PERSONS_TABLE_SQL, PERSONS_TABLE_MV_SQL | ||
| from posthog.models.person.sql import KAFKA_PERSONS_TABLE_SQL, PERSONS_TABLE, PERSONS_TABLE_MV_SQL | ||
| from posthog.settings import CLICKHOUSE_CLUSTER | ||
|
|
||
| operations = [ | ||
| run_sql_with_exceptions(f"DROP TABLE person_mv ON CLUSTER '{CLICKHOUSE_CLUSTER}'"), | ||
| run_sql_with_exceptions(f"DROP TABLE kafka_person ON CLUSTER '{CLICKHOUSE_CLUSTER}'"), | ||
| run_sql_with_exceptions(f"ALTER TABLE person ON CLUSTER '{CLICKHOUSE_CLUSTER}' DROP COLUMN IF EXISTS distinct_ids"), | ||
| run_sql_with_exceptions(KAFKA_PERSONS_TABLE_SQL()), | ||
| run_sql_with_exceptions(PERSONS_TABLE_MV_SQL), | ||
| run_sql_with_exceptions(PERSONS_TABLE_MV_SQL(target_table=PERSONS_TABLE)), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 6 additions & 2 deletions
8
posthog/clickhouse/migrations/0054_add_person_distinct_id_overrides_consumer.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,11 @@ | ||
| from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions | ||
| from posthog.models.person.sql import KAFKA_PERSON_DISTINCT_ID_OVERRIDES_TABLE_SQL, PERSON_DISTINCT_ID_OVERRIDES_MV_SQL | ||
| from posthog.models.person.sql import ( | ||
| KAFKA_PERSON_DISTINCT_ID_OVERRIDES_TABLE_SQL, | ||
| PERSON_DISTINCT_ID_OVERRIDES_MV_SQL, | ||
| PERSON_DISTINCT_ID_OVERRIDES_TABLE, | ||
| ) | ||
|
|
||
| operations = [ | ||
| run_sql_with_exceptions(KAFKA_PERSON_DISTINCT_ID_OVERRIDES_TABLE_SQL()), | ||
| run_sql_with_exceptions(PERSON_DISTINCT_ID_OVERRIDES_MV_SQL), | ||
| run_sql_with_exceptions(PERSON_DISTINCT_ID_OVERRIDES_MV_SQL(target_table=PERSON_DISTINCT_ID_OVERRIDES_TABLE)), | ||
| ] |
17 changes: 17 additions & 0 deletions
17
posthog/clickhouse/migrations/0149_groups_ingestion_layer.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| from posthog.clickhouse.client.connection import NodeRole | ||
| from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions | ||
| from posthog.models.group.sql import ( | ||
| DROP_GROUPS_TABLE_MV_SQL, | ||
| DROP_KAFKA_GROUPS_TABLE_SQL, | ||
| GROUPS_TABLE_MV_SQL, | ||
| GROUPS_WRITABLE_TABLE_SQL, | ||
| KAFKA_GROUPS_TABLE_SQL, | ||
| ) | ||
|
|
||
| operations = [ | ||
| run_sql_with_exceptions(DROP_GROUPS_TABLE_MV_SQL, node_roles=[NodeRole.DATA]), | ||
| run_sql_with_exceptions(DROP_KAFKA_GROUPS_TABLE_SQL, node_roles=[NodeRole.DATA]), | ||
| run_sql_with_exceptions(GROUPS_WRITABLE_TABLE_SQL(), node_roles=[NodeRole.INGESTION_SMALL]), | ||
| run_sql_with_exceptions(KAFKA_GROUPS_TABLE_SQL(on_cluster=False), node_roles=[NodeRole.INGESTION_SMALL]), | ||
| run_sql_with_exceptions(GROUPS_TABLE_MV_SQL(on_cluster=False), node_roles=[NodeRole.INGESTION_SMALL]), | ||
| ] |
57 changes: 57 additions & 0 deletions
57
posthog/clickhouse/migrations/0152_non_sharded_tables_ingestion_layer.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| from posthog.clickhouse.client.connection import NodeRole | ||
| from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions | ||
| from posthog.clickhouse.plugin_log_entries import ( | ||
| DROP_KAFKA_PLUGIN_LOG_ENTRIES_TABLE_SQL, | ||
| DROP_PLUGIN_LOG_ENTRIES_TABLE_MV_SQL, | ||
| KAFKA_PLUGIN_LOG_ENTRIES_TABLE_SQL, | ||
| PLUGIN_LOG_ENTRIES_TABLE_MV_SQL, | ||
| PLUGIN_LOG_ENTRIES_WRITABLE_TABLE_SQL, | ||
| ) | ||
| from posthog.models.person.sql import ( | ||
| DROP_KAFKA_PERSON_DISTINCT_ID2_TABLE_SQL, | ||
| DROP_KAFKA_PERSON_DISTINCT_ID_OVERRIDES_TABLE_SQL, | ||
| DROP_KAFKA_PERSONS_TABLE_SQL, | ||
| DROP_PERSON_DISTINCT_ID2_TABLE_MV_SQL, | ||
| DROP_PERSON_DISTINCT_ID_OVERRIDES_TABLE_MV_SQL, | ||
| DROP_PERSONS_TABLE_MV_SQL, | ||
| KAFKA_PERSON_DISTINCT_ID2_TABLE_SQL, | ||
| KAFKA_PERSON_DISTINCT_ID_OVERRIDES_TABLE_SQL, | ||
| KAFKA_PERSONS_TABLE_SQL, | ||
| PERSON_DISTINCT_ID2_MV_SQL, | ||
| PERSON_DISTINCT_ID2_WRITABLE_TABLE_SQL, | ||
| PERSON_DISTINCT_ID_OVERRIDES_MV_SQL, | ||
| PERSON_DISTINCT_ID_OVERRIDES_WRITABLE_TABLE_SQL, | ||
| PERSONS_TABLE_MV_SQL, | ||
| PERSONS_WRITABLE_TABLE_SQL, | ||
| ) | ||
|
|
||
| operations = [ | ||
| run_sql_with_exceptions(DROP_PERSON_DISTINCT_ID2_TABLE_MV_SQL, node_roles=[NodeRole.DATA]), | ||
| run_sql_with_exceptions(DROP_KAFKA_PERSON_DISTINCT_ID2_TABLE_SQL, node_roles=[NodeRole.DATA]), | ||
| run_sql_with_exceptions(PERSON_DISTINCT_ID2_WRITABLE_TABLE_SQL(), node_roles=[NodeRole.INGESTION_SMALL]), | ||
| run_sql_with_exceptions( | ||
| KAFKA_PERSON_DISTINCT_ID2_TABLE_SQL(on_cluster=False), node_roles=[NodeRole.INGESTION_SMALL] | ||
| ), | ||
| run_sql_with_exceptions(PERSON_DISTINCT_ID2_MV_SQL(on_cluster=False), node_roles=[NodeRole.INGESTION_SMALL]), | ||
| run_sql_with_exceptions(DROP_PERSON_DISTINCT_ID_OVERRIDES_TABLE_MV_SQL, node_roles=[NodeRole.DATA]), | ||
| run_sql_with_exceptions(DROP_KAFKA_PERSON_DISTINCT_ID_OVERRIDES_TABLE_SQL, node_roles=[NodeRole.DATA]), | ||
| run_sql_with_exceptions(PERSON_DISTINCT_ID_OVERRIDES_WRITABLE_TABLE_SQL(), node_roles=[NodeRole.INGESTION_SMALL]), | ||
| run_sql_with_exceptions( | ||
| KAFKA_PERSON_DISTINCT_ID_OVERRIDES_TABLE_SQL(on_cluster=False), node_roles=[NodeRole.INGESTION_SMALL] | ||
| ), | ||
| run_sql_with_exceptions( | ||
| PERSON_DISTINCT_ID_OVERRIDES_MV_SQL(on_cluster=False), node_roles=[NodeRole.INGESTION_SMALL] | ||
| ), | ||
| run_sql_with_exceptions(DROP_PLUGIN_LOG_ENTRIES_TABLE_MV_SQL, node_roles=[NodeRole.DATA]), | ||
| run_sql_with_exceptions(DROP_KAFKA_PLUGIN_LOG_ENTRIES_TABLE_SQL, node_roles=[NodeRole.DATA]), | ||
| run_sql_with_exceptions(PLUGIN_LOG_ENTRIES_WRITABLE_TABLE_SQL(), node_roles=[NodeRole.INGESTION_SMALL]), | ||
| run_sql_with_exceptions( | ||
| KAFKA_PLUGIN_LOG_ENTRIES_TABLE_SQL(on_cluster=False), node_roles=[NodeRole.INGESTION_SMALL] | ||
| ), | ||
| run_sql_with_exceptions(PLUGIN_LOG_ENTRIES_TABLE_MV_SQL(on_cluster=False), node_roles=[NodeRole.INGESTION_SMALL]), | ||
| run_sql_with_exceptions(DROP_PERSONS_TABLE_MV_SQL, node_roles=[NodeRole.DATA]), | ||
| run_sql_with_exceptions(DROP_KAFKA_PERSONS_TABLE_SQL, node_roles=[NodeRole.DATA]), | ||
| run_sql_with_exceptions(PERSONS_WRITABLE_TABLE_SQL(), node_roles=[NodeRole.DATA]), | ||
| run_sql_with_exceptions(KAFKA_PERSONS_TABLE_SQL(on_cluster=False), node_roles=[NodeRole.DATA]), | ||
| run_sql_with_exceptions(PERSONS_TABLE_MV_SQL(on_cluster=False), node_roles=[NodeRole.DATA]), | ||
| ] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.