OneSizeFitsQuorum commented on code in PR #11748:
URL: https://github.com/apache/iotdb/pull/11748#discussion_r1431000755


##########
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/IoTConsensusConfig.java:
##########
@@ -253,7 +253,8 @@ public static class Replication {
     private final int maxLogEntriesNumPerBatch;
     private final int maxSizePerBatch;
     private final int maxPendingBatchesNum;
-
+    private final int maxWriteRetryTime;
+    private final long writeRetryWaitTime;

Review Comment:
   InMs



##########
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/config/IoTConsensusConfig.java:
##########
@@ -253,7 +253,8 @@ public static class Replication {
     private final int maxLogEntriesNumPerBatch;
     private final int maxSizePerBatch;
     private final int maxPendingBatchesNum;
-
+    private final int maxWriteRetryTime;

Review Comment:
   Time -> Times



##########
iotdb-core/consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java:
##########
@@ -215,33 +215,54 @@ public TSStatus write(IConsensusRequest request) {
       }
       IConsensusRequest planNode = 
stateMachine.deserializeRequest(indexedConsensusRequest);
       long startWriteTime = System.nanoTime();
-      TSStatus result = stateMachine.write(planNode);
-      PERFORMANCE_OVERVIEW_METRICS.recordEngineCost(System.nanoTime() - 
startWriteTime);
-
-      long writeToStateMachineEndTime = System.nanoTime();
-      // statistic the time of writing request into stateMachine
-      ioTConsensusServerMetrics.recordWriteStateMachineTime(
-          writeToStateMachineEndTime - writeToStateMachineStartTime);
-      if (result.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
-        // The index is used when constructing batch in LogDispatcher. If its 
value
-        // increases but the corresponding request does not exist or is not 
put into
-        // the queue, the dispatcher will try to find the request in WAL. This 
behavior
-        // is not expected and will slow down the preparation speed for batch.
-        // So we need to use the lock to ensure the `offer()` and 
`incrementAndGet()` are
-        // in one transaction.
-        synchronized (searchIndex) {
-          logDispatcher.offer(indexedConsensusRequest);
-          searchIndex.incrementAndGet();
+

Review Comment:
   I have no problem with the following logic being correct, but I have a 
feeling that the write function is now over 100 lines long. Maybe we can split 
the function into several subfunctions in this PR to make our code cleaner



-- 
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]

Reply via email to