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

MDEV-181: XID crash recovery across binlog boundaries

Keep track of how many pending XIDs (transactions that are prepared in
storage engine and written into binlog, but not yet durably committed
on disk in the engine) there are in each binlog.

When the count of one binlog drops to zero, write a new binlog checkpoint
event, telling which is the oldest binlog with pending XIDs.

When doing XA recovery after a crash, check the last binlog checkpoint
event, and scan all binlog files from that point onwards for XIDs that
must be committed if found in prepared state inside engine.

Remove the code in binlog rotation that waits for all prepared XIDs to
be committed before writing a new binlog file (this is no longer necessary
when recovery can scan multiple binlog files).
This commit is contained in:
unknown
2012-06-22 11:46:28 +02:00
parent 9fe317ffd6
commit 0697ee265f
53 changed files with 1174 additions and 221 deletions

View File

@ -623,6 +623,30 @@ send_event_to_slave(THD *thd, NET *net, String* const packet, ushort flags,
}
}
/*
Do not send binlog checkpoint events to a slave that does not understand it.
*/
if (unlikely(event_type == BINLOG_CHECKPOINT_EVENT) &&
mariadb_slave_capability < MARIA_SLAVE_CAPABILITY_BINLOG_CHECKPOINT)
{
if (mariadb_slave_capability >= MARIA_SLAVE_CAPABILITY_TOLERATE_HOLES)
{
/* This slave can tolerate events omitted from the binlog stream. */
return NULL;
}
else
{
/*
The slave does not understand BINLOG_CHECKPOINT_EVENT. Send a dummy
event instead, with same length so slave does not get confused about
binlog positions.
*/
if (Query_log_event::dummy_event(packet, ev_offset, current_checksum_alg))
return "Failed to replace binlog checkpoint event with dummy: "
"too small event.";
}
}
/*
Skip events with the @@skip_replication flag set, if slave requested
skipping of such events.