Skip to content

Commit

Permalink
fix schema change
Browse files Browse the repository at this point in the history
  • Loading branch information
mymeiyi committed Dec 11, 2024
1 parent 72c9f64 commit f7ae8bd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions be/src/olap/schema_change.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ Status SchemaChangeJob::_do_process_alter_tablet(const TAlterTabletReqV2& reques
for (int i = 0; i < num_cols; ++i) {
return_columns[i] = i;
}
std::vector<uint32_t> cluster_key_idxes;

// begin to find deltas to convert from base tablet to new tablet so that
// obtain base tablet and new tablet's push lock and header write lock to prevent loading data
Expand Down Expand Up @@ -980,6 +981,12 @@ Status SchemaChangeJob::_do_process_alter_tablet(const TAlterTabletReqV2& reques
reader_context.batch_size = ALTER_TABLE_BATCH_SIZE;
reader_context.delete_bitmap = &_base_tablet->tablet_meta()->delete_bitmap();
reader_context.version = Version(0, end_version);
if (!_base_tablet_schema->cluster_key_uids().empty()) {
for (const auto& uid : _base_tablet_schema->cluster_key_uids()) {
cluster_key_idxes.emplace_back(_base_tablet_schema->field_index(uid));
}
reader_context.read_orderby_key_columns = &cluster_key_idxes;
}
for (auto& rs_split : rs_splits) {
res = rs_split.rs_reader->init(&reader_context);
if (!res) {
Expand Down Expand Up @@ -1366,15 +1373,8 @@ Status SchemaChangeJob::parse_request(const SchemaChangeParams& sc_params,

if (sc_params.enable_unique_key_merge_on_write &&
new_tablet_schema->num_key_columns() > base_tablet_schema->num_key_columns()) {
if (base_tablet_schema->cluster_key_uids().empty()) {
*sc_directly = true;
return Status::OK();
} else {
// For mow table with cluster keys, the data in segments of one rowset is sorted by
// cluster keys, the short key index may be overlapped.
*sc_sorting = true;
return Status::OK();
}
*sc_directly = true;
return Status::OK();
}

if (base_tablet_schema->num_short_key_columns() != new_tablet_schema->num_short_key_columns()) {
Expand Down

0 comments on commit f7ae8bd

Please sign in to comment.