1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-13577 slave_parallel_mode=optimistic should not report the mode's specific temporary errors

Revert 7bbe324fc1
Fix the bug differently (in log_event.cc)
Fix the test case to actually fail without the bug fix
This commit is contained in:
Sergei Golubchik
2018-06-20 10:45:57 +02:00
parent 44682962e3
commit bb24663f5a
8 changed files with 18 additions and 38 deletions

View File

@ -112,7 +112,6 @@ typedef struct my_aio_result {
#define ME_JUST_INFO 1024 /**< not error but just info */ #define ME_JUST_INFO 1024 /**< not error but just info */
#define ME_JUST_WARNING 2048 /**< not error but just warning */ #define ME_JUST_WARNING 2048 /**< not error but just warning */
#define ME_FATALERROR 4096 /* Fatal statement error */ #define ME_FATALERROR 4096 /* Fatal statement error */
#define ME_LOG_AS_WARN 8192 /* is error but error-logged as warning */
/* Bits in last argument to fn_format */ /* Bits in last argument to fn_format */
#define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */ #define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */

View File

@ -1,6 +1,4 @@
include/rpl_init.inc [topology=1->2] include/rpl_init.inc [topology=1->2]
call mtr.add_suppression("Warning.*Deadlock found when trying to get lock; try restarting transaction");
call mtr.add_suppression("Warning.*mysqld: Can't find record in 't2'");
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB; CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
@ -549,6 +547,7 @@ DELETE FROM t1;
DELETE FROM t2; DELETE FROM t2;
include/save_master_gtid.inc include/save_master_gtid.inc
include/sync_with_master_gtid.inc include/sync_with_master_gtid.inc
set global log_warnings=2;
BEGIN; BEGIN;
INSERT INTO t1 SET a=1; INSERT INTO t1 SET a=1;
SET @save.binlog_format=@@session.binlog_format; SET @save.binlog_format=@@session.binlog_format;
@ -567,6 +566,7 @@ DELETE FROM t2;
include/save_master_gtid.inc include/save_master_gtid.inc
include/sync_with_master_gtid.inc include/sync_with_master_gtid.inc
include/stop_slave.inc include/stop_slave.inc
set global log_warnings=default;
SET GLOBAL slave_parallel_mode=@old_parallel_mode; SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads; SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc include/start_slave.inc

View File

@ -4,11 +4,6 @@
--let $rpl_topology=1->2 --let $rpl_topology=1->2
--source include/rpl_init.inc --source include/rpl_init.inc
--connection server_2
call mtr.add_suppression("Warning.*Deadlock found when trying to get lock; try restarting transaction");
# The following instruction is a part of the proof of MDEV-13577 fixes, below.
call mtr.add_suppression("Warning.*mysqld: Can't find record in 't2'");
--connection server_1 --connection server_1
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB; CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
@ -500,6 +495,7 @@ DELETE FROM t2;
# The 1st of the following two trx:s a blocker on slave # The 1st of the following two trx:s a blocker on slave
--connection server_2 --connection server_2
set global log_warnings=2;
BEGIN; BEGIN;
INSERT INTO t1 SET a=1; INSERT INTO t1 SET a=1;
@ -546,6 +542,7 @@ DELETE FROM t2;
# #
--connection server_2 --connection server_2
--source include/stop_slave.inc --source include/stop_slave.inc
set global log_warnings=default;
SET GLOBAL slave_parallel_mode=@old_parallel_mode; SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads; SET GLOBAL slave_parallel_threads=@old_parallel_threads;
--source include/start_slave.inc --source include/start_slave.inc

View File

@ -3639,13 +3639,10 @@ void handler::print_error(int error, myf errflag)
if ((debug_assert_if_crashed_table || if ((debug_assert_if_crashed_table ||
global_system_variables.log_warnings > 1)) global_system_variables.log_warnings > 1))
{ {
THD *thd= ha_thd();
/* /*
Log error to log before we crash or if extended warnings are requested Log error to log before we crash or if extended warnings are requested
*/ */
errflag|= ME_NOREFRESH; errflag|= ME_NOREFRESH;
if (thd && thd->is_optimistic_slave_worker())
errflag|= ME_LOG_AS_WARN;
} }
} }

