ClickHouse/tests/integration/test_storage_kafka
Robert Schulze 81bf43157f
Allow configuration of Kafka topics with periods
The Kafka table engine allows global configuration and per-Kafka-topic
configuration. The latter uses syntax <kafka_TOPIC>, e.g. for topic
"football":

  <kafka_football>
      <retry_backoff_ms>250</retry_backoff_ms>
      <fetch_min_bytes>100000</fetch_min_bytes>
  </kafka_football>

Some users had to find out the hard way that such configuration doesn't
take effect if the topic name contains a period, e.g. "sports.football".
The reason is that ClickHouse configuration framework already uses
periods as level separators to descend the configuration hierarchy.
(Besides that, per-topic configuration at the same level as global
configuration could be considered ugly.)

Note that Kafka topics may contain characters "a-zA-Z0-9._-" (*) and
a tree-like topic organization using periods is quite common in
practice.

This PR deprecates the existing per-topic configuration syntax (but
continues to support it for backward compat) and introduces a new
per-topic configuration syntax below the global Kafka configuration of
the form:

<kafka>
   <topic name="football">
       <retry_backoff_ms>250</retry_backoff_ms>
       <fetch_min_bytes>100000</fetch_min_bytes>
   </topic>
</kafka>

The period restriction doesn't apply to XML attributes, so <topic
name="sports.football"> will work. Also, everything Kafka-related is
below <kafka>.

Considered but rejected alternatives:
- Extending Poco ConfigurationView with custom separators (e.g."/"
  instead of "."). Won't work easily because ConfigurationView only
  builds a path but defers descending the configuration tree to the
  normal configuration classes.
- Reloading the configuration file in StorageKafka (instead of reading
  the loaded file) but with a custom separator. This mode is supported
  by XML configuration. Too ugly and error-prone since the true
  configuration is composed from multiple configuration files.

(*) https://stackoverflow.com/a/37067544
2023-02-22 20:35:09 +00:00
..
clickhouse_path/format_schemas Test for issue #26643 2021-10-04 14:38:10 +00:00
configs Allow configuration of Kafka topics with periods 2023-02-22 20:35:09 +00:00
__init__.py Move all folders inside /dbms one level up (#9974) 2020-04-02 02:51:21 +03:00
kafka_pb2.py impl 2022-06-06 13:09:48 +02:00
message_with_repeated_pb2.py update other files 2022-06-06 15:31:20 +02:00
social_pb2.py update other files 2022-06-06 15:31:20 +02:00
test_kafka_json.reference Move all folders inside /dbms one level up (#9974) 2020-04-02 02:51:21 +03:00
test_kafka_virtual1.reference Move all folders inside /dbms one level up (#9974) 2020-04-02 02:51:21 +03:00
test_kafka_virtual2.reference Update tests 2020-07-31 00:24:14 +03:00
test.py Set retention policy for Kafka topic 2023-01-04 12:04:00 +00:00