This is an automated email from the ASF dual-hosted git repository. ckj pushed a commit to branch ozone-1.3 in repository https://gitbox.apache.org/repos/asf/ozone.git
commit 838587256966f2c5ee31ca101bb73a81fd0d1747 Author: Sumit Agrawal <[email protected]> AuthorDate: Thu Dec 15 06:44:05 2022 +0530 HDDS-7643. rocksdb iterator is not closed properly (#4084) --- .../org/apache/hadoop/ozone/om/KeyManagerImpl.java | 25 ++++++++++++---------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java index 60eed79891..8bf672fa7d 100644 --- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java +++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java @@ -1299,17 +1299,20 @@ public class KeyManagerImpl implements KeyManager { OmKeyInfo fakeDirKeyInfo = null; String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName); String fileKeyBytes = metadataManager.getOzoneKey(volume, bucket, keyName); - Table.KeyValue<String, OmKeyInfo> keyValue = - metadataManager.getKeyTable(layout).iterator() - .seek(OzoneFSUtils.addTrailingSlashIfNeeded(fileKeyBytes)); - - if (keyValue != null) { - Path fullPath = Paths.get(keyValue.getValue().getKeyName()); - Path subPath = Paths.get(dirKey); - OmKeyInfo omKeyInfo = keyValue.getValue(); - if (fullPath.startsWith(subPath)) { - // create fake directory - fakeDirKeyInfo = createDirectoryKey(omKeyInfo, dirKey); + try (TableIterator<String, ? extends Table.KeyValue<String, OmKeyInfo>> + keyTblItr = metadataManager.getKeyTable(layout).iterator()) { + Table.KeyValue<String, OmKeyInfo> keyValue = + keyTblItr + .seek(OzoneFSUtils.addTrailingSlashIfNeeded(fileKeyBytes)); + + if (keyValue != null) { + Path fullPath = Paths.get(keyValue.getValue().getKeyName()); + Path subPath = Paths.get(dirKey); + OmKeyInfo omKeyInfo = keyValue.getValue(); + if (fullPath.startsWith(subPath)) { + // create fake directory + fakeDirKeyInfo = createDirectoryKey(omKeyInfo, dirKey); + } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
