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

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


The following commit(s) were added to refs/heads/master by this push:
     new f6f07aff9d HDDS-8803. Release CodecBuffers when batch operation is 
closed (#4873)
f6f07aff9d is described below

commit f6f07aff9db970c12421b700a49e57d29005fc36
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Mon Jun 12 10:30:33 2023 +0200

    HDDS-8803. Release CodecBuffers when batch operation is closed (#4873)
---
 .../apache/hadoop/hdds/utils/db/RDBBatchOperation.java   | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBBatchOperation.java
 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBBatchOperation.java
index 88e3c48c09..fa435e6d85 100644
--- 
a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBBatchOperation.java
+++ 
b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBBatchOperation.java
@@ -166,17 +166,28 @@ public class RDBBatchOperation implements BatchOperation {
           }
         }
 
-        debug(() -> String.format("  %s %s, #put=%s, #del=%s", this,
-            batchSizeDiscardedString(), putCount, delCount));
+        debug(this::summary);
+      }
+
+      private String summary() {
+        return String.format("  %s %s, #put=%s, #del=%s", this,
+            batchSizeDiscardedString(), putCount, delCount);
       }
 
       void clear() {
+        final boolean warn = !isCommit && batchSize > 0;
+        String details = warn ? summary() : null;
+
         for (Object value : ops.values()) {
           if (value instanceof CodecBuffer) {
             ((CodecBuffer) value).release(); // the key will also be released
           }
         }
         ops.clear();
+
+        if (warn) {
+          LOG.warn("discarding changes {}", details);
+        }
       }
 
       void putOrDelete(Bytes key, int keyLen, Object val, int valLen) {
@@ -351,6 +362,7 @@ public class RDBBatchOperation implements BatchOperation {
   public void close() {
     debug(() -> String.format("%s: close", name));
     writeBatch.close();
+    opCache.clear();
   }
 
   public void delete(ColumnFamily family, byte[] key) throws IOException {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to