mariadb/sql/wsrep_dummy.cc
Jan Lindström 224c950462 MDEV-23101 : SIGSEGV in lock_rec_unlock() when Galera is enabled
Remove incorrect BF (brute force) handling from lock_rec_has_to_wait_in_queue
and move condition to correct callers. Add a function to report
BF lock waits and assert if incorrect BF-BF lock wait happens.

wsrep_report_bf_lock_wait
	Add a new function to report BF lock wait.

wsrep_assert_no_bf_bf_wait
	Add a new function to check do we have a
	BF-BF wait and if we have report this case
	and assert as it is a bug.

lock_rec_has_to_wait
	Use new wsrep_assert_bf_wait to check BF-BF wait.

lock_rec_create_low
lock_table_create
	Use new function to report BF lock waits.

lock_rec_insert_by_trx_age
lock_grant_and_move_on_page
lock_grant_and_move_on_rec
	Assert that trx is not Galera as VATS is not compatible
	with Galera.

lock_rec_add_to_queue
	If there is conflicting lock in a queue make sure that
	transaction is BF.

lock_rec_has_to_wait_in_queue
	Remove incorrect BF handling. If there is conflicting
	locks in a queue all transactions must wait.

lock_rec_dequeue_from_page
lock_rec_unlock
	If there is conflicting lock make sure it is not
	BF-BF case.

lock_rec_queue_validate
	Add Galera record locking rules comment and use
	new function to report BF lock waits.

All attempts to reproduce the original assertion have been
failed. Therefore, there is no test case on this commit.
2020-09-10 13:18:12 +03:00

160 lines
3.5 KiB
C++

/* Copyright (C) 2014, 2020, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA. */
#include <my_global.h>
#include <sql_class.h>
#include <mysql/service_wsrep.h>
my_bool wsrep_thd_is_BF(THD *, my_bool)
{ return 0; }
int wsrep_trx_order_before(THD *, THD *)
{ return 0; }
enum wsrep_conflict_state wsrep_thd_conflict_state(THD *, my_bool)
{ return NO_CONFLICT; }
int wsrep_is_wsrep_xid(const XID*)
{ return 0; }
bool wsrep_prepare_key(const uchar*, size_t, const uchar*, size_t, struct wsrep_buf*, size_t*)
{ return 0; }
struct wsrep *get_wsrep()
{ return 0; }
my_bool get_wsrep_certify_nonPK()
{ return 0; }
my_bool get_wsrep_debug()
{ return 0; }
my_bool get_wsrep_drupal_282555_workaround()
{ return 0; }
my_bool get_wsrep_load_data_splitting()
{ return 0; }
my_bool get_wsrep_recovery()
{ return 0; }
my_bool get_wsrep_log_conflicts()
{ return 0; }
long get_wsrep_protocol_version()
{ return 0; }
my_bool wsrep_aborting_thd_contains(THD *)
{ return 0; }
void wsrep_aborting_thd_enqueue(THD *)
{ }
bool wsrep_consistency_check(THD *)
{ return 0; }
void wsrep_lock_rollback()
{ }
int wsrep_on(THD *thd)
{ return 0; }
void wsrep_post_commit(THD*, bool)
{ }
enum wsrep_trx_status wsrep_run_wsrep_commit(THD *, bool)
{ return WSREP_TRX_ERROR; }
void wsrep_thd_LOCK(THD *)
{ }
void wsrep_thd_UNLOCK(THD *)
{ }
void wsrep_thd_awake(THD *, my_bool)
{ }
const char *wsrep_thd_conflict_state_str(THD *)
{ return 0; }
enum wsrep_exec_mode wsrep_thd_exec_mode(THD *)
{ return LOCAL_STATE; }
const char *wsrep_thd_exec_mode_str(THD *)
{ return NULL; }
enum wsrep_conflict_state wsrep_thd_get_conflict_state(THD *)
{ return NO_CONFLICT; }
my_bool wsrep_thd_is_wsrep(THD *)
{ return 0; }
const char *wsrep_thd_query(THD *)
{ return "NULL"; }
enum wsrep_query_state wsrep_thd_query_state(THD *)
{ return QUERY_IDLE; }
const char *wsrep_thd_query_state_str(THD *)
{ return 0; }
int wsrep_thd_retry_counter(THD *)
{ return 0; }
void wsrep_thd_set_conflict_state(THD *, enum wsrep_conflict_state)
{ }
bool wsrep_thd_ignore_table(THD *)
{ return 0; }
longlong wsrep_thd_trx_seqno(THD *)
{ return -1; }
struct wsrep_ws_handle* wsrep_thd_ws_handle(THD *)
{ return 0; }
void wsrep_thd_auto_increment_variables(THD *thd,
unsigned long long *offset,
unsigned long long *increment)
{
*offset= thd->variables.auto_increment_offset;
*increment= thd->variables.auto_increment_increment;
}
void wsrep_set_load_multi_commit(THD *thd, bool split)
{ }
bool wsrep_is_load_multi_commit(THD *thd)
{ return false; }
int wsrep_trx_is_aborting(THD *)
{ return 0; }
void wsrep_unlock_rollback()
{ }
void wsrep_set_data_home_dir(const char *)
{ }
void wsrep_log(void (*)(const char *, ...), const char *, ...)
{
}
my_bool wsrep_thd_is_applier(MYSQL_THD thd)
{ return false; }
void wsrep_report_bf_lock_wait(MYSQL_THD thd,
unsigned long long id)
{}