ArafatKhan2198 commented on code in PR #4182:
URL: https://github.com/apache/ozone/pull/4182#discussion_r1133511302


##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/ContainerEndpoint.java:
##########
@@ -170,11 +170,18 @@ public Response getKeysForContainer(
       for (ContainerKeyPrefix containerKeyPrefix : containerKeyPrefixMap
           .keySet()) {
 
-        // Directly calling get() on the Key table instead of iterating since
-        // only full keys are supported now. When we change to using a prefix
-        // of the key, this needs to change to prefix seek.
-        OmKeyInfo omKeyInfo = omMetadataManager.getKeyTable(getBucketLayout())
+        // Directly calling getSkipCache() on the Key/FileTable table
+        // instead of iterating since only full keys are supported now. We will
+        // try to get the OmKeyInfo object by searching the KEY_TABLE table 
with
+        // the key prefix. If it's not found, we will then search the 
FILE_TABLE
+        OmKeyInfo omKeyInfo = 
omMetadataManager.getKeyTable(BucketLayout.LEGACY)
             .getSkipCache(containerKeyPrefix.getKeyPrefix());
+        if (omKeyInfo == null) {
+          omKeyInfo =
+              omMetadataManager.getKeyTable(BucketLayout.FILE_SYSTEM_OPTIMIZED)

Review Comment:
   Thank you @sumitagrawl  for pointing out the flaw in the PR submission. It 
would have been incomplete without it.
   The keys in fileTable and keyTable are stored slightly differently:
   ```
   FSO : /VolumeId/BucketId/ParentId/KeyName
   ObjectStore / Legacy : /VolumeName/BucketName/keyName
   ```
   To ensure that the prevkey parameter works correctly, we need to identify 
whether the path provided by the user is for FSO or OBS/Legacy. If the path is 
for OBS/Legacy, then the path should be fine because the OBS/Legacy format 
contains the volumeName and BucketName in its path.
   
   However, if the path is for FSO, we need to find the objectId for the 
respective volumeName, bucketName, and parentDirectoryName, and then use it to 
search the fileTable. The fileTable has the following structure:
   
   ```
   fileTable: /volumeId/bucketId/parentId/fileName -> KeyInfo
   ```
   So I have added a helper method in ContainerEndpoint that coverts the user 
path for FSO keys given by the user, to their respective objectID paths.
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to