You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Prefix-scoped record enumeration in NameService for ledger-name lookups #1248
drop_ledger (and other call sites that need every branch of a single ledger) currently does:
let all = self.nameservice().all_records().await?;let branches:Vec<NsRecord> = all.into_iter().filter(|r| r.name == ledger_name).collect();
That's a full nameservice scan followed by an in-memory filter. It's correct, but it grows with the total NS size rather than with the number of branches under the target ledger. On large deployments — DynamoDB nameservice in particular — this is wasteful, and the cost is paid per drop.
…where backends that support a server-side filter implement it efficiently (DynamoDB Query on the partition key, storage_ns prefix scan, etc.) and others can fall back to the existing all_records().filter(...) path. Then swap the call site in drop_ledger (fluree-db-api/src/admin.rs:~392) to use it.
Scope notes
Trait change + impls across memory.rs, file.rs, storage_ns.rs, and the DynamoDB nameservice.
NotifyingNameService passthrough.
Audit other all_records() callers — any that filter by name should switch over too.
Not behavior-changing; just shifts the filter to the most efficient layer the backend supports.
Closing as fixed by #2168. It added NameServiceLookup::branch_records, a per-ledger listing that each backend serves natively: a GSI1 prefix query on DynamoDB, a prefix LIST on storage-backed nameservices, and its own versions in the file and memory backends. GC, materialize, list_branches and the storage proxy now use it.
Three admin paths still call all_records() on purpose: drop_ledger, purge_branch and hold_ledger_for_maintenance (fluree-db-api/src/admin.rs). They also have to find nested ledgers under the name/ prefix (nested_ledgers in gc/sweep.rs), which a per-ledger listing doesn't return. They are rare admin operations, so the full listing stays.
Activity
bplatz commentedon Nov 14, 2026
Closing as fixed by #2168. It added
NameServiceLookup::branch_records, a per-ledger listing that each backend serves natively: a GSI1 prefix query on DynamoDB, a prefix LIST on storage-backed nameservices, and its own versions in the file and memory backends. GC, materialize,list_branchesand the storage proxy now use it.Three admin paths still call
all_records()on purpose:drop_ledger,purge_branchandhold_ledger_for_maintenance(fluree-db-api/src/admin.rs). They also have to find nested ledgers under thename/prefix (nested_ledgersingc/sweep.rs), which a per-ledger listing doesn't return. They are rare admin operations, so the full listing stays.