hello-stephen commented on code in PR #70593:
URL: https://github.com/apache/doris/pull/70593#discussion_r4731043754
##########
be/src/storage/index/inverted/snii/writer/logical_index_writer.cpp:
##########
@@ -1071,6 +1171,25 @@ Status LogicalIndexWriter::finalize_build() {
std::vector<uint64_t>().swap(term_hashes_); // release
term_hashes_reservation_.reset();
+ // The gram summary is written only where it can skip blocks
(dict_gram_summary.h).
+ gram_summary_bytes_.clear();
+ gram_summary_built_ = false;
+ if (dict_gram_summary_enabled_ && gram_summary_.prunes()) {
+ ByteSink summary_sink;
+ gram_summary_.finish(&summary_sink);
Review Comment:
[P2] Reserve gram-summary serialization memory before allocating it
Native compaction shares a hard-limit `MemoryReporter` across destination
sessions, so other sessions can still occupy most of the budget here.
`DictGramSummaryBuilder::finish()` allocates ordering/offset vectors, encoded
rows, a section buffer and a separate output copy without a reservation; only
the retained output is charged afterward. The per-index `cap_bytes()/64` check
bounds the builder, not this peak (65,536 distinct three-byte keys require at
least 2.8 MiB of additional serialization buffers). A near-cap merge can
therefore exceed its workspace limit before the reservation/fallback mechanism
sees it, even if the ratio check discards the summary. Reserve scratch/output
before serialization and omit this optional section when it cannot fit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]