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.