MXS-2047 Add column binlog_rdir to BLR gtid_maps table
This column will be used to store the relative path of the file where a particular event can be found. Unless the path is stored, BLR will not be able to find an event based on the gtid if BRL is connected to a node in a Galera cluster and updates are made to nodes other than that node as in that case, the GTID domain id and server id, will not identify the correct directory. The full path is not stored in the column binlog_file as the path would in that case (without other modifications) be visible to the client.
This commit is contained in:
parent
c105a71317
commit
16e2740762
@ -3253,6 +3253,7 @@ static bool blr_open_gtid_maps_storage(ROUTER_INSTANCE* inst)
|
||||
"rep_domain INT, "
|
||||
"server_id INT, "
|
||||
"sequence BIGINT, "
|
||||
"binlog_rdir VARCHAR(255), "
|
||||
"binlog_file VARCHAR(255), "
|
||||
"start_pos BIGINT, "
|
||||
"end_pos BIGINT);"
|
||||
@ -3273,6 +3274,36 @@ static bool blr_open_gtid_maps_storage(ROUTER_INSTANCE* inst)
|
||||
return false;
|
||||
}
|
||||
|
||||
// If we are opening an existing database, created by a previous version
|
||||
// of BLR, the column 'binlog_rdir' is not present, so we add it.
|
||||
rc = sqlite3_exec(inst->gtid_maps,
|
||||
"ALTER TABLE gtid_maps ADD COLUMN binlog_rdir VARCHAR(255);",
|
||||
NULL,
|
||||
NULL,
|
||||
&errmsg);
|
||||
|
||||
if (rc != SQLITE_OK)
|
||||
{
|
||||
std::string s(errmsg);
|
||||
sqlite3_free(errmsg);
|
||||
|
||||
if ((rc == SQLITE_ERROR) && (s.find("binlog_rdir") != std::string::npos))
|
||||
{
|
||||
// If it's the generic error and "binlog_rdir" is in the error message, we
|
||||
// assume it is the complaint "duplicate column name: binlog_rdir" and
|
||||
// things are fine (the column is already there).
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise we bail out.
|
||||
MXS_ERROR("Service %s, failed to alter GTID index table 'gtid_map': %s",
|
||||
inst->service->name,
|
||||
s.c_str());
|
||||
sqlite3_close_v2(inst->gtid_maps);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
MXS_NOTICE("%s: Service has MariaDB GTID otion set to ON",
|
||||
inst->service->name);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user