日度归档:2017年12月30日

MySQL ARCHIVE 引擎,从库突然Can’t write; duplicate key in table ‘nopay_record” on query.

这是ARCHIVE引擎的BUG

Error ‘Can’t write; duplicate key in table ‘nopay_record” on query. Default database: ‘doufu’. Query: ‘insert into `nopay_record` (`user_id`, `novel_id`, `chapter_id`, `channel`, `created_at`) values (3927416, 365027, 2499984, NULL, ‘2017-12-29 23:38:01′)’

表结构:

CREATE TABLE `nopay_record` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`novel_id` int(11) NOT NULL,
`chapter_id` int(11) NOT NULL,
`channel` tinyint(4) DEFAULT NULL,
`created_at` timestamp NOT NULL DEFAULT ‘0000-00-00 00:00:00’,
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=ARCHIVE AUTO_INCREMENT=440357 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

改成innodb