scylla/3.11.x: fix ShardAwarenessTest.correctShardInTracingTest for Scylla 2025.1#931
scylla/3.11.x: fix ShardAwarenessTest.correctShardInTracingTest for Scylla 2025.1#931nikagra wants to merge 1 commit into
Conversation
|
Warning Review limit reached
More reviews will be available in 19 minutes and 36 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe tracing shard-awareness test now normalizes trace thread names by removing the Scylla 2025.1+ service-level suffix before checking shard prefixes, while still requiring at least one local query event. The keyspace setup in the tracing test now disables tablets and is formatted across multiple lines. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
4956eff to
318e0a4
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@driver-core/src/test/java/com/datastax/driver/core/ShardAwarenessTest.java`:
- Line 95: The test assertion in ShardAwarenessTest currently uses the
no-message assertTrue overload, so update the anyLocal check to include a clear
failure message. Locate the assertion in the shard awareness test and change it
to document that no "querying locally" event was observed, so failures are
easier to diagnose.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: d34dc26c-9c6e-4949-8d75-e1d0e8854e1a
📒 Files selected for processing (1)
driver-core/src/test/java/com/datastax/driver/core/ShardAwarenessTest.java
318e0a4 to
1998141
Compare
Two Scylla 2025.1 changes break correctShardInTracingTest:
1. Tablets enabled by default for NTS keyspaces make the driver's
hash-based getShardId() prediction non-deterministic, so the
hardcoded expected shards ("shard 0" / "shard 1") become
unreliable. Fix: ADD TABLETS = {'enabled': false} to the CREATE
KEYSPACE statement to restore traditional token-based shard
assignment.
2. A new coordinator-side trace event runs on shard 0 regardless of
the data shard, causing the previous per-event assertion to fail.
Fix: only assert the shard for events whose description contains
"querying locally" (the data-local event).
Also:
- Thread names now include a /sl:<service_level> suffix (e.g.
"shard 0/sl:default"). Strip it before the startsWith() comparison.
- assertThat(anyLocal) was a no-op BooleanAssert (never called
.isTrue()). Replace with assertTrue(anyLocal) so the liveness
guard actually fires.
1998141 to
9ea57f2
Compare
Problem
ShardAwarenessTest.correctShardInTracingTestfails on Scylla 2025.1 (bothscylla/3.11.4.0andscylla/3.11.5.15matrix entries) with:Two Scylla 2025.1 changes contribute to this failure:
Tablets enabled by default for NTS keyspaces (primary, confirmed): Scylla 2025.1 enables tablets by default for
NetworkTopologyStrategykeyspaces. With tablets, shard assignment is arbitrary — the driver's hash-basedgetShardId(token)prediction no longer matches the shard that actually handles the request. The test createsshardawaretestwithout explicitly disabling tablets, so the expected and actual shards diverge.Service-level suffix in thread names: Since Scylla 2025.1, thread names include a
/sl:suffix (e.g."shard 0/sl:default"). Note:startsWith("shard N")still matches correctly-sharded events — stripping the suffix is defensive hygiene rather than a direct fix.Pre-existing bug (unmasked):
assertThat(anyLocal)is an AssertJ no-op — it wraps the value but never calls.isTrue(). The liveness guard never actually fired even before 2025.1.Fix
AND TABLETS = {'enabled': false}toCREATE KEYSPACE shardawaretestto restore deterministic hash-based shard assignment."querying locally"event (the event that executes on the data-owning shard), making the assertion robust to any future addition of coordinator-side events./sl:...suffix withreplaceFirst("/sl:[^/]*$", "")beforestartsWith(shard)(defensive hygiene).assertThat(anyLocal)(no-op) toassertTrue(anyLocal, ...)so the guard actually fires when no local event is found.Testing
Verified via staging job
java-driver-matrix-2025.1build #2 — GREEN on Scylla2025.1.15-0.20260624.b48b97fb10bd, all 4 driver versions (3.11.4.0,3.11.5.15,4.18.1.0,4.19.0.9).scylla/4.18.1.0andscylla/4.19.0.9pass the test today without changes; this PR targets only3.11.x(via matrix patches in the companion scylla-java-driver-matrix PR #155).