Revert acccord module to absolute path

This commit is contained in:
Alex Petrov 2024-08-26 12:54:54 +02:00 committed by David Capwell
parent c16297f862
commit 66c50d796a
2 changed files with 31 additions and 1 deletions

2
.gitmodules vendored
View File

@ -1,4 +1,4 @@
[submodule "modules/accord"] [submodule "modules/accord"]
path = modules/accord path = modules/accord
url = ../cassandra-accord.git url = https://github.com/apache/cassandra-accord.git
branch = trunk branch = trunk

View File

@ -27,6 +27,7 @@ import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.utils.Clock; import org.apache.cassandra.utils.Clock;
import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly; import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
import static org.apache.cassandra.tcm.Retry.Jitter.MAX_JITTER_MS;
public abstract class Retry public abstract class Retry
{ {
@ -160,6 +161,35 @@ public abstract class Retry
return new Deadline(Clock.Global.nanoTime() + timeoutNanos, delegate); return new Deadline(Clock.Global.nanoTime() + timeoutNanos, delegate);
} }
/**
* Since we are using message expiration for communicating timeouts to CMS nodes, we have to be careful not
* to overflow the long, since messaging is using only 32 bits for deadlines. To achieve that, we are
* giving `timeoutNanos` every time we retry, but will retry indefinitely.
*/
public static Deadline retryIndefinitely(long timeoutNanos, Meter retryMeter)
{
return new Deadline(Clock.Global.nanoTime() + timeoutNanos,
new Retry.Jitter(Integer.MAX_VALUE, MAX_JITTER_MS, new Random(), retryMeter))
{
@Override
public boolean reachedMax()
{
return false;
}
@Override
public long remainingNanos()
{
return timeoutNanos;
}
public String toString()
{
return String.format("RetryIndefinitely{tries=%d}", currentTries());
}
};
}
@Override @Override
public boolean reachedMax() public boolean reachedMax()
{ {