RongtongJin commented on code in PR #4355:
URL: https://github.com/apache/rocketmq/pull/4355#discussion_r880143036
##########
store/src/main/java/org/apache/rocketmq/store/CommitLog.java:
##########
@@ -805,13 +805,17 @@ public CompletableFuture<PutMessageResult>
asyncPutMessage(final MessageExtBroke
boolean needHandleHA = needHandleHA(msg);
int needAckNums = 1;
- if (needHandleHA) {
- int inSyncReplicas =
Math.min(this.defaultMessageStore.getAliveReplicaNumInGroup(),
-
this.defaultMessageStore.getHaService().inSyncSlaveNums(currOffset) + 1);
- needAckNums = calcNeedAckNums(inSyncReplicas);
- if (needAckNums > inSyncReplicas) {
- // Tell the producer, don't have enough slaves to handle the
send request
- return CompletableFuture.completedFuture(new
PutMessageResult(PutMessageStatus.IN_SYNC_REPLICAS_NOT_ENOUGH, null));
+ if
(this.defaultMessageStore.getMessageStoreConfig().isAllAckInSyncStateSet()) {
+ needAckNums = -1;
+ } else {
+ if (needHandleHA) {
+ int inSyncReplicas =
Math.min(this.defaultMessageStore.getAliveReplicaNumInGroup(),
+
this.defaultMessageStore.getHaService().inSyncSlaveNums(currOffset) + 1);
+ needAckNums = calcNeedAckNums(inSyncReplicas);
+ if (needAckNums > inSyncReplicas) {
+ // Tell the producer, don't have enough slaves to handle
the send request
+ return CompletableFuture.completedFuture(new
PutMessageResult(PutMessageStatus.IN_SYNC_REPLICAS_NOT_ENOUGH, null));
+ }
Review Comment:
可以放在一个if else里,不需要else里面嵌套
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]