Skip to content

feat(shard): Implement shard router - #2853

Merged
hubcio merged 7 commits into
apache:masterfrom
krishvishal:shard-router
Mar 4, 2026
Merged

hubcio merged 7 commits into
apache:masterfrom
krishvishal:shard-router

Conversation

@krishvishal

Copy link
Copy Markdown
Member

In the shard router each shard gets an inbox (flume channel) and a vector of senders to all other shards (including itself). When a message arrives at any shard, the router:

  1. Decomposes the generic message to extract the operation and namespace
  2. Resolves the target shard - metadata ops go to shard 0, partition ops are looked up in the ShardsTable, unknown ops default to shard 0
  3. Enqueues a ShardFrame into the target shard's channel

The message pump (run_message_pump) drains the inbox and processes frames sequentially, ensuring all mutations on a given shard are serialized through a single async task.

The ShardsTable trait abstracts partition ownership lookup with two implementations:

  • () : no-op for single-shard setups (simulator for now)
  • PapayaShardsTable: lock-free concurrent map for multi-shard deployments

@codecov

codecov Bot commented Mar 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 168 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.77%. Comparing base (50423db) to head (d81c3fd).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
core/shard/src/router.rs 0.00% 86 Missing ⚠️
core/shard/src/lib.rs 0.00% 37 Missing ⚠️
core/shard/src/shards_table.rs 0.00% 33 Missing ⚠️
core/common/src/types/consensus/header.rs 0.00% 8 Missing ⚠️
core/simulator/src/replica.rs 0.00% 2 Missing ⚠️
core/metadata/src/impls/metadata.rs 0.00% 1 Missing ⚠️
core/partitions/src/iggy_partitions.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2853      +/-   ##
============================================
- Coverage     67.91%   67.77%   -0.14%     
  Complexity      739      739              
============================================
  Files          1049     1051       +2     
  Lines         84394    84544     +150     
  Branches      60973    61132     +159     
============================================
- Hits          57313    57300      -13     
- Misses        24720    24874     +154     
- Partials       2361     2370       +9     
Flag Coverage Δ
csharp 67.43% <ø> (-0.19%) ⬇️
go 6.33% <ø> (ø)
java 54.83% <ø> (ø)
node 92.26% <ø> (-0.04%) ⬇️
python 0.00% <ø> (ø)
rust 70.01% <0.00%> (-0.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
core/metadata/src/impls/metadata.rs 16.53% <0.00%> (+0.25%) ⬆️
core/partitions/src/iggy_partitions.rs 0.00% <0.00%> (ø)
core/simulator/src/replica.rs 0.00% <0.00%> (ø)
core/common/src/types/consensus/header.rs 23.57% <0.00%> (-0.70%) ⬇️
core/shard/src/shards_table.rs 0.00% <0.00%> (ø)
core/shard/src/lib.rs 0.00% <0.00%> (ø)
core/shard/src/router.rs 0.00% <0.00%> (ø)

... and 20 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.

@hubcio

hubcio commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

can you use crossfire instead of flume? its much more battle-tested than flume and seems to have better performance.

@krishvishal

Copy link
Copy Markdown
Member Author

can you use crossfire instead of flume? its much more battle-tested than flume and seems to have better performance.

Okay, I will look into it.

Comment thread core/shard/src/router.rs Outdated
Comment thread core/shard/src/lib.rs Outdated
Comment thread core/shard/src/router.rs Outdated
Comment thread core/shard/src/router.rs Outdated
Comment thread core/common/src/types/consensus/header.rs
numinnex
numinnex previously approved these changes Mar 4, 2026
@krishvishal

Copy link
Copy Markdown
Member Author

Fixed merge conflicts.

@hubcio
hubcio merged commit 11295b3 into apache:master Mar 4, 2026
74 checks passed
@krishvishal
krishvishal deleted the shard-router branch March 4, 2026 17:27
kriti-sc pushed a commit to kriti-sc/iggy that referenced this pull request Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants