Skip to content

Commit dc76e43

Browse files
fix: add arg db in NsClient::AddMultiIndex(#2205)
1 parent df28cd3 commit dc76e43

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

src/client/ns_client.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ bool NsClient::AddIndex(const std::string& db_name,
884884
return false;
885885
}
886886

887-
base::Status NsClient::AddMultiIndex(const std::string& table_name,
887+
base::Status NsClient::AddMultiIndex(const std::string& db, const std::string& table_name,
888888
const std::vector<::openmldb::common::ColumnKey>& column_keys) {
889889
::openmldb::nameserver::AddIndexRequest request;
890890
::openmldb::nameserver::GeneralResponse response;
@@ -896,7 +896,7 @@ base::Status NsClient::AddMultiIndex(const std::string& table_name,
896896
}
897897
}
898898
request.set_name(table_name);
899-
request.set_db(GetDb());
899+
request.set_db(db);
900900
bool ok = client_.SendRequest(&::openmldb::nameserver::NameServer_Stub::AddIndex, &request, &response,
901901
FLAGS_request_timeout_ms, 1);
902902
if (ok && response.code() == 0) {

src/client/ns_client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class NsClient : public Client {
217217
std::vector<openmldb::common::ColumnDesc>* cols,
218218
std::string& msg); // NOLINT
219219

220-
base::Status AddMultiIndex(const std::string& table_name,
220+
base::Status AddMultiIndex(const std::string& db, const std::string& table_name,
221221
const std::vector<::openmldb::common::ColumnKey>& column_keys);
222222

223223
bool DeleteIndex(const std::string& table_name, const std::string& idx_name,

src/nameserver/name_server_impl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9040,7 +9040,7 @@ void NameServerImpl::AddIndex(RpcController* controller, const AddIndexRequest*
90409040
std::map<std::string, std::shared_ptr<::openmldb::client::TabletClient>> tablet_client_map;
90419041
if (!GetTableInfo(name, db, &table_info)) {
90429042
base::SetResponseStatus(ReturnCode::kTableIsNotExist, "table is not exist!", response);
9043-
LOG(WARNING) << "table[" << name << "] is not exist!";
9043+
LOG(WARNING) << "table[" << db << "." << name << "] is not exist!";
90449044
return;
90459045
}
90469046
if (table_info->storage_mode() != ::openmldb::common::kMemory) {

src/sdk/sql_cluster_router.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3054,7 +3054,7 @@ hybridse::sdk::Status SQLClusterRouter::HandleIndex(const std::string& db,
30543054
return get_index_status;
30553055
}
30563056

3057-
auto add_index_status = AddNewIndex(table_map, new_index_map);
3057+
auto add_index_status = AddNewIndex(db, table_map, new_index_map);
30583058
if (!add_index_status.IsOK()) {
30593059
return add_index_status;
30603060
}
@@ -3178,16 +3178,16 @@ hybridse::sdk::Status SQLClusterRouter::GetNewIndex(
31783178
return {};
31793179
}
31803180

3181-
hybridse::sdk::Status SQLClusterRouter::AddNewIndex(
3181+
hybridse::sdk::Status SQLClusterRouter::AddNewIndex(const std::string& db,
31823182
const std::map<std::string, ::openmldb::nameserver::TableInfo>& table_map,
31833183
const std::map<std::string, std::vector<::openmldb::common::ColumnKey>>& new_index_map) {
31843184
auto ns = cluster_sdk_->GetNsClient();
31853185
if (cluster_sdk_->IsClusterMode()) {
31863186
for (auto& kv : new_index_map) {
3187-
auto status = ns->AddMultiIndex(kv.first, kv.second);
3187+
auto status = ns->AddMultiIndex(db, kv.first, kv.second);
31883188
if (!status.OK()) {
31893189
return {::hybridse::common::StatusCode::kCmdError,
3190-
"table " + kv.first + " add index failed. " + status.msg};
3190+
"table [" + db + "." + kv.first + "] add index failed. " + status.msg};
31913191
}
31923192
}
31933193
} else {

src/sdk/sql_cluster_router.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ class SQLClusterRouter : public SQLRouter {
384384
std::map<std::string, std::vector<::openmldb::common::ColumnKey>>* new_index_map);
385385

386386
hybridse::sdk::Status AddNewIndex(
387-
const std::map<std::string, ::openmldb::nameserver::TableInfo>& table_map,
387+
const std::string& db, const std::map<std::string, ::openmldb::nameserver::TableInfo>& table_map,
388388
const std::map<std::string, std::vector<::openmldb::common::ColumnKey>>& new_index_map);
389389

390390
hybridse::sdk::Status HandleCreateFunction(const hybridse::node::CreateFunctionPlanNode* node);

0 commit comments

Comments
 (0)