Bug #28538 Assertion failure when replicating "DELETE FROM t" from ndb to myisam.
Submitted: 19 May 2007 14:16 Modified: 21 May 2007 9:16
Reporter: Rafal Somla Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.1.18, 5.1.21 OS:Linux
Assigned to: Assigned Account CPU Architecture:Any
Triage: Triaged: D2 (Serious)

[19 May 2007 14:16] Rafal Somla
Description:
When replicating "DELETE FROM t" statement in RBR, assertion in handler::ha_reset() gets violated:

 mysqld: handler.cc:3624: int handler::ha_reset(): 
 Assertion `bitmap_is_set_all(&table->s->all_set)' failed.

This happens when thread tables are closed when replication context is cleaned after event execution. Here is a stack trace from the failure:

#7  0x0837c081 in handler::ha_reset (this=0x900c560) at handler.cc:3624
#8  0x082c333c in close_thread_table (thd=0x9040b08, table_ptr=0x9040b48) at sql_base.cc:1264
#9  0x082c4f95 in close_thread_tables (thd=0x9040b08, lock_in_use=false, skip_derived=false) at sql_base.cc:1214
#10 0x084192ef in st_relay_log_info::cleanup_context (this=0x9034e18, thd=0x9040b08, error=false) at rpl_rli.cc:1160
#11 0x08348988 in Rows_log_event::do_update_pos (this=0x90027d8, rli=0x9034e18) at log_event.cc:6267
#12 0x084122ed in Log_event::update_pos (this=0x90027d8, rli=0x9034e18) at log_event.h:830
#13 0x084100fe in exec_relay_log_event (thd=0x9040b08, rli=0x9034e18) at slave.cc:1814
#14 0x08410bdc in handle_slave_sql (arg=0x9033f98) at slave.cc:2407

How to repeat:
Use the folowing test case:

---------------------------------------------------------------------------
-- source include/have_ndb.inc
-- source include/master-slave.inc
SET storage_engine=ndb;

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_query_log

CREATE TABLE t1 (id int, b int, primary key(id));
sync_slave_with_master;

connection master;
INSERT INTO t1(id) VALUES (1);
INSERT INTO t1(id) VALUES (2);
sync_slave_with_master;

connection master;
DELETE FROM t1;
DROP TABLE IF EXISTS t1;
sync_slave_with_master;
---------------------------------------------------------------------------

The failure happens only when replicating ndb->myisam. For ndb->ndb and ndb->innodb test works fine. Column b in t1 is crucial - without it there is no
failure.
[21 May 2007 9:16] Sveta Smirnova
Thank you for the report.

Verified as described.
[25 Aug 2007 10:30] Rafal Somla
I've noticed that the problem doesn't occur if only one row is delted. E.g., when replicating statement like:

DELETE FROM t1 WHERE id = 412;
[11 Feb 2008 22:05] Andrei Elkin
The regression test does not pass because of later changes in logics of
handling mixed self-logging and some other engines.
The point of assert can not be reached as the slave gets stopped:
Last_SQL_Errno  1598
Last_SQL_Error  Error 'Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging' in Write_rows event: when locking tables

Too early to say cannot repeat. Needs more analysis.