You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by kx...@apache.org on 2023/06/20 13:22:32 UTC
[doris] branch master updated: [Fix](inverted index) skip index compaction when src rs did not have inverted index (#21010)
This is an automated email from the ASF dual-hosted git repository.
kxiao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 7a58a69aa9 [Fix](inverted index) skip index compaction when src rs did not have inverted index (#21010)
7a58a69aa9 is described below
commit 7a58a69aa966cc8663b365f660aa947ffa50fc0e
Author: airborne12 <ai...@gmail.com>
AuthorDate: Tue Jun 20 21:22:25 2023 +0800
[Fix](inverted index) skip index compaction when src rs did not have inverted index (#21010)
---
be/src/olap/compaction.cpp | 9 ++++++++-
be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp | 10 ++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/be/src/olap/compaction.cpp b/be/src/olap/compaction.cpp
index 005a948c55..5366020f35 100644
--- a/be/src/olap/compaction.cpp
+++ b/be/src/olap/compaction.cpp
@@ -462,7 +462,14 @@ Status Compaction::construct_output_rowset_writer(RowsetWriterContext& ctx, bool
for (auto& index : _cur_tablet_schema->indexes()) {
if (index.index_type() == IndexType::INVERTED) {
auto unique_id = index.col_unique_ids()[0];
- if (field_is_slice_type(_cur_tablet_schema->column_by_uid(unique_id).type())) {
+ //NOTE: here src_rs may be in building index progress, so it would not contain inverted index info.
+ bool all_have_inverted_index = std::all_of(
+ _input_rowsets.begin(), _input_rowsets.end(), [&](const auto& src_rs) {
+ return src_rs->tablet_schema()->get_inverted_index(unique_id) !=
+ nullptr;
+ });
+ if (all_have_inverted_index &&
+ field_is_slice_type(_cur_tablet_schema->column_by_uid(unique_id).type())) {
ctx.skip_inverted_index.insert(unique_id);
}
}
diff --git a/be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp b/be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp
index 03badd0807..83347a3764 100644
--- a/be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp
+++ b/be/src/olap/rowset/segment_v2/inverted_index_compaction.cpp
@@ -41,6 +41,16 @@ void compact_column(int32_t index_id, int src_segment_num, int dest_segment_num,
// format: rowsetId_segmentId_indexId.idx
std::string src_idx_full_name =
src_index_files[i] + "_" + std::to_string(index_id) + ".idx";
+ bool exists = false;
+ auto st = fs->exists(src_idx_full_name, &exists);
+ if (!st.ok()) {
+ LOG(ERROR) << src_idx_full_name << " fs->exists error:" << st;
+ return;
+ }
+ if (!exists) {
+ LOG(WARNING) << src_idx_full_name << " is not exists, will stop index compaction ";
+ return;
+ }
DorisCompoundReader* reader = new DorisCompoundReader(
DorisCompoundDirectory::getDirectory(fs, tablet_path.c_str()),
src_idx_full_name.c_str());
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org