|
38 | 38 | import org.apache.kafka.server.config.ServerLogConfigs;
|
39 | 39 | import org.apache.kafka.server.config.ServerTopicConfigSynonyms;
|
40 | 40 | import org.apache.kafka.server.record.BrokerCompressionType;
|
| 41 | +import org.apache.kafka.server.record.TableTopicSchemaType; |
41 | 42 |
|
42 | 43 | import java.util.Collections;
|
43 | 44 | import java.util.HashMap;
|
@@ -340,6 +341,7 @@ public Optional<String> serverConfigName(String configName) {
|
340 | 341 | .define(TopicConfig.TABLE_TOPIC_ENABLE_CONFIG, BOOLEAN, false, null, MEDIUM, TopicConfig.TABLE_TOPIC_ENABLE_DOC)
|
341 | 342 | .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)
|
342 | 343 | .define(TopicConfig.TABLE_TOPIC_NAMESPACE_CONFIG, STRING, null, null, MEDIUM, TopicConfig.TABLE_TOPIC_NAMESPACE_DOC)
|
| 344 | + .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) |
343 | 345 | // AutoMQ inject end
|
344 | 346 | .define(TopicConfig.REMOTE_LOG_COPY_DISABLE_CONFIG, BOOLEAN, false, MEDIUM, TopicConfig.REMOTE_LOG_COPY_DISABLE_DOC)
|
345 | 347 | .define(TopicConfig.REMOTE_LOG_DELETE_ON_DISABLE_CONFIG, BOOLEAN, false, MEDIUM, TopicConfig.REMOTE_LOG_DELETE_ON_DISABLE_DOC);
|
@@ -393,6 +395,7 @@ public Optional<String> serverConfigName(String configName) {
|
393 | 395 | public final boolean tableTopicEnable;
|
394 | 396 | public final long tableTopicCommitInterval;
|
395 | 397 | public final String tableTopicNamespace;
|
| 398 | + public final TableTopicSchemaType tableTopicSchemaType; |
396 | 399 | // AutoMQ inject end
|
397 | 400 |
|
398 | 401 | private final int maxMessageSize;
|
@@ -449,6 +452,7 @@ public LogConfig(Map<?, ?> props, Set<String> overriddenConfigs) {
|
449 | 452 | this.tableTopicEnable = getBoolean(TopicConfig.TABLE_TOPIC_ENABLE_CONFIG);
|
450 | 453 | this.tableTopicCommitInterval = getLong(TopicConfig.TABLE_TOPIC_COMMIT_INTERVAL_CONFIG);
|
451 | 454 | this.tableTopicNamespace = getString(TopicConfig.TABLE_TOPIC_NAMESPACE_CONFIG);
|
| 455 | + this.tableTopicSchemaType = TableTopicSchemaType.forName(getString(TopicConfig.TABLE_TOPIC_SCHEMA_TYPE_CONFIG)); |
452 | 456 | // AutoMQ inject end
|
453 | 457 |
|
454 | 458 | remoteLogConfig = new RemoteLogConfig(this);
|
@@ -782,6 +786,16 @@ public static void validate(Map<String, String> existingConfigs,
|
782 | 786 | }
|
783 | 787 | }
|
784 | 788 |
|
| 789 | + // AutoMQ inject start |
| 790 | + public static void validateTableTopicSchemaConfigValues(Properties props, String tableTopicSchemaRegistryUrl) { |
| 791 | + String schemaType = props.getProperty(TopicConfig.TABLE_TOPIC_SCHEMA_TYPE_CONFIG); |
| 792 | + if (TableTopicSchemaType.SCHEMA.name.equals(schemaType) && tableTopicSchemaRegistryUrl == null) { |
| 793 | + throw new InvalidConfigurationException("Table topic schema type is set to SCHEMA but schema registry URL is not configured"); |
| 794 | + } |
| 795 | + } |
| 796 | + |
| 797 | + // AutoMQ inject end |
| 798 | + |
785 | 799 | @Override
|
786 | 800 | public String toString() {
|
787 | 801 | return "LogConfig{" +
|
|
0 commit comments