Fix and improve binlogrouter GTID option processing

The transaction safety was checked even if master GTID registration was
disabled. This always caused a failure when the router was started without
the transaction safety parameter.

As transaction safety is required by the GTID registration, it is not very
helpful to refuse to start if an invalid set of options is detected. To
make usage of the master GTID registration easier, the transaction safety
is also automatically enabled.
This commit is contained in:
Markus Mäkelä 2017-11-07 09:24:18 +02:00
parent 4f01ff1955
commit 4bca9aa023
2 changed files with 15 additions and 23 deletions

View File

@ -296,13 +296,13 @@ Example:
```
### `mariadb10_master_gtid`
This option allows MaxScale binlog router to register
with MariaDB 10.X master using GTID instead of _binlog_file_ name
and _position_ in CHANGE MASTER TO admin command.
The user can set a known GTID or an empty value
(in this case the Master server will send events
from it's first available binlog file).
This option allows MaxScale binlog router to register with MariaDB 10.X master
using GTID instead of _binlog_file_ name and _position_ in CHANGE MASTER TO
admin command. This feature is disabled by default.
The user can set a known GTID or an empty value (in this case the Master server
will send events from it's first available binlog file).
Example of MaxScale connection to a MariaDB 10.X Master
@ -316,13 +316,13 @@ MariaDB> CHANGE MASTER TO
MariaDB> START SLAVE;
```
If using GTID request then it's no longer possible to use
MASTER_LOG_FILE and MASTER_LOG_POS in `CHANGE MASTER TO`
command: an error will be reported.
If using GTID request then it's no longer possible to use MASTER_LOG_FILE and
MASTER_LOG_POS in `CHANGE MASTER TO` command: an error will be reported.
The default option value is _Off_, setting it to _On_
automatically sets _mariadb10_slave_gtid_ to _On_
(which enables GTID storage and GTID slave connections)
If this feature is enabled, the _mariadb10_slave_gtid_ and
_transaction_safety_ features will be automatically enabled. The binlog
files will also be stored in a hierarchical directory tree instead of a
single directory.
**Note:**

View File

@ -770,6 +770,8 @@ createInstance(SERVICE *service, char **options)
{
/* Force GTID slave request handling */
inst->mariadb10_gtid = true;
/* Force transaction safety */
inst->trx_safe = true;
/* Force binlog storage as tree */
inst->storage_type = BLR_BINLOG_STORAGE_TREE;
}
@ -782,18 +784,8 @@ createInstance(SERVICE *service, char **options)
"'tree' mode using GTID domain_id and server_id");
/* Enable MariaDB the GTID maps store */
if (inst->mariadb10_compat &&
inst->mariadb10_gtid)
if (inst->mariadb10_compat && inst->mariadb10_master_gtid)
{
if (!inst->trx_safe)
{
MXS_ERROR("MariaDB GTID can be enabled only"
" with Transaction Safety feature."
" Please enable it with option 'transaction_safety = on'");
free_instance(inst);
return NULL;
}
/* Create/Open R/W GTID sqlite3 storage */
if (!blr_open_gtid_maps_storage(inst))
{