Skip to content
Permalink
Browse files
Merge 10.2 into bb-10.2-ext
  • Loading branch information
dr-m committed Dec 8, 2017
2 parents a61fbf8 + dfafe15 commit 0a02c1a
Show file tree
Hide file tree
Showing 16 changed files with 271 additions and 110 deletions.
@@ -34,9 +34,9 @@

char *host= NULL, *user= 0, *opt_password= 0,
*default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH];
char ex_var_names[MAX_MYSQL_VAR][FN_REFLEN];
ulonglong last_values[MAX_MYSQL_VAR];
char truncated_var_names[MAX_MYSQL_VAR+100][MAX_TRUNC_LENGTH];
char ex_var_names[MAX_MYSQL_VAR+100][FN_REFLEN];
ulonglong last_values[MAX_MYSQL_VAR+100];
static int interval=0;
static my_bool option_force=0,interrupted=0,new_line=0,
opt_compress= 0, opt_local= 0, opt_relative= 0, opt_verbose= 0,
@@ -885,7 +885,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
return -1;
}

DBUG_ASSERT(mysql_num_rows(res) < MAX_MYSQL_VAR);
DBUG_ASSERT(mysql_num_rows(res) < MAX_MYSQL_VAR+100);

if (!opt_vertical)
print_header(res);
@@ -57,6 +57,8 @@ galera_as_slave : MDEV-13549 Galera test failures 10.1
galera_var_innodb_disallow_writes : MDEV-10949
galera_kill_applier : race condition at the start of the test
GAL-480 : "Lost connection to MySQL"
MW-328A : "Found wrong usage of mutex"
MW-328B : "Found wrong usage of mutex"
MW-328C : "Found wrong usage of mutex"
MW-328C: MDEV-13549 Galera test failures 10.1
MW-328A: MDEV-13549 Galera test failures 10.1
MW-328B: MDEV-13549 Galera test failures 10.1
MW-328: MDEV-13549 Galera test failures 10.1
galera_suspend_slave: MDEV-13549 Galera test failures 10.1
@@ -1,3 +1,4 @@
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
CREATE PROCEDURE insert_proc ()
BEGIN
@@ -12,28 +13,37 @@ SET GLOBAL wsrep_slave_threads = 2;
SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb";
Warnings:
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
connection node_2;
INSERT INTO t1 VALUES (1, 'node 2');;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1a;
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
connection node_1;
SET SESSION wsrep_sync_wait = 0;
SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication_reached WAIT_FOR wsrep_after_replication_continue';
CALL insert_proc ();;
connection node_1a;
SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached";
SET GLOBAL DEBUG = "";
Warnings:
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
connection node_2;
connection node_1;
SELECT @errno = 1213;
@errno = 1213
1
0
SELECT * FROM t1;
f1 f2
1 node 2
3 node 1
connection node_2;
SELECT * FROM t1;
f1 f2
1 node 2
3 node 1
connection node_1;
SET GLOBAL wsrep_slave_threads = DEFAULT;
DROP TABLE t1;
DROP PROCEDURE insert_proc;
@@ -0,0 +1,23 @@
CREATE TABLE t1 ENGINE=InnoDB select 1 as a, 1 as b union select 2, 2;
ALTER TABLE t1 add primary key(a);
CREATE PROCEDURE p1()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION rollback;
WHILE 1 DO
start transaction;
update t1 set b=connection_id() where a=1;
commit;
END WHILE;
END|
connect node_1_p1, 127.0.0.1, root, , test, $NODE_MYPORT_1;
call p1;
connect node_1_p2, 127.0.0.1, root, , test, $NODE_MYPORT_1;
call p1;
connect node_2_p1, 127.0.0.1, root, , test, $NODE_MYPORT_2;
call p1;
connect node_2_p2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
call p1;
connection default;
checking error log for 'BF lock wait long' message for 10 times every 10 seconds ...
drop table t1;
drop procedure p1;
@@ -0,0 +1,52 @@
--source include/galera_cluster.inc
--source include/big_test.inc

CREATE TABLE t1 ENGINE=InnoDB select 1 as a, 1 as b union select 2, 2;
ALTER TABLE t1 add primary key(a);

DELIMITER |;

CREATE PROCEDURE p1()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION rollback;
WHILE 1 DO
start transaction;
update t1 set b=connection_id() where a=1;
commit;
END WHILE;
END|


DELIMITER ;|

