[Commits] 3dd88fb: MDEV-10714: Could not execute Delete_rows event on table; wsrep_max_ws_rows exceeded. Error_Code 1180

Nirbhay Choubey nirbhay at mariadb.com
Thu Sep 1 19:59:11 EEST 2016


revision-id: 3dd88fbd1132ae36c00adb67cbe2fc4ff97a6789 (mariadb-galera-10.0.27-2-g3dd88fb)
parent(s): 616271b7c9f69596df740a8fec5a4f39b959d064
author: Nirbhay Choubey
committer: Nirbhay Choubey
timestamp: 2016-09-01 12:59:11 -0400
message:

MDEV-10714: Could not execute Delete_rows event on table; wsrep_max_ws_rows exceeded. Error_Code 1180

The wsrep_max_ws_rows related implementation should be skipped
when server is running with wsrep disabled.

---
 mysql-test/suite/wsrep/r/wsrep_rpl.result | 22 +++++++++++++
 mysql-test/suite/wsrep/t/wsrep_rpl.cnf    |  1 +
 mysql-test/suite/wsrep/t/wsrep_rpl.test   | 50 +++++++++++++++++++++++++++++
 sql/handler.cc                            | 53 ++++++++++++++++++-------------
 4 files changed, 104 insertions(+), 22 deletions(-)

diff --git a/mysql-test/suite/wsrep/r/wsrep_rpl.result b/mysql-test/suite/wsrep/r/wsrep_rpl.result
new file mode 100644
index 0000000..fd792c2
--- /dev/null
+++ b/mysql-test/suite/wsrep/r/wsrep_rpl.result
@@ -0,0 +1,22 @@
+include/master-slave.inc
+[connection master]
+#
+# MDEV-10714: Could not execute Delete_rows event on table;
+# wsrep_max_ws_rows exceeded. Error_Code 1180
+#
+CREATE TABLE t1(i INT) ENGINE = INNODB;
+SET @@GLOBAL.wsrep_max_ws_rows = 1;
+INSERT INTO t1 VALUES(1), (2);
+SELECT COUNT(*) = 2 FROM t1;
+COUNT(*) = 2
+1
+SET @@GLOBAL.wsrep_max_ws_rows = 1;
+DELETE FROM t1;
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+SET @@GLOBAL.wsrep_max_ws_rows = 0;
+SET @@GLOBAL.wsrep_max_ws_rows = 0;
+include/rpl_end.inc
+# End of test.
diff --git a/mysql-test/suite/wsrep/t/wsrep_rpl.cnf b/mysql-test/suite/wsrep/t/wsrep_rpl.cnf
new file mode 100644
index 0000000..56e874f
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep_rpl.cnf
@@ -0,0 +1 @@
+!include ../../rpl/my.cnf
diff --git a/mysql-test/suite/wsrep/t/wsrep_rpl.test b/mysql-test/suite/wsrep/t/wsrep_rpl.test
new file mode 100644
index 0000000..1cc7214
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/wsrep_rpl.test
@@ -0,0 +1,50 @@
+--source include/have_wsrep.inc
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+--echo #
+--echo # MDEV-10714: Could not execute Delete_rows event on table;
+--echo # wsrep_max_ws_rows exceeded. Error_Code 1180
+--echo #
+# Save wsrep_max_ws_rows on master and slave.
+connection master;
+let $wsrep_max_ws_rows_master = `SELECT @@GLOBAL.wsrep_max_ws_rows`;
+connection slave;
+let $wsrep_max_ws_rows_slave = `SELECT @@GLOBAL.wsrep_max_ws_rows`;
+
+connection master;
+CREATE TABLE t1(i INT) ENGINE = INNODB;
+
+# Setting wsrep_max_ws_rows should have no impact on replication master
+# unless its a cluster node.
+SET @@GLOBAL.wsrep_max_ws_rows = 1;
+INSERT INTO t1 VALUES(1), (2);
+
+sync_slave_with_master;
+SELECT COUNT(*) = 2 FROM t1;
+
+connection slave;
+# Setting wsrep_max_ws_rows should have no impact on replication slave
+# unless its a cluster node.
+SET @@GLOBAL.wsrep_max_ws_rows = 1;
+
+connection master;
+DELETE FROM t1;
+
+sync_slave_with_master;
+SELECT COUNT(*) = 0 FROM t1;
+
+connection master;
+DROP TABLE t1;
+
+sync_slave_with_master;
+
+# Restore wsrep_max_ws_rows on master and slave
+connection master;
+eval SET @@GLOBAL.wsrep_max_ws_rows = $wsrep_max_ws_rows_master;
+connection slave;
+eval SET @@GLOBAL.wsrep_max_ws_rows = $wsrep_max_ws_rows_slave;
+
+--source include/rpl_end.inc
+--echo # End of test.
+
diff --git a/sql/handler.cc b/sql/handler.cc
index af83e91..a142bb4 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -6109,14 +6109,17 @@ int handler::ha_write_row(uchar *buf)
   if (unlikely(error= binlog_log_row(table, 0, buf, log_func)))
     DBUG_RETURN(error); /* purecov: inspected */
 #ifdef WITH_WSREP
