Bug #87353 "ndb_restore --print-data" and "ndb_restore --print-sql-log" have duplicate row
Description:
Output of "ndb_restore --print-data" and "ndb_restore --print-sql-log" have duplicate row.
I found duplicate row as follows.
- Output of "ndb_restore --print-data" has row which ID is 4530-4533.
- Output of "ndb_restore --print-sql-log" has row which ID is 4530-4533.
Ex)
$ ndb_restore -c localhost:1186 -n 2 -b 4 --print-data --tab=./csvdata --append ./data1/BACKUP/BACKUP-4
$ ndb_restore -c localhost:1186 -n 3 -b 4 --print-data --tab=./csvdata --append ./data2/BACKUP/BACKUP-4
$ tail -5 ./csvdata/city.txt
4520 TEST JPN TEST 0
4526 TEST JPN TEST 0
4528 TEST JPN TEST 0
4529 TEST JPN TEST 0
4530 TEST JPN TEST 0
$ ndb_restore -c localhost:1186 -n 3 -b 4 --print-sql-log ./data2/BACKUP/BACKUP-4
<< snip >>
2017-08-09 17:07:08 [restore_log] Restore log entries
INSERT INTO world.city VALUES(4530,'TEST','JPN','TEST',0);
INSERT INTO world.city VALUES(4536,'TEST','JPN','TEST',0);
INSERT INTO world.city VALUES(4538,'TEST','JPN','TEST',0);
INSERT INTO world.city VALUES(4540,'TEST','JPN','TEST',0);
Printed 0 tuples and 4 log entries to stdout.
NDBT_ProgramExit: 0 - OK
How to repeat:
1.Execute following sql with infinite loop.
insert into world.city(Name,CountryCode,District,Population) values('TEST','JPN','TEST',0);
2.Get online backup via "ndb_mgm -e "START BACKUP"
3.Execute ndb_restore with --print-data option.
Ex)
$ ndb_restore -c localhost:1186 -n 2 -b 4 --print-data --tab=./csvdata --append ./data1/BACKUP/BACKUP-4
$ ndb_restore -c localhost:1186 -n 3 -b 4 --print-data --tab=./csvdata --append ./data2/BACKUP/BACKUP-4
4.Execute ndb_restore with --print-sql-log option.
Ex)
$ ndb_restore -c localhost:1186 -n 2 -b 4 --print-sql-log ./data1/BACKUP/BACKUP-4
Suggested fix:
Using REPLACE instead of INSERT. It is convenient for restore log data to InnoDB.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.055 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: Output of "ndb_restore --print-data" and "ndb_restore --print-sql-log" have duplicate row. I found duplicate row as follows. - Output of "ndb_restore --print-data" has row which ID is 4530-4533. - Output of "ndb_restore --print-sql-log" has row which ID is 4530-4533. Ex) $ ndb_restore -c localhost:1186 -n 2 -b 4 --print-data --tab=./csvdata --append ./data1/BACKUP/BACKUP-4 $ ndb_restore -c localhost:1186 -n 3 -b 4 --print-data --tab=./csvdata --append ./data2/BACKUP/BACKUP-4 $ tail -5 ./csvdata/city.txt 4520 TEST JPN TEST 0 4526 TEST JPN TEST 0 4528 TEST JPN TEST 0 4529 TEST JPN TEST 0 4530 TEST JPN TEST 0 $ ndb_restore -c localhost:1186 -n 3 -b 4 --print-sql-log ./data2/BACKUP/BACKUP-4 << snip >> 2017-08-09 17:07:08 [restore_log] Restore log entries INSERT INTO world.city VALUES(4530,'TEST','JPN','TEST',0); INSERT INTO world.city VALUES(4536,'TEST','JPN','TEST',0); INSERT INTO world.city VALUES(4538,'TEST','JPN','TEST',0); INSERT INTO world.city VALUES(4540,'TEST','JPN','TEST',0); Printed 0 tuples and 4 log entries to stdout. NDBT_ProgramExit: 0 - OK How to repeat: 1.Execute following sql with infinite loop. insert into world.city(Name,CountryCode,District,Population) values('TEST','JPN','TEST',0); 2.Get online backup via "ndb_mgm -e "START BACKUP" 3.Execute ndb_restore with --print-data option. Ex) $ ndb_restore -c localhost:1186 -n 2 -b 4 --print-data --tab=./csvdata --append ./data1/BACKUP/BACKUP-4 $ ndb_restore -c localhost:1186 -n 3 -b 4 --print-data --tab=./csvdata --append ./data2/BACKUP/BACKUP-4 4.Execute ndb_restore with --print-sql-log option. Ex) $ ndb_restore -c localhost:1186 -n 2 -b 4 --print-sql-log ./data1/BACKUP/BACKUP-4 Suggested fix: Using REPLACE instead of INSERT. It is convenient for restore log data to InnoDB.