mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +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:
@ -325,7 +325,8 @@ if ($CRC_RET_stmt_sidef) {
|
||||
SHOW BINLOG EVENTS;
|
||||
--die Wrong number of warnings.
|
||||
}
|
||||
--let $binlog_event= query_get_value(SHOW BINLOG EVENTS, Event_type, 2)
|
||||
# There should be no events after format description and binlog checkpoint.
|
||||
--let $binlog_event= query_get_value(SHOW BINLOG EVENTS, Event_type, 3)
|
||||
if ($binlog_event != No such row) {
|
||||
--enable_query_log
|
||||
--echo ******** Failure! Something was written to the binlog despite SQL_LOG_BIN=0 ********
|
||||
@ -345,23 +346,23 @@ if ($CRC_RET_stmt_sidef) {
|
||||
SHOW BINLOG EVENTS;
|
||||
--die Warnings printed
|
||||
}
|
||||
--let $event_type= query_get_value(SHOW BINLOG EVENTS, Event_type, 3)
|
||||
# The first event is format_description, the second is
|
||||
# Query_event('BEGIN'), and the third should be our Query
|
||||
--let $event_type= query_get_value(SHOW BINLOG EVENTS, Event_type, 4)
|
||||
# The first event is format_description, the second is Binlog_checkpoint,
|
||||
# the third Query_event('BEGIN'), and the fourth should be our Query
|
||||
# for 'INSERT DELAYED' unsafe_type 3, which is safe after
|
||||
# the fix of bug#54579.
|
||||
if (`SELECT $unsafe_type = 3 AND '$event_type' != 'Query'`) {
|
||||
--enable_query_log
|
||||
--echo ******** Failure! Event number 3 was a '$event_type', not a 'Query'. ********
|
||||
--echo ******** Failure! Event number 4 was a '$event_type', not a 'Query'. ********
|
||||
SHOW BINLOG EVENTS;
|
||||
--die Wrong events in binlog.
|
||||
}
|
||||
# The first event is format_description, the second is
|
||||
# Query_event('BEGIN'), and the third should be our Table_map
|
||||
# The first event is format_description, the second is Binlog_checkpoint,
|
||||
# the third is Query_event('BEGIN'), and the fourth should be our Table_map
|
||||
# for unsafe statement.
|
||||
if (`SELECT $unsafe_type != 3 AND '$event_type' != 'Table_map'`) {
|
||||
--enable_query_log
|
||||
--echo ******** Failure! Event number 3 was a '$event_type', not a 'Table_map'. ********
|
||||
--echo ******** Failure! Event number 4 was a '$event_type', not a 'Table_map'. ********
|
||||
SHOW BINLOG EVENTS;
|
||||
--die Wrong events in binlog.
|
||||
}
|
||||
|
Reference in New Issue
Block a user