HDDS-806. Update Ratis to latest snapshot version in ozone. Contributed by Tsz Wo Nicholas Sze and Mukul Kumar Singh.
This commit is contained in:
parent
8d99648c20
commit
31614bcc7c
@ -85,6 +85,14 @@ public final class ScmConfigKeys {
|
|||||||
public static final TimeDuration
|
public static final TimeDuration
|
||||||
DFS_CONTAINER_RATIS_STATEMACHINEDATA_SYNC_TIMEOUT_DEFAULT =
|
DFS_CONTAINER_RATIS_STATEMACHINEDATA_SYNC_TIMEOUT_DEFAULT =
|
||||||
TimeDuration.valueOf(10, TimeUnit.SECONDS);
|
TimeDuration.valueOf(10, TimeUnit.SECONDS);
|
||||||
|
public static final String
|
||||||
|
DFS_CONTAINER_RATIS_STATEMACHINEDATA_SYNC_RETRIES =
|
||||||
|
"dfs.container.ratis.statemachinedata.sync.retries";
|
||||||
|
public static final int
|
||||||
|
DFS_CONTAINER_RATIS_STATEMACHINEDATA_SYNC_RETRIES_DEFAULT = -1;
|
||||||
|
public static final String DFS_CONTAINER_RATIS_LOG_QUEUE_SIZE =
|
||||||
|
"dfs.container.ratis.log.queue.size";
|
||||||
|
public static final int DFS_CONTAINER_RATIS_LOG_QUEUE_SIZE_DEFAULT = 128;
|
||||||
public static final String DFS_RATIS_CLIENT_REQUEST_TIMEOUT_DURATION_KEY =
|
public static final String DFS_RATIS_CLIENT_REQUEST_TIMEOUT_DURATION_KEY =
|
||||||
"dfs.ratis.client.request.timeout.duration";
|
"dfs.ratis.client.request.timeout.duration";
|
||||||
public static final TimeDuration
|
public static final TimeDuration
|
||||||
|
@ -261,6 +261,16 @@ public final class OzoneConfigKeys {
|
|||||||
public static final TimeDuration
|
public static final TimeDuration
|
||||||
DFS_RATIS_SERVER_RETRY_CACHE_TIMEOUT_DURATION_DEFAULT =
|
DFS_RATIS_SERVER_RETRY_CACHE_TIMEOUT_DURATION_DEFAULT =
|
||||||
ScmConfigKeys.DFS_RATIS_SERVER_RETRY_CACHE_TIMEOUT_DURATION_DEFAULT;
|
ScmConfigKeys.DFS_RATIS_SERVER_RETRY_CACHE_TIMEOUT_DURATION_DEFAULT;
|
||||||
|
public static final String
|
||||||
|
DFS_CONTAINER_RATIS_STATEMACHINEDATA_SYNC_RETRIES =
|
||||||
|
ScmConfigKeys.DFS_CONTAINER_RATIS_STATEMACHINEDATA_SYNC_RETRIES;
|
||||||
|
public static final int
|
||||||
|
DFS_CONTAINER_RATIS_STATEMACHINEDATA_SYNC_RETRIES_DEFAULT =
|
||||||
|
ScmConfigKeys.DFS_CONTAINER_RATIS_STATEMACHINEDATA_SYNC_RETRIES_DEFAULT;
|
||||||
|
public static final String DFS_CONTAINER_RATIS_LOG_QUEUE_SIZE =
|
||||||
|
ScmConfigKeys.DFS_CONTAINER_RATIS_LOG_QUEUE_SIZE;
|
||||||
|
public static final int DFS_CONTAINER_RATIS_LOG_QUEUE_SIZE_DEFAULT =
|
||||||
|
ScmConfigKeys.DFS_CONTAINER_RATIS_LOG_QUEUE_SIZE_DEFAULT;
|
||||||
public static final String DFS_RATIS_SERVER_REQUEST_TIMEOUT_DURATION_KEY =
|
public static final String DFS_RATIS_SERVER_REQUEST_TIMEOUT_DURATION_KEY =
|
||||||
ScmConfigKeys.DFS_RATIS_SERVER_REQUEST_TIMEOUT_DURATION_KEY;
|
ScmConfigKeys.DFS_RATIS_SERVER_REQUEST_TIMEOUT_DURATION_KEY;
|
||||||
public static final TimeDuration
|
public static final TimeDuration
|
||||||
|
@ -59,6 +59,21 @@
|
|||||||
<description>Timeout for StateMachine data writes by Ratis.
|
<description>Timeout for StateMachine data writes by Ratis.
|
||||||
</description>
|
</description>
|
||||||
</property>
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>dfs.container.ratis.statemachinedata.sync.retries</name>
|
||||||
|
<value>-1</value>
|
||||||
|
<tag>OZONE, DEBUG, CONTAINER, RATIS</tag>
|
||||||
|
<description>Number of times the WriteStateMachineData op will be tried
|
||||||
|
before failing, if this value is -1, then this retries indefinitely.
|
||||||
|
</description>
|
||||||
|
</property>
|
||||||
|
<property>
|
||||||
|
<name>dfs.container.ratis.log.queue.size</name>
|
||||||
|
<value>128</value>
|
||||||
|
<tag>OZONE, DEBUG, CONTAINER, RATIS</tag>
|
||||||
|
<description>Number of operation pending with Raft's Log Worker.
|
||||||
|
</description>
|
||||||
|
</property>
|
||||||
<property>
|
<property>
|
||||||
<name>dfs.container.ratis.datanode.storage.dir</name>
|
<name>dfs.container.ratis.datanode.storage.dir</name>
|
||||||
<value/>
|
<value/>
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
import org.apache.hadoop.hdds.HddsUtils;
|
import org.apache.hadoop.hdds.HddsUtils;
|
||||||
import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
|
import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
|
||||||
import org.apache.hadoop.ozone.container.common.helpers.BlockData;
|
import org.apache.hadoop.ozone.container.common.helpers.BlockData;
|
||||||
import org.apache.ratis.proto.RaftProtos.StateMachineEntryProto;
|
import org.apache.ratis.proto.RaftProtos.RaftPeerRole;
|
||||||
import org.apache.ratis.protocol.RaftGroup;
|
import org.apache.ratis.protocol.RaftGroup;
|
||||||
import org.apache.ratis.protocol.RaftGroupId;
|
import org.apache.ratis.protocol.RaftGroupId;
|
||||||
import org.apache.ratis.server.RaftServer;
|
import org.apache.ratis.server.RaftServer;
|
||||||
@ -55,7 +55,6 @@
|
|||||||
import org.apache.ratis.statemachine.TransactionContext;
|
import org.apache.ratis.statemachine.TransactionContext;
|
||||||
import org.apache.ratis.statemachine.impl.BaseStateMachine;
|
import org.apache.ratis.statemachine.impl.BaseStateMachine;
|
||||||
import org.apache.ratis.statemachine.impl.SimpleStateMachineStorage;
|
import org.apache.ratis.statemachine.impl.SimpleStateMachineStorage;
|
||||||
import org.apache.ratis.statemachine.impl.TransactionContextImpl;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -206,7 +205,6 @@ public TransactionContext startTransaction(RaftClientRequest request)
|
|||||||
final ContainerCommandRequestProto proto =
|
final ContainerCommandRequestProto proto =
|
||||||
getRequestProto(request.getMessage().getContent());
|
getRequestProto(request.getMessage().getContent());
|
||||||
Preconditions.checkArgument(request.getRaftGroupId().equals(gid));
|
Preconditions.checkArgument(request.getRaftGroupId().equals(gid));
|
||||||
final StateMachineLogEntryProto log;
|
|
||||||
if (proto.getCmdType() == Type.WriteChunk) {
|
if (proto.getCmdType() == Type.WriteChunk) {
|
||||||
final WriteChunkRequestProto write = proto.getWriteChunk();
|
final WriteChunkRequestProto write = proto.getWriteChunk();
|
||||||
// create the state machine data proto
|
// create the state machine data proto
|
||||||
@ -236,33 +234,29 @@ public TransactionContext startTransaction(RaftClientRequest request)
|
|||||||
.setWriteChunk(commitWriteChunkProto)
|
.setWriteChunk(commitWriteChunkProto)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
log = createSMLogEntryProto(request,
|
return TransactionContext.newBuilder()
|
||||||
commitContainerCommandProto.toByteString(),
|
.setClientRequest(request)
|
||||||
dataContainerCommandProto.toByteString());
|
.setStateMachine(this)
|
||||||
|
.setServerRole(RaftPeerRole.LEADER)
|
||||||
|
.setStateMachineData(dataContainerCommandProto.toByteString())
|
||||||
|
.setLogData(commitContainerCommandProto.toByteString())
|
||||||
|
.build();
|
||||||
} else if (proto.getCmdType() == Type.CreateContainer) {
|
} else if (proto.getCmdType() == Type.CreateContainer) {
|
||||||
log = createSMLogEntryProto(request,
|
return TransactionContext.newBuilder()
|
||||||
request.getMessage().getContent(), request.getMessage().getContent());
|
.setClientRequest(request)
|
||||||
|
.setStateMachine(this)
|
||||||
|
.setServerRole(RaftPeerRole.LEADER)
|
||||||
|
.setStateMachineData(request.getMessage().getContent())
|
||||||
|
.setLogData(request.getMessage().getContent())
|
||||||
|
.build();
|
||||||
} else {
|
} else {
|
||||||
log = createSMLogEntryProto(request, request.getMessage().getContent(),
|
return TransactionContext.newBuilder()
|
||||||
null);
|
.setClientRequest(request)
|
||||||
|
.setStateMachine(this)
|
||||||
|
.setServerRole(RaftPeerRole.LEADER)
|
||||||
|
.setLogData(request.getMessage().getContent())
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
return new TransactionContextImpl(this, request, log);
|
|
||||||
}
|
|
||||||
|
|
||||||
private StateMachineLogEntryProto createSMLogEntryProto(RaftClientRequest r,
|
|
||||||
ByteString logData, ByteString smData) {
|
|
||||||
StateMachineLogEntryProto.Builder builder =
|
|
||||||
StateMachineLogEntryProto.newBuilder();
|
|
||||||
|
|
||||||
builder.setCallId(r.getCallId())
|
|
||||||
.setClientId(r.getClientId().toByteString())
|
|
||||||
.setLogData(logData);
|
|
||||||
|
|
||||||
if (smData != null) {
|
|
||||||
builder.setStateMachineEntry(StateMachineEntryProto.newBuilder()
|
|
||||||
.setStateMachineData(smData).build());
|
|
||||||
}
|
|
||||||
return builder.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ByteString getStateMachineData(StateMachineLogEntryProto entryProto) {
|
private ByteString getStateMachineData(StateMachineLogEntryProto entryProto) {
|
||||||
|
@ -287,6 +287,17 @@ private RaftProperties newRaftProperties(Configuration conf) {
|
|||||||
setAutoTriggerEnabled(properties, true);
|
setAutoTriggerEnabled(properties, true);
|
||||||
RaftServerConfigKeys.Snapshot.
|
RaftServerConfigKeys.Snapshot.
|
||||||
setAutoTriggerThreshold(properties, snapshotThreshold);
|
setAutoTriggerThreshold(properties, snapshotThreshold);
|
||||||
|
int logQueueSize =
|
||||||
|
conf.getInt(OzoneConfigKeys.DFS_CONTAINER_RATIS_LOG_QUEUE_SIZE,
|
||||||
|
OzoneConfigKeys.DFS_CONTAINER_RATIS_LOG_QUEUE_SIZE_DEFAULT);
|
||||||
|
RaftServerConfigKeys.Log.setQueueSize(properties, logQueueSize);
|
||||||
|
|
||||||
|
int numSyncRetries = conf.getInt(
|
||||||
|
OzoneConfigKeys.DFS_CONTAINER_RATIS_STATEMACHINEDATA_SYNC_RETRIES,
|
||||||
|
OzoneConfigKeys.
|
||||||
|
DFS_CONTAINER_RATIS_STATEMACHINEDATA_SYNC_RETRIES_DEFAULT);
|
||||||
|
RaftServerConfigKeys.Log.StateMachineData.setSyncTimeoutRetry(properties,
|
||||||
|
numSyncRetries);
|
||||||
|
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|||||||
<hdds.version>0.4.0-SNAPSHOT</hdds.version>
|
<hdds.version>0.4.0-SNAPSHOT</hdds.version>
|
||||||
|
|
||||||
<!-- Apache Ratis version -->
|
<!-- Apache Ratis version -->
|
||||||
<ratis.version>0.3.0-1d2ebee-SNAPSHOT</ratis.version>
|
<ratis.version>0.3.0-1d07b18-SNAPSHOT</ratis.version>
|
||||||
|
|
||||||
<bouncycastle.version>1.60</bouncycastle.version>
|
<bouncycastle.version>1.60</bouncycastle.version>
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|||||||
<hadoop.version>3.2.1-SNAPSHOT</hadoop.version>
|
<hadoop.version>3.2.1-SNAPSHOT</hadoop.version>
|
||||||
<hdds.version>0.4.0-SNAPSHOT</hdds.version>
|
<hdds.version>0.4.0-SNAPSHOT</hdds.version>
|
||||||
<ozone.version>0.4.0-SNAPSHOT</ozone.version>
|
<ozone.version>0.4.0-SNAPSHOT</ozone.version>
|
||||||
<ratis.version>0.3.0-1d2ebee-SNAPSHOT</ratis.version>
|
<ratis.version>0.3.0-1d07b18-SNAPSHOT</ratis.version>
|
||||||
<bouncycastle.version>1.60</bouncycastle.version>
|
<bouncycastle.version>1.60</bouncycastle.version>
|
||||||
<ozone.release>Badlands</ozone.release>
|
<ozone.release>Badlands</ozone.release>
|
||||||
<declared.ozone.version>${ozone.version}</declared.ozone.version>
|
<declared.ozone.version>${ozone.version}</declared.ozone.version>
|
||||||
|
Loading…
Reference in New Issue
Block a user