Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.apache.hadoop.ozone.om.helpers.BucketLayout;
import org.apache.hadoop.ozone.om.helpers.OmDirectoryInfo;
import org.apache.hadoop.ozone.om.helpers.OmKeyInfo;
import org.apache.hadoop.ozone.om.helpers.OzoneFSUtils;
import org.apache.hadoop.ozone.om.helpers.OzoneFileStatus;
import org.apache.hadoop.ozone.om.request.file.OMFileRequest;
import org.apache.hadoop.ozone.om.request.util.ObjectParser;
Expand Down Expand Up @@ -96,6 +97,9 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager, Execut
throw new OMException("Key not found. Key:" + key, KEY_NOT_FOUND);
}
omKeyInfo = keyStatus.getKeyInfo();
// Reverting back the full path to key name
// Eg: a/b/c/d/e/file1 -> file1
omKeyInfo.setKeyName(OzoneFSUtils.getFileName(key));
final long volumeId = omMetadataManager.getVolumeId(volume);
final long bucketId = omMetadataManager.getBucketId(volume, bucket);
final String dbKey = omMetadataManager.getOzonePathKey(volumeId, bucketId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public void testKeyAddAclRequest() throws Exception {
assertEquals(OzoneManagerProtocolProtos.Status.OK,
omClientResponse.getOMResponse().getStatus());

// Verify result of adding acl.
OmKeyInfo newKeyInfo = omMetadataManager.getKeyTable(getBucketLayout()).get(ozoneKey);
assertEquals(1, newKeyInfo.getAcls().size());
assertEquals(omKeyInfo.getKeyName(), newKeyInfo.getKeyName());
}

@Test
Expand Down Expand Up @@ -141,10 +145,9 @@ public void testKeyRemoveAclRequest() throws Exception {
omRemoveAclResponse.getStatus());

// Verify result of removing acl.
List<OzoneAcl> newAcls =
omMetadataManager.getKeyTable(getBucketLayout()).get(ozoneKey)
.getAcls();
assertEquals(0, newAcls.size());
OmKeyInfo newKeyInfo = omMetadataManager.getKeyTable(getBucketLayout()).get(ozoneKey);
assertEquals(0, newKeyInfo.getAcls().size());
assertEquals(omKeyInfo.getKeyName(), newKeyInfo.getKeyName());
}

@Test
Expand Down Expand Up @@ -182,10 +185,9 @@ public void testKeySetAclRequest() throws Exception {
omSetAclResponse.getStatus());

// Verify result of setting acl.
List<OzoneAcl> newAcls =
omMetadataManager.getKeyTable(getBucketLayout()).get(ozoneKey)
.getAcls();
assertEquals(newAcls.get(0), acl);
OmKeyInfo newKeyInfo = omMetadataManager.getKeyTable(getBucketLayout()).get(ozoneKey);
assertEquals(newKeyInfo.getAcls().get(0), acl);
assertEquals(omKeyInfo.getKeyName(), newKeyInfo.getKeyName());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,15 @@ public class TestOMKeyAclRequestWithFSO extends TestOMKeyAclRequest {
protected String addKeyToTable() throws Exception {
String parentDir = "c/d/e";
String fileName = "file1";
String key = parentDir + "/" + fileName;
keyName = key; // updated key name
keyName = parentDir + "/" + fileName; // updated key name

// Create parent dirs for the path
long parentId = OMRequestTestUtils
.addParentsToDirTable(volumeName, bucketName, parentDir,
omMetadataManager);

OmKeyInfo omKeyInfo =
OMRequestTestUtils.createOmKeyInfo(volumeName, bucketName, key, RatisReplicationConfig.getInstance(ONE))
OMRequestTestUtils.createOmKeyInfo(volumeName, bucketName, fileName, RatisReplicationConfig.getInstance(ONE))
.setObjectID(parentId + 1L)
.setParentObjectID(parentId)
.setUpdateID(100L)
Expand Down