--connect node_1_p1, 127.0.0.1, root, , test, $NODE_MYPORT_1
send call p1;
--connect node_1_p2, 127.0.0.1, root, , test, $NODE_MYPORT_1
send call p1;
--connect node_2_p1, 127.0.0.1, root, , test, $NODE_MYPORT_2
send call p1;
--connect node_2_p2, 127.0.0.1, root, , test, $NODE_MYPORT_2
send call p1;

connection default;
let $counter=10;
let $sleep_period=10;

echo checking error log for 'BF lock wait long' message for $counter times every $sleep_period seconds ...;
while($counter > 0)
{
--disable_query_log
--disable_result_log
eval do sleep($sleep_period);
--enable_query_log
--enable_result_log

# use error 0,1 instead if want test to continue
--error 1
exec grep 'BF lock wait long' $MYSQLTEST_VARDIR/log/mysqld.*.err;
dec $counter;
}

drop table t1;
drop procedure p1;

@@ -69,7 +69,7 @@ INSERT INTO t1 (a,b,c,d) VALUES
(1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF);
EXPLAIN SELECT HEX(b+c) FROM t1 WHERE c > 1 OR HEX(b) < 0xFFFFFF;
id select_type table type possible_keys key key_len ref rows Extra
# # # # # b_c # # # #
# # # # # NULL # # # #
SELECT HEX(b+c) FROM t1 WHERE c > 1 OR HEX(b) < 0xFFFFFF;
HEX(b+c)
10
@@ -98,7 +98,7 @@ INSERT INTO t1 (a,b,c,d) VALUES
(1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF);
EXPLAIN SELECT DISTINCT a+0 FROM t1 ORDER BY a;
id select_type table type possible_keys key key_len ref rows Extra
# # # # # a # # # #
# # # # # NULL # # # #
SELECT DISTINCT a+0 FROM t1 ORDER BY a;
a+0
0
@@ -5751,14 +5751,19 @@ mysql_execute_command(THD *thd)
thd->print_aborted_warning(3, "RELEASE");
}
#ifdef WITH_WSREP
if (WSREP(thd) && (thd->wsrep_conflict_state != NO_CONFLICT &&
thd->wsrep_conflict_state != REPLAYING))
{
DBUG_ASSERT(thd->is_error()); // the error is already issued
if (WSREP(thd)) {

if (thd->wsrep_conflict_state == NO_CONFLICT ||
thd->wsrep_conflict_state == REPLAYING)
{
my_ok(thd);
}
} else {
#endif /* WITH_WSREP */
my_ok(thd);
#ifdef WITH_WSREP
}
else
#endif /* WITH_WSREP */
my_ok(thd);
break;
}
case SQLCOM_ROLLBACK:
@@ -5795,13 +5800,16 @@ mysql_execute_command(THD *thd)
if (tx_release)
thd->set_killed(KILL_CONNECTION);
#ifdef WITH_WSREP
if (WSREP(thd) && thd->wsrep_conflict_state != NO_CONFLICT)
{
DBUG_ASSERT(thd->is_error()); // the error is already issued
if (WSREP(thd)) {
if (thd->wsrep_conflict_state == NO_CONFLICT) {
my_ok(thd);
}
} else {
#endif /* WITH_WSREP */
my_ok(thd);
#ifdef WITH_WSREP
}
else
#endif /* WITH_WSREP */
my_ok(thd);
break;
}
case SQLCOM_RELEASE_SAVEPOINT:
@@ -6258,8 +6266,9 @@ mysql_execute_command(THD *thd)
trans_rollback_stmt(thd);
}
#ifdef WITH_WSREP
else if (thd->spcont &&
if (thd->spcont &&
(thd->wsrep_conflict_state == MUST_ABORT ||
thd->wsrep_conflict_state == ABORTED ||
thd->wsrep_conflict_state == CERT_FAILURE))
{
/*
@@ -5014,7 +5014,8 @@ static Sys_var_mybool Sys_wsrep_on (
"wsrep_on", "To enable wsrep replication ",
SESSION_VAR(wsrep_on),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_on_check),
ON_UPDATE(wsrep_on_update));

static Sys_var_charptr Sys_wsrep_start_position (
@@ -42,12 +42,28 @@ int wsrep_init_vars()
return 0;
}

extern ulong innodb_lock_schedule_algorithm;

bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type)
{
if (var_type == OPT_GLOBAL) {
// FIXME: this variable probably should be changed only per session
thd->variables.wsrep_on = global_system_variables.wsrep_on;
}

return false;
}

bool wsrep_on_check(sys_var *self, THD* thd, set_var* var)
{
bool new_wsrep_on= (bool)var->save_result.ulonglong_value;

if (new_wsrep_on && innodb_lock_schedule_algorithm != 0) {
my_message(ER_WRONG_ARGUMENTS, " WSREP (galera) can't be enabled "
"if innodb_lock_schedule_algorithm=VATS. Please configure"
" innodb_lock_schedule_algorithm=FCFS and restart.", MYF(0));
return true;
}
return false;
}

@@ -41,7 +41,8 @@ int wsrep_init_vars();
#define DEFAULT_ARGS (THD* thd, enum_var_type var_type)
#define INIT_ARGS (const char* opt)

extern bool wsrep_causal_reads_update UPDATE_ARGS;
extern bool wsrep_causal_reads_update UPDATE_ARGS;
extern bool wsrep_on_check CHECK_ARGS;
extern bool wsrep_on_update UPDATE_ARGS;
extern bool wsrep_sync_wait_update UPDATE_ARGS;
extern bool wsrep_start_position_check CHECK_ARGS;
@@ -2446,8 +2446,6 @@ fseg_alloc_free_page_low(
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
== FSEG_MAGIC_N_VALUE);
ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE));
ut_ad(space->purpose == FIL_TYPE_TEMPORARY
|| space->purpose == FIL_TYPE_TABLESPACE);
seg_id = mach_read_from_8(seg_inode + FSEG_ID);

ut_ad(seg_id);
@@ -3864,6 +3864,16 @@ innobase_init(
goto error;
}

#ifdef WITH_WSREP
/* Currently, Galera does not support VATS lock schedule algorithm. */
if (innodb_lock_schedule_algorithm == INNODB_LOCK_SCHEDULE_ALGORITHM_VATS
&& global_system_variables.wsrep_on) {
ib::info() << "In Galera environment Variance-Aware-Transaction-Sheduling Algorithm"
" is not supported. Falling back to First-Come-First-Served order. ";
innodb_lock_schedule_algorithm = INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS;
}
#endif /* WITH_WSREP */

#ifndef HAVE_LZ4
if (innodb_compression_algorithm == PAGE_LZ4_ALGORITHM) {
sql_print_error("InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
@@ -5353,7 +5363,7 @@ innobase_kill_query(
wsrep_thd_is_BF(current_thd, FALSE));
}

if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE) && trx->abort_type != TRX_WSREP_ABORT) {
lock_mutex_enter();
lock_mutex_taken = true;
}
@@ -20879,7 +20889,7 @@ static MYSQL_SYSVAR_ULONG(doublewrite_batch_size, srv_doublewrite_batch_size,
#endif /* defined UNIV_DEBUG || defined UNIV_PERF_DEBUG */

static MYSQL_SYSVAR_ENUM(lock_schedule_algorithm, innodb_lock_schedule_algorithm,
PLUGIN_VAR_RQCMDARG,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"The algorithm Innodb uses for deciding which locks to grant next when"
" a lock is released. Possible values are"
" FCFS"
@@ -721,7 +721,7 @@ class RecLock {
as a victim, and we got the lock immediately: no need to
wait then */
dberr_t add_to_waitq(
const lock_t* wait_for,
lock_t* wait_for,
const lock_prdt_t*
prdt = NULL);

@@ -731,21 +731,22 @@ class RecLock {
@param[in] owns_trx_mutex true if caller owns the trx_t::mutex
@param[in] add_to_hash add the lock to hash table
@param[in] prdt Predicate lock (optional)
@param[in,out] c_lock Conflicting lock request or NULL
in Galera conflicting lock is selected
as deadlock victim if requester
is BF transaction.
@return new lock instance */
lock_t* create(
trx_t* trx,
bool owns_trx_mutex,
bool add_to_hash,
const lock_prdt_t*
prdt = NULL);
prdt = NULL
#ifdef WITH_WSREP
,lock_t* c_lock = NULL
#endif /* WITH_WSREP */
);

lock_t* create(
lock_t* const c_lock,
trx_t* trx,
bool owns_trx_mutex,
bool add_to_hash,
const lock_prdt_t*
prdt = NULL);
/**
Check of the lock is on m_rec_id.
@param[in] lock Lock to compare with

0 comments on commit 0a02c1a

Please sign in to comment.