Skip to content

Keep the mapped CSR and the mapped index in separate members - #47

Merged
zirui-song-18 merged 1 commit into
opensearch-project:mainfrom
chishui:split-csr-and-index-mappings
Sep 4, 2026
Merged

Keep the mapped CSR and the mapped index in separate members#47
zirui-song-18 merged 1 commit into
opensearch-project:mainfrom
chishui:split-csr-and-index-mappings

Conversation

@chishui

@chishui chishui commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Description

MmapIndex held one MmapFile mapped_file_ for both mappings a borrowed buffer can point into: a native CSR corpus from read_csr's mapped residency, and a serialized index file from a derived mmap_index(). Those sources are mutually exclusive, but they're populated by unrelated paths and released at different times, which one member made hard to see — InvertedIndex::build() closes the mapping once its posting lists own their entries, correct only for the CSR side, while every mmap_index() assigns the other.

Split into csr_mapping_ and index_mapping_. Both stay declared ahead of vectors_ and batch_spill_, so reverse-declaration-order destruction still outlives every borrower. batch_spill_ keeps its own mapping: release() must unmap before unlinking, so path and mapping belong together.

No behaviour change; comments updated to match.

Check List

  • Commits signed off per the DCO
  • Tests pass locally (638/638 via ctest)

Apache 2.0 license.

MmapIndex held one MmapFile for both mappings a borrowed buffer can point
into, on the grounds that a native CSR corpus and a serialized index file
are mutually exclusive sources. They are, but they are populated by
unrelated paths and released at different times, and the single member
made that hard to see: InvertedIndex::build() closes the mapping once its
posting lists own their entries, which is only ever correct for the CSR
side, while every mmap_index() assigns the index side.

Split it into csr_mapping_ and index_mapping_. Both stay declared ahead of
vectors_ and batch_spill_, so reverse-declaration-order destruction still
outlives every borrower.

No behaviour change.

Signed-off-by: Liyun Xiu <xiliyun@amazon.com>

@zirui-song-18 zirui-song-18 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@zirui-song-18
zirui-song-18 merged commit 7acc13c into opensearch-project:main Sep 4, 2026
10 checks passed
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.

2 participants