Details
-
Bug
-
Status: In Progress (View Workflow)
-
Critical
-
Resolution: Unresolved
-
10.6.19, 11.4.5
Description
Tested on: 10.6.19-15 Enterprise (consistent), 10.6.19 Community (consistent), 11.4.5 Community (consistent)
- You will need 3 instances to make this occur: Master (db1) / Slave (db2) / Slave (db3)
- The backup is taken on the SLAVE that is running, but after restore on the other slave, replication is connected to master.
- If inserts on the master are slowed down to one per second, this failure does not occur and checksum table shows that tables are perfect copies.
- If the table is ENGINE=INNODB the failure will not occur.
On master, create a table:
Drop schema if exists Rpa; Create schema Rpa; Use Rpa;
|
DROP TABLE IF EXISTS `aria_table`;
|
CREATE TABLE `aria_table` (
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
`message` longtext NOT NULL, `createdOn` datetime NOT NULL DEFAULT current_timestamp(),
|
`processId` int(11) DEFAULT NULL, PRIMARY KEY (`id`), KEY `idx_svax` (`processId`)
|
) ENGINE=ARIA AUTO_INCREMENT=7295 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci PAGE_CHECKSUM=1;
|
On master, run a bash script that quickly inserts into the aria_table:
#!/bin/bash
|
touch t.txt
|
mariadb -Ae "truncate table Rpa.aria_table;"
|
ii=0
|
while [ -f t.txt ]; do
|
ii=$(( $ii + 1 ))
|
mariadb -Ae "use Rpa; INSERT INTO aria_table ( message, createdOn, processId) VALUES ( 'Lorem ipsum dolor sit amet, et pharetra nulla tincidunt.', now(), round(rand()*10000000));"
|
echo $ii
|
done
|
echo "finished"
|
Verify that db2 is a slave of db1 and that the slave is running.
On db3, stop server, destroy the data:
systemctl stop mariadb
|
datadir=/var/lib/mysql
|
logdir=/var/log/mysql
|
rm -fr $datadir/* $logdir/*
|
On db2, use mariabackup to stream a backup into the datadir of db3:
datadir=/var/lib/mysql
|
replica=192.168.8.113
|
mariabackup --user=root --backup --stream=xbstream | ssh -o StrictHostKeyChecking=NO root@"$replica" -t "cd $datadir; mbstream -x"
|
On db3, set the replication to db1
mhost=db1.edw.ee
|
datadir=/var/lib/mysql
|
logdir=/var/log/mysql
|
mport=3306
|
mpw=password
|
muser=repl
|
|
# Test the connectivity from this replica node to the primary:
|
mariadb -h$mhost -u$muser -p$mpw -ABNe "select now(); select @@hostname;"
|
|
cd $datadir
|
|
gtid=$(cat $datadir/*_binlog_info | tail -1 | awk '{print $3}')
|
echo $gtid $mhost $mport $muser $mpw
|
|
mariabackup --prepare --target-dir=$datadir
|
|
chown -R mysql:mysql $datadir
|
chown -R mysql:mysql $logdir
|
|
systemctl start mariadb;
|
|
mariadb -ABNe "stop slave; reset slave; set global gtid_slave_pos='$gtid'; change master to master_host='$mhost', master_port=$mport, master_user='$muser', master_password='$mpw', master_use_gtid=slave_pos; start slave;"
|
|
mariadb -Ae "show replica status\G"
|
ERROR OCCURS!
Last_SQL_Error: Error 'Duplicate entry '9699' for key 'PRIMARY'' on query. Default database: 'Rpa'. Query: 'INSERT INTO aria_table ( message, createdOn, processId) VALUES ( 'Lorem ipsum dolor sit amet, et pharetra nulla tincidunt.', now(), round(rand()*10000000))'
|
julien.fritschYes on CS 11.5.4 with mariabackup --stream=xbstream the above problem is consistently hit!
./bin/mariabackup --user=root --port=11531 --socket=/test/MDEV-36143-MD270225-mariadb-11.4.5-linux-x86_64-opt/socket_slave.sock --backup --stream=xbstream | ssh -o StrictHostKeyChecking=NO root@"$replica" -t "cd $datadir; mbstream -x"
...
[00] 2025-02-27 20:57:48 Finished backing up non-InnoDB tables and files
[00] 2025-02-27 20:57:48 Waiting for log copy thread to read lsn 107434590
[00] 2025-02-27 20:57:49 Start copying aria log file tail: /test/MDEV-36143-MD270225-mariadb-11.4.5-linux-x86_64-opt/data_slave//aria_log.00000001
[00] 2025-02-27 20:57:49 Stop copying aria log file tail: /test/MDEV-36143-MD270225-mariadb-11.4.5-linux-x86_64-opt/data_slave//aria_log.00000001, copied 8192 bytes
[00] 2025-02-27 20:57:49 BACKUP STAGE BLOCK_COMMIT
[00] 2025-02-27 20:57:49 Copied file ./mysql/slow_log.CSM for log table `mysql`.`slow_log`, 35 bytes
[00] 2025-02-27 20:57:49 Copied file ./mysql/slow_log.CSV for log table `mysql`.`slow_log`, 0 bytes
[00] 2025-02-27 20:57:49 Copied file ./mysql/general_log.CSV for log table `mysql`.`general_log`, 0 bytes
[00] 2025-02-27 20:57:49 Copied file ./mysql/general_log.CSM for log table `mysql`.`general_log`, 35 bytes
[00] 2025-02-27 20:57:49 mariabackup: The latest check point (for incremental): '70765024'
[00] 2025-02-27 20:57:49 Waiting for log copy thread to read lsn 18446744073709551615
[00] 2025-02-27 20:57:50 Start copying statistics aria tables.
[00] 2025-02-27 20:57:50 aria table file ./mysql/column_stats.MAI is copied successfully.
[00] 2025-02-27 20:57:50 aria table file ./mysql/column_stats.MAD is copied successfully.
[00] 2025-02-27 20:57:50 aria table file ./mysql/index_stats.MAI is copied successfully.
[00] 2025-02-27 20:57:50 aria table file ./mysql/index_stats.MAD is copied successfully.
[00] 2025-02-27 20:57:50 aria table file ./mysql/table_stats.MAI is copied successfully.
[00] 2025-02-27 20:57:50 aria table file ./mysql/table_stats.MAD is copied successfully.
[00] 2025-02-27 20:57:50 Stop copying statistics aria tables.
[00] 2025-02-27 20:57:50 Start copying aria log file tail: /test/MDEV-36143-MD270225-mariadb-11.4.5-linux-x86_64-opt/data_slave//aria_log.00000001
[00] 2025-02-27 20:57:50 Stop copying aria log file tail: /test/MDEV-36143-MD270225-mariadb-11.4.5-linux-x86_64-opt/data_slave//aria_log.00000001, copied 8192 bytes
[00] 2025-02-27 20:57:50 Streaming mariadb_backup_binlog_info
[00] 2025-02-27 20:57:50 ...done
[00] 2025-02-27 20:57:50 Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...
[00] 2025-02-27 20:57:50 BACKUP STAGE END
[00] 2025-02-27 20:57:50 Executing BACKUP STAGE END
[00] 2025-02-27 20:57:50 All tables unlocked
[00] 2025-02-27 20:57:50 Backup created in directory '/test/MDEV-36143-MD270225-mariadb-11.4.5-linux-x86_64-opt/mariadb_backup_files/'
[00] 2025-02-27 20:57:50 MySQL binlog position: filename '1.000002', position '109356715', GTID of the last change '0-1-237737'
[00] 2025-02-27 20:57:50 Streaming backup-my.cnf
[00] 2025-02-27 20:57:50 ...done
[00] 2025-02-27 20:57:50 Streaming mariadb_backup_info
[00] 2025-02-27 20:57:50 ...done
[00] 2025-02-27 20:57:50 Redo log (from LSN 70765024 to 107442118) was copied.
[00] 2025-02-27 20:57:50 completed OK!
MariaDB [(none)]> show replica status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 127.0.0.1
Master_User: repl_user
Master_Port: 12523
Connect_Retry: 60
Master_Log_File: 1.000002
Read_Master_Log_Pos: 122896212
Relay_Log_File: qa-susil-1-relay-bin.000002
Relay_Log_Pos: 606
Relay_Master_Log_File: 1.000002
Slave_IO_Running: Yes
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1062
Last_Error: Could not execute Write_rows_v1 event on table Rpa.aria_table; Duplicate entry '1724' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log 1.000002, end_log_pos 0
Skip_Counter: 0
Exec_Master_Log_Pos: 109356572
Relay_Log_Space: 8301308
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: Yes
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: Yes
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 1062
Last_SQL_Error: Could not execute Write_rows_v1 event on table Rpa.aria_table; Duplicate entry '1724' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log 1.000002, end_log_pos 0
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: Slave_Pos
Gtid_IO_Pos: 0-1-267171
Replicate_Do_Domain_Ids:
Replicate_Ignore_Domain_Ids:
Parallel_Mode: optimistic
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Slave_DDL_Groups: 0
Slave_Non_Transactional_Groups: 1
Slave_Transactional_Groups: 0
Replicate_Rewrite_DB:
1 row in set (0.000 sec)
MariaDB [(none)]>SELECT VERSION();
+----------------+
| VERSION() |
+----------------+
| 11.4.5-MariaDB |
+----------------+
1 row in set (0.000 sec)
MariaDB [(none)]>
So, I confirm this customer issue is a valid bug.