[MDEV-23944] GTID column in P_S events_transactions_% summary tables is always '0-0-0' Created: 2020-10-12  Updated: 2020-10-12

Status: Open
Project: MariaDB Server
Component/s: Performance Schema
Affects Version/s: 10.5.7
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Valerii Kravchuk Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Start MariaDB with Performance _schema and binary logging enabled, then enable all instruments and consumers:

update setup_consumers set enabled='yes';
update setup_instruments set enabled='yes', timed='yes';

Do some transactions in one session:

MariaDB [test]> start transaction;
Query OK, 0 rows affected (0,000 sec)
 
MariaDB [test]> show variables like 'gtid%';
+-------------------------+-------+
| Variable_name           | Value |
+-------------------------+-------+
| gtid_binlog_pos         | 0-1-1 |
| gtid_binlog_state       | 0-1-1 |
| gtid_cleanup_batch_size | 64    |
| gtid_current_pos        | 0-1-1 |
| gtid_domain_id          | 0     |
| gtid_ignore_duplicates  | OFF   |
| gtid_pos_auto_engines   |       |
| gtid_seq_no             | 0     |
| gtid_slave_pos          |       |
| gtid_strict_mode        | OFF   |
+-------------------------+-------+
10 rows in set (0,003 sec)
 
MariaDB [test]> select * from t limit 1;
+----+------+
| id | c1   |
+----+------+
|  1 |    1 |
+----+------+
1 row in set (0,002 sec)
 
MariaDB [test]> update t set c1 = 2 where id = 1;
Query OK, 1 row affected (0,001 sec)
Rows matched: 1  Changed: 1  Warnings: 0
 
MariaDB [test]> update t set c1 = 3 where id = 2;
Query OK, 1 row affected (0,001 sec)
Rows matched: 1  Changed: 1  Warnings: 0
 
MariaDB [test]> commit;
Query OK, 0 rows affected (0,044 sec)
 
MariaDB [test]> show variables like 'gtid%';
+-------------------------+-------+
| Variable_name           | Value |
+-------------------------+-------+
| gtid_binlog_pos         | 0-1-2 |
| gtid_binlog_state       | 0-1-2 |
| gtid_cleanup_batch_size | 64    |
| gtid_current_pos        | 0-1-2 |
| gtid_domain_id          | 0     |
| gtid_ignore_duplicates  | OFF   |
| gtid_pos_auto_engines   |       |
| gtid_seq_no             | 0     |
| gtid_slave_pos          |       |
| gtid_strict_mode        | OFF   |
+-------------------------+-------+
10 rows in set (0,003 sec)
 
MariaDB [test]> start transaction;
Query OK, 0 rows affected (0,000 sec)

Note that gtid_binlog_pos and gtid_current_pos is updates as new GTID values are assigned to transactions. Now check any of the P_S events_transactions_% tables:

MariaDB [performance_schema]> select * from events_transactions_history\G
*************************** 1. row ***************************
                      THREAD_ID: 15
                       EVENT_ID: 6
                   END_EVENT_ID: 538
                     EVENT_NAME: transaction
                          STATE: ROLLED BACK
                         TRX_ID: NULL
                           GTID: 0-0-0
                  XID_FORMAT_ID: NULL
                      XID_GTRID: NULL
                      XID_BQUAL: NULL
                       XA_STATE: NULL
                         SOURCE:
                    TIMER_START: 32473825181000
                      TIMER_END: 82769681346000
                     TIMER_WAIT: 50295856165000
                    ACCESS_MODE: READ WRITE
                ISOLATION_LEVEL: REPEATABLE READ
                     AUTOCOMMIT: NO
           NUMBER_OF_SAVEPOINTS: 0
NUMBER_OF_ROLLBACK_TO_SAVEPOINT: 0
    NUMBER_OF_RELEASE_SAVEPOINT: 0
          OBJECT_INSTANCE_BEGIN: NULL
               NESTING_EVENT_ID: 1
             NESTING_EVENT_TYPE: STATEMENT
*************************** 2. row ***************************
                      THREAD_ID: 15
                       EVENT_ID: 554
                   END_EVENT_ID: 860
                     EVENT_NAME: transaction
                          STATE: COMMITTED
                         TRX_ID: NULL
                           GTID: 0-0-0
                  XID_FORMAT_ID: NULL
                      XID_GTRID: NULL
                      XID_BQUAL: NULL
                       XA_STATE: NULL
                         SOURCE:
                    TIMER_START: 92466149449000
                      TIMER_END: 728169532788000
                     TIMER_WAIT: 635703383339000
                    ACCESS_MODE: READ WRITE
                ISOLATION_LEVEL: REPEATABLE READ
                     AUTOCOMMIT: NO
           NUMBER_OF_SAVEPOINTS: 0
NUMBER_OF_ROLLBACK_TO_SAVEPOINT: 0
    NUMBER_OF_RELEASE_SAVEPOINT: 0
          OBJECT_INSTANCE_BEGIN: NULL
               NESTING_EVENT_ID: 549
             NESTING_EVENT_TYPE: STATEMENT
2 rows in set (0,001 sec)

Note that GTID has value 0-0-0 in alk rows, both for current transactions and history. This is wrong, I'd expect to see the same values as in the binary log and related GTID variables:

MariaDB [performance_schema]> show binlog events;
+------------------+-----+-------------------+-----------+-------------+-----------------------------------------------+
| Log_name         | Pos | Event_type        | Server_id | End_log_pos | Info                                          |
+------------------+-----+-------------------+-----------+-------------+-----------------------------------------------+
| ao756-bin.000001 |   4 | Format_desc       |         1 |         256 | Server ver: 10.5.7-MariaDB-log, Binlog ver: 4 |
| ao756-bin.000001 | 256 | Gtid_list         |         1 |         285 | []                                            |
| ao756-bin.000001 | 285 | Binlog_checkpoint |         1 |         328 | ao756-bin.000001                              |
,,,
| ao756-bin.000001 | 463 | Gtid              |         1 |         505 | BEGIN GTID 0-1-2                              |
| ao756-bin.000001 | 505 | Query             |         1 |         604 | use `test`; update t set c1 = 2 where id = 1  |
| ao756-bin.000001 | 604 | Query             |         1 |         703 | use `test`; update t set c1 = 3 where id = 2  |
| ao756-bin.000001 | 703 | Xid               |         1 |         734 | COMMIT /* xid=102 */                          |
+------------------+-----+-------------------+-----------+-------------+-----------------------------------------------+
9 rows in set (0,026 sec)


Generated at Thu Feb 08 09:26:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.