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 @@ -107,13 +107,7 @@ private boolean isLeader() throws ServiceException {
public SCMBlockLocationResponse send(RpcController controller,
SCMBlockLocationRequest request) throws ServiceException {
if (!isLeader()) {
SCMBlockLocationResponse.Builder response = createSCMBlockResponse(
request.getCmdType(),
request.getTraceID());
response.setSuccess(false);
response.setStatus(Status.SCM_NOT_LEADER);
response.setLeaderSCMNodeId(null);
return response.build();
throw new ServiceException(new IOException("SCM IS NOT LEADER"));
}
return dispatcher.processRequest(
request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,7 @@ private boolean isLeader() throws ServiceException {
public ScmContainerLocationResponse submitRequest(RpcController controller,
ScmContainerLocationRequest request) throws ServiceException {
if (!isLeader()) {
return ScmContainerLocationResponse.newBuilder()
.setCmdType(request.getCmdType()).setTraceID(request.getTraceID())
.setSuccess(false).setStatus(Status.SCM_NOT_LEADER).build();
throw new ServiceException(new IOException("SCM IS NOT LEADER"));
Copy link
Contributor

@timmylicheng timmylicheng Dec 3, 2020

Choose a reason for hiding this comment

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

Shall we expose scm names or ipadress for the current SCM in the exception message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@timmylicheng Thanks for looking at this patch !

Good point !
As far as I know, the failover proxy provider will print out the IP address, along with the exception.

We need revisit this code in future, when the failover proxy provider should support leaderHint. I've file a jira to track this task, https://issues.apache.org/jira/browse/HDDS-4545

}
return dispatcher
.processRequest(request, this::processRequest, request.getCmdType(),
Expand Down