HDDS-1241. Update ozone to latest ratis snapshot build (0.4.0-5680cf5-SNAPSHOT). Contributed by Mukul Kumar Singh.
This commit is contained in:
parent
f235a942d5
commit
ea9fb07fd2
@ -140,7 +140,6 @@ public class ContainerStateMachine extends BaseStateMachine {
|
|||||||
private ExecutorService[] executors;
|
private ExecutorService[] executors;
|
||||||
private final int numExecutors;
|
private final int numExecutors;
|
||||||
private final Map<Long, Long> applyTransactionCompletionMap;
|
private final Map<Long, Long> applyTransactionCompletionMap;
|
||||||
private long lastIndex;
|
|
||||||
private final Cache<Long, ByteString> stateMachineDataCache;
|
private final Cache<Long, ByteString> stateMachineDataCache;
|
||||||
private final boolean isBlockTokenEnabled;
|
private final boolean isBlockTokenEnabled;
|
||||||
private final TokenVerifier tokenVerifier;
|
private final TokenVerifier tokenVerifier;
|
||||||
@ -163,7 +162,6 @@ public ContainerStateMachine(RaftGroupId gid, ContainerDispatcher dispatcher,
|
|||||||
this.executors = executors.toArray(new ExecutorService[numExecutors]);
|
this.executors = executors.toArray(new ExecutorService[numExecutors]);
|
||||||
this.writeChunkFutureMap = new ConcurrentHashMap<>();
|
this.writeChunkFutureMap = new ConcurrentHashMap<>();
|
||||||
applyTransactionCompletionMap = new ConcurrentHashMap<>();
|
applyTransactionCompletionMap = new ConcurrentHashMap<>();
|
||||||
this.lastIndex = RaftServerConstants.INVALID_LOG_INDEX;
|
|
||||||
stateMachineDataCache = CacheBuilder.newBuilder()
|
stateMachineDataCache = CacheBuilder.newBuilder()
|
||||||
.expireAfterAccess(expiryInterval, TimeUnit.MILLISECONDS)
|
.expireAfterAccess(expiryInterval, TimeUnit.MILLISECONDS)
|
||||||
// set the limit on no of cached entries equal to no of max threads
|
// set the limit on no of cached entries equal to no of max threads
|
||||||
@ -202,7 +200,6 @@ private long loadSnapshot(SingleFileSnapshotInfo snapshot)
|
|||||||
"The snapshot info is null." + "Setting the last applied index to:"
|
"The snapshot info is null." + "Setting the last applied index to:"
|
||||||
+ empty);
|
+ empty);
|
||||||
setLastAppliedTermIndex(empty);
|
setLastAppliedTermIndex(empty);
|
||||||
lastIndex = RaftServerConstants.INVALID_LOG_INDEX;
|
|
||||||
return RaftServerConstants.INVALID_LOG_INDEX;
|
return RaftServerConstants.INVALID_LOG_INDEX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +208,6 @@ private long loadSnapshot(SingleFileSnapshotInfo snapshot)
|
|||||||
SimpleStateMachineStorage.getTermIndexFromSnapshotFile(snapshotFile);
|
SimpleStateMachineStorage.getTermIndexFromSnapshotFile(snapshotFile);
|
||||||
LOG.info("Setting the last applied index to " + last);
|
LOG.info("Setting the last applied index to " + last);
|
||||||
setLastAppliedTermIndex(last);
|
setLastAppliedTermIndex(last);
|
||||||
lastIndex = last.getIndex();
|
|
||||||
|
|
||||||
// initialize the dispatcher with snapshot so that it build the missing
|
// initialize the dispatcher with snapshot so that it build the missing
|
||||||
// container list
|
// container list
|
||||||
@ -572,6 +568,18 @@ private void updateLastApplied() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies the state machine about index updates because of entries
|
||||||
|
* which do not cause state machine update, i.e. conf entries, metadata
|
||||||
|
* entries
|
||||||
|
* @param term term of the log entry
|
||||||
|
* @param index index of the log entry
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void notifyIndexUpdate(long term, long index) {
|
||||||
|
applyTransactionCompletionMap.put(index, term);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ApplyTransaction calls in Ratis are sequential.
|
* ApplyTransaction calls in Ratis are sequential.
|
||||||
*/
|
*/
|
||||||
@ -583,14 +591,6 @@ public CompletableFuture<Message> applyTransaction(TransactionContext trx) {
|
|||||||
.setTerm(trx.getLogEntry().getTerm())
|
.setTerm(trx.getLogEntry().getTerm())
|
||||||
.setLogIndex(index);
|
.setLogIndex(index);
|
||||||
|
|
||||||
// ApplyTransaction call can come with an entryIndex much greater than
|
|
||||||
// lastIndex updated because in between entries in the raft log can be
|
|
||||||
// appended because raft config persistence. Just add a dummy entry
|
|
||||||
// for those.
|
|
||||||
for (long i = lastIndex + 1; i < index; i++) {
|
|
||||||
LOG.info("Gap in indexes at:{} detected, adding dummy entries ", i);
|
|
||||||
applyTransactionCompletionMap.put(i, trx.getLogEntry().getTerm());
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
metrics.incNumApplyTransactionsOps();
|
metrics.incNumApplyTransactionsOps();
|
||||||
ContainerCommandRequestProto requestProto =
|
ContainerCommandRequestProto requestProto =
|
||||||
@ -613,7 +613,6 @@ public CompletableFuture<Message> applyTransaction(TransactionContext trx) {
|
|||||||
.supplyAsync(() -> runCommand(requestProto, builder.build()),
|
.supplyAsync(() -> runCommand(requestProto, builder.build()),
|
||||||
getCommandExecutor(requestProto));
|
getCommandExecutor(requestProto));
|
||||||
|
|
||||||
lastIndex = index;
|
|
||||||
future.thenAccept(m -> {
|
future.thenAccept(m -> {
|
||||||
final Long previous =
|
final Long previous =
|
||||||
applyTransactionCompletionMap
|
applyTransactionCompletionMap
|
||||||
|
@ -46,7 +46,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.4.0-f283ffa-SNAPSHOT</ratis.version>
|
<ratis.version>0.4.0-5680cf5-SNAPSHOT</ratis.version>
|
||||||
|
|
||||||
<bouncycastle.version>1.60</bouncycastle.version>
|
<bouncycastle.version>1.60</bouncycastle.version>
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<hadoop.version>3.2.0</hadoop.version>
|
<hadoop.version>3.2.0</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.4.0-f283ffa-SNAPSHOT</ratis.version>
|
<ratis.version>0.4.0-5680cf5-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