This is an automated email from the ASF dual-hosted git repository.
ifesdjeen pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-accord.git
The following commit(s) were added to refs/heads/trunk by this push:
new 84e89bd9 Accord Journal Determinism: PreAccept replay stability
84e89bd9 is described below
commit 84e89bd91cf1b058fbf314b750336a1ec1096b18
Author: Alex Petrov <[email protected]>
AuthorDate: Wed May 29 14:32:33 2024 +0200
Accord Journal Determinism: PreAccept replay stability
Patch by Alex Petrov; reviewed by Aleksey Yeschenko for CASSANDRA-19664
---
.../src/main/java/accord/local/CommandStore.java | 6 +----
.../main/java/accord/local/SafeCommandStore.java | 5 ++++
.../java/accord/messages/ExecutionContext.java | 29 ----------------------
.../src/main/java/accord/messages/Propagate.java | 1 -
.../main/java/accord/messages/ReplyContext.java | 1 +
.../src/main/java/accord/messages/TxnRequest.java | 5 ++++
6 files changed, 12 insertions(+), 35 deletions(-)
diff --git a/accord-core/src/main/java/accord/local/CommandStore.java
b/accord-core/src/main/java/accord/local/CommandStore.java
index 1d5a3913..c7baf2f5 100644
--- a/accord-core/src/main/java/accord/local/CommandStore.java
+++ b/accord-core/src/main/java/accord/local/CommandStore.java
@@ -319,13 +319,9 @@ public abstract class CommandStore implements AgentExecutor
*/
final Timestamp preaccept(TxnId txnId, Seekables<?, ?> keys,
SafeCommandStore safeStore, boolean permitFastPath)
{
- // TODO (expected): make preAcceptTimeout() be a part of
SafeCommandStore, initiated from ExecutionContext;
- // preAcceptTimeout can be subject to local configuration
changes, which would break determinism of repeated
- // message processing, if, say, replayed from a log.
-
NodeTimeService time = safeStore.time();
- boolean isExpired = time.now() - txnId.hlc() >=
agent().preAcceptTimeout() && !txnId.kind().isSyncPoint();
+ boolean isExpired = time.now() - txnId.hlc() >=
safeStore.preAcceptTimeout() && !txnId.kind().isSyncPoint();
if (rejectBefore != null && !isExpired)
isExpired = null == rejectBefore.foldl(keys, (rejectIfBefore,
test) -> rejectIfBefore.compareTo(test) > 0 ? null : test, txnId,
Objects::isNull);
diff --git a/accord-core/src/main/java/accord/local/SafeCommandStore.java
b/accord-core/src/main/java/accord/local/SafeCommandStore.java
index 5c8e2834..139bf088 100644
--- a/accord-core/src/main/java/accord/local/SafeCommandStore.java
+++ b/accord-core/src/main/java/accord/local/SafeCommandStore.java
@@ -183,6 +183,11 @@ public abstract class SafeCommandStore
return maybeTruncate(safeCfk);
}
+ public long preAcceptTimeout()
+ {
+ return agent().preAcceptTimeout();
+ }
+
protected abstract SafeCommand getInternal(TxnId txnId);
protected abstract SafeCommand getInternalIfLoadedAndInitialised(TxnId
txnId);
protected abstract SafeCommandsForKey getInternal(Key key);
diff --git a/accord-core/src/main/java/accord/messages/ExecutionContext.java
b/accord-core/src/main/java/accord/messages/ExecutionContext.java
deleted file mode 100644
index dbf4c2db..00000000
--- a/accord-core/src/main/java/accord/messages/ExecutionContext.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package accord.messages;
-
-/**
- * Necessary context to allow for deterministic repeated execution of requests
(e.g. when re-applying from a log)
- */
-public interface ExecutionContext
-{
- /**
- * @return PreAccept timeout as it was at request execution
- */
- long preAcceptTimeout();
-}
diff --git a/accord-core/src/main/java/accord/messages/Propagate.java
b/accord-core/src/main/java/accord/messages/Propagate.java
index 351c636e..c67d5fa2 100644
--- a/accord-core/src/main/java/accord/messages/Propagate.java
+++ b/accord-core/src/main/java/accord/messages/Propagate.java
@@ -53,7 +53,6 @@ import static accord.local.SaveStatus.Stable;
import static accord.local.SaveStatus.Uninitialised;
import static accord.local.Status.NotDefined;
import static accord.local.Status.Phase.Cleanup;
-import static accord.local.Status.PreAccepted;
import static accord.local.Status.PreApplied;
import static accord.messages.CheckStatus.WithQuorum.HasQuorum;
import static accord.primitives.Routables.Slice.Minimal;
diff --git a/accord-core/src/main/java/accord/messages/ReplyContext.java
b/accord-core/src/main/java/accord/messages/ReplyContext.java
index 48343947..44a26ccb 100644
--- a/accord-core/src/main/java/accord/messages/ReplyContext.java
+++ b/accord-core/src/main/java/accord/messages/ReplyContext.java
@@ -18,6 +18,7 @@
package accord.messages;
+// TODO: rename to ExecutionContext maybe?
public interface ReplyContext
{
}
diff --git a/accord-core/src/main/java/accord/messages/TxnRequest.java
b/accord-core/src/main/java/accord/messages/TxnRequest.java
index f6ea2c4c..db7de00c 100644
--- a/accord-core/src/main/java/accord/messages/TxnRequest.java
+++ b/accord-core/src/main/java/accord/messages/TxnRequest.java
@@ -112,6 +112,11 @@ public abstract class TxnRequest<R> implements Request,
PreLoadContext, MapReduc
protected transient Id replyTo;
protected transient ReplyContext replyContext;
+ public ReplyContext replyContext()
+ {
+ return replyContext;
+ }
+
public TxnRequest(Node.Id to, Topologies topologies, Route<?> route, TxnId
txnId)
{
this(to, topologies, route, txnId, latestRelevantEpochIndex(to,
topologies, route));
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]