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

chore: drop kafka_skip_broken_messages from kafka_events_json #18970

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions posthog/clickhouse/migrations/0050_drop_skip_messages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions
from posthog.models.event.sql import (
EVENTS_TABLE_JSON_MV_SQL,
KAFKA_EVENTS_TABLE_JSON_SQL,
)
from posthog.settings import CLICKHOUSE_CLUSTER

operations = [
run_sql_with_exceptions(f"DROP TABLE IF EXISTS events_json_mv ON CLUSTER '{CLICKHOUSE_CLUSTER}'"),
run_sql_with_exceptions(f"DROP TABLE IF EXISTS kafka_events_json ON CLUSTER '{CLICKHOUSE_CLUSTER}'"),
run_sql_with_exceptions(KAFKA_EVENTS_TABLE_JSON_SQL()),
run_sql_with_exceptions(EVENTS_TABLE_JSON_MV_SQL()),
]
6 changes: 0 additions & 6 deletions posthog/clickhouse/test/__snapshots__/test_schema.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@

) ENGINE = Kafka('kafka:9092', 'clickhouse_events_json_test', 'group1', 'JSONEachRow')

SETTINGS kafka_skip_broken_messages = 100

'
---
# name: test_create_kafka_table_with_different_kafka_host[kafka_app_metrics]
Expand Down Expand Up @@ -111,8 +109,6 @@

) ENGINE = Kafka('test.kafka.broker:9092', 'clickhouse_events_json_test', 'group1', 'JSONEachRow')

SETTINGS kafka_skip_broken_messages = 100

'
---
# name: test_create_kafka_table_with_different_kafka_host[kafka_groups]
Expand Down Expand Up @@ -728,8 +724,6 @@

) ENGINE = Kafka('kafka:9092', 'clickhouse_events_json_test', 'group1', 'JSONEachRow')

SETTINGS kafka_skip_broken_messages = 100

'
---
# name: test_create_table_query[kafka_groups]
Expand Down
11 changes: 1 addition & 10 deletions posthog/models/event/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,7 @@
storage_policy=STORAGE_POLICY(),
)

# we add the settings to prevent poison pills from stopping ingestion
# kafka_skip_broken_messages is an int, not a boolean, so we explicitly set
# the max block size to consume from kafka such that we skip _all_ broken messages
# this is an added safety mechanism given we control payloads to this topic
KAFKA_EVENTS_TABLE_JSON_SQL = lambda: (
EVENTS_TABLE_BASE_SQL
+ """
SETTINGS kafka_skip_broken_messages = 100
"""
).format(
KAFKA_EVENTS_TABLE_JSON_SQL = lambda: EVENTS_TABLE_BASE_SQL.format(
table_name="kafka_events_json",
cluster=settings.CLICKHOUSE_CLUSTER,
engine=kafka_engine(topic=KAFKA_EVENTS_JSON),
Expand Down
Loading