最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

SuddenlyMyISAMbecametransaction-aware._MySQL

来源:动视网 责编:小采 时间:2020-11-09 19:16:20
文档

SuddenlyMyISAMbecametransaction-aware._MySQL

SuddenlyMyISAMbecametransaction-aware._MySQL:DROP DATABASE IF EXISTS `gtid_test`;CREATE DATABASE `gtid_test`;USE `gtid_test`;CREATE TABLE `tab1` (`a` INT DEFAULT NULL) ENGINE=MYISAM ;CREATE TABLE `tab2` (`b` INT) ENGINE=INNODB;SET autocommit=0;INSERT INTO `tab1` VALUES (1);INSERT INTO
推荐度:
导读SuddenlyMyISAMbecametransaction-aware._MySQL:DROP DATABASE IF EXISTS `gtid_test`;CREATE DATABASE `gtid_test`;USE `gtid_test`;CREATE TABLE `tab1` (`a` INT DEFAULT NULL) ENGINE=MYISAM ;CREATE TABLE `tab2` (`b` INT) ENGINE=INNODB;SET autocommit=0;INSERT INTO `tab1` VALUES (1);INSERT INTO


DROP DATABASE IF EXISTS `gtid_test`;
CREATE DATABASE `gtid_test`;
USE `gtid_test`;

CREATE TABLE `tab1` (
`a` INT DEFAULT NULL
) ENGINE=MYISAM ;

CREATE TABLE `tab2` (
`b` INT
) ENGINE=INNODB;

SET autocommit=0;

INSERT INTO `tab1` VALUES (1);
INSERT INTO `tab2` VALUES (1);

UPDATE `tab1` SET `a` = 5 WHERE `a` = 1;

– Error Code: 1785
— When @@GLOBAL.ENFORCE_GTID_CONSISTENCY = 1, 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.

This happens with MySQL 5.6 GTIDs (Global Transaction IDs) enabled and it is documented here:https://dev.mysql.com/doc/refman/5.6/en/replication-gtids-restrictions.html: “updates to tables using nontransactional storage engines such as MyISAM cannot be made in the same statement or transaction as updates to tables using transactional storage engines such as InnoDB.”

To reproduce the above test case you need the options –log-bin, –log-slave-updates, –gtid_mode=ON and –enforce_gtid_consistency=ON

If you have some tool doing UPDATES to multiple tables in a single transaction and if you have schemas using a mix of InnoDB and MyISAM tables the tool will fail.

This is just a (one more!) reminder that upgrading to MySQL 5.6 is*a major thing to do*if you intend to use new features added. Be careful to test on a staging environment that all tools and scripts, that you need for your daily survival, still work as expected.

GTIDs in MariaDB 10.0 are not affected and I find the MariaDB GTID implementation superior. MyISAM always was ‘transaction-agnostic’. The storage engine as such still probably is (the new restriction must have been implemented in the server layer and not the storage engine layer). But Oracle managed (a very bad way IMO) to introduce a GTID implementation that kills a major MyISAM feature (its ‘transaction-agnosticity’) and introduced potential risks when using legacy tools and scripts.

文档

SuddenlyMyISAMbecametransaction-aware._MySQL

SuddenlyMyISAMbecametransaction-aware._MySQL:DROP DATABASE IF EXISTS `gtid_test`;CREATE DATABASE `gtid_test`;USE `gtid_test`;CREATE TABLE `tab1` (`a` INT DEFAULT NULL) ENGINE=MYISAM ;CREATE TABLE `tab2` (`b` INT) ENGINE=INNODB;SET autocommit=0;INSERT INTO `tab1` VALUES (1);INSERT INTO
推荐度:
标签: mysql aware myisam
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top