|
40 | 40 | import org.apache.kafka.server.config.ServerLogConfigs;
|
41 | 41 | import org.apache.kafka.server.config.ServerTopicConfigSynonyms;
|
42 | 42 | import org.apache.kafka.server.record.BrokerCompressionType;
|
| 43 | +import org.apache.kafka.server.record.TableTopicSchemaType; |
43 | 44 |
|
44 | 45 | import java.util.Collections;
|
45 | 46 | import java.util.HashMap;
|
@@ -336,6 +337,7 @@ public Optional<String> serverConfigName(String configName) {
|
336 | 337 | .define(TopicConfig.TABLE_TOPIC_ENABLE_CONFIG, BOOLEAN, false, null, MEDIUM, TopicConfig.TABLE_TOPIC_ENABLE_DOC)
|
337 | 338 | .define(TopicConfig.TABLE_TOPIC_COMMIT_INTERVAL_CONFIG, LONG, TimeUnit.MINUTES.toMillis(5), between(1, TimeUnit.MINUTES.toMillis(15)), MEDIUM, TopicConfig.TABLE_TOPIC_COMMIT_INTERVAL_DOC)
|
338 | 339 | .define(TopicConfig.TABLE_TOPIC_NAMESPACE_CONFIG, STRING, null, null, MEDIUM, TopicConfig.TABLE_TOPIC_NAMESPACE_DOC)
|
| 340 | + .define(TopicConfig.TABLE_TOPIC_SCHEMA_TYPE_CONFIG, STRING, TableTopicSchemaType.SCHEMALESS.name, in(TableTopicSchemaType.names().toArray(new String[0])), MEDIUM, TopicConfig.TABLE_TOPIC_SCHEMA_TYPE_DOC) |
339 | 341 | // AutoMQ inject end
|
340 | 342 | .define(TopicConfig.REMOTE_LOG_DISABLE_POLICY_CONFIG, STRING, TopicConfig.REMOTE_LOG_DISABLE_POLICY_RETAIN,
|
341 | 343 | in(TopicConfig.REMOTE_LOG_DISABLE_POLICY_RETAIN, TopicConfig.REMOTE_LOG_DISABLE_POLICY_DELETE),
|
@@ -390,6 +392,7 @@ public Optional<String> serverConfigName(String configName) {
|
390 | 392 | public final boolean tableTopicEnable;
|
391 | 393 | public final long tableTopicCommitInterval;
|
392 | 394 | public final String tableTopicNamespace;
|
| 395 | + public final TableTopicSchemaType tableTopicSchemaType; |
393 | 396 | // AutoMQ inject end
|
394 | 397 |
|
395 | 398 | private final int maxMessageSize;
|
@@ -446,6 +449,7 @@ public LogConfig(Map<?, ?> props, Set<String> overriddenConfigs) {
|
446 | 449 | this.tableTopicEnable = getBoolean(TopicConfig.TABLE_TOPIC_ENABLE_CONFIG);
|
447 | 450 | this.tableTopicCommitInterval = getLong(TopicConfig.TABLE_TOPIC_COMMIT_INTERVAL_CONFIG);
|
448 | 451 | this.tableTopicNamespace = getString(TopicConfig.TABLE_TOPIC_NAMESPACE_CONFIG);
|
| 452 | + this.tableTopicSchemaType = TableTopicSchemaType.forName(getString(TopicConfig.TABLE_TOPIC_SCHEMA_TYPE_CONFIG)); |
449 | 453 | // AutoMQ inject end
|
450 | 454 |
|
451 | 455 | remoteLogConfig = new RemoteLogConfig(this);
|
@@ -723,6 +727,16 @@ public static void validate(Properties props,
|
723 | 727 | }
|
724 | 728 | }
|
725 | 729 |
|
| 730 | + // AutoMQ inject start |
| 731 | + public static void validateTableTopicSchemaConfigValues(Properties props, String tableTopicSchemaRegistryUrl) { |
| 732 | + String schemaType = props.getProperty(TopicConfig.TABLE_TOPIC_SCHEMA_TYPE_CONFIG); |
| 733 | + if (TableTopicSchemaType.SCHEMA.name.equals(schemaType) && tableTopicSchemaRegistryUrl == null) { |
| 734 | + throw new InvalidConfigurationException("Table topic schema type is set to SCHEMA but schema registry URL is not configured"); |
| 735 | + } |
| 736 | + } |
| 737 | + |
| 738 | + // AutoMQ inject end |
| 739 | + |
726 | 740 | @Override
|
727 | 741 | public String toString() {
|
728 | 742 | return "LogConfig{" +
|
|
0 commit comments