Bug #41514 ndb_print_schema_file segfaults and documentation is lacking
Submitted: 16 Dec 2008 15:28 Modified: 16 Jan 2009 10:02
Reporter: Alexander Yu Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:mysql-5.1-telco-6.3 OS:Linux (2.6.24-19-generic #1 SMP Wed Aug 20 22:56:21 UTC 2008 i686 GNU/Linux)
Assigned to: CPU Architecture:Any
Tags: 6.3.17, Backup, ndb, utilities

[16 Dec 2008 15:28] Alexander Yu
Description:
ndb_print_schema_file segfaults when examining backup files. (mysql-5.1.27 ndb-6.3.17)

Also there should be some kind of documentation on how to interpret the output below. Or if the info is only useful for ndb-dev then it should mention it in the ref docs.

----- Schemafile: BACKUP-6/BACKUP-6.2.ctl -----
Magic: NDBBCKUP ByteOrder: 0b030600 NdbVersion: 256.0.0 FileSize: 150994944
BACKUP-6/BACKUP-6.2.ctl: impossible version 0x01000000
BACKUP-6/BACKUP-6.2.ctl: invalid FileSize 150994944
----- Page: 0 (36864) -----
BACKUP-6/BACKUP-6.2.ctl: page 0 invalid CheckSum
BACKUP-6/BACKUP-6.2.ctl: page 0 invalid NoOfTableEntries 100663808
Table 0: State = 3887224321 version = 3430008(18) type = 285410816 noOfWords = 453051648 gcp: 67108864
BACKUP-6/BACKUP-6.2.ctl: entry 0 garbage in m_unused[3]
...

How to repeat:
$ ndb_mgm -e 'start backup'
Connected to Management Server at: localhost:1186
Waiting for completed, this may take several minutes
Node 2: Backup 6 started from node 1
Node 2: Backup 6 started from node 1 completed
 StartGCP: 9321 StopGCP: 9324
 #Records: 5376 #LogRecords: 0
 Data: 744036 bytes Log: 0 bytes

$ ndb_print_schema_file BACKUP-6/BACKUP-6.2.log

----- Schemafile: BACKUP-6/BACKUP-6.2.log -----
Magic: NDBBCKUP ByteOrder: 0b030600 NdbVersion: 256.0.0 FileSize: 150994944
BACKUP-6/BACKUP-6.2.log: impossible version 0x01000000
BACKUP-6/BACKUP-6.2.log: invalid FileSize 150994944
----- Page: 0 (36864) -----
BACKUP-6/BACKUP-6.2.log: page 0 invalid CheckSum
BACKUP-6/BACKUP-6.2.log: page 0 invalid NoOfTableEntries 100663808
...
BACKUP-6/BACKUP-6.2.log: page 31 invalid NoOfTableEntries 0
----- Page: 32 (36864) -----
BACKUP-6/BACKUP-6.2.log: page 32 invalid magic
BACKUP-6/BACKUP-6.2.log: page 32 FileSize changed to 0!=150994944
Segmentation fault
[16 Jan 2009 10:02] Hartmut Holzgraefe
ndb_print_schema_file does indeed segfault when given something that is not a *.SchemaLog file as input, and the documentation is indeed not clear about what kind of file is exactly expected as input and does not help to interpret the output (on both valid and invalid files) either.

Shouldn't the tool exit with an error code after detecting a wrong magic header != "NDBSCHEMA"?