[Commits] 06b07bb: MDEV-10957: Assertion failure when dropping a myisam table with wsrep_replicate_myisam enabled

Nirbhay Choubey nirbhay at mariadb.com
Wed Oct 5 11:24:08 EEST 2016


revision-id: 06b07bb4cb012b67ccd03bc78daa96dcc77a2f23 (mariadb-10.1.18-5-g06b07bb)
parent(s): 326a6729ec4475cac3fc509ed9746dfb2288ae12
author: Nirbhay Choubey
committer: Nirbhay Choubey
timestamp: 2016-10-05 04:24:07 -0400
message:

MDEV-10957: Assertion failure when dropping a myisam table with wsrep_replicate_myisam enabled

Internal updates to system statistical tables could wrongly
trigger an additional total-order replication if wsrep_repli
-cate_myisam is enabled.
Fixed by adding a check to skip total-order replication for
stat tables.

Test: galera.galera_var_replicate_myisam_on

---
 sql/sql_base.cc       |  1 +
 sql/sql_statistics.cc | 18 ++++++++++++++++++
 sql/sql_statistics.h  |  1 +
 3 files changed, 20 insertions(+)

diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index b4a3cc2..f04bece 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -4736,6 +4736,7 @@ bool open_tables(THD *thd, const DDL_options_st &options,
       (*start)                                 &&
       (*start)->table                          &&
       (*start)->table->file->ht == myisam_hton &&
+      !is_stat_table((*start)->db, (*start)->alias) &&
       sqlcom_can_generate_row_events(thd)      &&
       thd->get_command() != COM_STMT_PREPARE)
   {
diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc
index 4020cbc..6ebbe9b 100644
--- a/sql/sql_statistics.cc
+++ b/sql/sql_statistics.cc
@@ -3847,3 +3847,21 @@ double Histogram::point_selectivity(double pos, double avg_sel)
   return sel;
 }
 
+/*
+  Check whether the table is one of the persistent statistical tables.
+*/
+bool is_stat_table(const char *db, const char *table)
+{
+  DBUG_ASSERT(db && table);
+
+  if (!memcmp(db, stat_tables_db_name.str, stat_tables_db_name.length))
+  {
+    for (uint i= 0; i < STATISTICS_TABLES; i ++)
+    {
+      if (!memcmp(table, stat_table_name[i].str, stat_table_name[i].length))
+        return true;
+    }
+  }
+  return false;
+}
+
diff --git a/sql/sql_statistics.h b/sql/sql_statistics.h
index 46e5cef..daffd79 100644
--- a/sql/sql_statistics.h
+++ b/sql/sql_statistics.h
@@ -107,6 +107,7 @@ double get_column_range_cardinality(Field *field,
                                     key_range *min_endp,
                                     key_range *max_endp,
                                     uint range_flag);
+bool is_stat_table(const char *db, const char *table);
 
 class Histogram
 {


More information about the commits mailing list