-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HDDS-12094. Update BasicKeyInfo to include isFile payload #7740
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2839,6 +2839,46 @@ public void testListKey() | |
assertFalse(volABucketBIter.hasNext()); | ||
} | ||
|
||
@Test | ||
public void testListKeyDirectoriesAreNotFiles() | ||
throws IOException { | ||
Comment on lines
+2842
to
+2844
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could not add this test to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to use |
||
// Test that directories in multilevel keys are not marked as files | ||
|
||
String volumeA = "volume-a-" + RandomStringUtils.randomNumeric(5); | ||
String bucketA = "bucket-a-" + RandomStringUtils.randomNumeric(5); | ||
store.createVolume(volumeA); | ||
OzoneVolume volA = store.getVolume(volumeA); | ||
volA.createBucket(bucketA); | ||
OzoneBucket volAbucketA = volA.getBucket(bucketA); | ||
|
||
String keyBaseA = "key-a/"; | ||
for (int i = 0; i < 10; i++) { | ||
byte[] value = RandomStringUtils.randomAscii(10240).getBytes(UTF_8); | ||
OzoneOutputStream one = volAbucketA.createKey( | ||
keyBaseA + i + "-" + RandomStringUtils.randomNumeric(5), | ||
value.length, RATIS, ONE, | ||
new HashMap<>()); | ||
one.write(value); | ||
one.close(); | ||
} | ||
|
||
Iterator<? extends OzoneKey> volABucketAIter1 = volAbucketA.listKeys(null); | ||
while (volABucketAIter1.hasNext()) { | ||
OzoneKey key = volABucketAIter1.next(); | ||
if (key.getName().endsWith("/")) { | ||
assertFalse(key.isFile(), "Key '" + key.getName() + "' is not a file"); | ||
} | ||
} | ||
|
||
Iterator<? extends OzoneKey> volABucketAIter2 = volAbucketA.listKeys("key-"); | ||
while (volABucketAIter2.hasNext()) { | ||
OzoneKey key = volABucketAIter2.next(); | ||
if (key.getName().endsWith("/")) { | ||
assertFalse(key.isFile(), "Key '" + key.getName() + "' is not a file"); | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
public void testListKeyOnEmptyBucket() | ||
throws IOException { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1182,6 +1182,7 @@ message BasicKeyInfo { | |
optional hadoop.hdds.ECReplicationConfig ecReplicationConfig = 7; | ||
optional string eTag = 8; | ||
optional string ownerName = 9; | ||
optional bool isFile = 10; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BasicKeyInfo was added in HDDS-9079 (1.4.0). |
||
} | ||
|
||
message DirectoryInfo { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an old client send a request containing BasicKeyInfo to a new OM, the isFile field will not be set and a file would always be identified as not a file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ptlrs can you please add test case in
hadoop-ozone/dist/src/main/smoketest/compatibility/read.robot
?