You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ri...@apache.org on 2022/08/24 23:40:17 UTC
[ozone] branch master updated: HDDS-7166. Memory leak in Recon when replacing DB for new checkpoint (#3713)
This is an automated email from the ASF dual-hosted git repository.
ritesh 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 9333f1e5bf HDDS-7166. Memory leak in Recon when replacing DB for new checkpoint (#3713)
9333f1e5bf is described below
commit 9333f1e5bfff3baa2a19882363679cb0bbc0bbe1
Author: Duong Nguyen <du...@gmail.com>
AuthorDate: Wed Aug 24 16:40:10 2022 -0700
HDDS-7166. Memory leak in Recon when replacing DB for new checkpoint (#3713)
---
.../ozone/recon/recovery/ReconOmMetadataManagerImpl.java | 10 +++++++++-
.../ozone/recon/recovery/TestReconOmMetadataManagerImpl.java | 7 +++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/ReconOmMetadataManagerImpl.java b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/ReconOmMetadataManagerImpl.java
index fc5cead796..0840839156 100644
--- a/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/ReconOmMetadataManagerImpl.java
+++ b/hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/recovery/ReconOmMetadataManagerImpl.java
@@ -109,7 +109,15 @@ public class ReconOmMetadataManagerImpl extends OmMetadataManagerImpl
FileUtils.deleteDirectory(oldDBLocation);
}
}
- initializeNewRdbStore(newDbLocation);
+ DBStore current = getStore();
+ try {
+ initializeNewRdbStore(newDbLocation);
+ } finally {
+ // Always close DBStore if it's replaced.
+ if (current != null && current != getStore()) {
+ current.close();
+ }
+ }
}
@Override
diff --git a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/recovery/TestReconOmMetadataManagerImpl.java b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/recovery/TestReconOmMetadataManagerImpl.java
index 4a8ac5d637..0ecde0afd2 100644
--- a/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/recovery/TestReconOmMetadataManagerImpl.java
+++ b/hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/recovery/TestReconOmMetadataManagerImpl.java
@@ -28,6 +28,7 @@ import org.apache.commons.io.FileUtils;
import org.apache.hadoop.hdds.client.StandaloneReplicationConfig;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.utils.db.DBStore;
import org.apache.hadoop.ozone.om.OMMetadataManager;
import org.apache.hadoop.ozone.om.OmMetadataManagerImpl;
import org.apache.hadoop.ozone.om.helpers.BucketLayout;
@@ -130,6 +131,12 @@ public class TestReconOmMetadataManagerImpl {
Assert.assertNotNull(reconOMMetadataManager.getKeyTable(getBucketLayout())
.get("/sampleVol/bucketOne/key_two"));
+ // Update again with an existing OM DB.
+ DBStore current = reconOMMetadataManager.getStore();
+ reconOMMetadataManager.updateOmDB(
+ checkpoint.getCheckpointLocation().toFile());
+ // Verify that the existing DB instance is closed.
+ Assert.assertTrue(current.isClosed());
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org