Bug #87353 "ndb_restore --print-data" and "ndb_restore --print-sql-log" have duplicate row

Submitted: 9 Aug 2017 8:30 Modified: 9 Aug 2017 9:33
Reporter: Yoshiaki Yamasaki Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:7.5.7 OS:Any
Assigned to: CPU Architecture:Any
Tags: MySQL Cluster, ndb_restore

[9 Aug 2017 8:30] Yoshiaki Yamasaki
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.
[9 Aug 2017 8:32] Yoshiaki Yamasaki
I submitted another related bug#87352.
[9 Aug 2017 9:33] MySQL Verification Team
Hello Yoshiaki,

Thank you for the report.

Thanks,
Umesh

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.