diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2019-10-29 13:11:34 +0200 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2019-10-30 10:14:56 +0200 |
commit | 36a969437845ce9f47a9e6d91514ddc7e00ca83a (patch) | |
tree | 847bffee755a4017242e5ca576b78c5fc3d2018d /sql/wsrep_mysqld.cc | |
parent | 44b0c8697135be4139c4431bbf02fbf4433e058f (diff) | |
download | mariadb-git-36a969437845ce9f47a9e6d91514ddc7e00ca83a.tar.gz |
MDEV-18562 [ERROR] InnoDB: WSREP: referenced FK check fail: Lock wait index
Lock wait can happen on secondary index when doing FK checks for wsrep.
We should just return error to upper layer and applier will retry
operation when needed.
Diffstat (limited to 'sql/wsrep_mysqld.cc')
-rw-r--r-- | sql/wsrep_mysqld.cc | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 12a9dc35a6a..5e2e48fd15d 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1594,25 +1594,6 @@ static bool wsrep_can_run_in_toi(THD *thd, const char *db, const char *table, } } -static const char* wsrep_get_query_or_msg(const THD* thd) -{ - switch(thd->lex->sql_command) - { - case SQLCOM_CREATE_USER: - return "CREATE USER"; - case SQLCOM_GRANT: - return "GRANT"; - case SQLCOM_REVOKE: - return "REVOKE"; - case SQLCOM_SET_OPTION: - if (thd->lex->definer) - return "SET PASSWORD"; - /* fallthrough */ - default: - return thd->query(); - } -} - /* returns: 0: statement was replicated as TOI @@ -1636,7 +1617,7 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_, } WSREP_DEBUG("TO BEGIN: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd), - thd->wsrep_exec_mode, wsrep_get_query_or_msg(thd)); + thd->wsrep_exec_mode, wsrep_thd_query(thd)); switch (thd->lex->sql_command) { @@ -1716,13 +1697,13 @@ static void wsrep_TOI_end(THD *thd) { wsrep_to_isolation--; WSREP_DEBUG("TO END: %lld, %d: %s", (long long)wsrep_thd_trx_seqno(thd), - thd->wsrep_exec_mode, wsrep_get_query_or_msg(thd)); + thd->wsrep_exec_mode, wsrep_thd_query(thd)); wsrep_set_SE_checkpoint(thd->wsrep_trx_meta.gtid.uuid, thd->wsrep_trx_meta.gtid.seqno); WSREP_DEBUG("TO END: %lld, update seqno", (long long)wsrep_thd_trx_seqno(thd)); - + if (WSREP_OK == (ret = wsrep->to_execute_end(wsrep, thd->thread_id))) { WSREP_DEBUG("TO END: %lld", (long long)wsrep_thd_trx_seqno(thd)); } @@ -2674,9 +2655,28 @@ extern "C" query_id_t wsrep_thd_query_id(THD *thd) } -char *wsrep_thd_query(THD *thd) +const char *wsrep_thd_query(THD *thd) { - return (thd) ? thd->query() : NULL; + if (thd) + { + switch(thd->lex->sql_command) + { + case SQLCOM_CREATE_USER: + return "CREATE USER"; + case SQLCOM_GRANT: + return "GRANT"; + case SQLCOM_REVOKE: + return "REVOKE"; + case SQLCOM_SET_OPTION: + if (thd->lex->definer) + return "SET PASSWORD"; + /* fallthrough */ + default: + if (thd->query()) + return thd->query(); + } + } + return "NULL"; } |