说GTID - GTID-based复制中的限制

发布时间:2020-05-22 11:40:53 作者:coveringindex
来源:网络 阅读:539


[root@mysql.sock][db1]> show create table t2 \G

*************************** 1. row ***************************

       Table: t2

Create Table: CREATE TABLE `t2` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  PRIMARY KEY (`id`)

) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4

1 row in set (0.00 sec)


[root@mysql.sock][db1]> start transaction;

Query OK, 0 rows affected (0.00 sec)


[root@mysql.sock][db1]> insert into t1 select null;

Query OK, 1 row affected (0.00 sec)

Records: 1  Duplicates: 0  Warnings: 0


[root@mysql.sock][db1]> insert into t2 select null;

ERROR 1785 (HY000): Statement violates GTID consistency: Updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables.

[root@mysql.sock][db1]> commit;

Query OK, 0 rows affected (0.01 sec)




[root@mysql.sock][db1]> create table t2 select * from t2;

ERROR 1786 (HY000): Statement violates GTID consistency: CREATE TABLE ... SELECT.





[root@mysql.sock][db1]> start transaction;

Query OK, 0 rows affected (0.00 sec)


[root@mysql.sock][db1]> create temporary table t4 (id int auto_increment primary key);

ERROR 1787 (HY000): Statement violates GTID consistency: CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE can only be executed outside transactional context.  These statements are also not allowed in a function or trigger because functions and triggers are also considered to be multi-statement transactions.

[root@mysql.sock][db1]> rollback;

Query OK, 0 rows affected (0.00 sec)


[root@mysql.sock][db1]> create temporary table t4 (id int auto_increment primary key);

Query OK, 0 rows affected (0.01 sec)


[root@mysql.sock][db1]> desc t4;

+-------+---------+------+-----+---------+----------------+

| Field | Type    | Null | Key | Default | Extra          |

+-------+---------+------+-----+---------+----------------+

| id    | int(11) | NO   | PRI | NULL    | auto_increment |

+-------+---------+------+-----+---------+----------------+

1 row in set (0.00 sec)


[root@mysql.sock][db1]> drop temporary table t4;

Query OK, 0 rows affected (0.00 sec)


[root@mysql.sock][db1]> desc t4;

ERROR 1146 (42S02): Table 'db1.t4' doesn't exist






SET GTID_NEXT='aaa-bbb-ccc-ddd:N';


BEGIN;

COMMIT;


SET GTID_NEXT='AUTOMATIC';



CHANGE MASTER TO语句中的IGNORE_SERVER_IDS不在起作用,已经回放过的事务会自动跳过。






推荐阅读:
  1. python 内置函数input/eval(22)
  2. 一招搞定各种报表合计需求

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

gtid's restrictions %d gti

上一篇:MySQL--字符编码和字符集

下一篇:如何批量修改MySQL存储引擎类型

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》