MXS-1266: saving GTID components into gtid_maps storage. part1

Saving GTID components into gtid_maps storage will allow to create a
hiearchical binlog cache dir.

Empty GTID  for master registration can be specified with SET
@@global.gtid_slave_pos = ‘’
This commit is contained in:
MassimilianoPinto
2017-05-19 10:23:35 +02:00
parent 56cf06ee08
commit 6c86e1ef2f
5 changed files with 262 additions and 116 deletions

View File

@ -3116,12 +3116,18 @@ static bool blr_open_gtid_maps_storage(ROUTER_INSTANCE *inst)
char* errmsg;
/* Create the gtid_maps table */
int rc = sqlite3_exec(inst->gtid_maps,
"CREATE TABLE IF NOT EXISTS "
"gtid_maps(gtid varchar(255), "
"binlog_file varchar(255), "
"start_pos bigint, "
"end_pos bigint, "
"primary key(gtid));",
"BEGIN;"
"CREATE TABLE IF NOT EXISTS gtid_maps("
"id INTEGER PRIMARY KEY AUTOINCREMENT, "
"rep_domain INT, "
"server_id INT, "
"sequence BIGINT, "
"binlog_file VARCHAR(255), "
"start_pos BIGINT, "
"end_pos BIGINT);"
"CREATE UNIQUE INDEX IF NOT EXISTS gtid_index "
"ON gtid_maps(rep_domain, server_id, sequence);"
"COMMIT;",
NULL, NULL, &errmsg);
if (rc != SQLITE_OK)
{