TangSiyang2001 commented on code in PR #28255: URL: https://github.com/apache/doris/pull/28255#discussion_r1424816408
########## be/src/service/internal_service.cpp: ########## @@ -719,17 +720,45 @@ void PInternalServiceImpl::_get_column_ids_by_tablet_ids( } // check schema consistency, column ids should be the same const auto& columns = tablet->tablet_schema()->columns(); + std::set<int32_t> column_ids; for (const auto& col : columns) { column_ids.insert(col.unique_id()); } filter_set.insert(column_ids); Review Comment: And change these lines to `filter_set.insert(tablet->tablet_schema()->columns())`. So that we could check consistency of: 1. the schema columns size 2. the columns respectively, including the uid. in the unique logic. looks like: ```cpp for (const auto& param : params) { int64_t index_id = param.indexid(); auto tablet_ids = param.tablet_ids(); std::set<std::vector<TabletColumn>> filter_set; for (const int64_t tablet_id : tablet_ids) { TabletSharedPtr tablet = tablet_mgr->get_tablet(tablet_id); if (tablet == nullptr) { std::stringstream ss; ss << "cannot get tablet by id:" << tablet_id; LOG(WARNING) << ss.str(); response->mutable_status()->set_status_code(TStatusCode::ILLEGAL_STATE); response->mutable_status()->add_error_msgs(ss.str()); return; } // check schema consistency, column ids should be the same filter_set.insert(tablet->tablet_schema()->columns()); } if (filter_set.size() > 1) { // consistecy check failed std::stringstream ss; ss << "consistency check failed: index{" << index_id << "}" << "got inconsistent shema"; LOG(WARNING) << ss.str(); response->mutable_status()->set_status_code(TStatusCode::ILLEGAL_STATE); response->mutable_status()->add_error_msgs(ss.str()); return; } // consistency check passed, use the first tablet to be the representative TabletSharedPtr tablet = tablet_mgr->get_tablet(tablet_ids[0]); const auto& columns = tablet->tablet_schema()->columns(); auto entry = response->add_entries(); entry->set_index_id(index_id); auto col_name_to_id = entry->mutable_col_name_to_id(); for (const auto& column : columns) { (*col_name_to_id)[column.name()] = column.unique_id(); } } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org