hanishakoneru commented on a change in pull request #856:
URL: https://github.com/apache/hadoop-ozone/pull/856#discussion_r432058124



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java
##########
@@ -121,15 +133,27 @@ public Builder enableTracing(boolean enableTracing) {
       return this;
     }
 
+    public Builder setIndexToTerm(Function<Long, Long> termGet) {
+      this.indexToTerm = termGet;
+      return this;
+    }
+
     public OzoneManagerDoubleBuffer build() {
+      if (isRatisEnabled) {
+        Preconditions.checkNotNull(indexToTerm, "When ratis is enabled, " +
+                "OzoneManagerRatisSnapshot should not be null");

Review comment:
       Checking indexToTerm not null instead of omRatisSnapshot

##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java
##########
@@ -173,17 +196,19 @@ private void flushTransactions() {
                 flushedTransactionsSize);
           }
 
-          long lastRatisTransactionIndex =
-              readyBuffer.stream().map(DoubleBufferEntry::getTrxLogIndex)
-                  .max(Long::compareTo).get();
-
-          List<Long> flushedEpochs =
-              readyBuffer.stream().map(DoubleBufferEntry::getTrxLogIndex)
-                  .sorted().collect(Collectors.toList());
+          // When non-HA do this step here, as the sorted is not require in
+          // flush to DB. As in non-HA We want to complete futures as quick
+          // as possible after flush to DB, to release rpc handler threads.
+          if (!isRatisEnabled) {

Review comment:
       Time for this sorting should be inconsequential. The readyBuffer would 
have 10s of transactions at max. 
   Do we really need to separate it for HA and non-HA? 
   NIT: Can you please fix the typo require -> required and capital W in We.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org

Reply via email to