Bug #30133 restore of backup from different endian does not work for timestamp column
Submitted: 31 Jul 2007 3:17 Modified: 31 Jul 2007 3:26
Reporter: li zhou Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:5.1 OS:Solaris ((linux <-> solaris))
Assigned to: li zhou CPU Architecture:Any

[31 Jul 2007 3:17] li zhou
Description:
Do backup on a little-endian machine with 'timestamp' type attribute, and copy backuped data to a big-endian machine(e.g.solaris), then restore it. will find that the restored
'timestamp' type data is not correct.

How to repeat:
1. start a 2 data nodes cluster on a SUN SPARC Solaris machine.
2. create a table with datetime type attribute, and insert values into it.
   mysql> use test;
   mysql> create table t1 (a int primary key, b timestamp) engine=ndbcluster;
   mysql> insert into t1 values (1, 20021029165106);
   mysql> select * from t1;
   +---+---------------------+
   | a | b                   |
   +---+---------------------+
   | 1 | 2002-10-29 16:51:06 |
   +---+---------------------+
   1 row in set (0.00 sec)
3. start backup on solaris
   ./bin/ndb_mgm -e "start backup"
4. copy the backuped data to a X86 Linux machine.
   scp -r data/node2/BACKUP/BACKUP-1/ x86-machine:/tmp/BACKUPS/
   scp -r data/node3/BACKUP/BACKUP-1/* x86-machine:/tmp/BACKUPS/BACKUP-1/
5. start a same configure cluster as SUN machine on X86 machine.
6. restore database.
   ./bin/ndb_restore -n 1 -b 1 -m -r /tmp/BACKUPS/BACKUP-1
   ./bin/ndb_restore -n 2 -b 1 -r /tmp/BACKUPS/BACKUP-1
7. select on linux.
   mysql> select * from t1;
   +---+---------------------+
   | a | b                   |
   +---+---------------------+
   | 1 | 2009-08-24 19:22:21 |
   +---+---------------------+
   1 row in set (0.07 sec)

Suggested fix:
Ndb backup/restore for timestamp should be endian compatible in 5.1.