Bug #29103 ndb_restore segfaults on NULL var[char|binary]

parent ca7180c7
...@@ -18,7 +18,7 @@ CREATE TABLE `t2_c` ( ...@@ -18,7 +18,7 @@ CREATE TABLE `t2_c` (
PRIMARY KEY (`capgotod`), PRIMARY KEY (`capgotod`),
KEY `i quadaddsvr` (`gotod`) KEY `i quadaddsvr` (`gotod`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1; ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t2_c` VALUES (500,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST'); INSERT INTO `t2_c` VALUES (500,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST'),(5,0,'',NULL,NULL,'');
CREATE TABLE `t3_c` ( CREATE TABLE `t3_c` (
`CapGoaledatta` smallint(5) unsigned NOT NULL default '0', `CapGoaledatta` smallint(5) unsigned NOT NULL default '0',
`capgotod` smallint(5) unsigned NOT NULL default '0', `capgotod` smallint(5) unsigned NOT NULL default '0',
...@@ -154,15 +154,15 @@ count(*) ...@@ -154,15 +154,15 @@ count(*)
5 5
select count(*) from t2; select count(*) from t2;
count(*) count(*)
6 7
select count(*) from t2_c; select count(*) from t2_c;
count(*) count(*)
6 7
select count(*) select count(*)
from (select * from t2 union from (select * from t2 union
select * from t2_c) a; select * from t2_c) a;
count(*) count(*)
6 7
select count(*) from t3; select count(*) from t3;
count(*) count(*)
4 4
...@@ -286,15 +286,15 @@ count(*) ...@@ -286,15 +286,15 @@ count(*)
5 5
select count(*) from t2; select count(*) from t2;
count(*) count(*)
6 7
select count(*) from t2_c; select count(*) from t2_c;
count(*) count(*)
6 7
select count(*) select count(*)
from (select * from t2 union from (select * from t2 union
select * from t2_c) a; select * from t2_c) a;
count(*) count(*)
6 7
select count(*) from t3; select count(*) from t3;
count(*) count(*)
4 4
...@@ -386,15 +386,15 @@ count(*) ...@@ -386,15 +386,15 @@ count(*)
5 5
select count(*) from t2; select count(*) from t2;
count(*) count(*)
6 7
select count(*) from t2_c; select count(*) from t2_c;
count(*) count(*)
6 7
select count(*) select count(*)
from (select * from t2 union from (select * from t2 union
select * from t2_c) a; select * from t2_c) a;
count(*) count(*)
6 7
select count(*) from t3; select count(*) from t3;
count(*) count(*)
4 4
......
...@@ -33,7 +33,7 @@ CREATE TABLE `t2_c` ( ...@@ -33,7 +33,7 @@ CREATE TABLE `t2_c` (
PRIMARY KEY (`capgotod`), PRIMARY KEY (`capgotod`),
KEY `i quadaddsvr` (`gotod`) KEY `i quadaddsvr` (`gotod`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1; ) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
INSERT INTO `t2_c` VALUES (500,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST'); INSERT INTO `t2_c` VALUES (500,4,'','q3.net','addavp:MK_CASELECTOR=1','postorod rattoaa'),(2,1,'4','','addavp:MK_BRANDTAD=345','REDS Brandtad'),(3,2,'4','q3.net','execorder','fixedRatediPO REDS'),(1,1,'3','','addavp:MK_BRANDTAD=123','TEST Brandtad'),(6,5,'','told.q3.net','addavp:MK_BRANDTAD=123','Brandtad Toldzone'),(4,3,'3','q3.net','addavp:MK_POOLHINT=2','ratedi PO TEST'),(5,0,'',NULL,NULL,'');
# Added ROW_FORMAT=FIXED to use below to see that setting is preserved # Added ROW_FORMAT=FIXED to use below to see that setting is preserved
# by restore # by restore
......
...@@ -1158,6 +1158,8 @@ void BackupRestore::tuple_a(restore_callback_t *cb) ...@@ -1158,6 +1158,8 @@ void BackupRestore::tuple_a(restore_callback_t *cb)
char * dataPtr = attr_data->string_value; char * dataPtr = attr_data->string_value;
Uint32 length = 0; Uint32 length = 0;
if (!attr_data->null)
{
const unsigned char * src = (const unsigned char *)dataPtr; const unsigned char * src = (const unsigned char *)dataPtr;
switch(attr_desc->m_column->getType()){ switch(attr_desc->m_column->getType()){
case NdbDictionary::Column::Varchar: case NdbDictionary::Column::Varchar:
...@@ -1172,6 +1174,7 @@ void BackupRestore::tuple_a(restore_callback_t *cb) ...@@ -1172,6 +1174,7 @@ void BackupRestore::tuple_a(restore_callback_t *cb)
length = attr_data->size; length = attr_data->size;
break; break;
} }
}
if (j == 0 && tup.getTable()->have_auto_inc(i)) if (j == 0 && tup.getTable()->have_auto_inc(i))
tup.getTable()->update_max_auto_val(dataPtr,size*arraySize); tup.getTable()->update_max_auto_val(dataPtr,size*arraySize);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment