You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by be...@apache.org on 2024/10/11 14:35:15 UTC
(cassandra-accord) branch trunk updated (31f391fa -> dd04c812)
This is an automated email from the ASF dual-hosted git repository.
benedict pushed a change to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-accord.git
discard 31f391fa do not schedule new durability attempts until prior ones have completed
new dd04c812 do not schedule new durability attempts until prior ones have completed
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (31f391fa)
\
N -- N -- N refs/heads/trunk (dd04c812)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../impl/CoordinateDurabilityScheduling.java | 23 +---------------------
1 file changed, 1 insertion(+), 22 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org
(cassandra-accord) 01/01: do not schedule new durability attempts until prior ones have completed
Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
benedict pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-accord.git
commit dd04c81214be9213cf503025bf6ed4cbf118be00
Author: Benedict Elliott Smith <be...@apache.org>
AuthorDate: Fri Oct 11 15:32:40 2024 +0100
do not schedule new durability attempts until prior ones have completed
---
.../java/accord/coordinate/CoordinateSyncPoint.java | 5 +++++
.../accord/impl/CoordinateDurabilityScheduling.java | 21 +++++++++++++++++++--
.../src/main/java/accord/local/CommandStore.java | 13 ++++++++++---
3 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/accord-core/src/main/java/accord/coordinate/CoordinateSyncPoint.java b/accord-core/src/main/java/accord/coordinate/CoordinateSyncPoint.java
index a5c976e4..6f271cec 100644
--- a/accord-core/src/main/java/accord/coordinate/CoordinateSyncPoint.java
+++ b/accord-core/src/main/java/accord/coordinate/CoordinateSyncPoint.java
@@ -78,6 +78,11 @@ public class CoordinateSyncPoint<U extends Unseekable> extends CoordinatePreAcce
return coordinate(node, txnId, keysOrRanges, Adapters.exclusiveSyncPoint());
}
+ public static <U extends Unseekable> AsyncResult<SyncPoint<U>> exclusiveSyncPoint(Node node, TxnId txnId, FullRoute<U> route)
+ {
+ return coordinate(node, txnId, route, Adapters.exclusiveSyncPoint());
+ }
+
public static <U extends Unseekable> AsyncResult<SyncPoint<U>> inclusive(Node node, Unseekables<U> keysOrRanges)
{
return coordinate(node, Kind.SyncPoint, keysOrRanges, Adapters.inclusiveSyncPoint());
diff --git a/accord-core/src/main/java/accord/impl/CoordinateDurabilityScheduling.java b/accord-core/src/main/java/accord/impl/CoordinateDurabilityScheduling.java
index 979a4a76..873cd9bd 100644
--- a/accord-core/src/main/java/accord/impl/CoordinateDurabilityScheduling.java
+++ b/accord-core/src/main/java/accord/impl/CoordinateDurabilityScheduling.java
@@ -24,6 +24,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
import com.google.common.primitives.Ints;
import org.slf4j.Logger;
@@ -36,6 +37,7 @@ import accord.coordinate.CoordinationFailed;
import accord.coordinate.ExecuteSyncPoint.SyncPointErased;
import accord.local.Node;
import accord.local.ShardDistributor;
+import accord.primitives.FullRoute;
import accord.primitives.Range;
import accord.primitives.Ranges;
import accord.primitives.Routable.Domain;
@@ -82,6 +84,7 @@ public class CoordinateDurabilityScheduling
private final Node node;
private Scheduler.Scheduled scheduled;
+ private final AtomicReference<Ranges> active = new AtomicReference<>(Ranges.EMPTY);
/*
* In each round at each node wait this amount of time between initiating new CoordinateShardDurable
@@ -206,7 +209,15 @@ public class CoordinateDurabilityScheduling
logger.trace("Scheduling CoordinateShardDurable for {} at {}", coordinate, nowMicros);
for (Ranges ranges : coordinate)
- startShardSync(ranges);
+ {
+ Ranges inactiveRanges = ranges.without(active.get());
+ if (inactiveRanges != ranges)
+ logger.info("Not initiating new durability scheduling for {} as previous attempt still in progress", ranges.without(inactiveRanges));
+ if (inactiveRanges.isEmpty())
+ continue;
+ active.accumulateAndGet(inactiveRanges, Ranges::with);
+ startShardSync(inactiveRanges);
+ }
}
/**
@@ -217,6 +228,7 @@ public class CoordinateDurabilityScheduling
{
TxnId at = node.nextTxnId(ExclusiveSyncPoint, Domain.Range);
node.scheduler().once(() -> node.withEpoch(at.epoch(), (ignored, withEpochFailure) -> {
+ FullRoute<Range> route = (FullRoute<Range>) node.computeRoute(at, ranges);
if (withEpochFailure != null)
{
Throwable wrapped = CoordinationFailed.wrap(withEpochFailure);
@@ -224,11 +236,12 @@ public class CoordinateDurabilityScheduling
node.agent().onUncaughtException(wrapped);
return;
}
- exclusiveSyncPoint(node, at, ranges)
+ exclusiveSyncPoint(node, at, route)
.addCallback((success, fail) -> {
if (fail != null)
{
logger.trace("{}: Exception coordinating ExclusiveSyncPoint for local shard durability of {}", at, ranges, fail);
+ active.accumulateAndGet(route.toRanges(), Ranges::without);
}
else
{
@@ -250,6 +263,10 @@ public class CoordinateDurabilityScheduling
logger.trace("Exception coordinating local shard durability, will retry immediately", fail);
coordinateShardDurableAfterExclusiveSyncPoint(node, exclusiveSyncPoint);
}
+ else
+ {
+ active.accumulateAndGet(exclusiveSyncPoint.route.toRanges(), Ranges::without);
+ }
});
});
}, durabilityLagMicros, MICROSECONDS);
diff --git a/accord-core/src/main/java/accord/local/CommandStore.java b/accord-core/src/main/java/accord/local/CommandStore.java
index 4fdbcc09..34647d92 100644
--- a/accord-core/src/main/java/accord/local/CommandStore.java
+++ b/accord-core/src/main/java/accord/local/CommandStore.java
@@ -487,7 +487,7 @@ public abstract class CommandStore implements AgentExecutor
CollectCalculatedDeps.withCalculatedDeps(node, id, route, route, before, (deps, fail) -> {
if (fail != null)
{
- node.scheduler().once(() -> fetchMajorityDeps(coordination, node, epoch, ranges), 10L, TimeUnit.SECONDS);
+ node.scheduler().once(() -> fetchMajorityDeps(coordination, node, epoch, ranges), 1L, TimeUnit.MINUTES);
node.agent().onUncaughtException(fail);
}
else
@@ -497,8 +497,15 @@ public abstract class CommandStore implements AgentExecutor
execute(contextFor(null, deps.txnIds(), deps.keyDeps.keys(), COMMANDS), safeStore -> {
safeStore.registerHistoricalTransactions(deps);
}).begin((success, fail2) -> {
- if (fail2 != null) fetchMajorityDeps(coordination, node, epoch, ranges);
- else coordination.setSuccess(null);
+ if (fail2 != null)
+ {
+ node.agent().onUncaughtException(fail2);
+ node.scheduler().once(() -> fetchMajorityDeps(coordination, node, epoch, ranges), 1L, TimeUnit.MINUTES);
+ }
+ else
+ {
+ coordination.setSuccess(null);
+ }
});
}
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org