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] better error message when load insert into a table with no pri… #1972

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

lyukun
Copy link

@lyukun lyukun commented May 17, 2024

Task Description

fix confusing error message in load insert , close #1971

Solution Description

When a parent DDL task failed because of the failure of child tasks, it should load error message reported by child tasks from __all_virtual_ddl_error_message table using a insert query SQL with parent_id and err_code as filter.

Passed Regressions

mysql_test:
tools/deploy/mysql_test/test_suite/table_redefinition/t/duplicate_key_load.test

Upgrade Compatibility

Other Information

Release Note

@lyukun
Copy link
Author

lyukun commented May 20, 2024

farm没过是还是因为test_keybtree这个unit_test不稳定

@@ -41,7 +41,7 @@ class ObDDLErrorMessageTableOperator
int prepare_user_message_buf(const int64_t len);
bool operator==(const ObBuildDDLErrorMessage &other) const;
bool operator!=(const ObBuildDDLErrorMessage &other) const;
TO_STRING_KV(K_(ret_code), K_(ddl_type), K_(affected_rows), K_(user_message), K_(dba_message));
TO_STRING_KV(K_(ret_code), K_(ddl_type), K_(affected_rows), K(ObString(user_message_)), K_(dba_message));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用message, ObString(user_message_)吧

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

const char *str_error = ob_errpkt_strerror(ret_code_, is_oracle_mode);
const int64_t buf_size = is_ddl_retry_task ? forward_user_message.length() + 1 : OB_MAX_ERROR_MSG_LEN;
error_message.ret_code_ = ret_code_;
if (is_parent_task_) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个is_parent_task_可能会随着状态变化以及RS切主而丢失掉,最好还是记录子任务的ID,这样查询__all_ddl_error_message表也是比较慢的,它上面没有parent_task_id的索引。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改,写一下修改后的逻辑。
对于走索引的问题,__all_ddl_error_message_这种表的索引列是(object_id, target_object_id),修改后的思路是parent task在发现错误后会尝试通过load_child_task_error函数,按照(object_id, parent_id, ret_code)这三列从__all_ddl_error_message_里捞子任务的出错信息。这是能走索引的。
对于持久化问题,目前parent_task_id在ObTableRedefinitionTask和ObColumnRedfinitionTask这两个task的构造函数中将maybe_parent_task激进地设置为true。所有maybe_parent_task为true的task都会走上面load_child_task_error的流程。故障切主后,新主上重新构造这些Task时,maybe_parent_task依然是true

@lyukun
Copy link
Author

lyukun commented May 23, 2024

farm没过是因为unittest btree_key本身不稳定

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants