This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new 0f1adc97a23 [fix](merge-on-write) schema change may cause mow duplicate key (#33536) (#33660) 0f1adc97a23 is described below commit 0f1adc97a23696b3504d0a5cb3cf48b2d24a084c Author: zhannngchen <48427519+zhannngc...@users.noreply.github.com> AuthorDate: Tue Apr 16 09:20:14 2024 +0800 [fix](merge-on-write) schema change may cause mow duplicate key (#33536) (#33660) --- be/src/olap/schema_change.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/be/src/olap/schema_change.cpp b/be/src/olap/schema_change.cpp index e753da43454..34b216fc546 100644 --- a/be/src/olap/schema_change.cpp +++ b/be/src/olap/schema_change.cpp @@ -954,6 +954,8 @@ Status SchemaChangeHandler::_do_process_alter_tablet_v2(const TAlterTabletReqV2& break; } + DCHECK_GE(real_alter_version, request.alter_version); + if (new_tablet->keys_type() == UNIQUE_KEYS && new_tablet->enable_unique_key_merge_on_write()) { res = _calc_delete_bitmap_for_mow_table(new_tablet, real_alter_version); @@ -1072,6 +1074,7 @@ Status SchemaChangeHandler::_convert_historical_rowsets(const SchemaChangeParams auto sc_procedure = get_sc_procedure(changer, sc_sorting, sc_directly); // c.Convert historical data + bool have_failure_rowset = false; for (const auto& rs_reader : sc_params.ref_rowset_readers) { VLOG_TRACE << "begin to convert a history rowset. version=" << rs_reader->version().first << "-" << rs_reader->version().second; @@ -1122,6 +1125,7 @@ Status SchemaChangeHandler::_convert_historical_rowsets(const SchemaChangeParams << "tablet=" << sc_params.new_tablet->tablet_id() << ", version='" << rs_reader->version().first << "-" << rs_reader->version().second; StorageEngine::instance()->add_unused_rowset(new_rowset); + have_failure_rowset = true; res = Status::OK(); } else if (!res) { LOG(WARNING) << "failed to register new version. " @@ -1135,7 +1139,9 @@ Status SchemaChangeHandler::_convert_historical_rowsets(const SchemaChangeParams << ", version=" << rs_reader->version().first << "-" << rs_reader->version().second; } - *real_alter_version = rs_reader->version().second; + if (!have_failure_rowset) { + *real_alter_version = rs_reader->version().second; + } VLOG_TRACE << "succeed to convert a history version." << " version=" << rs_reader->version().first << "-" --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org