This is an automated email from the ASF dual-hosted git repository.

aengineer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 27b6042  HDDS-2379. OM terminates with RocksDB error while 
continuously writing keys. (#100)
27b6042 is described below

commit 27b6042f0e99ebcfdbbe21ee905084be3aadd6b1
Author: Bharat Viswanadham <bha...@apache.org>
AuthorDate: Tue Oct 29 21:09:20 2019 -0700

    HDDS-2379. OM terminates with RocksDB error while continuously writing 
keys. (#100)
---
 .../ozone/om/ratis/OzoneManagerDoubleBuffer.java   | 31 +++++++++++-----------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java
 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java
index 58b057f..1c7173f 100644
--- 
a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java
+++ 
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerDoubleBuffer.java
@@ -129,21 +129,22 @@ public class OzoneManagerDoubleBuffer {
       try {
         if (canFlush()) {
           setReadyBuffer();
-          final BatchOperation batchOperation = omMetadataManager.getStore()
-              .initBatchOperation();
-
-          readyBuffer.iterator().forEachRemaining((entry) -> {
-            try {
-              entry.getResponse().addToDBBatch(omMetadataManager,
-                  batchOperation);
-            } catch (IOException ex) {
-              // During Adding to RocksDB batch entry got an exception.
-              // We should terminate the OM.
-              terminate(ex);
-            }
-          });
-
-          omMetadataManager.getStore().commitBatchOperation(batchOperation);
+          try(BatchOperation batchOperation = omMetadataManager.getStore()
+              .initBatchOperation()) {
+
+            readyBuffer.iterator().forEachRemaining((entry) -> {
+              try {
+                entry.getResponse().addToDBBatch(omMetadataManager,
+                    batchOperation);
+              } catch (IOException ex) {
+                // During Adding to RocksDB batch entry got an exception.
+                // We should terminate the OM.
+                terminate(ex);
+              }
+            });
+
+            omMetadataManager.getStore().commitBatchOperation(batchOperation);
+          }
 
           // Complete futures first and then do other things. So, that
           // handler threads will be released.


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

Reply via email to