Bug #30739 Truncating ndb table while importing data into table causes errors
Submitted: 31 Aug 2007 4:26 Modified: 31 Aug 2007 22:22
Reporter: Jason Brooke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Disk Data Severity:S1 (Critical)
Version:5.1.20 OS:Linux
Assigned to: CPU Architecture:Any

[31 Aug 2007 4:26] Jason Brooke
Description:
Truncating an ndb table while data is being imported into it by redirecting a mysqldump file into the mysql client, results in the import failing with 'table doesn't exist' and an undeletable/unuseable table. I suspect it's more to do with the 'truncate-while-inserting' than the method though.

How to repeat:
In shell #1 inject a table dump of several million rows (enough to take several minutes) into the mysql client:

mysql db < tbl.sql

In shell #2, while the import in shell #1 is still running, log into the same sql node and issue the command:

truncate table tbl

more info:

using disk storage with 50gb tablespace file

table schema:

CREATE TABLE `tbl` (
  `id` int(11) NOT NULL auto_increment,
  `userid` int(11) NOT NULL default '0',
  `expires` int(11) NOT NULL default '0',
  `sessionid` varchar(40) NOT NULL default '',
  `campaigncode` varchar(10) NOT NULL default '',
  `countrycode` char(3) NOT NULL default '0',
  `error` varchar(256) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `userid` (`userid`),
  KEY `sessionid` (`sessionid`)
) ENGINE=ndb tablespace ts_1 storage disk DEFAULT CHARSET=latin1;

Suggested fix:
I haven't yet found a fix or workaround
[31 Aug 2007 22:22] Jason Brooke
I've closed this off because I was mistaken about the conditions under which this occurs, I'll make a new report when I have better information.