View File

@ -12080,6 +12080,16 @@ void issue_long_find_row_warning(Log_event_type type,
} }
/*
HA_ERR_KEY_NOT_FOUND is a fatal error normally, but it's an expected
error in speculate optimistic mode, so use something non-fatal instead
*/
static int row_not_found_error(rpl_group_info *rgi)
{
return rgi->speculation != rpl_group_info::SPECULATE_OPTIMISTIC
? HA_ERR_KEY_NOT_FOUND : HA_ERR_RECORD_CHANGED;
}
/** /**
Locate the current row in event's table. Locate the current row in event's table.
@ -12167,8 +12177,8 @@ int Rows_log_event::find_row(rpl_group_info *rgi)
if (error) if (error)
{ {
DBUG_PRINT("info",("rnd_pos returns error %d",error)); DBUG_PRINT("info",("rnd_pos returns error %d",error));
if (error == HA_ERR_RECORD_DELETED) if (error == HA_ERR_RECORD_DELETED || error == HA_ERR_KEY_NOT_FOUND)
error= HA_ERR_KEY_NOT_FOUND; error= row_not_found_error(rgi);
table->file->print_error(error, MYF(0)); table->file->print_error(error, MYF(0));
} }
DBUG_RETURN(error); DBUG_RETURN(error);
@ -12233,8 +12243,8 @@ int Rows_log_event::find_row(rpl_group_info *rgi)
HA_READ_KEY_EXACT))) HA_READ_KEY_EXACT)))
{ {
DBUG_PRINT("info",("no record matching the key found in the table")); DBUG_PRINT("info",("no record matching the key found in the table"));
if (error == HA_ERR_RECORD_DELETED) if (error == HA_ERR_RECORD_DELETED || error == HA_ERR_KEY_NOT_FOUND)
error= HA_ERR_KEY_NOT_FOUND; error= row_not_found_error(rgi);
table->file->print_error(error, MYF(0)); table->file->print_error(error, MYF(0));
table->file->ha_index_end(); table->file->ha_index_end();
goto end; goto end;

View File

@ -3517,16 +3517,6 @@ void my_message_sql(uint error, const char *str, myf MyFlags)
level= Sql_condition::WARN_LEVEL_WARN; level= Sql_condition::WARN_LEVEL_WARN;
func= sql_print_warning; func= sql_print_warning;
} }
else if (MyFlags & ME_LOG_AS_WARN)
{
/*
Typical use case is optimistic parallel slave where DA needs to hold
an error condition caused by the current error, but the error-log
level is relaxed to the warning one.
*/
level= Sql_condition::WARN_LEVEL_ERROR;
func= sql_print_warning;
}
else else
{ {
level= Sql_condition::WARN_LEVEL_ERROR; level= Sql_condition::WARN_LEVEL_ERROR;

View File

@ -7003,13 +7003,6 @@ bool THD::rgi_have_temporary_tables()
return rgi_slave->rli->save_temporary_tables != 0; return rgi_slave->rli->save_temporary_tables != 0;
} }
bool THD::is_optimistic_slave_worker()
{
DBUG_ASSERT(system_thread != SYSTEM_THREAD_SLAVE_SQL || rgi_slave);
return system_thread == SYSTEM_THREAD_SLAVE_SQL && rgi_slave &&
rgi_slave->speculation == rpl_group_info::SPECULATE_OPTIMISTIC;
}
void void
wait_for_commit::reinit() wait_for_commit::reinit()

View File

@ -4168,12 +4168,6 @@ public:
(THD_TRANS::DID_WAIT | THD_TRANS::CREATED_TEMP_TABLE | (THD_TRANS::DID_WAIT | THD_TRANS::CREATED_TEMP_TABLE |
THD_TRANS::DROPPED_TEMP_TABLE | THD_TRANS::DID_DDL)); THD_TRANS::DROPPED_TEMP_TABLE | THD_TRANS::DID_DDL));
} }
/*
Returns true when the thread handle belongs to a slave worker thread
running in the optimistic execution mode.
*/
bool is_optimistic_slave_worker();
}; };