Bug #29974 ndb_restore assert when restoring varchar from 5.0 into 5.1
Submitted: 23 Jul 2007 8:56 Modified: 5 Aug 2007 2:07
Reporter: Guangbao Ni Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:mysql-5.1 OS:Any
Assigned to: CPU Architecture:Any
Tags: 5.1.21, 5.1.21

[23 Jul 2007 8:56] Guangbao Ni
Description:
  ndb_restore restores varchar data from 5.0 backup into 5.1, if ((the length of varchar data + sizeof(length byte)) /4 != 0), it will assert(arraySize <= attr_desc->arraySize);

How to repeat:
  In 5.0
  create table t1(varchar(100))engine=ndb;  //here (100+1)/4 != 0 
  insert into t1 values("ngbao");
  start backup

  in 5.1
  restore it with ndb_restore
[5 Aug 2007 2:07] Adam Dixon
create table t1(c1 varchar(100))engine=ndb;
insert into t1 values("ngbao");

ndb_mgm> start backup

Attaching ndb_restore -r debug trace. Backup taken from slightly aged 5.0.48 to slightly aged 5.1.21

mysql51]# bin/ndb_restore -c localhost -n 2 -b 1 --backup_path=/usr/local/mysqlcluster/ndbd1/BACKUP/BACKUP-1/ --ndb-nodeid=6 --print_meta

Nodeid = 2
Backup Id = 1
backup path = /usr/local/mysqlcluster/ndbd1/BACKUP/BACKUP-1/
Ndb version in backup files: Version 5.0.48
-- test/def/t1 --
Version: 1
Fragment type: 2
K Value: 6
Min load factor: 78
Max load factor: 80
Temporary table: no
Number of attributes: 2
Number of primary keys: 1
Length of frm data: 177
Row Checksum: 1
Row GCI: 1
SingleUserMode: 0
ForceVarPart: 0
TableStatus: Retrieved
-- Attributes -- 
c1 Varchar(100;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY
$PK Bigunsigned PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY

Successfully printed table: 
NDBT_ProgramExit: 0 - OK

mysql51]# bin/ndb_restore -c localhost -n 2 -b 1 --backup_path=/usr/local/mysqlcluster/ndbd1/BACKUP/BACKUP-1/ --ndb-nodeid=6 -m

Nodeid = 2
Backup Id = 1
backup path = /usr/local/mysqlcluster/ndbd1/BACKUP/BACKUP-1/
Ndb version in backup files: Version 5.0.48
Connected to ndb!!
Successfully restored table `test/def/t1`
Successfully restored table event REPL$test/t1

NDBT_ProgramExit: 0 - OK

mysql51]# bin/ndb_restore -c localhost -n 2 -b 1 --backup_path=/usr/local/mysqlcluster/ndbd1/BACKUP/BACKUP-1/ --ndb-nodeid=6 -r --debug

Nodeid = 2
Backup Id = 1
backup path = /usr/local/mysqlcluster/ndbd1/BACKUP/BACKUP-1/
Ndb version in backup files: Version 5.0.48
Connected to ndb!!
m_columns c1 != c1
Restore: Failed to restore data, test/def/t1 table structure doesn't match backup ... Exiting 

NDBT_ProgramExit: 1 - Failed
[5 Aug 2007 2:08] Adam Dixon
ndb_restore --debug output

Attachment: ndb_restore.trace.backup1.gz (application/x-gzip, text), 1.69 KiB.

[8 Aug 2007 5:32] Guangbao Ni
Hi Adam,
The really problem is not what you said. when you restore data from 5.0 into 5.1
with ndb_restore, "-s" option should be used.

if you use "-s" option , you will find the real problem about the bug. :-)