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

bug: revert code, mv ret value from try block back to catch block #1532

Closed
2 of 3 tasks
hustjieke opened this issue Apr 5, 2023 · 0 comments · Fixed by #1555
Closed
2 of 3 tasks

bug: revert code, mv ret value from try block back to catch block #1532

hustjieke opened this issue Apr 5, 2023 · 0 comments · Fixed by #1555
Labels
A-bug Something isn't working C-stonedb-5.7 associated with stonedb 5.7 good first issue Good for newcomers

Comments

@hustjieke
Copy link
Collaborator

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

Before, we set ret = 1 if catch a throw, but in pr 0be195a, set ret action has been moved to try block, not efficient, every time we do truncate success, ret will be setted to 1.

1225 int ha_tianmu::truncate() {
1226   DBUG_ENTER(__PRETTY_FUNCTION__);
1227   int ret = 1;
1228   try {
1229     ha_tianmu_engine_->TruncateTable(table_name_, ha_thd());
1230     ret = 0;
1231   } catch (std::exception &e) {
1232     TIANMU_LOG(LogCtl_Level::ERROR, "An exception is caught: %s", e.what());
1233   } catch (...) {
1234     TIANMU_LOG(LogCtl_Level::ERROR, "An unknown system exception error caught.");
1235   }
1236   DBUG_RETURN(ret);
1237 }

Expected behavior

move back to catch block.

1225 int ha_tianmu::truncate() {
1226   DBUG_ENTER(__PRETTY_FUNCTION__);
1227   int ret = 0;
1228   try {
1229     ha_tianmu_engine_->TruncateTable(table_name_, ha_thd());
1230   } catch (std::exception &e) {
1231     TIANMU_LOG(LogCtl_Level::ERROR, "An exception is caught: %s", e.what());
1232     ret = 1;
1233   } catch (...) {
1234     TIANMU_LOG(LogCtl_Level::ERROR, "An unknown system exception error caught.");
1235     ret = 1;
1236   }
1237   DBUG_RETURN(ret);
1238 }

How To Reproduce

No response

Environment

No response

Are you interested in submitting a PR to solve the problem?

  • Yes, I will!
@hustjieke hustjieke added A-bug Something isn't working good first issue Good for newcomers C-stonedb-5.7 associated with stonedb 5.7 labels Apr 5, 2023
@hustjieke hustjieke added this to the stonedb_5.7_v1.0.4 milestone Apr 5, 2023
@mergify mergify bot closed this as completed in #1555 Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-bug Something isn't working C-stonedb-5.7 associated with stonedb 5.7 good first issue Good for newcomers
Projects
1 participant