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 @@ -53,7 +53,6 @@
.OMResponse;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type;
import org.apache.hadoop.ozone.security.acl.IAccessAuthorizer;
import org.apache.hadoop.ozone.security.acl.OzoneObj;
import org.apache.hadoop.util.Time;
import org.apache.hadoop.hdds.utils.db.cache.CacheKey;
import org.apache.hadoop.hdds.utils.db.cache.CacheValue;
Expand Down Expand Up @@ -133,9 +132,11 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
volumeName = keyArgs.getVolumeName();
bucketName = keyArgs.getBucketName();

long clientID = multipartCommitUploadPartRequest.getClientID();

// check acl
checkKeyAcls(ozoneManager, volumeName, bucketName, keyName,
IAccessAuthorizer.ACLType.WRITE, OzoneObj.ResourceType.KEY);
checkKeyAclsInOpenKeyTable(ozoneManager, volumeName, bucketName, keyName,
IAccessAuthorizer.ACLType.WRITE, clientID);

acquiredLock = omMetadataManager.getLock().acquireWriteLock(BUCKET_LOCK,
volumeName, bucketName);
Expand All @@ -149,8 +150,6 @@ public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager,
multipartKeyInfo = omMetadataManager.getMultipartInfoTable()
.get(multipartKey);

long clientID = multipartCommitUploadPartRequest.getClientID();

openKey = getOpenKey(volumeName, bucketName, keyName, omMetadataManager,
clientID);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.apache.hadoop.ozone.audit.AuditMessage;
import org.apache.hadoop.ozone.om.OMConfigKeys;
import org.apache.hadoop.ozone.om.OMMetadataManager;
import org.apache.hadoop.ozone.om.OmMetadataReader;
import org.apache.hadoop.ozone.om.OMMetrics;
import org.apache.hadoop.ozone.om.OmMetadataManagerImpl;
import org.apache.hadoop.ozone.om.OzoneManager;
Expand Down Expand Up @@ -83,6 +84,8 @@ public void setup() throws Exception {
when(ozoneManager.getMetrics()).thenReturn(omMetrics);
when(ozoneManager.getMetadataManager()).thenReturn(omMetadataManager);
auditLogger = Mockito.mock(AuditLogger.class);
OmMetadataReader omMetadataReader = Mockito.mock(OmMetadataReader.class);
when(ozoneManager.getOmMetadataReader()).thenReturn(omMetadataReader);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is duplicated with line 85. Need to verify if the mock is necessary.
when(ozoneManager.getMetadataManager()).thenReturn(omMetadataManager);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They seem to be different: getMetadataManager vs. getOmMetadataReader.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, my mistake.

when(ozoneManager.getAuditLogger()).thenReturn(auditLogger);
when(ozoneManager.getDefaultReplicationConfig()).thenReturn(
ReplicationConfig.getDefault(ozoneConfiguration));
Expand Down