Status: Closed (View Workflow)
When a master server starts up, it needs to initialise the binlog GTID state,
so that it can log the correct GTID_LIST event at the start of the newly
created next binlog file and initialise @@gtid_binlog_pos correctly and so on.
After a normal shutdown, this happens by reading the mariadb-bin.state file.
After a crash, the last binlog file is marked as crashed, and the binlog GTID
state is initialised as part of binlog crash recovery.
However, if a normal shutdown took place (so the last binlog file is not
marked as crashed), but the mariadb-bin.state file was lost before server
starts up again, the code currently wrongly initialises the binlog GTID state
to empty. This is very wrong and can lead to all sorts of problems.
A typical way to lose the .state file is if the binlogs are copied to a new
server. But in any case, the server must never knowingly start up with a
binlog GTID state that is inconsistent with the binlogs actually in use.