Skip to content

feat(server-ng): close the partition materialisation race at the owner - #3786

Open
krishvishal wants to merge 1 commit into
masterfrom
part-mat-barrier
Open

feat(server-ng): close the partition materialisation race at the owner#3786
krishvishal wants to merge 1 commit into
masterfrom
part-mat-barrier

Conversation

@krishvishal

Copy link
Copy Markdown
Contributor

Problem

create_topic returns on metadata commit; the owning shard publishes the partition only after build_partition_fresh (mkdir, segment open, fallocate). A produce issued right after races materialisation, on every shard.

partition_reconciler carried a TODO for a materialisation barrier: stop non-owners seeding shards_table rows, have the owner push its row to peers, so row presence implies the partition exists.

Rejected. It turns a deterministic hash cache into a distributed readiness protocol whose deltas need ordering, retry and repair, and it gives up level-triggered repair (a pass re-derives every row from committed metadata, so a lost row is rewritten). The owner can decide all of it locally.

Approach

Resolve at the owner; shards_table stays a hint.

  • router::route_typed falls back to calculate_shard_assignment on a missing row, so an early frame reaches the future owner.
  • park_if_unmaterialised holds it until the matching InsertOwned, then re-queues onto that shard's inbox.
  • serves_committed_incarnation refuses a namespace whose committed created_revision disagrees with the row epoch, so a mid-teardown request cannot be acked against an incarnation about to be erased.

Tombstoned namespace, park overflow, and a namespace the shard gave up building all reply with a retriable status. No silence, so no lockstep transport waits out its read timeout.

@github-actions github-actions Bot added the S-waiting-on-review PR is waiting on a reviewer label Jul 31, 2026
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.92382% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.77%. Comparing base (53a7ff9) to head (2c2610e).

Files with missing lines Patch % Lines
core/shard/src/lib.rs 76.02% 43 Missing and 4 partials ⚠️
core/server-ng/src/partition_reconciler.rs 98.96% 4 Missing ⚠️
core/shard/src/router.rs 42.85% 4 Missing ⚠️
core/shard/src/metrics.rs 94.73% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             master    #3786       +/-   ##
=============================================
- Coverage     75.58%   55.77%   -19.81%     
  Complexity      969      969               
=============================================
  Files          1317     1315        -2     
  Lines        155244   137476    -17768     
  Branches     128866   111178    -17688     
=============================================
- Hits         117339    76681    -40658     
- Misses        34361    57353    +22992     
+ Partials       3544     3442      -102     
Components Coverage Δ
Rust Core 50.76% <90.92%> (-24.79%) ⬇️
Java SDK 62.71% <ø> (ø)
C# SDK 71.14% <ø> (-1.19%) ⬇️
Python SDK 92.27% <ø> (ø)
PHP SDK 84.52% <ø> (ø)
Node SDK 95.31% <ø> (+0.11%) ⬆️
Go SDK 43.08% <ø> (ø)
Files with missing lines Coverage Δ
core/metadata/src/stm/stream.rs 62.17% <100.00%> (+0.19%) ⬆️
core/server-ng/src/dispatch.rs 40.00% <100.00%> (+0.19%) ⬆️
core/simulator/src/lib.rs 97.09% <100.00%> (+<0.01%) ⬆️
core/shard/src/metrics.rs 89.51% <94.73%> (+0.94%) ⬆️
core/server-ng/src/partition_reconciler.rs 91.42% <98.96%> (+4.09%) ⬆️
core/shard/src/router.rs 47.94% <42.85%> (+0.32%) ⬆️
core/shard/src/lib.rs 58.37% <76.02%> (+2.16%) ⬆️

... and 360 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review PR is waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant