Bug #65467 --print_data truncating the last 16 bytes of blob field
Submitted: 30 May 2012 20:08 Modified: 6 Nov 2014 17:35
Reporter: Dustin Koupal Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:7.2.6, 7.2.7 OS:Any
Assigned to: CPU Architecture:Any

[30 May 2012 20:08] Dustin Koupal
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();
[31 May 2012 18:33] Sveta Smirnova
Thank you for the report.

Verified as described.
[16 Dec 2013 19:06] David Squier
Since this is not getting any traction, I have asked Michael Kludjian (michael.kludjian@oracle.com) to look into this for us.
[6 Nov 2014 17:35] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

Fix documented as follows in the NDB 7.2.19 and 7.3.8 changelogs:

    ndb_restore --print_data truncated TEXT and BLOB column values 
    to 240 bytes rather than 256 bytes.

Closed.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html