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 @@ -146,7 +146,8 @@ public static OMClientRequest createClientRequest(OMRequest omRequest) {
case GetS3Secret:
return new S3GetSecretRequest(omRequest);
default:
return null;
throw new IllegalStateException("Unrecognized write command " +
"type request" + cmdType);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
.OMRequest;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
.OMResponse;
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos
.Type;

/**
* Command Handler for OM requests. OM State Machine calls this handler for
Expand All @@ -48,58 +46,11 @@ public OzoneManagerHARequestHandlerImpl(OzoneManager om,
@Override
public OMResponse handleApplyTransaction(OMRequest omRequest,
long transactionLogIndex) {
if (LOG.isDebugEnabled()) {
LOG.debug("Received OMRequest: {}, ", omRequest);
}
Type cmdType = omRequest.getCmdType();
switch (cmdType) {
case CreateVolume:
case SetVolumeProperty:
case DeleteVolume:
case CreateBucket:
case DeleteBucket:
case SetBucketProperty:
case AllocateBlock:
case CreateKey:
case CommitKey:
case DeleteKey:
case RenameKey:
case CreateDirectory:
case CreateFile:
case PurgeKeys:
case CreateS3Bucket:
case DeleteS3Bucket:
case InitiateMultiPartUpload:
case CommitMultiPartUpload:
case AbortMultiPartUpload:
case CompleteMultiPartUpload:
case AddAcl:
case RemoveAcl:
case SetAcl:
case GetDelegationToken:
case CancelDelegationToken:
case RenewDelegationToken:
//TODO: We don't need to pass transactionID, this will be removed when
// complete write requests is changed to new model. And also we can
// return OMClientResponse, then adding to doubleBuffer can be taken
// care by stateMachine. And also integrate both HA and NON HA code
// paths.
OMClientRequest omClientRequest =
OzoneManagerRatisUtils.createClientRequest(omRequest);
if (omClientRequest != null) {
OMClientResponse omClientResponse =
omClientRequest.validateAndUpdateCache(getOzoneManager(),
transactionLogIndex, ozoneManagerDoubleBuffer::add);
return omClientResponse.getOMResponse();
} else {
//TODO: remove this once we have all HA support for all write request.
return handle(omRequest);
}

default:
// As all request types are not changed so we need to call handle
// here.
return handle(omRequest);
}
OMClientRequest omClientRequest =
OzoneManagerRatisUtils.createClientRequest(omRequest);
OMClientResponse omClientResponse =
omClientRequest.validateAndUpdateCache(getOzoneManager(),
transactionLogIndex, ozoneManagerDoubleBuffer::add);
return omClientResponse.getOMResponse();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,6 @@ private OMResponse processRequest(OMRequest request) throws
try {
OMClientRequest omClientRequest =
OzoneManagerRatisUtils.createClientRequest(request);
Preconditions.checkState(omClientRequest != null,
"Unrecognized write command type request" + request.toString());
request = omClientRequest.preExecute(ozoneManager);
} catch (IOException ex) {
// As some of the preExecute returns error. So handle here.
Expand Down