Bug #30674 Update without all blob/text columns in master table causes slave to fail
Submitted: 28 Aug 2007 17:30 Modified: 11 Dec 2007 7:44
Reporter: Jonathan Miller Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Replication Severity:S1 (Critical)
Version:5.1.22_6.2.8 OS:Linux (64 bit)
Assigned to: Frazer Clement CPU Architecture:Any

[28 Aug 2007 17:30] Jonathan Miller
Description:
Using the extra column in a master table as the column in the where clause will stop the SQL thread on the slave with the following messages:

070828 20:12:03 [ERROR] Slave: Error in Write_rows event: row application failed. Got error 4288 'Blob handle for column not available' from NDBCLUSTER, Error_code: 1296
070828 20:12:03 [ERROR] Slave: Error in Write_rows event: error during transaction execution on table test.t18. Got error 4288 'Blob handle for column not available' from NDBCLUSTER, Error_code: 1296
070828 20:12:03 [Warning] Slave: Got error 4288 'Blob handle for column not available' from NDB Error_code: 1296
070828 20:12:03 [Warning] Slave: Got error 4288 'Blob handle for column not available' from NDBCLUSTER Error_code: 1296
070828 20:12:03 [Warning] Slave: Unknown error Error_code: 1105
070828 20:12:03 [Warning] Slave: Unknown error Error_code: 1105
070828 20:12:03 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'master-bin.000001' position 568

How to repeat:
STOP SLAVE;
RESET SLAVE;
eval CREATE TABLE t18 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
                       ) ENGINE=$engine_type;

--echo
--echo *** Create t18 on Master ***
connection master;
eval CREATE TABLE t18 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
                      c6 INT DEFAULT '1',
                      c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
                      )ENGINE=$engine_type;

RESET MASTER;

--echo
--echo *** Start Slave ***
connection slave;
START SLAVE;

--echo
--echo *** Master Data Insert ***
connection master;
set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);

INSERT INTO t18 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
                        (2,@b1,'JOE',2,DEFAULT),
                        (3,@b1,'QA',3,DEFAULT);
--replace_column 5 CURRENT_TIMESTAMP
SELECT * FROM t18 ORDER BY c1;

--echo
--echo ** Select * from Slave **
sync_slave_with_master;
SELECT * FROM t18 ORDER BY c1;

--echo
--echo ** update from master **
connection master;
UPDATE t18 SET c5 = 'TEST' WHERE c6 = 3;

Slave SQL Thread should stop at this time

Suggested fix:
Should be handled the same as done when using InnoDB or MyISAM
[16 Nov 2007 14:37] Geert Vanderkelen
Verified using 5.1.22_6.2.8 and 5.1.22_6.3.6, --ndb-log-updated-only on or off, same error on slave:

Error in Write_rows event: error during transaction execution on table test.t10. Got error 4288 'Blob handle for column not available' from NDBCLUSTER.

Works fine with 5.1.15_6.1.22!

Test case:
* Setup replication, no special options.
* On master:
   mysql> CREATE TABLE t10 ( a INT PRIMARY KEY, b INT, t TEXT(8192) CHARACTER SET utf8 COLLATE utf8_bin ) ENGINE=ndbcluster PARTITION BY KEY(a);
   mysql> INSERT INTO t10 VALUES (1,2,'kjhkhfkhfakfhalkjhfksjdhfkjhdsfkjhsdf');
* On slave: all should be OK
   mysql> SELECT * FROM t10;
* Now on master do an update:
   mysql> UPDATE t10 SET b = 4 WHERE b = 2;
* On Slave you'll see an error:
   mysql> SHOW SLAVE STATUS\G
[19 Nov 2007 14:50] Frazer Clement
Patch for issue

Attachment: blob-fix.diff (text/x-patch), 594 bytes.

[19 Nov 2007 16:45] Frazer Clement
Diff including re-activated testcases

Attachment: bug30674.diff (text/x-patch), 7.59 KiB.

[19 Nov 2007 16:58] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/38081

ChangeSet@1.2684, 2007-11-19 16:58:19+00:00, frazer@forth.ndb.mysql.com +5 -0
  Bug#30674 : NDB: Update mst table using extra column for where clause slave to fail
  
  Problem was caused by attempting to set the value of a blob which was not in the set of updated
  columns which were replicated.
  
  Testcase reactivated and expected results updated
[20 Nov 2007 17:04] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/38153

ChangeSet@1.2685, 2007-11-20 17:03:37+00:00, frazer@forth.ndb.mysql.com +3 -0
  Bug # 30674
  Changes after review - we need to set all Blob values in the Insert case.
  Added testcase and results to suite/ndb/t/ndb_blob.test to verify this via an Insert which uses
  default values
[23 Nov 2007 10:46] Jon Stephens
Documented in 5.1.22-ndb-6.2.9 changelog as follows:

        Where a table on the master had additional columns as compared
        to the slave's copy of the table, referring to one or more of 
        the extra columns in the master's copy in a WHERE clause stopped 
        the SQL thread on the slave with Error in Write_rows event: row 
        application failed. Got error 4288 'Blob handle for column not 
        available' from NDBCLUSTER.

Left bug in PA status pending further merges.
[28 Nov 2007 9:13] Frazer Clement
Modifying synopsis to reflect real nature of the bug which is related to updates which do not include all Blob columns.
[10 Dec 2007 13:01] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/39647

ChangeSet@1.2593, 2007-12-10 13:29:23+01:00, tomas@whalegate.ndb.mysql.com +6 -0
  backport test for bug#30674
  (bug not present in 5.1)
[11 Dec 2007 7:43] Jon Stephens
Per Frazer's note, updated changelog entry to:

        Where a table being replicated had a TEXT or
        BLOB column, an UPDATE on
        the master that did not refer explicitly to this column in the
        WHERE clause stopped the SQL thread on the
        slave with Error in Write_rows event: row application
        failed. Got error 4288 'Blob handle for column not available'
        from NDBCLUSTER.

Per note from Tomas, closed bug without any further action.
[11 Dec 2007 7:44] Jon Stephens
Thank you for your bug report. This issue has already been fixed in the latest released version of that product.
[14 Dec 2007 17:08] Bugs System
Pushed into 5.1.23-rc
[14 Dec 2007 17:08] Bugs System
Pushed into 6.0.5-alpha