Skip to content
Permalink
Browse files
Fix wsrep_affected_rows.
The value of wsrep_affected_rows were not reseted properly for
slave. Now we also wsrep_affected_rows in Xid_log_event::do_apply_event
also , apart from THD::cleanup_after_query().

Signed-off-by: Sachin Setiya <sachin.setiya@mariadb.com>
  • Loading branch information
mariadb-SachinSetiya committed Mar 15, 2017
1 parent 1743d68 commit 5bb7653
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
@@ -5,12 +5,12 @@ include/master-slave.inc
# wsrep_max_ws_rows exceeded. Error_Code 1180
#
CREATE TABLE t1(i INT) ENGINE = INNODB;
SET @@GLOBAL.wsrep_max_ws_rows = 1;
SET @@GLOBAL.wsrep_max_ws_rows = 2;
INSERT INTO t1 VALUES(1), (2);
SELECT COUNT(*) = 2 FROM t1;
COUNT(*) = 2
1
SET @@GLOBAL.wsrep_max_ws_rows = 1;
SET @@GLOBAL.wsrep_max_ws_rows = 2;
DELETE FROM t1;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
@@ -15,18 +15,13 @@ 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;
SET @@GLOBAL.wsrep_max_ws_rows = 2;
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;
SET @@GLOBAL.wsrep_max_ws_rows = 2;

connection master;
DELETE FROM t1;
@@ -38,7 +33,6 @@ 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;
@@ -5943,7 +5943,7 @@ static int binlog_log_row(TABLE* table,
}

/* enforce wsrep_max_ws_rows */
if (table->s->tmp_table == NO_TMP_TABLE)
if (table->s->tmp_table == NO_TMP_TABLE && WSREP(thd))
{
thd->wsrep_affected_rows++;
if (wsrep_max_ws_rows &&
@@ -7422,6 +7422,10 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
Record any GTID in the same transaction, so slave state is transactionally
consistent.
*/

/*Set wsrep_affected_rows = 0 */
thd->wsrep_affected_rows= 0;

if (rgi->gtid_pending)
{
sub_id= rgi->gtid_sub_id;

0 comments on commit 5bb7653

Please sign in to comment.