Skip to content
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

fix: create function return success if create failed on tablet #3441

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion src/cmd/single_tablet_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ TEST_P(DBSDKTest, CreateFunction) {
sr = cli->sr;
::openmldb::sdk::SQLClusterRouter* sr_2 = nullptr;
if (cs->IsClusterMode()) {
::openmldb::sdk::ClusterOptions copt;
::openmldb::sdk::ClusterOptions copt;
copt.zk_cluster = mc.GetZkCluster();
copt.zk_path = mc.GetZkPath();
auto cur_cs = new ::openmldb::sdk::ClusterSDK(copt);
Expand All @@ -75,6 +75,10 @@ TEST_P(DBSDKTest, CreateFunction) {
ProcessSQLs(sr_2, {"set @@execute_mode = 'online'"});
}
hybridse::sdk::Status status;
std::string err_cut2_sql = absl::StrCat("CREATE FUNCTION cut2(x STRING) RETURNS STRING "
"OPTIONS (FILE='libnotfound_udf.so');");
sr->ExecuteSQL(err_cut2_sql, &status);
ASSERT_FALSE(status.IsOK());
std::string so_path = openmldb::test::GetParentDir(openmldb::test::GetExeDir()) + "/libtest_udf.so";
std::string cut2_sql = absl::StrCat("CREATE FUNCTION cut2(x STRING) RETURNS STRING "
"OPTIONS (FILE='", so_path, "');");
Expand Down
3 changes: 2 additions & 1 deletion src/nameserver/name_server_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9735,8 +9735,9 @@ void NameServerImpl::CreateFunction(RpcController* controller, const CreateFunct
std::string msg;
if (!tablet->client_->CreateFunction(request->fun(), &msg)) {
error_msgs.append("create function failed on " + tablet->client_->GetEndpoint() + ", reason: " + msg + ";");
} else {
succ_tablets.emplace_back(tablet);
}
succ_tablets.emplace_back(tablet);
}
// rollback and return, it's ok if tablet rollback failed
if (succ_tablets.size() < tablets.size()) {
Expand Down
Loading