Skip to content

fix(fts): synchronize wildcard DF accumulation#1

Open
future3OOO wants to merge 1 commit intoLadybugDB:mainfrom
future3OOO:fix/fts-wildcard-race
Open

fix(fts): synchronize wildcard DF accumulation#1
future3OOO wants to merge 1 commit intoLadybugDB:mainfrom
future3OOO:fix/fts-wildcard-race

Conversation

@future3OOO
Copy link
Copy Markdown

Summary

  • synchronize wildcard DF accumulation in MatchTermsVertexCompute
  • share a single mutex across copy() worker instances
  • remove the unsynchronized unordered_map write race in the wildcard FTS path

Root cause

MatchTermsVertexCompute stores std::unordered_map<offset_t, uint64_t>& resDfs and copy() returns new worker instances that share that same map. Ladybug runs those copies concurrently from VertexComputeTask::run(), so wildcard matches can execute resDfs[nodeIds[i].offset] = dfs[i]; from multiple worker threads at once.

Why this fix

This is the smallest correctness-first change that matches the demonstrated race without changing the existing VertexCompute API. A thread-local merge design may recover more parallelism later, but it needs extra merge plumbing that does not exist on the current worker interface.

Validation

  • source-level review against current main (160c616cdb0688fd00fdcb4686bb269801a374d4)
  • workload-level reproduction was previously observed from GitNexus wildcard augment calls with native frames through MatchTermsVertexCompute, VertexComputeTask::run(), and std::__detail::_Map_base<...>::operator[]
  • this environment does not currently have a compiler toolchain (gcc/g++/clang absent), so I could not rebuild the extension locally before opening this draft PR

Follow-up

If maintainers want the higher-throughput design, I can rework this toward worker-local accumulation plus post-scan merge once the merge point is agreed.

@future3OOO future3OOO marked this pull request as ready for review April 21, 2026 09:02
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.

1 participant