diff --git a/3rdParty/iresearch/core/index/index_writer.cpp b/3rdParty/iresearch/core/index/index_writer.cpp index 7c50242728..943b0ff680 100644 --- a/3rdParty/iresearch/core/index/index_writer.cpp +++ b/3rdParty/iresearch/core/index/index_writer.cpp @@ -2038,6 +2038,11 @@ index_writer::pending_context_t index_writer::flush_all(const before_commit_f& b // pending consolidation request pending_candidates_count += candidates.size(); } else { + // during consolidation doc_mask could be already populated even for just merged segment + if (pending_segment.segment.meta.docs_count != pending_segment.segment.meta.live_docs_count) { + index_utils::read_document_mask(docs_mask, dir, pending_segment.segment.meta); + } + bool docs_mask_modified = false; // pending already imported/consolidated segment, apply deletes // mask documents matching filters from segment_contexts (i.e. from new operations) for (auto& modifications: ctx->pending_segment_contexts_) { @@ -2052,7 +2057,7 @@ index_writer::pending_context_t index_writer::flush_all(const before_commit_f& b modifications_end - modifications_begin ); - add_document_mask_modified_records( + docs_mask_modified |= add_document_mask_modified_records( modification_queries, docs_mask, cached_readers_, // reader cache for segments @@ -2060,6 +2065,11 @@ index_writer::pending_context_t index_writer::flush_all(const before_commit_f& b pending_segment.generation ); } + + // if mask left untouched, reset it, to prevent unnecessary writes + if (!docs_mask_modified) { + docs_mask.clear(); + } } // skip empty segments diff --git a/CHANGELOG b/CHANGELOG index 6694c99603..ea1ac98d41 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ v3.5.3 (XXXX-XX-XX) ------------------- +* Fixed ArangoSearch index removes being discarded on commiting consolidation + results with pending removes after some segments under consolidation were + already committed. + * Assertion fail when no timestamp in agency's persistence. * Fixed internal issue #647: custom analyzer provokes errors on Active Failover