Repository navigation
Conversation
Move the Roaring-bitmap-based serialization of posting lists into `PostingListCodecNone::encode` / `decode` so that all non-raw cases go through `IPostingListCodec::encode`. `PostingsSerialization::serialize` now has only one special case for `RawPostings` (small posting lists written as VarUInts); everything else delegates to the configured codec, which serializes the data and fills `TokenPostingsInfo` with per-segment offsets and ranges. Removed the `serialize(const roaring_bitmap_t &, ...)` overload and the ad-hoc multi-block path in `serializePostings` — segment splitting is now the codec's responsibility, matching how `PostingListCodecBitpacking` already worked. `deserialize` mirrors the change: `RawPostings` uses the inline VarUInt buffer, otherwise the configured codec decodes. `MergeTextIndexesTask::flushDictionaryBlock` was updated to use the unified builder-based `serialize` for embedded postings instead of the removed bitmap overload.
|
Workflow [PR], commit [07c1124] Summary: ⏳
AI ReviewSummaryThis PR refactors text-index posting list construction/serialization to operate on row-id arrays and routes Findings❌ Blockers
Final VerdictStatus:
|
| return; | ||
| } | ||
|
|
||
| std::vector<char> buffer(num_bytes); |
There was a problem hiding this comment.
This adds a fresh heap allocation for every fallback decode (std::vector<char> buffer(num_bytes)).
Before this refactor, the same path reused PostingsSerialization::deserialization_buffer; now merges/reads that decode many posting blocks can hit allocator churn on every block when the payload is not fully contiguous in the current ReadBuffer window.
Can we keep a reusable scratch buffer for none decoding (for example by restoring a reusable buffer in PostingsSerialization and using it here) so we don't regress decode throughput/latency under fragmented reads?
| for (const auto & plist : posting_lists) | ||
| posting_lists_size += plist.getSizeInBytes(); | ||
| /// Heap-allocated posting list data (beyond the inline buffer in each PostingListBuilder). | ||
| /// The inline portion is already included in tokens_map.getBufferSizeInBytes(). |
There was a problem hiding this comment.
tokens_map now stores PostingListBuilder *, so tokens_map.getBufferSizeInBytes() no longer includes inline PostingListBuilder storage.
With this change, memoryUsageBytes underreports per-token memory by omitting the posting_list_builders objects (and list-node overhead), while only counting heap spill bytes via getSizeInBytes.
Please include base posting_list_builders object storage in this estimate as well (for example, iterate posting_list_builders instead of only tokens_and_postings pointers, and add per-builder object cost).
| PostingList output_postings; | ||
| /// Row_ids accumulated for the current token across all source parts. | ||
| /// Sorted and deduplicated before serialization. | ||
| std::vector<UInt32> output_postings; |
There was a problem hiding this comment.
Switching output_postings from roaring::Roaring to std::vector<UInt32> means we now materialize all row ids for a token before dedup (sort + unique in flushPostingList).
For dense tokens in large merges, this can grow to hundreds of MB/GB (4 * cardinality bytes) and is a real peak-memory regression compared to the previous compressed accumulator.
Can we avoid full materialization here (for example by keeping a compressed accumulator, or by incremental merge/dedup that does not require holding the full token posting list as a flat vector)?
LLVM Coverage Report
Changed lines: 90.80% (158/174) | lost baseline coverage: 3 line(s) · Uncovered code |
|
Continued in #106735. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Improved performance of building text indexes during inserts (especially for indexes with
bitpackingcodec).