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 2025/04/05 08:25:59 UTC
(cassandra) 02/02: Fix CQLSSTableWriterConcurrencyTest
This is an automated email from the ASF dual-hosted git repository.
benedict pushed a commit to branch cep-15-accord
in repository https://gitbox.apache.org/repos/asf/cassandra.git
commit e0dc2fc712f0f8698641fc885b5b67faf32c79b4
Author: Benedict Elliott Smith <be...@apache.org>
AuthorDate: Fri Apr 4 20:12:30 2025 +0100
Fix CQLSSTableWriterConcurrencyTest
patch by Benedict; reviewed by David Capwell for CASSANDRA-20529
---
src/java/org/apache/cassandra/config/Config.java | 2 +-
src/java/org/apache/cassandra/service/RetryStrategy.java | 14 ++++++++++----
.../apache/cassandra/service/paxos/ContentionStrategy.java | 2 +-
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/java/org/apache/cassandra/config/Config.java b/src/java/org/apache/cassandra/config/Config.java
index 94f05be7c1..ce08f9ceeb 100644
--- a/src/java/org/apache/cassandra/config/Config.java
+++ b/src/java/org/apache/cassandra/config/Config.java
@@ -185,7 +185,7 @@ public class Config
public volatile DurationSpec.IntMillisecondsBound cms_default_retry_backoff = null;
@Deprecated(since="5.1")
public volatile DurationSpec.IntMillisecondsBound cms_default_max_retry_backoff = null;
- public String cms_retry_delay = "0 <= 50ms*1*attempts <= 1s,retries=10";
+ public String cms_retry_delay = "50ms*attempts <= 500ms ... 100ms*attempts <= 1s,retries=10";
public volatile int epoch_aware_debounce_inflight_tracker_max_size = 100;
diff --git a/src/java/org/apache/cassandra/service/RetryStrategy.java b/src/java/org/apache/cassandra/service/RetryStrategy.java
index a89f93363d..91c87c520d 100644
--- a/src/java/org/apache/cassandra/service/RetryStrategy.java
+++ b/src/java/org/apache/cassandra/service/RetryStrategy.java
@@ -97,7 +97,7 @@ public class RetryStrategy implements WaitStrategy
static final Pattern PARSE = Pattern.compile(
"(\\s*(?<minmin>0|[0-9]+[mu]?s)\\s*<=)?" +
- "(\\s*(?<min>[^=]+)\\s*[.]{3})?" +
+ "(\\s*(?<min>[^=]+)([(]?\\s*<=\\s*(?<maxmin>0|[0-9]+[mu]?s)\\s*[)]?)?\\s*[.]{3})?" +
"(\\s*(?<max>[^=]+))" +
"(\\s*<=\\s*(?<maxmax>0|[0-9]+[mu]?s))?");
@@ -198,16 +198,17 @@ public class RetryStrategy implements WaitStrategy
}
public final WaitRandomizer waitRandomizer;
- public final long minMinMicros, maxMaxMicros;
+ public final long minMinMicros, maxMinMicros, maxMaxMicros;
public final @Nullable Wait min;
public final @Nonnull Wait max;
public final int maxAttempts;
- protected RetryStrategy(WaitRandomizer waitRandomizer, long minMinMicros, Wait min, Wait max, long maxMaxMicros, int retries)
+ protected RetryStrategy(WaitRandomizer waitRandomizer, long minMinMicros, Wait min, long maxMinMicros, Wait max, long maxMaxMicros, int retries)
{
this.waitRandomizer = waitRandomizer;
this.minMinMicros = minMinMicros;
this.min = min;
+ this.maxMinMicros = maxMinMicros;
this.max = max;
this.maxMaxMicros = maxMaxMicros;
this.maxAttempts = retries == Integer.MAX_VALUE ? Integer.MAX_VALUE : retries + 1;
@@ -235,6 +236,8 @@ public class RetryStrategy implements WaitStrategy
else
{
long min = this.min.getMicros(attempt);
+ if (min > maxMinMicros)
+ min = maxMinMicros;
long max = this.max.getMicros(attempt);
result = min >= max ? min : waitRandomizer.wait(min, max, attempt);
}
@@ -294,11 +297,14 @@ public class RetryStrategy implements WaitStrategy
throw new IllegalArgumentException("Invalid to specify randomiser when no range specified: '" + original + '\'');
if (min instanceof Wait.Constant && minMin != 0)
throw new IllegalArgumentException("Invalid to specify an absolute minimum constant when the min bound is itself a constant: '" + original + '\'');
+ long maxMin = parseInMicros(m.group("maxmin"), Long.MAX_VALUE);
+ if (min instanceof Wait.Constant && maxMin != Long.MAX_VALUE)
+ throw new IllegalArgumentException("Invalid to specify an absolute max(min) constant when the min bound is itself a constant: '" + original + '\'');
if (max instanceof Wait.Constant && maxMax != Long.MAX_VALUE)
throw new IllegalArgumentException("Invalid to specify an absolute maximum constant when the max bound is itself a constant: '" + original + '\'');
if (randomizer == null)
randomizer = randomizers.uniform();
- return new RetryStrategy(randomizer, minMin, min, max, maxMax, retries);
+ return new RetryStrategy(randomizer, minMin, min, maxMin, max, maxMax, retries);
}
@VisibleForTesting
diff --git a/src/java/org/apache/cassandra/service/paxos/ContentionStrategy.java b/src/java/org/apache/cassandra/service/paxos/ContentionStrategy.java
index 3f983faa8c..63dba970be 100644
--- a/src/java/org/apache/cassandra/service/paxos/ContentionStrategy.java
+++ b/src/java/org/apache/cassandra/service/paxos/ContentionStrategy.java
@@ -109,7 +109,7 @@ public class ContentionStrategy extends RetryStrategy
public ContentionStrategy(WaitRandomizer waitRandomizer, LegacyWait min, LegacyWait max, LegacyWait spread, int retries, int traceAfterAttempts)
{
- super(waitRandomizer, min.min, min, max, max.max, retries);
+ super(waitRandomizer, min.min, min, min.max, max, max.max, retries);
this.traceAfterAttempts = traceAfterAttempts;
this.spread = spread;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org