This is an automated email from the ASF dual-hosted git repository.
zhaocong pushed a commit to branch branch-2.10
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-2.10 by this push:
new 9bc15bfa375 [fix][broker] Fix typo in the config key (#21690)
9bc15bfa375 is described below
commit 9bc15bfa375a2b6e24e893c9714e48e3ed62754c
Author: Cong Zhao <[email protected]>
AuthorDate: Fri Dec 8 04:23:30 2023 +0800
[fix][broker] Fix typo in the config key (#21690)
(cherry picked from commit 822b7f434e062989eb2dbc84dc2ca50fc0e6b134)
---
conf/broker.conf | 2 +-
conf/standalone.conf | 2 +-
.../java/org/apache/pulsar/broker/ServiceConfiguration.java | 2 +-
.../java/org/apache/pulsar/compaction/TwoPhaseCompactor.java | 12 ++++++------
.../java/org/apache/pulsar/compaction/CompactionTest.java | 2 +-
5 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/conf/broker.conf b/conf/broker.conf
index 29e434de7c1..42f2df8beb3 100644
--- a/conf/broker.conf
+++ b/conf/broker.conf
@@ -508,7 +508,7 @@ brokerServiceCompactionThresholdInBytes=0
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 22ab0223e58..11fee710233 100644
--- a/conf/standalone.conf
+++ b/conf/standalone.conf
@@ -1104,4 +1104,4 @@ zookeeperServers=
configurationStoreServers=
# 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 79454c0199b..53014519e0e 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
@@ -2298,7 +2298,7 @@ public class ServiceConfiguration implements
PulsarConfiguration {
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 831baffd7f2..59e1e39f3e6 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 @@ public class TwoPhaseCompactor extends Compactor {
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 @@ public class TwoPhaseCompactor extends Compactor {
ScheduledExecutorService scheduler) {
super(conf, pulsar, bk, scheduler);
phaseOneLoopReadTimeout =
Duration.ofSeconds(conf.getBrokerServiceCompactionPhaseOneLoopTimeInSeconds());
- topicCompactionRemainNullKey = conf.isTopicCompactionRemainNullKey();
+ topicCompactionRetainNullKey = conf.isTopicCompactionRetainNullKey();
}
@Override
@@ -138,7 +138,7 @@ public class TwoPhaseCompactor extends Compactor {
.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 @@ public class TwoPhaseCompactor extends Compactor {
latestForKey.remove(keyAndSize.getLeft());
}
} else {
- if (!topicCompactionRemainNullKey) {
+ if (!topicCompactionRetainNullKey) {
deletedMessage = true;
}
}
@@ -267,7 +267,7 @@ public class TwoPhaseCompactor extends Compactor {
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 @@ public class TwoPhaseCompactor extends Compactor {
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 6e909a9ef02..22607de6b3a 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
@@ -637,7 +637,7 @@ public class CompactionTest extends
MockedPulsarServiceBaseTest {
@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";