Repository navigation
pool: reject hosts displaced from metadata - #1166
Conversation
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1166 +/- ##
==========================================
+ Coverage 87.26% 87.30% +0.03%
==========================================
Files 44 44
Lines 19242 19251 +9
Branches 3009 3011 +2
==========================================
+ Hits 16792 16807 +15
+ Misses 1793 1789 -4
+ Partials 657 655 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
f194662 to
c8fba18
Compare
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can tweak Display settings with a live preview to see your comment before it ships Powered by Qodo |
| if host._is_removed: | ||
| if not owns_host: | ||
| terminal_result = False | ||
| return_none = not is_direct_add |
There was a problem hiding this comment.
[Minor] 🟡 The not owns_host branch does not release the claimed intent, unlike the _is_removed branch below it (pops pool_intents[host] when current_intent is intent). If the host is displaced during distance(), the completed intent stays in _pool_intents holding the displaced Host until the replacement's next claim overwrites it or remove_pool/shutdown clears it. In the plain-removal case no replacement exists, so it lingers. Same shape in update_created_pools (line 5076). test_distance_callback_displaces_owner compares _pool_intents to a snapshot taken after the claim, so it accepts the leftover.
Generated by Claude Code
Metadata can publish a replacement Host before retiring its predecessor. Endpoint and generation checks alone let the displaced lifecycle replace a healthy session pool during that interval. Validate exact metadata ownership before claiming pool intents, after policy callbacks, on setup failures and through final pool publication. Acquire Connection locks before the metadata guard and keep callbacks, network waits and candidate cleanup outside it. Release displaced intents only while they remain current, preserving replacement ownership. Register metadata owners in existing pool fixtures and cover publication orders, replacement identities, stale admission and setup failures. Check intent cleanup and completion across policy distances and use bounded thread probes for lock ordering. Fixes: #860
c8fba18 to
a1aa84e
Compare
Issue
#860 permits an asynchronous pool attempt to publish after metadata has replaced its Host. Metadata publishes the new owner before retiring the old object, so endpoint and generation checks can still accept the displaced lifecycle. A stale renewal can overwrite and close a healthy replacement pool during that interval.
Fix
Require the exact Host object to own its metadata entry before claiming pool intent and after load-balancing callbacks. Recheck metadata ownership for constructor and keyspace failures, and hold that ownership stable through final pool publication. Acquire Connection locks before the metadata guard, and run callbacks, network waits and candidate cleanup outside it.
Captured reconciliation snapshots and stale direct renewals leave the replacement pool, generation, intent and distance untouched. Existing completion behavior for competing attempts on the current Host is preserved. This changes internal Session pool lifecycle handling without public API or protocol changes.
Deterministic regressions cover both publication orders, endpoint moves, different-ID replacements at the same endpoint, equal-ID Host objects, missing metadata owners, policy callbacks, keyspace synchronization and constructor failures.
Validation
TZ=UTC: 2,136 tests with the normal extension build and 2,058 with a clean pure-Python build. The fixture preparation commit also passes its affected suites (435 tests).SCYLLA_VERSION=release:2025.2.Fixes: #860
Pre-review checklist
./docs/source/.Fixes:annotations to PR description.Required integration scenarios: live IP change and USE during background shard connection creation (both verified on Scylla 2025.2).