gavinchou commented on code in PR #47629: URL: https://github.com/apache/doris/pull/47629#discussion_r1962952192
########## cloud/src/meta-service/meta_service.cpp: ########## @@ -2556,4 +2556,58 @@ std::size_t get_segments_key_bounds_bytes(const doris::RowsetMetaCloudPB& rowset return ret; } +void MetaServiceImpl::get_schema_dict(::google::protobuf::RpcController* controller, + const GetSchemaDictRequest* request, + GetSchemaDictResponse* response, + ::google::protobuf::Closure* done) { + RPC_PREPROCESS(get_schema_dict); + instance_id = get_instance_id(resource_mgr_, request->cloud_unique_id()); + if (instance_id.empty()) { + code = MetaServiceCode::INVALID_ARGUMENT; + msg = "empty instance_id"; + LOG(WARNING) << msg << ", cloud_unique_id=" << request->cloud_unique_id(); + return; + } + + if (!request->has_index_id()) { + code = MetaServiceCode::INVALID_ARGUMENT; + msg = "missing index_id in request"; + return; + } + + RPC_RATE_LIMIT(get_schema_dict) + + std::unique_ptr<Transaction> txn; + TxnErrorCode err = txn_kv_->create_txn(&txn); + if (err != TxnErrorCode::TXN_OK) { + code = cast_as<ErrCategory::CREATE>(err); + msg = "failed to init txn"; + return; + } + + std::string dict_key = meta_schema_pb_dictionary_key({instance_id, request->index_id()}); + ValueBuf dict_val; + err = cloud::get(txn.get(), dict_key, &dict_val); + LOG(INFO) << "Retrieved column pb dictionary, index_id=" << request->index_id() + << " key=" << hex(dict_key) << " error=" << err; + if (err != TxnErrorCode::TXN_KEY_NOT_FOUND && err != TxnErrorCode::TXN_OK) { + // Handle retrieval error. + ss << "Failed to retrieve column pb dictionary, instance_id=" << instance_id + << " table_id=" << request->index_id() << " key=" << hex(dict_key) << " error=" << err; + msg = ss.str(); + code = cast_as<ErrCategory::READ>(err); + return; + } + SchemaCloudDictionary schema_dict; + if (err == TxnErrorCode::TXN_OK && !dict_val.to_pb(&schema_dict)) { + // Handle parse error. + code = MetaServiceCode::PROTOBUF_PARSE_ERR; + msg = fmt::format("Malformed tablet dictionary value, key={}", hex(dict_key)); + return; + } + + response->mutable_schema_dict()->Swap(&schema_dict); + TEST_SYNC_POINT_CALLBACK("get_schema_dict::finish", &response); Review Comment: where is this sync point is used? -- 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