⚡ Bolt: Use AtomicBitSet for join visited indices#263
Conversation
What: This PR replaces the `Mutex<BooleanBufferBuilder>` used for tracking visited left-side indices in join operations with a lock-free `AtomicBitSet`. Why: In parallel join operations (HashJoin, NestedLoopJoin, PiecewiseMergeJoin), multiple probe threads frequently update a shared bitmap to mark build-side rows as visited. Using a `Mutex` creates a bottleneck and source of lock contention, especially with high parallelism. Impact: Eliminates per-batch lock contention in the parallel probe phase of joins, improving performance and scalability. Measurement: Verified by running `cargo test -p datafusion-physical-plan` (920 join tests passed). Performance improvement is expected in scenarios with high parallelism and many-to-one/many-to-many matches. Co-authored-by: Dandandan <163737+Dandandan@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Resolved lock contention in join operations by introducing a thread-safe
AtomicBitSet.Summary of changes:
AtomicBitSetindatafusion/physical-plan/src/joins/atomic_bit_set.rs.SharedBitmapBuilderasArc<AtomicBitSet>indatafusion/physical-plan/src/joins/mod.rs.HashJoinExec,NestedLoopJoinExec, andPiecewiseMergeJoinExecto use atomic bit set operations instead of locking aBooleanBufferBuilder.datafusion/physical-plan/src/joins/utils.rsto handleAtomicBitSet.PR created automatically by Jules for task 14507652605152518059 started by @Dandandan