Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BugFix] Be crash when doing compaction apply (#14513)
This bug is introduced by #12068. To reduce the memory usage during apply, we don't preload all segments' primary keys and process segment by segment(#12068). ``` .... uint32_t max_rowset_id = *std::max_element(info->inputs.begin(), info->inputs.end()); Rowset* rowset = _get_rowset(max_rowset_id).get(); ..... for (size_t i = 0; i < _compaction_state->pk_cols.size(); i++) { // the rowset is not what we should load if (st = _compaction_state->load_segments(rowset, i); !st.ok()) { manager->index_cache().release(index_entry); _compaction_state.reset(); std::string msg = strings::Substitute("_apply_compaction_commit error: load compaction state failed: $0 $1", st.to_string(), debug_string()); LOG(ERROR) << msg; _set_error(msg); return; } ..... } ``` As the above code shown, we will load one segment for a loop. However, the `rowset` is not the output rowset after compaction but one of the input rowsets, so we may get an unexpected error. (cherry picked from commit 287f82a)
- Loading branch information