MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / SaveTableInfo

Method SaveTableInfo

src/nameserver/name_server_impl.cc:4019–4039  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4017}
4018
4019bool NameServerImpl::SaveTableInfo(std::shared_ptr<TableInfo> table_info) {
4020 std::string table_value;
4021 table_info->SerializeToString(&table_value);
4022 if (table_info->db().empty()) {
4023 if (!zk_client_->CreateNode(zk_table_data_path_ + "/" + table_info->name(), table_value)) {
4024 PDLOG(WARNING, "create object table node[%s/%s] failed!", zk_table_data_path_.c_str(),
4025 table_info->name().c_str());
4026 return false;
4027 }
4028 PDLOG(INFO, "create table node[%s/%s] success!", zk_table_data_path_.c_str(), table_info->name().c_str());
4029 } else {
4030 if (!zk_client_->CreateNode(zk_db_table_data_path_ + "/" + std::to_string(table_info->tid()), table_value)) {
4031 PDLOG(WARNING, "create object db table node[%s/%s] failed!", zk_db_table_data_path_.c_str(),
4032 table_info->name().c_str());
4033 return false;
4034 }
4035 PDLOG(INFO, "create db table node[%s/%s] success!", zk_db_table_data_path_.c_str(), table_info->name().c_str());
4036 }
4037
4038 return true;
4039}
4040void NameServerImpl::CreateTableInternel(GeneralResponse& response,
4041 std::shared_ptr<::fedb::nameserver::TableInfo> table_info,
4042 uint64_t cur_term,

Callers

nothing calls this directly

Calls 3

to_stringFunction · 0.85
CreateNodeMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected