Bug #115922 Provide more precise examples to explain usage of gtid tags
Submitted: 23 Aug 18:14 Modified: 25 Aug 16:35
Reporter: Chelluru Vidyadhar Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:8.4.0 OS:Any
Assigned to: CPU Architecture:Any

[23 Aug 18:14] Chelluru Vidyadhar
Description:
Current MySQL documentation mention that when multiple tags are used, they will be treated like each from different server.

 GTIDs originating from the same server but having different tags are treated in a manner similar to those originating from different servers, like this:

3E11FA47-71CA-11E1-9E33-C80AA9429562:Domain_1:1-3:15-21, 3E11FA47-71CA-11E1-9E33-C80AA9429562:Domain_2:8-52

However, its possible that the "show binary log status" output can give a result similar to below:

+---------------+----------+--------------+------------------+------------------------------------------------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set                                          |
+---------------+----------+--------------+------------------+------------------------------------------------------------+
| binlog.000004 |     4023 |              |                  | 00008400-0000-0000-0000-000000008400:1-7:olap:1-3:oltp:1-3 |
+---------------+----------+--------------+------------------+------------------------------------------------------------+
1 row in set (0.00 sec)

Cosnider to explain the same with an example in mysql documentation.

How to repeat:
[root@testbox ~]# mysql80 -u root -p****** -S /tmp/mysql_sandbox8400.sock
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.4.0-debug MySQL Community Server - GPL - Debug

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
mysql> 
mysql> show global variables like '%gtid%';
+----------------------------------+-------+
| Variable_name                    | Value |
+----------------------------------+-------+
| binlog_gtid_simple_recovery      | ON    |
| enforce_gtid_consistency         | OFF   |
| gtid_executed                    |       |
| gtid_executed_compression_period | 0     |
| gtid_mode                        | OFF   |
| gtid_owned                       |       |
| gtid_purged                      |       |
| session_track_gtids              | OFF   |
+----------------------------------+-------+
8 rows in set (0.01 sec)

mysql> set global ENFORCE_GTID_CONSISTENCY=ON;
Query OK, 0 rows affected (0.01 sec)

mysql> set global gtid_mode=OFF_PERMISSIVE;
Query OK, 0 rows affected (0.01 sec)

mysql> set global gtid_mode=ON_PERMISSIVE;
Query OK, 0 rows affected (0.01 sec)

mysql> set global gtid_mode=ON;
Query OK, 0 rows affected (0.01 sec)

mysql> show binary log status;
+---------------+----------+--------------+------------------+-------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+---------------+----------+--------------+------------------+-------------------+
| binlog.000004 |      158 |              |                  |                   |
+---------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)

mysql> 
mysql> create database test123;
Query OK, 1 row affected (0.01 sec)

mysql> show binary log status;
+---------------+----------+--------------+------------------+----------------------------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set                      |
+---------------+----------+--------------+------------------+----------------------------------------+
| binlog.000004 |      352 |              |                  | 00008400-0000-0000-0000-000000008400:1 |
+---------------+----------+--------------+------------------+----------------------------------------+
1 row in set (0.00 sec)

mysql> SET gtid_next = 'AUTOMATIC:tag-olap';
ERROR 1774 (HY000): Malformed GTID specification 'AUTOMATIC:tag-olap'.
mysql> 
mysql> SET gtid_next = 'AUTOMATIC:tagolap';
Query OK, 0 rows affected (0.00 sec)

mysql> 
mysql> SET gtid_next = 'AUTOMATIC:olap';
Query OK, 0 rows affected (0.00 sec)

mysql> select @@gtid_next;
+----------------+
| @@gtid_next    |
+----------------+
| AUTOMATIC:olap |
+----------------+
1 row in set (0.00 sec)

mysql> 
mysql> create database olap;
Query OK, 1 row affected (0.00 sec)

mysql> use olap
Database changed
mysql> create table t1(id int);
Query OK, 0 rows affected (0.08 sec)

mysql> insert into t1 values(1),(2);
Query OK, 2 rows affected (0.02 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> show binary log status;
+---------------+----------+--------------+------------------+-------------------------------------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set                               |
+---------------+----------+--------------+------------------+-------------------------------------------------+
| binlog.000004 |      995 |              |                  | 00008400-0000-0000-0000-000000008400:1:olap:1-3 |
+---------------+----------+--------------+------------------+-------------------------------------------------+
1 row in set (0.00 sec)

mysql> SET gtid_next = 'AUTOMATIC:oltp';
Query OK, 0 rows affected (0.00 sec)

mysql> create database oltp;
Query OK, 1 row affected (0.01 sec)

mysql> use oltp
Database changed
mysql> create table t1(id int);
Query OK, 0 rows affected (0.05 sec)

mysql> insert into t1 values(1),(2);
Query OK, 2 rows affected (0.01 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> show binary log status;
+---------------+----------+--------------+------------------+----------------------------------------------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set                                        |
+---------------+----------+--------------+------------------+----------------------------------------------------------+
| binlog.000004 |     1638 |              |                  | 00008400-0000-0000-0000-000000008400:1:olap:1-3:oltp:1-3 |
+---------------+----------+--------------+------------------+----------------------------------------------------------+
1 row in set (0.00 sec)

mysql> \q
Bye
[root@testbox ~]#

Suggested fix:
Provide more example outputs to explain the usage of tags.
[25 Aug 16:35] MySQL Verification Team
Hello Chelluru,

Thank you for the report and feedback.

regards,
Umesh