Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
support __consumer_offsets topic compaction (#401)
Browse files Browse the repository at this point in the history
fix #316
  • Loading branch information
dockerzhang authored Mar 11, 2021
1 parent bc16dc1 commit 5ad37f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,7 @@ CompletableFuture<Reader<ByteBuffer>> getOffsetsTopicReader(int partitionId) {
}
return metadataTopicReaderBuilder.clone()
.topic(offsetConfig.offsetsTopicName() + PARTITIONED_TOPIC_SUFFIX + partitionId)
.readCompacted(true)
.createAsync();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
*/
@Slf4j
public class MetadataUtils {
// trigger compaction when the offset backlog reaches 100MB
public static final int MAX_COMPACTION_THRESHOLD = 100 * 1024 * 1024;

public static String constructOffsetsTopicBaseName(KafkaServiceConfiguration conf) {
return conf.getKafkaMetadataTenant() + "/" + conf.getKafkaMetadataNamespace()
Expand Down Expand Up @@ -112,6 +114,7 @@ public static void createKafkaMetadataIfMissing(PulsarAdmin pulsarAdmin, KafkaSe
namespaces.setNamespaceReplicationClusters(kafkaMetadataNamespace, replicationClusters);
namespaces.setRetention(kafkaMetadataNamespace,
new RetentionPolicies(-1, -1));
namespaces.setCompactionThreshold(kafkaMetadataNamespace, MAX_COMPACTION_THRESHOLD);
} else {
List<String> replicationClusters = namespaces.getNamespaceReplicationClusters(kafkaMetadataNamespace);
if (!replicationClusters.contains(cluster)) {
Expand Down

0 comments on commit 5ad37f3

Please sign in to comment.