summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/my_sys.h1
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_optimistic.result4
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel_optimistic.test7
-rw-r--r--sql/handler.cc3
-rw-r--r--sql/log_event.cc18
-rw-r--r--sql/mysqld.cc10
-rw-r--r--sql/sql_class.cc7
-rw-r--r--sql/sql_class.h6
8 files changed, 18 insertions, 38 deletions
diff --git a/include/my_sys.h b/include/my_sys.h
index 1c5649812d1..110a2ee9af3 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -112,7 +112,6 @@ typedef struct my_aio_result {
#define ME_JUST_INFO 1024 /**< not error but just info */
#define ME_JUST_WARNING 2048 /**< not error but just warning */
#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 */
#define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result b/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result
index a6da3399fab..3cd4f8231bf 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_optimistic.result
@@ -1,6 +1,4 @@
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;
CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
@@ -549,6 +547,7 @@ DELETE FROM t1;
DELETE FROM t2;
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
+set global log_warnings=2;
BEGIN;
INSERT INTO t1 SET a=1;
SET @save.binlog_format=@@session.binlog_format;
@@ -567,6 +566,7 @@ DELETE FROM t2;
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
include/stop_slave.inc
+set global log_warnings=default;
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test b/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test
index 28bf4a77fd4..9f6669279db 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test
@@ -4,11 +4,6 @@
--let $rpl_topology=1->2
--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
ALTER TABLE mysql.gtid_slave_pos 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
--connection server_2
+set global log_warnings=2;
BEGIN;
INSERT INTO t1 SET a=1;
@@ -546,6 +542,7 @@ DELETE FROM t2;
#
--connection server_2
--source include/stop_slave.inc
+set global log_warnings=default;
SET GLOBAL slave_parallel_mode=@old_parallel_mode;
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
--source include/start_slave.inc
diff --git a/sql/handler.cc b/sql/handler.cc
index 1027a8b102d..35b0814ef79 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -3639,13 +3639,10 @@ void handler::print_error(int error, myf errflag)
if ((debug_assert_if_crashed_table ||
global_system_variables.log_warnings > 1))
{
- THD *thd= ha_thd();
/*
Log error to log before we crash or if extended warnings are requested
*/
errflag|= ME_NOREFRESH;
- if (thd && thd->is_optimistic_slave_worker())
- errflag|= ME_LOG_AS_WARN;
}
}
diff --git a/sql/log_event.cc b/sql/log_event.cc
index e70d97c54c0..3ac7ac5a20f 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -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.
@@ -12167,8 +12177,8 @@ int Rows_log_event::find_row(rpl_group_info *rgi)
if (error)
{
DBUG_PRINT("info",("rnd_pos returns error %d",error));
- if (error == HA_ERR_RECORD_DELETED)
- error= HA_ERR_KEY_NOT_FOUND;
+ if (error == HA_ERR_RECORD_DELETED || error == HA_ERR_KEY_NOT_FOUND)
+ error= row_not_found_error(rgi);
table->file->print_error(error, MYF(0));
}
DBUG_RETURN(error);
@@ -12233,8 +12243,8 @@ int Rows_log_event::find_row(rpl_group_info *rgi)
HA_READ_KEY_EXACT)))
{
DBUG_PRINT("info",("no record matching the key found in the table"));
- if (error == HA_ERR_RECORD_DELETED)
- error= HA_ERR_KEY_NOT_FOUND;
+ if (error == HA_ERR_RECORD_DELETED || error == HA_ERR_KEY_NOT_FOUND)
+ error= row_not_found_error(rgi);
table->file->print_error(error, MYF(0));
table->file->ha_index_end();
goto end;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 5bf5e3f73fc..5f954f7576d 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -3517,16 +3517,6 @@ void my_message_sql(uint error, const char *str, myf MyFlags)
level= Sql_condition::WARN_LEVEL_WARN;
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
{
level= Sql_condition::WARN_LEVEL_ERROR;
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 0a95d2e2cc5..0f629a2c995 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -7003,13 +7003,6 @@ bool THD::rgi_have_temporary_tables()
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
wait_for_commit::reinit()
diff --git a/sql/sql_class.h b/sql/sql_class.h
index fb3604b899b..6d3f0965df0 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -4168,12 +4168,6 @@ public:
(THD_TRANS::DID_WAIT | THD_TRANS::CREATED_TEMP_TABLE |
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();
};