observer:4.2.1.8-ce
模拟V3,关闭参数,即模拟该 SQL 语句是直接在事务开启节点执行
mysql> show proxyconfig like '%enable_transaction_internal_routing%';
+-------------------------------------+-------+--------------------------------------------------------------------------------------+-------------+---------------+-------+--------------+
| name | value | info | need_reboot | visible_level | range | config_level |
+-------------------------------------+-------+--------------------------------------------------------------------------------------+-------------+---------------+-------+--------------+
| enable_transaction_internal_routing | False | if enabled, proxy will route the dml statement in a transaction to different servers | false | USER | | LEVEL_GLOBAL |
+-------------------------------------+-------+--------------------------------------------------------------------------------------+-------------+---------------+-------+--------------+
1 row in set (0.00 sec)
mysql> show proxyconfig like '%enable_ob_protocol_v2';
+-----------------------+-------+---------------------------------------------------------------------------+-------------+---------------+-------+--------------+
| name | value | info | need_reboot | visible_level | range | config_level |
+-----------------------+-------+---------------------------------------------------------------------------+-------------+---------------+-------+--------------+
| enable_ob_protocol_v2 | False | deprecated, Do not use and not work anymore, use server_protocol instead. | false | USER | | LEVEL_GLOBAL |
+-----------------------+-------+---------------------------------------------------------------------------+-------------+---------------+-------+--------------+
1 row in set (0.00 sec)
创建表和插入数据:
mysql> CREATE TABLE T1(C1 INT,C2 INT) PARTITION BY HASH(C1) PARTITIONS 2;
Query OK, 0 rows affected (0.24 sec)
mysql> CREATE TABLE T2(C1 INT,C2 INT) PARTITION BY HASH(C1) PARTITIONS 2;
Query OK, 0 rows affected (0.12 sec)
mysql> INSERT INTO T1 VALUES(1,1); INSERT INTO T1 VALUES(2,2); INSERT INTO T2 VALUES(11,11); INSERT INTO T2 VALUES(22,22);
Query OK, 1 row affected (0.05 sec)
Query OK, 1 row affected (0.03 sec)
Query OK, 1 row affected (0.01 sec)
Query OK, 1 row affected (0.01 sec)
查看表分区分布:
执行事务(在10.xx.xx.30上):
mysql> BEGIN; update t1 set c2=3 where c1=1; update t1 set c2=4 where c1=2; update t2 set c2=33 where c1=11; update t2 set c2=43 where c1=22; COMMIT;
Query OK, 0 rows affected (0.00 sec)
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Query OK, 0 rows affected (0.00 sec)
查看执行语句所在的事务:
mysql> select query_sql,tx_id from oceanbase.gv$ob_sql_audit where query_sql like 'update t1 set c2=3 where c1=1%' order by request_time desc limit 1;
+-------------------------------+---------+
| query_sql | tx_id |
+-------------------------------+---------+
| update t1 set c2=3 where c1=1 | 1179370 |
+-------------------------------+---------+
1 row in set (0.06 sec)
查看事务执行情况:
而下面的是文档上的结果:
为什么试验结果和文档上不一样呢?