summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2013-03-28 13:03:51 +0100
committerunknown <knielsen@knielsen-hq.org>2013-03-28 13:03:51 +0100
commit5aaf73fcaac30ebfd45188c24de3b57aa0929c36 (patch)
tree6df5f76db8f127fc156c5c2a0b076a88536ba917 /sql
parent9303ecd02202afac0b7ab1cdec7bfe3e6c3aef95 (diff)
downloadmariadb-git-5aaf73fcaac30ebfd45188c24de3b57aa0929c36.tar.gz
MDEV-26: Global transaction ID.
Add tests crashing the slave in the middle of replication and checking that replication picks-up again on restart in a crash-safe way. Fix silly code that causes crash by inserting uninitialised data into a hash.
Diffstat (limited to 'sql')
-rw-r--r--sql/rpl_gtid.cc1
-rw-r--r--sql/rpl_rli.cc15
2 files changed, 11 insertions, 5 deletions
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index cdb948f3618..d6a6ed90bd3 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -329,6 +329,7 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
table->field[1]->store(sub_id, true);
table->field[2]->store((ulonglong)gtid->server_id, true);
table->field[3]->store(gtid->seq_no, true);
+ DBUG_EXECUTE_IF("inject_crash_before_write_rpl_slave_state", DBUG_SUICIDE(););
if ((err= table->file->ha_write_row(table->record[0])))
goto end;
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index 41bff96b5e5..6d53e6c3187 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -1246,7 +1246,9 @@ void Relay_log_info::stmt_done(my_off_t event_master_log_pos,
DBA aware of the problem in the error log.
*/
}
+ DBUG_EXECUTE_IF("inject_crash_before_flush_rli", DBUG_SUICIDE(););
flush_relay_log_info(this);
+ DBUG_EXECUTE_IF("inject_crash_after_flush_rli", DBUG_SUICIDE(););
/*
Note that Rotate_log_event::do_apply_event() does not call this
function, so there is no chance that a fake rotate event resets
@@ -1453,6 +1455,10 @@ rpl_load_gtid_slave_state(THD *thd)
entry= (struct local_element *)rec;
if (entry->sub_id >= sub_id)
continue;
+ entry->sub_id= sub_id;
+ DBUG_ASSERT(entry->gtid.domain_id == domain_id);
+ entry->gtid.server_id= server_id;
+ entry->gtid.seq_no= seq_no;
}
else
{
@@ -1462,17 +1468,16 @@ rpl_load_gtid_slave_state(THD *thd)
err= 1;
goto end;
}
+ entry->sub_id= sub_id;
+ entry->gtid.domain_id= domain_id;
+ entry->gtid.server_id= server_id;
+ entry->gtid.seq_no= seq_no;
if ((err= my_hash_insert(&hash, (uchar *)entry)))
{
my_free(entry);
goto end;
}
}
-
- entry->sub_id= sub_id;
- entry->gtid.domain_id= domain_id;
- entry->gtid.server_id= server_id;
- entry->gtid.seq_no= seq_no;
}
rpl_global_gtid_slave_state.lock();