Skip to content

Commit

Permalink
HDDS-9065. [FSO]ListKeys: Incorrect result when keyPrefix matching mu…
Browse files Browse the repository at this point in the history
…ltiple exist keys
  • Loading branch information
Sadanand Shenoy committed Jan 23, 2024
1 parent 863627b commit 54dbdef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,10 @@ public void testListKeysWithMixOfDirsAndFiles() throws Exception {

expectedKeys = getExpectedKeyList("a", "a1", legacyOzoneBucket2);
checkKeyList("a", "a1", expectedKeys, fsoOzoneBucket2);

expectedKeys =
getExpectedKeyList("x/y/z/z1.tx", "", legacyOzoneBucket2);
checkKeyList("x/y/z/z1.tx", "", expectedKeys, fsoOzoneBucket2);
}

@Test
Expand Down Expand Up @@ -549,6 +553,7 @@ private static void buildNameSpaceTree2(OzoneBucket ozoneBucket)
keys.add("/a3/b1/c1/c1.tx");

keys.add("/x/y/z/z1.tx");
keys.add("/x/y/z/z1.txdir/z2.tx");

keys.add("/dir1/dir2/dir3/d11.tx");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public Collection<OzoneFileStatus> listStatusFSO(OmKeyArgs args,
getStatusHelper.apply(args, clientAddress, allowPartialPrefixes);

String dbPrefixKey;
if (fileStatus == null) {
if (fileStatus == null || allowPartialPrefixes) {
// if the file status is null, prefix is a not a valid filesystem path
// this should only work in list keys mode.
// fetch the db key based on the prefix path.
Expand Down

0 comments on commit 54dbdef

Please sign in to comment.