kaijchen commented on code in PR #4236:
URL: https://github.com/apache/ozone/pull/4236#discussion_r1096485674


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java:
##########
@@ -1178,21 +1178,18 @@ private OmKeyInfo createFakeDirIfShould(String volume, 
String bucket,
       String keyName, BucketLayout layout) throws IOException {
     OmKeyInfo fakeDirKeyInfo = null;
     String dirKey = OzoneFSUtils.addTrailingSlashIfNeeded(keyName);
-    String fileKeyBytes = metadataManager.getOzoneKey(volume, bucket, keyName);
+    String targetKey = OzoneFSUtils.addTrailingSlashIfNeeded(
+        metadataManager.getOzoneKey(volume, bucket, keyName));
     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);
-        }
+      Table.KeyValue<String, OmKeyInfo> keyValue = keyTblItr.seek(targetKey);
+
+      // HDDS-7871: RocksIterator#seek() may position at the key

Review Comment:
   While I'm still reading the RocksDB bloom filter docs, I have added more 
test cases to cover your scenarios.
   
   
   > Was looking for `/vol2/bucket2/key1` and getting false positive.
   
   Looking for `/vol1/bucket2/dir3/` is added in my false positive test. Is it 
equivalent?
   
   > and now you are looking for `/vol1/bucket2/dir1` but seek is pointing to ` 
/vol1/bucket1/dir1/key1`. So it will be a miss all the time now.
   
   TestFalseNegative is added, but I'm not sure why it might happen.
   
   
   
   



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