maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #12950
Re: 6d0c1f3ae12: MDEV-23328 Server hang due to Galera lock conflict resolution
Hi, Jan!
This was good! Just a few questions, see below
On Oct 24, Jan Lindström wrote:
> revision-id: 6d0c1f3ae12 (mariadb-10.2.40-114-g6d0c1f3ae12)
> parent(s): 3153cc799e2
> author: Jan Lindström
> committer: Jan Lindström
> timestamp: 2021-10-22 07:02:39 +0300
> message:
>
> MDEV-23328 Server hang due to Galera lock conflict resolution
...
> diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
> index 3e1f248b082..5d40106d0ad 100644
> --- a/sql/sql_parse.cc
> +++ b/sql/sql_parse.cc
> @@ -2159,6 +2159,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
> }
> DBUG_PRINT("quit",("Got shutdown command for level %u", level));
> general_log_print(thd, command, NullS);
> + DBUG_EXECUTE_IF("shutdown_unireg_abort", { unireg_abort(1); });
what's the point of this test?
> my_eof(thd);
> kill_mysql(thd);
> error=TRUE;
> diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
> index e60100e2e90..7466654eead 100644
> --- a/sql/wsrep_mysqld.cc
> +++ b/sql/wsrep_mysqld.cc
> @@ -835,13 +835,25 @@ void wsrep_thr_init()
> DBUG_VOID_RETURN;
> }
>
> +/* This is wrapper for wsrep_break_lock in thr_lock.c */
> +static int wsrep_thr_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr, my_bool signal)
When is it called? Under what conditions?
> +{
> + THD* victim_thd= (THD *) victim_thd_ptr;
> + /* We need to lock THD::LOCK_thd_data to protect victim
> + from concurrent usage or disconnect or delete. */
> + mysql_mutex_lock(&victim_thd->LOCK_thd_data);
> + int res= wsrep_abort_thd(bf_thd_ptr, victim_thd_ptr, signal);
> + return res;
> +}
> +
> diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
> index 73b3625b6fd..56400264245 100644
> --- a/storage/innobase/handler/ha_innodb.cc
> +++ b/storage/innobase/handler/ha_innodb.cc
> @@ -19720,46 +19716,113 @@ wsrep_innobase_kill_one_trx(
> +/*******************************************************************
> +This function is used to kill one transaction in BF. */
> +void
> +wsrep_innobase_kill_one_trx(
> + MYSQL_THD const bf_thd,
> + const trx_t * const bf_trx,
> + trx_t *victim_trx,
> + my_bool signal)
> +{
> + ut_ad(bf_thd);
> + ut_ad(victim_trx);
> + ut_ad(lock_mutex_own());
> + ut_ad(trx_mutex_own(victim_trx));
> +
> + DBUG_ENTER("wsrep_innobase_kill_one_trx");
> + THD *thd= (THD *) victim_trx->mysql_thd;
> +
> + /* Here we need to lock THD::LOCK_thd_data to protect from
> + concurrent usage or disconnect or delete. */
> + DEBUG_SYNC(bf_thd, "wsrep_before_BF_victim_lock");
> + my_sleep(100000);
Eh? Forgot to remove after debugging?
> + wsrep_thd_LOCK(thd);
> + my_sleep(100000);
and here
> + DEBUG_SYNC(bf_thd, "wsrep_after_BF_victim_lock");
> +
Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx
Follow ups