Skip to content

Commit

Permalink
[ISSUE apache#8657] Make retry topic pop probability configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
GenerousMan authored Sep 7, 2024
1 parent 5496807 commit 9b53c06
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public RemotingCommand processRequest(final ChannelHandlerContext ctx, RemotingC
// considered the same type because they share the same retry flag in previous fields.
// Therefore, needRetryV1 is designed as a subset of needRetry, and within a single request,
// only one type of retry topic is able to call popMsgFromQueue.
boolean needRetry = randomQ % 5 == 0;
boolean needRetry = randomQ < brokerConfig.getPopFromRetryProbability();
boolean needRetryV1 = false;
if (brokerConfig.isEnableRetryTopicV2() && brokerConfig.isRetrieveMessageFromPopRetryTopicV1()) {
needRetryV1 = randomQ % 2 == 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ public class BrokerConfig extends BrokerIdentity {
// read message from pop retry topic v1, for the compatibility, will be removed in the future version
private boolean retrieveMessageFromPopRetryTopicV1 = true;
private boolean enableRetryTopicV2 = false;

private int popFromRetryProbability = 20;
private boolean realTimeNotifyConsumerChange = true;

private boolean litePullMessageEnable = true;
Expand Down Expand Up @@ -563,6 +563,15 @@ public void setEnablePopLog(boolean enablePopLog) {
this.enablePopLog = enablePopLog;
}

public int getPopFromRetryProbability() {
return popFromRetryProbability;
}

public void setPopFromRetryProbability(int popFromRetryProbability) {
this.popFromRetryProbability = popFromRetryProbability;
}


public boolean isTraceOn() {
return traceOn;
}
Expand Down

0 comments on commit 9b53c06

Please sign in to comment.