TRUNCATE TEMPORARY table is replicated

Bug #1194156 reported by Jay Janssen on 2013-06-24
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
MySQL patches by Codership
Status tracked in 5.6
5.5
High
Teemu Ollakka
5.6
High
Teemu Ollakka
Percona XtraDB Cluster moved to https://jira.percona.com/projects/PXC
Status tracked in 5.6
5.5
Fix Released
Undecided
Raghavendra D Prabhu
5.6
Fix Released
Undecided
Unassigned

Bug Description

TEMPORARY tables are not replicated, but any DDL on those tables are, which generates error messages on the other nodes.

130621 14:53:10 [Warning] WSREP: Ignoring error for TO isolated action: source: 193e9e28-daa3-11e2-0800-300ea6ca3dcc version: 2 local: 0 state: APPLYING flags: 65 conn_id: 229 trx_id: -1 seqnos (l: 982, g: 938471, s: 938470, d: 938470, ts: 1371844390327885983)
130621 14:53:10 [ERROR] Slave SQL: Error 'Table 'moodle.mdl_backup_files_temp' doesn't exist' on query. Default database: 'moodle'. Query: 'CREATE INDEX mdl_backfiletemp_bacconcom2_ix ON mdl_backup_files_temp (backupid, contextid, component, filearea, itemid)', Error_code: 1146
130621 14:53:10 [Warning] WSREP: RBR event 1 Query apply warning: 1, 938472
130621 14:53:10 [Warning] WSREP: Ignoring error for TO isolated action: source: 193e9e28-daa3-11e2-0800-300ea6ca3dcc version: 2 local: 0 state: A

Ideally, DDL applied to a TEMPORARY TABLE would not get replicated at all.

Tags: ddl Edit Tag help

DDL needs to be filtered here as well, like for lp:1177263

tags: added: ddl
Dmitry Gribov (grib-d) wrote :

Confirm, same with "truncate":
 130712 19:54:11 [ERROR] Slave SQL: Error 'Table 'fbhub.incoming_money_stat_all_tmp' doesn't exist' on query. Default database: 'fbhub'. Query: 'TRUNCATE incoming_money_stat_all_tmp', Error_code: 1146
130712 19:54:11 [Warning] WSREP: RBR event 1 Query apply warning: 1, 829784151
130712 19:54:11 [Warning] WSREP: Ignoring error for TO isolated action: source: a54f1061-e7ce-11e2-8a68-7fe1575d62b6 version: 2 local: 0 state: APPLYING flags: 65 conn_id: 313755 trx_id: -1 seqnos (l: 18135943, g: 829784151, s: 829784150, d: 829784150, ts: 1373644451351229588)

CREATE TEMPORARY TABLE is not replicated due to https://bugs.launchpad.net/codership-mysql/+bug/1246257

But truncate is still replicated.

summary: - DDL on a TEMPORARY table should not get replicated
+ TRUNCATE TEMPORARY table is replicated

 === modified file 'Percona-Server/sql/sql_truncate.cc'
 --- Percona-Server/sql/sql_truncate.cc 2013-01-16 01:34:54 +0000
 +++ Percona-Server/sql/sql_truncate.cc 2013-11-12 14:55:27 +0000
 @@ -447,6 +447,12 @@
    {
      bool hton_can_recreate;

 +#ifdef WITH_WSREP
 + if (WSREP(thd) && wsrep_to_isolation_begin(thd,
 + table_ref->db,
 + table_ref->table_name, NULL))
 + DBUG_RETURN(TRUE);
 +#endif /* WITH_WSREP */
      if (lock_table(thd, table_ref, &hton_can_recreate))
        DBUG_RETURN(TRUE);

 @@ -523,12 +529,6 @@
    if (check_one_table_access(thd, DROP_ACL, first_table))
      DBUG_RETURN(res);

 -#ifdef WITH_WSREP
 - if (WSREP(thd) && wsrep_to_isolation_begin(thd,
 - first_table->db,
 - first_table->table_name, NULL))
 - DBUG_RETURN(TRUE);
 -#endif /* WITH_WSREP */
    if (! (res= truncate_table(thd, first_table)))
      my_ok(thd);
    DBUG_RETURN(res);

fixes it.
============================================

Tested with the fix.
Tested with the fix.

Michaël de Groot (z-miceael-6) wrote :

Hi,

Why was this fix committed in February but not released yet? Would have saved me some investigative work :)

Thanks,
Michaël

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PXC-1383

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers