Skip to content

Commit 2f1f8de

Browse files
committed
add code.
1 parent 24c927e commit 2f1f8de

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2801,13 +2801,24 @@ The delayed message index time step(in seconds) in per bucket snapshot segment,
28012801
)
28022802
private long brokerServiceCompactionThresholdInBytes = 0;
28032803

2804+
@Deprecated
28042805
@FieldContext(
28052806
category = CATEGORY_SERVER,
2807+
deprecated = true,
28062808
doc = "Timeout for the compaction phase one loop, If the execution time of the compaction "
28072809
+ "phase one loop exceeds this time, the compaction will not proceed."
2810+
+ "@deprecated - Use brokerServiceCompactionPhaseOneLoopReadTimeoutInSeconds instead" +
2811+
"to control the timeout for each read request."
28082812
)
28092813
private long brokerServiceCompactionPhaseOneLoopTimeInSeconds = 30;
28102814

2815+
@FieldContext(
2816+
category = CATEGORY_SERVER,
2817+
doc = "Timeout for each read request in the compaction phase one loop, If the execution time of one "
2818+
+ "single message read operation exceeds this time, the compaction will not proceed."
2819+
)
2820+
private long brokerServiceCompactionPhaseOneLoopReadTimeoutInSeconds = 30;
2821+
28112822
@FieldContext(
28122823
category = CATEGORY_SERVER,
28132824
doc = "Whether retain null-key message during topic compaction."

pulsar-broker/src/main/java/org/apache/pulsar/compaction/StrategicTwoPhaseCompactor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public StrategicTwoPhaseCompactor(ServiceConfiguration conf,
7272
ScheduledExecutorService scheduler) {
7373
super(conf, pulsar, bk, scheduler);
7474
batchMessageContainer = new RawBatchMessageContainerImpl();
75-
phaseOneLoopReadTimeout = Duration.ofSeconds(conf.getBrokerServiceCompactionPhaseOneLoopTimeInSeconds());
75+
phaseOneLoopReadTimeout = Duration.ofSeconds(conf.getBrokerServiceCompactionPhaseOneLoopReadTimeoutInSeconds());
7676
}
7777

7878
public CompletableFuture<Long> compact(String topic) {

pulsar-broker/src/main/java/org/apache/pulsar/compaction/TwoPhaseCompactor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public TwoPhaseCompactor(ServiceConfiguration conf,
7070
BookKeeper bk,
7171
ScheduledExecutorService scheduler) {
7272
super(conf, pulsar, bk, scheduler);
73-
phaseOneLoopReadTimeout = Duration.ofSeconds(conf.getBrokerServiceCompactionPhaseOneLoopTimeInSeconds());
73+
phaseOneLoopReadTimeout = Duration.ofSeconds(conf.getBrokerServiceCompactionPhaseOneLoopReadTimeoutInSeconds());
7474
topicCompactionRetainNullKey = conf.isTopicCompactionRetainNullKey();
7575
}
7676

pulsar-broker/src/test/java/org/apache/pulsar/compaction/CompactorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ public void testCompactEmptyTopic() throws Exception {
260260
@Test
261261
public void testPhaseOneLoopTimeConfiguration() {
262262
ServiceConfiguration configuration = new ServiceConfiguration();
263-
configuration.setBrokerServiceCompactionPhaseOneLoopTimeInSeconds(60);
263+
configuration.setBrokerServiceCompactionPhaseOneLoopReadTimeoutInSeconds(60);
264264
PulsarClientImpl mockClient = mock(PulsarClientImpl.class);
265265
ConnectionPool connectionPool = mock(ConnectionPool.class);
266266
when(mockClient.getCnxPool()).thenReturn(connectionPool);

0 commit comments

Comments
 (0)