[fix][broker] Fix typo in the config key (#21690)
(cherry picked from commit 822b7f434e062989eb2dbc84dc2ca50fc0e6b134)
diff --git a/conf/broker.conf b/conf/broker.conf
index 29c76b5..1b3bdd1 100644
--- a/conf/broker.conf
+++ b/conf/broker.conf
@@ -526,7 +526,7 @@
brokerServiceCompactionPhaseOneLoopTimeInSeconds=30
# Whether retain null-key message during topic compaction
-topicCompactionRemainNullKey=true
+topicCompactionRetainNullKey=true
# Whether to enable the delayed delivery for messages.
# If disabled, messages will be immediately delivered and there will
diff --git a/conf/standalone.conf b/conf/standalone.conf
index a45d0e9..52da27a 100644
--- a/conf/standalone.conf
+++ b/conf/standalone.conf
@@ -1199,4 +1199,4 @@
managedLedgerMaxUnackedRangesToPersistInZooKeeper=-1
# Whether retain null-key message during topic compaction
-topicCompactionRemainNullKey=true
+topicCompactionRetainNullKey=true
diff --git a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
index 88e052a..d7fa1ef 100644
--- a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
+++ b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
@@ -2476,7 +2476,7 @@
category = CATEGORY_SERVER,
doc = "Whether retain null-key message during topic compaction."
)
- private boolean topicCompactionRemainNullKey = true;
+ private boolean topicCompactionRetainNullKey = true;
@FieldContext(
category = CATEGORY_SCHEMA,
diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/compaction/TwoPhaseCompactor.java b/pulsar-broker/src/main/java/org/apache/pulsar/compaction/TwoPhaseCompactor.java
index 831baff..59e1e39 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/compaction/TwoPhaseCompactor.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/compaction/TwoPhaseCompactor.java
@@ -62,7 +62,7 @@
private static final int MAX_OUTSTANDING = 500;
private static final String COMPACTED_TOPIC_LEDGER_PROPERTY = "CompactedTopicLedger";
private final Duration phaseOneLoopReadTimeout;
- private final boolean topicCompactionRemainNullKey;
+ private final boolean topicCompactionRetainNullKey;
public TwoPhaseCompactor(ServiceConfiguration conf,
PulsarClient pulsar,
@@ -70,7 +70,7 @@
ScheduledExecutorService scheduler) {
super(conf, pulsar, bk, scheduler);
phaseOneLoopReadTimeout = Duration.ofSeconds(conf.getBrokerServiceCompactionPhaseOneLoopTimeInSeconds());
- topicCompactionRemainNullKey = conf.isTopicCompactionRemainNullKey();
+ topicCompactionRetainNullKey = conf.isTopicCompactionRetainNullKey();
}
@Override
@@ -138,7 +138,7 @@
.extractIdsAndKeysAndSize(m, true)) {
if (e != null) {
if (e.getMiddle() == null) {
- if (!topicCompactionRemainNullKey) {
+ if (!topicCompactionRetainNullKey) {
// record delete null-key message event
deleteCnt++;
mxBean.addCompactionRemovedEvent(reader.getTopic());
@@ -175,7 +175,7 @@
latestForKey.remove(keyAndSize.getLeft());
}
} else {
- if (!topicCompactionRemainNullKey) {
+ if (!topicCompactionRetainNullKey) {
deletedMessage = true;
}
}
@@ -267,7 +267,7 @@
if (RawBatchConverter.isReadableBatch(m)) {
try {
messageToAdd = RawBatchConverter.rebatchMessage(
- m, (key, subid) -> subid.equals(latestForKey.get(key)), topicCompactionRemainNullKey);
+ m, (key, subid) -> subid.equals(latestForKey.get(key)), topicCompactionRetainNullKey);
} catch (IOException ioe) {
log.info("Error decoding batch for message {}. Whole batch will be included in output",
id, ioe);
@@ -277,7 +277,7 @@
Pair<String, Integer> keyAndSize = extractKeyAndSize(m);
MessageId msg;
if (keyAndSize == null) {
- messageToAdd = topicCompactionRemainNullKey ? Optional.of(m) : Optional.empty();
+ messageToAdd = topicCompactionRetainNullKey ? Optional.of(m) : Optional.empty();
} else if ((msg = latestForKey.get(keyAndSize.getLeft())) != null
&& msg.equals(id)) { // consider message only if present into latestForKey map
if (keyAndSize.getRight() <= 0) {
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactionTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactionTest.java
index 006dce0..6792d4a 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactionTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactionTest.java
@@ -640,7 +640,7 @@
@Test(dataProvider = "retainNullKey")
public void testKeyLessMessagesPassThrough(boolean retainNullKey) throws Exception {
- conf.setTopicCompactionRemainNullKey(retainNullKey);
+ conf.setTopicCompactionRetainNullKey(retainNullKey);
restartBroker();
String topic = "persistent://my-property/use/my-ns/my-topic1";