You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/08/23 05:39:54 UTC

[GitHub] [ozone] rakeshadr commented on a change in pull request #2369: HDDS-5349. Avoid usage of locks in listStatus.

rakeshadr commented on a change in pull request #2369:
URL: https://github.com/apache/ozone/pull/2369#discussion_r693673458



##########
File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
##########
@@ -2688,15 +2771,11 @@ protected int getDirectories(
   private int getFilesFromDirectory(
       TreeMap<String, OzoneFileStatus> cacheKeyMap,
       String seekKeyInDB, String prefixKeyPath, long prefixKeyInDB,
-      String startKey, int countEntries, long numEntries) throws IOException {
-
-    // A set to keep track of keys deleted in cache but not flushed to DB.
-    Set<String> deletedKeySet = new TreeSet<>();
+      int countEntries, long numEntries, Set<String> deletedKeySet)
+      throws IOException {
 
     Table<String, OmKeyInfo> keyTable = metadataManager.getKeyTable();
-    countEntries = listStatusFindFilesInTableCache(cacheKeyMap, keyTable,
-            prefixKeyInDB, seekKeyInDB, prefixKeyPath, startKey,
-            countEntries, numEntries, deletedKeySet);
+
     TableIterator<String, ? extends Table.KeyValue<String, OmKeyInfo>>
             iterator = keyTable.iterator();
     iterator.seek(seekKeyInDB);

Review comment:
       In SIMPLE layout code path, `iterator = keyTable.iterator();` is inside BUCKET_LOCK.  How about moving the BUCKET_LOCK in PREFIX layout something like,
   
   ```
   // First under lock obtain both entries from dir/file cache and generate
         // entries marked for delete.
         try {
           iterator = keyTable.iterator();
           countEntries = getFilesAndDirsFromCacheWithBucketLock(volumeName,
               bucketName, cacheFileMap, tempCacheDirMap, deletedKeySet,
               prefixKeyInDB, seekFileInDB, seekDirInDB, prefixPath, startKey,
               countEntries, numEntries);
         } finally {
           metadataManager.getLock().releaseReadLock(BUCKET_LOCK, volumeName,
               bucketName);
         }
         countEntries = getFilesFromDirectory(cacheFileMap, seekFileInDB,
             prefixPath, prefixKeyInDB, countEntries, numEntries, deletedKeySet,
             iterator);
   
   ```
   Reference: https://github.com/apache/ozone/pull/2369/files#diff-bde0dade7dd5ddda419499f4f999d25d40fcec1412e0ce809c36ffd1be473f22R2357
   




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

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

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



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