forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support DescribeConfigs request (apache#251)
Master issue: apache#241 This PR add support for Kafka DescribeConfigs request. The request is to get topic or broker related configs from Kafka but the Kafka's config is much different from KoP. We just only support request for topic's configs and use the default config value so that Confluent Schema Registry can run with KoP. * Handle DescribeConfig request * Add check for topic existence * Fix NPE when DescribeConfigsRequest has no config names * Check for non-existed topic * Add unit test for DescribeConfigsRequest
- Loading branch information
1 parent
9f324b0
commit 08a8c07
Showing
5 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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
62 changes: 62 additions & 0 deletions
62
kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/KafkaLogConfig.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/** | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.streamnative.pulsar.handlers.kop; | ||
|
||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.apache.kafka.common.config.TopicConfig; | ||
import org.apache.kafka.common.record.Records; | ||
|
||
/** | ||
* KafkaLogConfig is ported from kafka.log.LogConfig. | ||
*/ | ||
public class KafkaLogConfig { | ||
private static final Map<String, String> entries = defaultEntries(); | ||
|
||
public static Map<String, String> getEntries() { | ||
return entries; | ||
} | ||
|
||
private static Map<String, String> defaultEntries() { | ||
return Collections.unmodifiableMap(new HashMap<String, String>(){{ | ||
put(TopicConfig.SEGMENT_BYTES_CONFIG, Integer.toString(1024 * 1024 * 1024)); | ||
put(TopicConfig.SEGMENT_MS_CONFIG, Long.toString(24 * 7 * 7 * 60 * 1000L)); | ||
put(TopicConfig.SEGMENT_JITTER_MS_CONFIG, "0"); | ||
put(TopicConfig.SEGMENT_INDEX_BYTES_CONFIG, Integer.toString(10 * 1024 * 1024)); | ||
put(TopicConfig.FLUSH_MESSAGES_INTERVAL_CONFIG, Long.toString(Long.MAX_VALUE)); | ||
put(TopicConfig.FLUSH_MS_CONFIG, Long.toString(Long.MAX_VALUE)); | ||
put(TopicConfig.RETENTION_BYTES_CONFIG, Long.toString(-1L)); | ||
put(TopicConfig.RETENTION_MS_CONFIG, Long.toString(24 * 7 * 60 * 60 * 60 * 1000L)); | ||
put(TopicConfig.MAX_MESSAGE_BYTES_CONFIG, Integer.toString(1000000 + Records.LOG_OVERHEAD)); | ||
put(TopicConfig.INDEX_INTERVAL_BYTES_CONFIG, "4096"); | ||
put(TopicConfig.DELETE_RETENTION_MS_CONFIG, Long.toString(24 * 60 * 60 * 1000L)); | ||
put(TopicConfig.MIN_COMPACTION_LAG_MS_CONFIG, Long.toString(0L)); | ||
put(TopicConfig.FILE_DELETE_DELAY_MS_CONFIG, "60000"); | ||
put(TopicConfig.MIN_CLEANABLE_DIRTY_RATIO_CONFIG, "0.5"); | ||
// Kafka's default value of cleanup.policy is "delete", but here we set it to "compact" because confluent | ||
// schema registry needs this config value. | ||
put(TopicConfig.CLEANUP_POLICY_CONFIG, "compact"); | ||
put(TopicConfig.MIN_IN_SYNC_REPLICAS_CONFIG, "1"); | ||
put(TopicConfig.COMPRESSION_TYPE_CONFIG, "producer"); | ||
put(TopicConfig.UNCLEAN_LEADER_ELECTION_ENABLE_CONFIG, "false"); | ||
put(TopicConfig.PREALLOCATE_CONFIG, "false"); | ||
put(TopicConfig.MESSAGE_FORMAT_VERSION_CONFIG, "2.0"); | ||
put(TopicConfig.MESSAGE_TIMESTAMP_TYPE_CONFIG, "CreateTime"); | ||
put(TopicConfig.MESSAGE_TIMESTAMP_DIFFERENCE_MAX_MS_CONFIG, Long.toString(Long.MAX_VALUE)); | ||
put(TopicConfig.MESSAGE_DOWNCONVERSION_ENABLE_CONFIG, "true"); | ||
}}); | ||
} | ||
} |
This file contains 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 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