This is an automated email from the ASF dual-hosted git repository.

gkoszyk pushed a commit to branch io_uring_tpc
in repository https://gitbox.apache.org/repos/asf/iggy.git


The following commit(s) were added to refs/heads/io_uring_tpc by this push:
     new cbd62a8f feat(io_uring): fix first shard annotation by making the id 
relative (#2212)
cbd62a8f is described below

commit cbd62a8f5d4ae378adfc23cd4f0f3e08edb98fda
Author: Grzegorz Koszyk <[email protected]>
AuthorDate: Sat Sep 27 11:18:50 2025 +0200

    feat(io_uring): fix first shard annotation by making the id relative (#2212)
---
 core/server/src/main.rs | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/core/server/src/main.rs b/core/server/src/main.rs
index 05e4ecc8..bd1b73c7 100644
--- a/core/server/src/main.rs
+++ b/core/server/src/main.rs
@@ -278,8 +278,11 @@ async fn main() -> Result<(), ServerError> {
         }
     });
 
-    for shard_id in shards_set {
-        let id = shard_id as u16;
+    for (id, cpu_id) in shards_set
+        .into_iter()
+        .enumerate()
+        .map(|(id, shard_id)| (id as u16, shard_id))
+    {
         let streams = streams.clone();
         let shards_table = shards_table.clone();
         let users = users.clone();
@@ -322,7 +325,7 @@ async fn main() -> Result<(), ServerError> {
         let handle = std::thread::Builder::new()
             .name(format!("shard-{id}"))
             .spawn(move || {
-                let affinity_set = HashSet::from([shard_id]);
+                let affinity_set = HashSet::from([cpu_id]);
                 let rt = create_shard_executor(affinity_set);
                 rt.block_on(async move {
                     let builder = IggyShard::builder();

Reply via email to