This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch branch-3.0 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push: new ba97470d3e8 branch-3.0: [fix](index compaction)Add column unique id check before use #47562 (#47577) ba97470d3e8 is described below commit ba97470d3e80ffdb303df4acbbad2a74ccbc3a72 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Sat Feb 8 14:48:47 2025 +0800 branch-3.0: [fix](index compaction)Add column unique id check before use #47562 (#47577) Cherry-picked from #47562 Co-authored-by: qiye <l...@selectdb.com> --- be/src/olap/compaction.cpp | 5 +++++ be/src/olap/tablet_schema.cpp | 4 ++++ be/src/olap/tablet_schema.h | 1 + 3 files changed, 10 insertions(+) diff --git a/be/src/olap/compaction.cpp b/be/src/olap/compaction.cpp index a59ab318078..1bc7fbfa2a3 100644 --- a/be/src/olap/compaction.cpp +++ b/be/src/olap/compaction.cpp @@ -828,6 +828,11 @@ void Compaction::construct_index_compaction_columns(RowsetWriterContext& ctx) { continue; } auto col_unique_id = col_unique_ids[0]; + if (!_cur_tablet_schema->has_column_unique_id(col_unique_id)) { + LOG(WARNING) << "tablet[" << _tablet->tablet_id() << "] column_unique_id[" + << col_unique_id << "] not found, will skip index compaction"; + continue; + } // Avoid doing inverted index compaction on non-slice type columns if (!field_is_slice_type(_cur_tablet_schema->column_by_uid(col_unique_id).type())) { continue; diff --git a/be/src/olap/tablet_schema.cpp b/be/src/olap/tablet_schema.cpp index 303d0a1dd53..9df75a84f6a 100644 --- a/be/src/olap/tablet_schema.cpp +++ b/be/src/olap/tablet_schema.cpp @@ -1352,6 +1352,10 @@ bool TabletSchema::exist_column(const std::string& field_name) const { return _field_name_to_index.contains(StringRef {field_name}); } +bool TabletSchema::has_column_unique_id(int32_t col_unique_id) const { + return _field_id_to_index.contains(col_unique_id); +} + Status TabletSchema::have_column(const std::string& field_name) const { if (!_field_name_to_index.contains(StringRef(field_name))) { return Status::Error<ErrorCode::INTERNAL_ERROR>( diff --git a/be/src/olap/tablet_schema.h b/be/src/olap/tablet_schema.h index 8179fd2ccc8..41eb8ccd1e3 100644 --- a/be/src/olap/tablet_schema.h +++ b/be/src/olap/tablet_schema.h @@ -344,6 +344,7 @@ public: Result<const TabletColumn*> column(const std::string& field_name) const; Status have_column(const std::string& field_name) const; bool exist_column(const std::string& field_name) const; + bool has_column_unique_id(int32_t col_unique_id) const; const TabletColumn& column_by_uid(int32_t col_unique_id) const; TabletColumn& mutable_column_by_uid(int32_t col_unique_id); TabletColumn& mutable_column(size_t ordinal); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org