Skip to content

Commit c4cd913

Browse files
committed
Bug #14198580 --PRINT_DATA NOT PRINTING TRAILING 0S ON LONGVARBINARY FIELD
The values of columns of type BINARY, VARBINARY, LONGVARBINARY are printed differently in mysql client and in ndb_restore when printed using hex format. In the mysql client, trailing zeroes are printed whereas in ndb_restore, they are not. This patch fixes this inconsistency by printing the trailing zeroes in ndb_restore as well. Also re-record relevant MTR result files since the trailing zeroes will now be printed.
1 parent e58cdef commit c4cd913

File tree

3 files changed

+23
-21
lines changed

3 files changed

+23
-21
lines changed

mysql-test/suite/ndb/r/ndb_native_default_support.result

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ d Double NULL AT=FIXED ST=MEMORY DEFAULT 8.800000
152152
d2 Double NOT NULL AT=FIXED ST=MEMORY
153153
ch Char(19;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY DEFAULT "aaa"
154154
vch Varchar(19;latin1_swedish_ci) NULL AT=SHORT_VAR ST=MEMORY DEFAULT "bbb"
155-
b Binary(19) NULL AT=FIXED ST=MEMORY DEFAULT 0x636363
155+
b Binary(19) NULL AT=FIXED ST=MEMORY DEFAULT 0x63636300000000000000000000000000000000
156156
vb Varbinary(19) NULL AT=SHORT_VAR ST=MEMORY DEFAULT 0x646464
157157
blob1 Blob(256,2000,0) NULL AT=MEDIUM_VAR ST=MEMORY BV=2 BT=NDB$BLOB_XX_9
158158
text1 Text(256,2000,0;latin1_swedish_ci) NULL AT=MEDIUM_VAR ST=MEMORY BV=2 BT=NDB$BLOB_XX_10
@@ -374,7 +374,7 @@ d Double NULL AT=FIXED ST=MEMORY DEFAULT 8.800000
374374
d2 Double NOT NULL AT=FIXED ST=MEMORY
375375
ch Char(19;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY DEFAULT "aaa"
376376
vch Varchar(19;latin1_swedish_ci) NULL AT=SHORT_VAR ST=MEMORY DEFAULT "bbb"
377-
b Binary(19) NULL AT=FIXED ST=MEMORY DEFAULT 0x636363
377+
b Binary(19) NULL AT=FIXED ST=MEMORY DEFAULT 0x63636300000000000000000000000000000000
378378
vb Varbinary(19) NULL AT=SHORT_VAR ST=MEMORY DEFAULT 0x646464
379379
blob1 Blob(256,2000,0) NULL AT=MEDIUM_VAR ST=MEMORY BV=2 BT=NDB$BLOB_XX_9
380380
text1 Text(256,2000,0;latin1_swedish_ci) NULL AT=MEDIUM_VAR ST=MEMORY BV=2 BT=NDB$BLOB_XX_10
@@ -1366,7 +1366,7 @@ f Float NOT NULL AT=FIXED ST=MEMORY DEFAULT 6.600000
13661366
d Double NULL AT=FIXED ST=MEMORY DEFAULT 8.800000
13671367
d2 Double NOT NULL AT=FIXED ST=MEMORY
13681368
ch Char(19;latin1_swedish_ci) NULL AT=FIXED ST=MEMORY DEFAULT "aaaAAA"
1369-
b Binary(19) NULL AT=FIXED ST=MEMORY DEFAULT 0x636363
1369+
b Binary(19) NULL AT=FIXED ST=MEMORY DEFAULT 0x63636300000000000000000000000000000000
13701370
vb Varbinary(19) NULL AT=SHORT_VAR ST=MEMORY DEFAULT 0x646464
13711371
blob1 Blob(256,2000,0) NULL AT=MEDIUM_VAR ST=MEMORY BV=2 BT=NDB$BLOB_XX_8
13721372
text1 Text(256,2000,0;latin1_swedish_ci) NULL AT=MEDIUM_VAR ST=MEMORY BV=2 BT=NDB$BLOB_XX_9

mysql-test/suite/ndb/r/ndb_restore_print.result

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,11 @@ hex(h3) NULL
227227
hex(i1) NULL
228228
hex(i2) NULL
229229
hex(i3) NULL
230-
1;0x1;0x17;0x789A;0x789ABCDE;0xFEDC0001;127;255;32767;65535;2147483647;4294967295;9223372036854775807;18446744073709551615;1;12345678901234567890123456789012;123456789;1;12345678901234567890123456789012;123456789;0x12;0x123456789ABCDEF0;0x012345;0x12;0x123456789ABCDEF0;0x00123450
231-
2;0x0;0x0;0x0;0x0;0x0;-128;0;-32768;0;-2147483648;0;-9223372036854775808;0;;;;;;;0x0;0x0;0x0;0x0;0x0;0x0
230+
1;0x1;0x17;0x789A;0x789ABCDE;0xFEDC0001;127;255;32767;65535;2147483647;4294967295;9223372036854775807;18446744073709551615;1;12345678901234567890123456789012;123456789;1;12345678901234567890123456789012;123456789;0x12;0x123456789ABCDEF0;0x012345000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;0x12;0x123456789ABCDEF0;0x00123450
231+
2;0x0;0x0;0x0;0x0;0x0;-128;0;-32768;0;-2147483648;0;-9223372036854775808;0;;;;;;;0x00;0x0000000000000000;0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000;0x00;0x00;0x00
232232
3;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N;\N
233-
1,0x1,0x17,0x789A,0x789ABCDE,0xFEDC0001,127,255,32767,65535,2147483647,4294967295,9223372036854775807,18446744073709551615,'1','12345678901234567890123456789012','123456789','1','12345678901234567890123456789012','123456789',0x12,0x123456789ABCDEF0,0x012345,0x12,0x123456789ABCDEF0,0x00123450
234-
2,0x0,0x0,0x0,0x0,0x0,-128,0,-32768,0,-2147483648,0,-9223372036854775808,0,'','','','','','',0x0,0x0,0x0,0x0,0x0,0x0
233+
1,0x1,0x17,0x789A,0x789ABCDE,0xFEDC0001,127,255,32767,65535,2147483647,4294967295,9223372036854775807,18446744073709551615,'1','12345678901234567890123456789012','123456789','1','12345678901234567890123456789012','123456789',0x12,0x123456789ABCDEF0,0x012345000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,0x12,0x123456789ABCDEF0,0x00123450
234+
2,0x0,0x0,0x0,0x0,0x0,-128,0,-32768,0,-2147483648,0,-9223372036854775808,0,'','','','','','',0x00,0x0000000000000000,0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,0x00,0x00,0x00
235235
3,,,,,,,,,,,,,,,,,,,,,,,,,
236236
drop table t1;
237237
create table t1
@@ -254,11 +254,11 @@ create table t4 (pk int key, a int) engine ndb;
254254
insert into t2 values (1,11),(2,12),(3,13),(4,14),(5,15);
255255
insert into t3 values (1,21),(2,22),(3,23),(4,24),(5,25);
256256
insert into t4 values (1,31),(2,32),(3,33),(4,34),(5,35);
257-
'1' '1' '12345678901234567890123456789012' '123456789' '1' '12345678901234567890123456789012' '123456789' '0x20' '0x123456789ABCDEF020' '0x012345000020' '0x1200000020' '0x123456789ABCDEF000000020' '0x00123450000020'
257+
'1' '1' '12345678901234567890123456789012' '123456789' '1' '12345678901234567890123456789012' '123456789' '0x20' '0x123456789ABCDEF020' '0x012345000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' '0x1200000020' '0x123456789ABCDEF000000020' '0x00123450000020'
258258

259259
t1
260260
--
261-
1 1 12345678901234567890123456789012 123456789 1 12345678901234567890123456789012 123456789 0x20 0x123456789ABCDEF020 0x012345000020 0x1200000020 0x123456789ABCDEF000000020 0x00123450000020
261+
1 1 12345678901234567890123456789012 123456789 1 12345678901234567890123456789012 123456789 0x20 0x123456789ABCDEF020 0x012345000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0x1200000020 0x123456789ABCDEF000000020 0x00123450000020
262262

263263
t2
264264
--

storage/ndb/src/ndbapi/NdbDictionary.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2010, 2011, 2013, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License as published by
@@ -2947,17 +2947,7 @@ pretty_print_string(NdbOut& out,
29472947
{
29482948
const unsigned char* ref = (const unsigned char*)aref;
29492949
int i, len, printable= 1;
2950-
// trailing zeroes are not printed
2951-
for (i=sz-1; i >= 0; i--)
2952-
if (ref[i] == 0) sz--;
2953-
else break;
2954-
if (!is_binary)
2955-
{
2956-
// trailing spaces are not printed
2957-
for (i=sz-1; i >= 0; i--)
2958-
if (ref[i] == 32) sz--;
2959-
else break;
2960-
}
2950+
29612951
if (is_binary && f.hex_format)
29622952
{
29632953
if (sz == 0)
@@ -2970,6 +2960,18 @@ pretty_print_string(NdbOut& out,
29702960
out.print("%02X", (int)ref[len]);
29712961
return;
29722962
}
2963+
2964+
// trailing zeroes are not printed
2965+
for (i=sz-1; i >= 0; i--)
2966+
if (ref[i] == 0) sz--;
2967+
else break;
2968+
if (!is_binary)
2969+
{
2970+
// trailing spaces are not printed
2971+
for (i=sz-1; i >= 0; i--)
2972+
if (ref[i] == 32) sz--;
2973+
else break;
2974+
}
29732975
if (sz == 0) return; // empty
29742976

29752977
// NOTE! This for loop both checks printable and counts length

0 commit comments

Comments
 (0)