Skip to content

[Fix](Variant) return status if dict key not found when sync_tablet_rowsets #49417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions be/src/cloud/cloud_meta_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ Status retry_rpc(std::string_view op_name, const Request& req, Response* res,
return Status::RpcError("failed to {}: rpc timeout, last msg={}", op_name, error_msg);
}

static void fill_schema_with_dict(const RowsetMetaCloudPB& in, RowsetMetaPB* out,
const SchemaCloudDictionary& dict) {
Status fill_schema_with_dict(const RowsetMetaCloudPB& in, RowsetMetaPB* out,
const SchemaCloudDictionary& dict) {
std::unordered_map<int32_t, ColumnPB*> unique_id_map;
//init map
for (ColumnPB& column : *out->mutable_tablet_schema()->mutable_column()) {
Expand All @@ -423,6 +423,9 @@ static void fill_schema_with_dict(const RowsetMetaCloudPB& in, RowsetMetaPB* out
// column info
for (int i = 0; i < in.schema_dict_key_list().column_dict_key_list_size(); ++i) {
int dict_key = in.schema_dict_key_list().column_dict_key_list(i);
if (dict.column_dict().find(dict_key) == dict.column_dict().end()) {
return Status::NotFound("Not found entry {}", dict_key);
}
const ColumnPB& dict_val = dict.column_dict().at(dict_key);
ColumnPB& to_add = *out->mutable_tablet_schema()->add_column();
to_add = dict_val;
Expand All @@ -432,6 +435,9 @@ static void fill_schema_with_dict(const RowsetMetaCloudPB& in, RowsetMetaPB* out
// index info
for (int i = 0; i < in.schema_dict_key_list().index_info_dict_key_list_size(); ++i) {
int dict_key = in.schema_dict_key_list().index_info_dict_key_list(i);
if (dict.index_dict().find(dict_key) == dict.index_dict().end()) {
return Status::NotFound("Not found entry {}", dict_key);
}
const doris::TabletIndexPB& dict_val = dict.index_dict().at(dict_key);
*out->mutable_tablet_schema()->add_index() = dict_val;
VLOG_DEBUG << "fill dict index " << dict_val.ShortDebugString();
Expand All @@ -440,10 +446,14 @@ static void fill_schema_with_dict(const RowsetMetaCloudPB& in, RowsetMetaPB* out
// sparse column info
for (int i = 0; i < in.schema_dict_key_list().sparse_column_dict_key_list_size(); ++i) {
int dict_key = in.schema_dict_key_list().sparse_column_dict_key_list(i);
if (dict.column_dict().find(dict_key) == dict.column_dict().end()) {
return Status::NotFound("Not found entry {}", dict_key);
}
const ColumnPB& dict_val = dict.column_dict().at(dict_key);
*unique_id_map.at(dict_val.parent_unique_id())->add_sparse_columns() = dict_val;
VLOG_DEBUG << "fill dict sparse column" << dict_val.ShortDebugString();
}
return Status::OK();
}

} // namespace
Expand Down Expand Up @@ -648,7 +658,8 @@ Status CloudMetaMgr::sync_tablet_rowsets(CloudTablet* tablet, bool warmup_delta_
// Otherwise, use the schema dictionary from the response (if available).
meta_pb = cloud_rowset_meta_to_doris(cloud_rs_meta_pb);
if (resp.has_schema_dict()) {
fill_schema_with_dict(cloud_rs_meta_pb, &meta_pb, resp.schema_dict());
RETURN_IF_ERROR(fill_schema_with_dict(cloud_rs_meta_pb, &meta_pb,
resp.schema_dict()));
}
}
auto rs_meta = std::make_shared<RowsetMeta>();
Expand Down
Loading