[MDEV-21417] Can't restore ARCHIVE tables Created: 2020-01-03  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: Backup, Storage Engine - Archive
Affects Version/s: 5.5, 10.1, 10.2, 10.3, 10.4
Fix Version/s: 10.4

Type: Bug Priority: Minor
Reporter: Silver Asu Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: upstream


 Description   

When creating backup from ARCHIVE table with mysqldump, it is not possible to restore this dump file, because error: Can't write; duplicate key in table 't1'
Mysqldump creates dump with CREATE TABLE ... AUTO_INCREMENT=next_id value and after CREATE TABLE it is not possible to insert data with lower id-s.

MariaDB [test]> CREATE TABLE t1(id INT AUTO_INCREMENT, PRIMARY KEY (`id`)) ENGINE=ARCHIVE;
Query OK, 0 rows affected (0.001 sec)
 
MariaDB [test]> INSERT INTO t1 VALUES (1);                                                
Query OK, 1 row affected (0.003 sec)
 
MariaDB [test]> Bye
[root@uvn-234-24 ~]# mysqldump test t1|mysql test
ERROR 1022 (23000) at line 37: Can't write; duplicate key in table 't1'



 Comments   
Comment by Elena Stepanova [ 2020-01-12 ]

This is the ancient upstream bug #37182.

Comment by Silver Asu [ 2020-01-13 ]

I see pretty easy fix for this. Just remove AUTO_INCREMENT=ID from CREATE TABLE when ENGINE=ARCHIVE.
As you can't delete records from archive table this should not break anything?

Generated at Thu Feb 08 09:06:59 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.