MXS-1266: blr_slave_gtid_request() the file in slave registration request is checked whether it exists or not

MXS-1266:
blr_slave_gtid_request() the file in slave registration request is
checked whether it exists or not and GTID file info could e set instead.

Also addded:

blr_handle_simple_select_stmt(): only mariadb10_gtid_domain is checked
for SELECT @@GLOBAL.gtid_domain_id slave request
blr_start_master_registration(): only router->mariadb10_compat is
checked before sending SELECT @@GLOBAL.gtid_domain_id to master
blr_file_create calls mxs_mkdir_all()
This commit is contained in:
MassimilianoPinto
2017-06-12 17:26:37 +02:00
parent 2cb874e95f
commit 4d78aaa3d8
3 changed files with 81 additions and 59 deletions

View File

@ -516,55 +516,25 @@ blr_file_create(ROUTER_INSTANCE *router, char *file)
router->storage_type == BLR_BINLOG_STORAGE_TREE)
{
char prefix[BINLOG_FILE_EXTRA_INFO];
// Add prefix
sprintf(prefix,
"%" PRIu32 "/",
router->mariadb10_gtid_domain);
// Add domain_id
strcat(path, prefix);
/**
* - 1 - Check and create $domain_id dir
*/
if (access(path, R_OK) == -1)
{
int mkdir_rval;
mkdir_rval = mkdir(path, 0700);
if (mkdir_rval == -1)
{
MXS_ERROR("Service %s, Failed to create binlog"
" directory tree (domain_id) '%s': [%d] %s",
router->service->name,
path,
errno,
mxs_strerror(errno));
return 0;
}
}
// Add server_id
sprintf(prefix,
"%" PRIu32 "/",
"%" PRIu32 "/%" PRIu32 "/",
router->mariadb10_gtid_domain,
router->orig_masterid);
strcat(path, prefix);
/**
* - 2 - Check and create $server_id dir under $domain_id
* Check and create $domain_id/$server_id dir
*/
if (access(path, R_OK) == -1)
if (!mxs_mkdir_all(path, 0700))
{
int mkdir_rval;
mkdir_rval = mkdir(path, 0700);
if (mkdir_rval == -1)
{
MXS_ERROR("Service %s, Failed to create binlog"
" directory tree (domain_id/server_id) '%s': [%d] %s",
router->service->name,
path,
errno,
mxs_strerror(errno));
return 0;
}
MXS_ERROR("Service %s, Failed to create binlog"
" directory tree '%s': [%d] %s",
router->service->name,
path,
errno,
mxs_strerror(errno));
return 0;
}
}