Description:
The documentation currently states that TEXT and BLOB column values are always truncated to the first 256 bytes in the output. It seems that the data is actually truncated to 240 bytes (blob field - ndb header size)
How to repeat:
Create a table with a blob field, insert a value greater than 240 bytes.
mysql> create database blob_test;
mysql> use blob_test;
Database changed
mysql> CREATE TABLE `test` ( `id` binary(16) NOT NULL, `data` blob NOT NULL, PRIMARY KEY (`id`)) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
Query OK, 0 rows affected (0.12 sec)
mysql> insert into test values (1, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE);
Create a backup with the defaults:
ndb_mgm> START BACKUP
Connected to Management Server at: localhost:1186
Waiting for completed, this may take several minutes
Node 3: Backup 2 started from node 1
ndb_mgm> Node 3: Backup 2 started from node 1 completed
StartGCP: 8056 StopGCP: 8059
#Records: 2062 #LogRecords: 0
Data: 52740 bytes Log: 0 bytes
Run ndb_restore with --print_data
[cooper@singe BACKUP-2]$ /usr/local/mysql/bin/ndb_restore -b 2 -n 3 --print_data
Backup Id = 2
Nodeid = 3
backup path = ./
Opening file './BACKUP-2.3.ctl'
File size 15960 bytes
Backup version in files: ndb-6.3.11 ndb version: mysql-5.5.22 ndb-7.2.6
Stop GCP of Backup: 8058
Opening file './BACKUP-2-0.3.Data'
File size 27320 bytes
_____________________________________________________
Processing data in table: mysql/def/NDB$BLOB_7_3(8) fragment 0
_____________________________________________________
Processing data in table: mysql/def/ndb_index_stat_sample(5) fragment 0
_____________________________________________________
Processing data in table: sys/def/NDB$EVENTS_0(3) fragment 0
_____________________________________________________
Processing data in table: mysql/def/ndb_apply_status(9) fragment 0
_____________________________________________________
Processing data in table: mysql/def/ndb_index_stat_head(4) fragment 0
_____________________________________________________
Processing data in table: blob_test/def/test(10) fragment 0
1 256:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
_____________________________________________________
Processing data in table: blob_test/def/NDB$BLOB_10_1(11) fragment 0
_____________________________________________________
Processing data in table: sys/def/SYSTAB_0(2) fragment 0
_____________________________________________________
Processing data in table: mysql/def/ndb_schema(7) fragment 0
NDBT_ProgramExit: 0 - OK
The last 16 bytes are missing (0xEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE)
Suggested fix:
I'm not sure if this will break anything, but for my setup, I was able to get around this by removing the headsize range on line 3195 in NdbDictionary.cpp
3195c3195,3196
< unsigned n = c->getInlineSize() - head.headsize;
---
> //unsigned n = c->getInlineSize() - head.headsize;
> unsigned n = c->getInlineSize();