我有一个包含两列 col1、col2 的表,它们是复合主键。请问,该表支持 MySQL InnoDB 集群中的组复制吗?
错误消息:
org.springframework.jdbc.UncategorizedSQLException: Hibernate flushing: Could not execute JDBC batch update; uncategorized SQLException for SQL [/* insert collection row com.domain.BatchClass.documentTypes */ insert into batch_class_document_type (batch_class_id, document_type_id) values (?, ?)]; SQL state [HY000]; error code [3098]; The table does not comply with the requirements by an external plugin.; nested exception is
显示创建表:
CREATE TABLE `batch_class_document_type` (
`batch_class_id` bigint(20) NOT NULL,
`document_type_id` bigint(20) NOT NULL,
PRIMARY KEY (`batch_class_id`,`document_type_id`),
KEY `FKB72AFCD2997AC796` (`document_type_id`),
KEY `FKB72AFCD2C473EFCA` (`batch_class_id`),
CONSTRAINT `FKB72AFCD2997AC796` FOREIGN KEY (`document_type_id`)
REFERENCES `document_type` (`id`),
CONSTRAINT `FKB72AFCD2C473EFCA` FOREIGN KEY (`batch_class_id`)
REFERENCES `batch_class` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
最佳答案
您在更新时出错,而不是在创建表时出错,对吧?
insert into batch_class_document_type (batch_class_id, document_type_id) values (?, ?)
我的猜测是,您正在以多主模式运行您的组,如下所述:
If a transaction executes against a table that has foreign keys with cascading constraints, then the transaction fails to commit when synchronizing itself with the group.
您已达到此限制。我的建议是尝试在单主模式下运行它。
关于mysql - innodb中复合主键的表是否支持组复制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54684176/