-
Notifications
You must be signed in to change notification settings - Fork 0
fix(server): INFO # Keyspace lists all dbs across all shards; GRAPH.LIST unions all shards #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -852,8 +852,43 @@ pub(super) async fn try_handle_graph_command( | |
| // thread-local once ShardSlice is initialized, so non-owner commands MUST | ||
| // hop via ShardMessage::GraphCommand — the shard-side handler dispatches | ||
| // on its own store and drains graph WAL records locally. | ||
| // GRAPH.LIST has no name argument and stays connection-local (it reports | ||
| // this shard's graphs only — recorded as a v3 observe delta). | ||
| // GRAPH.LIST has no name argument: scatter to EVERY shard and union the | ||
| // names (a local-only answer listed roughly 1/N of the graphs). | ||
| if ctx.num_shards > 1 && cmd.eq_ignore_ascii_case(b"GRAPH.LIST") { | ||
| let mut receivers = Vec::with_capacity(ctx.num_shards - 1); | ||
| for target in 0..ctx.num_shards { | ||
| if target == ctx.shard_id { | ||
| continue; | ||
| } | ||
| let (reply_tx, reply_rx) = crate::runtime::channel::oneshot(); | ||
| let msg = crate::shard::dispatch::ShardMessage::GraphCommand { | ||
| command: std::sync::Arc::new(frame.clone()), | ||
| reply_tx, | ||
| }; | ||
| let _ = crate::shard::coordinator::spsc_send( | ||
| &ctx.dispatch_tx, | ||
| ctx.shard_id, | ||
| target, | ||
| msg, | ||
| &ctx.spsc_notifiers, | ||
| ) | ||
| .await; | ||
| receivers.push(reply_rx); | ||
| } | ||
| let mut remotes = Vec::with_capacity(receivers.len()); | ||
| for rx in receivers { | ||
| if let Ok(f) = crate::shard::coordinator::recv_reply_bounded(rx).await { | ||
| remotes.push(f); | ||
| } | ||
| } | ||
| let local = crate::shard::slice::with_shard(|s| { | ||
| crate::command::graph::dispatch_graph_read(&s.graph_store, cmd, cmd_args, None) | ||
| }); | ||
| responses.push(crate::command::graph::merge_graph_list_responses( | ||
| local, &remotes, | ||
| )); | ||
| return true; | ||
| } | ||
|
Comment on lines
+857
to
+891
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
grep -n '^futures' Cargo.toml
rg -n 'join_all|FuturesUnordered|select_all' src --type rust
ast-grep run --pattern 'fn race2($$$) { $$$ }' --lang rust src/runtimeRepository: pilotspace/moon Length of output: 1359 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Map the relevant files first
ast-grep outline src/server/conn/handler_monoio/write.rs --view expanded
ast-grep outline src/shard/coordinator.rs --view expanded
ast-grep outline src/runtime/channel.rs --view expanded
ast-grep outline src/server/conn/blocking.rs --view expanded
# Inspect the graph-list branch and the bounded receive helper
sed -n '840,910p' src/server/conn/handler_monoio/write.rs
rg -n 'recv_reply_bounded|XSHARD_REPLY_TIMEOUT|FuturesUnordered|join_all|select_all' src/shard src/runtime src/server/conn --type rust
sed -n '1,220p' src/shard/coordinator.rs
sed -n '230,390p' src/runtime/channel.rs
sed -n '200,290p' src/server/conn/blocking.rsRepository: pilotspace/moon Length of output: 30386 Await the GRAPH.LIST replies concurrently. 🤖 Prompt for AI Agents |
||
| if ctx.num_shards > 1 && !cmd.eq_ignore_ascii_case(b"GRAPH.LIST") { | ||
| if let Some(name) = cmd_args.first().and_then(extract_bytes) { | ||
| let owner = crate::shard::dispatch::graph_to_shard(&name, ctx.num_shards); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -759,8 +759,43 @@ pub(super) async fn try_handle_graph_command( | |
| // thread-local once ShardSlice is initialized, so non-owner commands MUST | ||
| // hop via ShardMessage::GraphCommand — the shard-side handler dispatches | ||
| // on its own store and drains graph WAL records locally. | ||
| // GRAPH.LIST has no name argument and stays connection-local (it reports | ||
| // this shard's graphs only — recorded as a v3 observe delta). | ||
| // GRAPH.LIST has no name argument: scatter to EVERY shard and union the | ||
| // names (a local-only answer listed roughly 1/N of the graphs). | ||
| if ctx.num_shards > 1 && cmd.eq_ignore_ascii_case(b"GRAPH.LIST") { | ||
| let mut receivers = Vec::with_capacity(ctx.num_shards - 1); | ||
| for target in 0..ctx.num_shards { | ||
| if target == ctx.shard_id { | ||
| continue; | ||
| } | ||
| let (reply_tx, reply_rx) = crate::runtime::channel::oneshot(); | ||
| let msg = crate::shard::dispatch::ShardMessage::GraphCommand { | ||
| command: std::sync::Arc::new(frame.clone()), | ||
| reply_tx, | ||
| }; | ||
| let _ = crate::shard::coordinator::spsc_send( | ||
| &ctx.dispatch_tx, | ||
| ctx.shard_id, | ||
| target, | ||
| msg, | ||
| &ctx.spsc_notifiers, | ||
| ) | ||
| .await; | ||
| receivers.push(reply_rx); | ||
| } | ||
| let mut remotes = Vec::with_capacity(receivers.len()); | ||
| for rx in receivers { | ||
| if let Ok(f) = crate::shard::coordinator::recv_reply_bounded(rx).await { | ||
| remotes.push(f); | ||
| } | ||
| } | ||
| let local = crate::shard::slice::with_shard(|s| { | ||
| crate::command::graph::dispatch_graph_read(&s.graph_store, cmd, cmd_args, None) | ||
| }); | ||
| responses.push(crate::command::graph::merge_graph_list_responses( | ||
| local, &remotes, | ||
| )); | ||
| return true; | ||
| } | ||
|
Comment on lines
+764
to
+798
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚀 Performance & Scalability | 🟠 Major | 🏗️ Heavy lift 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Map the relevant files and symbols first.
ast-grep outline src/server/conn/handler_sharded/write.rs --view expanded | sed -n '1,220p'
printf '\n---\n'
ast-grep outline src/server/conn/handler_monoio/write.rs --view expanded | sed -n '1,240p'
printf '\n---\n'
rg -n "recv_reply_bounded|XSHARD_REPLY_TIMEOUT|GraphCommand|GRAPH.LIST|dispatch_graph_read|merge_graph_list_responses" src/server src/shard src/command -SRepository: pilotspace/moon Length of output: 9011 🏁 Script executed: ast-grep outline src/server/conn/handler_sharded/write.rs --view expanded | sed -n '1,220p'
printf '\n---\n'
ast-grep outline src/server/conn/handler_monoio/write.rs --view expanded | sed -n '1,240p'
printf '\n---\n'
rg -n "recv_reply_bounded|XSHARD_REPLY_TIMEOUT|GraphCommand|GRAPH.LIST|dispatch_graph_read|merge_graph_list_responses" src/server src/shard src/command -SRepository: pilotspace/moon Length of output: 9011 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '746,802p' src/server/conn/handler_sharded/write.rs
printf '\n---\n'
sed -n '839,893p' src/server/conn/handler_monoio/write.rs
printf '\n---\n'
sed -n '191,230p' src/shard/coordinator.rsRepository: pilotspace/moon Length of output: 6677 Collect shard replies concurrently. The 🤖 Prompt for AI Agents |
||
| if ctx.num_shards > 1 && !cmd.eq_ignore_ascii_case(b"GRAPH.LIST") { | ||
| if let Some(name) = cmd_args.first().and_then(extract_bytes) { | ||
| let owner = crate::shard::dispatch::graph_to_shard(&name, ctx.num_shards); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Only scatter when the requested INFO section includes Keyspace.
Line 644 runs the cross-shard gather for
INFO server,INFO clients, etc.;info_with_keyspacethen returns the unchanged local response when# Keyspaceis absent. Gate this call using the same section parsing asconn_cmd::info, including the default/all forms, so unrelated diagnostics do not incur shard timeouts.🤖 Prompt for AI Agents