-  current_thd->wsrep_affected_rows++;
-  if (wsrep_max_ws_rows &&
-      current_thd->wsrep_exec_mode != REPL_RECV &&
-      current_thd->wsrep_affected_rows > wsrep_max_ws_rows)
+  if (WSREP(current_thd))
   {
-    trans_rollback_stmt(current_thd) || trans_rollback(current_thd);
-    my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
-    DBUG_RETURN(ER_ERROR_DURING_COMMIT);
+    current_thd->wsrep_affected_rows++;
+    if (wsrep_max_ws_rows &&
+        current_thd->wsrep_exec_mode != REPL_RECV &&
+        current_thd->wsrep_affected_rows > wsrep_max_ws_rows)
+    {
+      trans_rollback_stmt(current_thd) || trans_rollback(current_thd);
+      my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
+      DBUG_RETURN(ER_ERROR_DURING_COMMIT);
+    }
   }
 #endif /* WITH_WSREP */
 
@@ -6153,14 +6156,17 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data)
   if (unlikely(error= binlog_log_row(table, old_data, new_data, log_func)))
     return error;
 #ifdef WITH_WSREP
-  current_thd->wsrep_affected_rows++;
-  if (wsrep_max_ws_rows &&
-      current_thd->wsrep_exec_mode != REPL_RECV &&
-      current_thd->wsrep_affected_rows > wsrep_max_ws_rows)
+  if (WSREP(current_thd))
   {
-    trans_rollback_stmt(current_thd) || trans_rollback(current_thd);
-    my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
-    return ER_ERROR_DURING_COMMIT;
+    current_thd->wsrep_affected_rows++;
+    if (wsrep_max_ws_rows &&
+        current_thd->wsrep_exec_mode != REPL_RECV &&
+        current_thd->wsrep_affected_rows > wsrep_max_ws_rows)
+    {
+      trans_rollback_stmt(current_thd) || trans_rollback(current_thd);
+      my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
+      return ER_ERROR_DURING_COMMIT;
+    }
   }
 #endif /* WITH_WSREP */
   return 0;
@@ -6191,14 +6197,17 @@ int handler::ha_delete_row(const uchar *buf)
   if (unlikely(error= binlog_log_row(table, buf, 0, log_func)))
     return error;
 #ifdef WITH_WSREP
-  current_thd->wsrep_affected_rows++;
-  if (wsrep_max_ws_rows &&
-      current_thd->wsrep_exec_mode != REPL_RECV &&
-      current_thd->wsrep_affected_rows > wsrep_max_ws_rows)
-  {
-    trans_rollback_stmt(current_thd) || trans_rollback(current_thd);
-    my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
-    return ER_ERROR_DURING_COMMIT;
+  if (WSREP(current_thd))
+  {
+    current_thd->wsrep_affected_rows++;
+    if (wsrep_max_ws_rows &&
+        current_thd->wsrep_exec_mode != REPL_RECV &&
+        current_thd->wsrep_affected_rows > wsrep_max_ws_rows)
+    {
+      trans_rollback_stmt(current_thd) || trans_rollback(current_thd);
+      my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
+      return ER_ERROR_DURING_COMMIT;
+    }
   }
 #endif /* WITH_WSREP */
   return 0;


More information about the commits mailing list