Skip to content

Commit b355cce

Browse files
authored
Add Valkey cluster backplane and sticky-410 ownership (clusters) (Stirling-Tools#6472)
1 parent de9d6ad commit b355cce

30 files changed

Lines changed: 3858 additions & 213 deletions

app/common/src/main/java/stirling/software/common/cluster/RateLimitStore.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
import java.time.Duration;
44

5-
/** Token-bucket rate limiting backed by the cluster backplane. */
5+
/**
6+
* Token-bucket rate limiting backed by the cluster backplane.
7+
*
8+
* <p>In-process implementations enforce a per-JVM limit; distributed implementations enforce a
9+
* single global limit across every node. Both use a Bucket4j greedy-refill token bucket so the
10+
* semantics match across single-node and cluster deployments.
11+
*/
612
public interface RateLimitStore {
713

814
/**

app/common/src/main/java/stirling/software/common/service/JobExecutorService.java

Lines changed: 3 additions & 132 deletions
Large diffs are not rendered by default.

app/common/src/test/java/stirling/software/common/cluster/inprocess/InProcessDistributedLockTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ void acquireReleaseAcquire() {
2424
}
2525

2626
@Test
27-
void reentryFromSameThreadFails() {
27+
void reentryFromSameThreadFails_parityWithValkey() {
28+
// The Valkey impl refuses reentry (SET NX semantics); the in-process impl must match,
29+
// otherwise code working in single-instance silently breaks in cluster mode.
2830
DistributedLock lock = new InProcessDistributedLock();
2931
DistributedLock.LockHandle h1 = lock.tryAcquire("k", Duration.ofSeconds(30)).orElseThrow();
3032
Optional<DistributedLock.LockHandle> reentry = lock.tryAcquire("k", Duration.ofSeconds(30));

app/common/src/test/java/stirling/software/common/service/TaskManagerJobStoreDelegationTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ public String localNodeId() {
8686

8787
@Override
8888
public boolean shouldRunLocalCleanup() {
89+
// Distributed backplanes own job TTL eviction themselves; this mock
90+
// mirrors the real ValkeyClusterBackplane override of the default true.
8991
return false;
9092
}
9193
};

0 commit comments

Comments
 (0)