wsrep_consistency_check only handled on SQLCOM_INSERT_SELECT

Bug #1343209 reported by Ben Mildren
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL patches by Codership
Status tracked in 5.6
5.5
Fix Committed
Undecided
Seppo Jaakola
5.6
Fix Released
Undecided
Seppo Jaakola
Percona XtraDB Cluster moved to https://jira.percona.com/projects/PXC
Status tracked in 5.6
5.5
Fix Released
Undecided
Unassigned
5.6
Fix Released
Undecided
Unassigned

Bug Description

pt-table-checksum uses REPLACE ... SELECT to create a checksum of chunks of data, I believe the wsrep_consistency_check was introduced to ensure the isolation would support this process, however it looks like the wsrep_consistency_check is only handled on SQLCOM_INSERT_SELECT and not SQLCOM_REPLACE_SELECT.
In order for pt-table-checksum to be re-runnable it makes sense for it to use SQLCOM_REPLACE_SELECT as opposed to SQLCOM_INSERT_SELECT, so it looks like the wsrep_consistency_check should also/alternatively be applied to the SQLCOM_REPLACE_SELECT.

----------------------
modified sql_parse.cc:
----------------------
#ifdef WITH_WSREP
    if (lex->sql_command == SQLCOM_INSERT_SELECT &&
 thd->wsrep_consistency_check == CONSISTENCY_CHECK_DECLARED)
    {
      thd->wsrep_consistency_check = CONSISTENCY_CHECK_RUNNING;
      WSREP_TO_ISOLATION_BEGIN(first_table->db, first_table->table_name, NULL);
    }

....

    if (lex->sql_command == SQLCOM_REPLACE_SELECT)
      lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_REPLACE_SELECT);

-----------------------
pt-table-checksum code:
-----------------------
   my $checksum_dml = "REPLACE INTO $repl_table "
                    . "(db, tbl, chunk, chunk_index,"
                    . " lower_boundary, upper_boundary, this_cnt, this_crc) "
                    . "SELECT"
                    . ($cluster->is_cluster_node($master_cxn) ? ' /*!99997*/' : '')
                    . " ?, ?, ?, ?, ?, ?,";

description: updated
description: updated
Revision history for this message
Alex Yurchenko (ayurchen) wrote :

yes, it looks like removing SQLCOM_INSERT_SELECT check from the if() statement could fix it.

Changed in codership-mysql:
assignee: nobody → Seppo Jaakola (seppo-jaakola)
Revision history for this message
Nilnandan Joshi (nilnandan-joshi) wrote :

Verified with PXC 5.5 and 5.6

----------------------
sql_parse.cc:
----------------------

#ifdef WITH_WSREP
    if (lex->sql_command == SQLCOM_INSERT_SELECT &&
 thd->wsrep_consistency_check == CONSISTENCY_CHECK_DECLARED)
    {
      thd->wsrep_consistency_check = CONSISTENCY_CHECK_RUNNING;
      WSREP_TO_ISOLATION_BEGIN(first_table->db, first_table->table_name, NULL);
    }

-----------------------
pt-table-checksum code:
-----------------------

# ########################################################################
   # Checksum args and the DMS part of the checksum query for each table.
   # ########################################################################
   my %crc_args = $rc->get_crc_args(dbh => $master_dbh);
   my $checksum_dml = "REPLACE INTO $repl_table "
                    . "(db, tbl, chunk, chunk_index,"
                    . " lower_boundary, upper_boundary, this_cnt, this_crc) "
                    . "SELECT"
                    . ($cluster->is_cluster_node($master_cxn) ? ' /*!99997*/' : '')
                    . " ?, ?, ?, ?, ?, ?,";
   my $past_cols = " COUNT(*), '0'";

Revision history for this message
Seppo Jaakola (seppo-jaakola) wrote :
Changed in codership-mysql:
status: New → In Progress
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

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

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

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.