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 @@ -467,6 +467,11 @@ public final class ScmConfigKeys {
public static final TimeDuration OZONE_SCM_RATIS_MINIMUM_TIMEOUT_DEFAULT
= TimeDuration.valueOf(1, TimeUnit.SECONDS);

public static final String OZONE_SCM_RATIS_REQUEST_TIMEOUT_KEY
= "ozone.scm.ratis.minimum.timeout";
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add the key to SCMHAConfiguration ?
BTW, the key OZONE_SCM_RATIS_SERVER_REQUEST_TIMEOUT_KEY, OZONE_SCM_RATIS_SERVER_RETRY_CACHE_TIMEOUT_KEY, OZONE_SCM_RATIS_MINIMUM_TIMEOUT_KEY, OZONE_SCM_LEADER_ELECTION_MINIMUM_TIMEOUT_DURATION_KEY etc are not used any more. Better clean up them.

Copy link
Contributor Author

@bshashikant bshashikant Mar 31, 2021

Choose a reason for hiding this comment

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

I think, we should be remove SCMHAConfiguration and pull all the required configs in ScmConfigKeys and remove the unused ones. But, i would prefer to do this as a part of different jira altogether.

https://issues.apache.org/jira/browse/HDDS-5054 is opened to track the same.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure. Thanks for creating the jira.

public static final String OZONE_SCM_RATIS_REQUEST_TIMEOUT_DEFAULT
= "30s";

// SCM Ratis Leader Election configurations
public static final String
OZONE_SCM_LEADER_ELECTION_MINIMUM_TIMEOUT_DURATION_KEY =
Expand Down
8 changes: 8 additions & 0 deletions hadoop-hdds/common/src/main/resources/ozone-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2067,6 +2067,14 @@
</description>
</property>

<property>
<name>ozone.scm.ratis.minimum.timeout</name>
<value>30s</value>
<tag>OZONE, SCM, HA, RATIS</tag>
<description>The request timeout duration for SCM's Ratis server request.
</description>
</property>

<property>
<name>ozone.scm.ratis.leader.election.minimum.timeout.duration</name>
<value>1s</value>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.io.IOException;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeoutException;

/**
* TODO.
Expand All @@ -36,7 +37,8 @@ public interface SCMRatisServer {
void registerStateMachineHandler(RequestType handlerType, Object handler);

SCMRatisResponse submitRequest(SCMRatisRequest request)
throws IOException, ExecutionException, InterruptedException;
throws IOException, ExecutionException, InterruptedException,
TimeoutException;

void stop() throws IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import java.util.UUID;
import java.util.Iterator;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;

Expand All @@ -32,6 +34,7 @@
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.protocol.proto.SCMRatisProtocol.RequestType;
import org.apache.hadoop.hdds.scm.AddSCMRequest;
import org.apache.hadoop.hdds.scm.ScmConfigKeys;
import org.apache.hadoop.hdds.scm.server.StorageContainerManager;
import org.apache.hadoop.ozone.OzoneConsts;
import org.apache.hadoop.util.Time;
Expand Down Expand Up @@ -195,7 +198,8 @@ public void registerStateMachineHandler(final RequestType handlerType,

@Override
public SCMRatisResponse submitRequest(SCMRatisRequest request)
throws IOException, ExecutionException, InterruptedException {
throws IOException, ExecutionException, InterruptedException,
TimeoutException {
final RaftClientRequest raftClientRequest = RaftClientRequest.newBuilder()
.setClientId(clientId)
.setServerId(getDivision().getId())
Expand All @@ -204,8 +208,14 @@ public SCMRatisResponse submitRequest(SCMRatisRequest request)
.setMessage(request.encode())
.setType(RaftClientRequest.writeRequestType())
.build();
// any request submitted to
final long requestTimeout = scm.getConfiguration()
.getTimeDuration(ScmConfigKeys.OZONE_SCM_RATIS_REQUEST_TIMEOUT_KEY,
ScmConfigKeys.OZONE_SCM_RATIS_REQUEST_TIMEOUT_DEFAULT,
TimeUnit.MILLISECONDS);
final RaftClientReply raftClientReply =
server.submitClientRequestAsync(raftClientRequest).get();
server.submitClientRequestAsync(raftClientRequest)
.get(requestTimeout, TimeUnit.MILLISECONDS);
if (LOG.isDebugEnabled()) {
LOG.info("request {} Reply {}", raftClientRequest, raftClientReply);
}
Expand Down