Skip to content

Conversation

@gengdy1545
Copy link
Collaborator

This PR introduces a high-performance visibility management scheme based on Epoch + COW + Lock-Free List.

Key Components:

  1. EpochManager:

    • Implements an epoch-based memory reclamation mechanism.
    • Query threads declare active status via enterEpoch() and exitEpoch().
    • GC threads advance the Epoch after retiring old data, only releasing memory safely once all threads in the old Epoch have exited.
  2. VersionedData & COW:

    • Encapsulates the base bitmap and deletion record list head within VersionedData.
    • GC operations create new VersionedData copies via Copy-on-Write.
    • Utilises atomic compare-and-swap (CAS) on std::atomic<VersionedData*> currentVersion to ensure query threads consistently observe a coherent snapshot.

Copy link
Contributor

@bianhq bianhq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@bianhq bianhq merged commit 19860cf into pixelsdb:master Dec 28, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cpp/pixels-retina] concurrency contention between GC (Garbage Collection) and visibility queries (getVisibility)

2 participants