-
-
Notifications
You must be signed in to change notification settings - Fork 141
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
feat(tianmu): support unsigned zerofill #1716 #1813
feat(tianmu): support unsigned zerofill #1716 #1813
Conversation
[summary] 1. delete unsigned/zerofill limit. 2. zerofill is deprecated and will be removed in a future release, Use the LPAD function to zero-pad numbers, or store the formatted numbers in a CHAR column.
[summary] In non-strict sql_mode, insert sucess with warning. in strict sql_mode, crashed in function `Sql_cmd_insert_values::execute_inner(THD *thd)` in file `sql/sql_insert.cc`: ``` if (write_record(thd, insert_table, &info, &update)) { has_error = true; break; } thd->get_stmt_da()->inc_current_row_for_condition(); } } // Statement plan is available within these braces assert(has_error == thd->get_stmt_da()->is_error()); ``` here `has_error` = false, `thd->get_stmt_da()->is_error()` = true, that caused crashed. When insert data out of range, `tianmu` engine push a warning into mysql, but in strict sql_mode, the `Sql_condition::SL_WARNING` will be changed to `Sql_condition::SL_ERROR` in function: ``` /** Implementation of STRICT mode. Upgrades a set of given conditions from warning to error. */ bool Strict_error_handler::handle_condition( ... ... switch (sql_errno) { ... case ER_WARN_DATA_OUT_OF_RANGE: case ER_WARN_DATA_OUT_OF_RANGE_FUNCTIONAL_INDEX: if ((*level == Sql_condition::SL_WARNING) && (!thd->get_transaction()->cannot_safely_rollback( Transaction_ctx::STMT) || (thd->variables.sql_mode & MODE_STRICT_ALL_TABLES))) { (*level) = Sql_condition::SL_ERROR; } break; default: break; } return false; ``` So, `write_record(thd, insert_table, &info, &update)` should return error and then set ` has_error = true;`, after debug, I found `ret` value not set `1` when execption get in function: ``` int Engine::InsertRow(const std::string &table_path, [[maybe_unused]] Transaction *trans_, TABLE *table, std::shared_ptr<TableShare> &share) { int ret = 0; try { ret = rct->Insert(table); return ret; } catch (...) { TIANMU_LOG(LogCtl_Level::ERROR, "delayed inserting failed."); } return ret; } ``` we should set `ret` = 1 in strict sql_mode in catch block.
This pull request's title should follow requirements next. @hustjieke please check it 👇. Valid format:
Valid types:
|
Thanks for the contribution! Please review the labels and make any necessary changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary about this PR
Issue Number: close #1716
Tests Check List
Changelog
Documentation