sadanand48 commented on code in PR #10894:
URL: https://github.com/apache/ozone/pull/10894#discussion_r3726956648
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmSnapshot.java:
##########
@@ -133,12 +133,13 @@ recursive, normalizeKeyName(startKey), numEntries,
public List<OzoneFileStatusLight> listStatusLight(OmKeyArgs args,
boolean recursive, String startKey, long numEntries,
boolean allowPartialPrefixes) throws IOException {
-
- List<OzoneFileStatus> ozoneFileStatuses =
- listStatus(args, recursive, startKey, numEntries,
allowPartialPrefixes);
+ List<OzoneFileStatusLight> ozoneFileStatuses = omMetadataReader
+ .listStatusLight(normalizeOmKeyArgs(args),
+ recursive, normalizeKeyName(startKey), numEntries,
+ allowPartialPrefixes);
Review Comment:
probably add a test to verify this path as well i.e
OmSnapshot.listStatusLight() now has a dedicated denormalization path,
_.snapshot/<name>/... key-name_ behavior for light listings in
OmSnapshotTests.java
``` diff
diff --git
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/OmSnapshotTests.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/OmSnapshotTests.java
index 40dd14d446..17b7651638 100644
---
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/OmSnapshotTests.java
+++
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/OmSnapshotTests.java
@@ -147,6 +147,7 @@
import org.apache.hadoop.ozone.om.helpers.OmKeyArgs;
import org.apache.hadoop.ozone.om.helpers.OmMultipartInfo;
import org.apache.hadoop.ozone.om.helpers.OzoneFileStatus;
+import org.apache.hadoop.ozone.om.helpers.OzoneFileStatusLight;
import org.apache.hadoop.ozone.om.helpers.SnapshotInfo;
import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol;
import org.apache.hadoop.ozone.om.service.SnapshotDiffCleanupService;
@@ -606,6 +607,30 @@ public void testNonExistentBucket() throws Exception {
assertEquals(BUCKET_NOT_FOUND, omException.getResult());
}
+
+ @Test
+ public void testSnapshotListStatusLightReturnsDenormalizedKeyName()
throws Exception {
+ String key = "light-list/" + "key-" + counter.incrementAndGet();
+ createFileKey(ozoneBucket, key);
+
+ String snapshotName = "snap-light-" + counter.incrementAndGet();
+ String snapshotKeyPrefix = createSnapshot(volumeName, bucketName,
snapshotName);
+ String snapshotKey = snapshotKeyPrefix + key;
+
+ OmKeyArgs keyArgs = genKeyArgs(snapshotKey);
+
+ List<OzoneFileStatus> fullStatuses =
+ writeClient.listStatus(keyArgs, false, "", 1, false);
+ List<OzoneFileStatusLight> lightStatuses =
+ writeClient.listStatusLight(keyArgs, false, "", 1, false);
+
+ assertEquals(1, fullStatuses.size());
+ assertEquals(1, lightStatuses.size());
+
+ assertEquals(snapshotKey,
fullStatuses.get(0).getKeyInfo().getKeyName());
+ assertEquals(snapshotKey,
lightStatuses.get(0).getKeyInfo().getKeyName());
+ }
+
@Test
public void testCreateSnapshotMissingMandatoryParams() throws Exception {
String volume = "vol-" + counter.incrementAndGet();
```
--
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]