MXS-1266: files are saved in GTID repo at creation time

Files are saved in GTID repo at creation time: this allows to show
files without transactions via SHOW [FULL] BINARY LOGS

The FULL keywords add domain_id and server id to the output as file
prefix: 0/10122/mysql-bin.000080
This commit is contained in:
MassimilianoPinto
2017-05-29 10:58:02 +02:00
parent a6e4ff1c10
commit f66623c382
5 changed files with 111 additions and 20 deletions

View File

@ -428,6 +428,30 @@ blr_file_create(ROUTER_INSTANCE *router, char *file)
spinlock_release(&router->binlog_lock);
created = 1;
/**
* Add an entry in GTID repo with size 4
* and router->orig_masterid.
* This allows SHOW BINARY LOGS to list
* new created files.
*/
if (router->mariadb10_compat &&
router->mariadb10_gtid)
{
MARIADB_GTID_ELEMS gtid_elms = {};
// Add GTID domain
gtid_elms.domain_id = router->mariadb10_gtid_domain;
// router->orig_masterid keeps the original ID
gtid_elms.server_id = router->orig_masterid;
// Pos 4 only for end_pos
router->pending_transaction.end_pos = 4;
memcpy(&router->pending_transaction.gtid_elms,
&gtid_elms,
sizeof(MARIADB_GTID_ELEMS));
/* Save GTID into repo */
blr_save_mariadb_gtid(router);
}
}
else
{