-
Notifications
You must be signed in to change notification settings - Fork 728
iceberg: add iceberg_dlq_table_suffix configuration property #28242
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 all commits
Commits
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
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 |
|---|---|---|
|
|
@@ -7,9 +7,13 @@ | |
| # the Business Source License, use of this software will be governed | ||
| # by the Apache License, Version 2.0 | ||
|
|
||
| import json | ||
|
|
||
| from confluent_kafka import Producer | ||
| from ducktape.mark import matrix | ||
| from ducktape.mark._mark import Mark | ||
|
|
||
| from rptest.clients.rpk import RpkTool | ||
| from rptest.context.gcp import GCPContext | ||
| from rptest.services.catalog_service import CatalogType | ||
| from rptest.services.cluster import cluster | ||
|
|
@@ -62,6 +66,8 @@ def gcp_only_test(func, /): | |
|
|
||
|
|
||
| class BiglakeTest(RedpandaTest): | ||
| dlq_table_suffix = "__panda_dlq" | ||
|
|
||
| def __init__(self, test_context, *args, **kwargs): | ||
| super().__init__( | ||
| test_context, | ||
|
|
@@ -70,6 +76,7 @@ def __init__(self, test_context, *args, **kwargs): | |
| extra_rp_conf={ | ||
| "iceberg_enabled": "true", | ||
| "iceberg_catalog_commit_interval_ms": 5000, | ||
| "iceberg_dlq_table_suffix": self.dlq_table_suffix, | ||
| }, | ||
| schema_registry_config=SchemaRegistryConfig(), | ||
| pandaproxy_config=PandaproxyConfig(), | ||
|
|
@@ -83,6 +90,32 @@ def setUp(self): | |
| # redpanda will be started by DatalakeServices | ||
| pass | ||
|
|
||
| def count_rows(self, dl: DatalakeServices, table_name: str) -> int: | ||
| t = dl.catalog_client().load_table(f"redpanda.{table_name}") | ||
| df = t.scan().to_duckdb("data") | ||
| r = df.sql("SELECT count(*) FROM data").fetchone() | ||
| self.logger.info(f"Row count for {table_name}: {r[0]}") | ||
| return r[0] | ||
|
|
||
| def wait_rows_count( | ||
| self, | ||
| dl: DatalakeServices, | ||
| table_name: str, | ||
| expected_count: int, | ||
| timeout_sec: int = 60, | ||
| ): | ||
| wait_until( | ||
| lambda: dl.catalog_client().table_exists(f"redpanda.{table_name}"), | ||
| timeout_sec=timeout_sec, | ||
| backoff_sec=1, | ||
| ) | ||
|
|
||
| wait_until( | ||
| lambda: self.count_rows(dl, table_name) == expected_count, | ||
| timeout_sec=timeout_sec, | ||
| backoff_sec=1, | ||
| ) | ||
|
|
||
| @gcp_only_test | ||
| @cluster(num_nodes=2) | ||
| @matrix(cloud_storage_type=supported_storage_types()) | ||
|
|
@@ -97,17 +130,55 @@ def test_e2e_basic(self, cloud_storage_type): | |
| dl.create_iceberg_enabled_topic(self.topic_name, partitions=10) | ||
| dl.produce_to_topic(self.topic_name, 1024, count) | ||
|
|
||
| wait_until( | ||
| lambda: dl.catalog_client().table_exists(f"redpanda.{self.topic_name}"), | ||
| timeout_sec=30, | ||
| backoff_sec=1, | ||
| self.wait_rows_count(dl, self.topic_name, count, timeout_sec=60) | ||
|
|
||
| @gcp_only_test | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. q: this will be cdt-only, right?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Will trigger a run as soon as everything else passes. |
||
| @cluster(num_nodes=2) | ||
| @matrix(cloud_storage_type=supported_storage_types()) | ||
| def test_dlq(self, cloud_storage_type): | ||
| count = 10 | ||
| with DatalakeServices( | ||
| self.test_context, | ||
| redpanda=self.redpanda, | ||
| include_query_engines=[], | ||
| catalog_type=CatalogType.BIGLAKE, | ||
| ) as dl: | ||
| dl.create_iceberg_enabled_topic( | ||
| self.topic_name, partitions=1, iceberg_mode="value_schema_latest" | ||
| ) | ||
|
|
||
| def count_rows(): | ||
| t = dl.catalog_client().load_table(f"redpanda.{self.topic_name}") | ||
| df = t.scan().to_duckdb("data") | ||
| r = df.sql("SELECT count(*) FROM data").fetchone() | ||
| self.logger.info(f"Row count for {self.topic_name}: {r[0]}") | ||
| return r[0] | ||
| self.logger.info(f"Creating schema for topic {self.topic_name}") | ||
| rpk = RpkTool(self.redpanda) | ||
| rpk.create_schema_from_str( | ||
| subject=f"{self.topic_name}-value", | ||
| schema=""" | ||
| { | ||
| "$schema": "http://json-schema.org/draft-07/schema#", | ||
| "type": "object", | ||
| "properties": { | ||
| "id": { "type": "integer" } | ||
| } | ||
| } | ||
| """, | ||
| schema_suffix="json", | ||
| ) | ||
|
|
||
| self.logger.info(f"Producing {count} invalid messages to {self.topic_name}") | ||
| dl.produce_to_topic(self.topic_name, 1024, count) | ||
|
|
||
| self.logger.info(f"Producing {count} valid messages to {self.topic_name}") | ||
| producer = Producer({"bootstrap.servers": self.redpanda.brokers()}) | ||
| for i in range(count): | ||
| producer.produce( | ||
| self.topic_name, | ||
| value=json.dumps({"id": i}), | ||
| ) | ||
| producer.flush() | ||
|
|
||
| self.logger.info("Waiting for DLQ table to have expected rows") | ||
| self.wait_rows_count( | ||
| dl, f"{self.topic_name}{self.dlq_table_suffix}", count, timeout_sec=60 | ||
| ) | ||
|
|
||
| wait_until(lambda: count_rows() == count, timeout_sec=60, backoff_sec=1) | ||
| self.logger.info("Waiting for main table to have expected rows") | ||
| self.wait_rows_count(dl, self.topic_name, count, timeout_sec=60) | ||
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
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.