diff options
author | Jacob Mathew <jacob.mathew@mariadb.com> | 2017-07-14 13:03:44 -0700 |
---|---|---|
committer | Jacob Mathew <jacob.mathew@mariadb.com> | 2017-07-14 13:03:44 -0700 |
commit | 2f0e0311ad48ac5b41f770609a0c7b4e6750bcbd (patch) | |
tree | 27921ff8b39acc3621dbce9faacb7244cb3845bc | |
parent | b685dfc68635fbe3b6319292580ad9d13351dc85 (diff) | |
download | mariadb-git-bb-10.2-spider-extra.tar.gz |
Spiral Patch 021: 021_mariadb-10.2.0.merge_table.diff MDEV-7719bb-10.2-spider-extra
Changes for identifying MyISAM Merge child tables that can be merged
Part of a set of patches to support partitioning.
-rw-r--r-- | sql/handler.h | 7 | ||||
-rw-r--r-- | sql/sql_admin.cc | 2 | ||||
-rw-r--r-- | sql/sql_base.cc | 14 | ||||
-rw-r--r-- | storage/myisammrg/ha_myisammrg.cc | 2 |
4 files changed, 15 insertions, 10 deletions
diff --git a/sql/handler.h b/sql/handler.h index 1fed7fc4754..91f8a603d1f 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1394,9 +1394,6 @@ handlerton *ha_default_tmp_handlerton(THD *thd); #define HTON_TEMPORARY_NOT_SUPPORTED (1 << 6) //Having temporary tables not supported #define HTON_SUPPORT_LOG_TABLES (1 << 7) //Engine supports log tables #define HTON_NO_PARTITION (1 << 8) //Not partition of these tables -#define HTON_CAN_MULTISTEP_MERGE (1 << 9) //You can merge mearged tables -// Engine needs to access the main connect string in partitions -#define HTON_CAN_READ_CONNECT_STRING_IN_PARTITION (1 << 10) /* This flag should be set when deciding that the engine does not allow @@ -1417,6 +1414,10 @@ handlerton *ha_default_tmp_handlerton(THD *thd); // MySQL compatibility. Unused. #define HTON_SUPPORTS_FOREIGN_KEYS (1 << 0) //Foreign key constraint supported. +#define HTON_CAN_MERGE (1 <<11) //Merge type table +// Engine needs to access the main connect string in partitions +#define HTON_CAN_READ_CONNECT_STRING_IN_PARTITION (1 <<12) + class Ha_trx_info; struct THD_TRANS diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index bc5b9bde8e8..d8afa51da03 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -182,7 +182,7 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list, goto end; // No data file /* A MERGE table must not come here. */ - DBUG_ASSERT(table->file->ht->db_type != DB_TYPE_MRG_MYISAM); + DBUG_ASSERT(!(table->file->ht->flags & HTON_CAN_MERGE)); // Name of data file strxmov(from, table->s->normalized_path.str, ext[1], NullS); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 5eade2994ee..df9fbc25d91 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -974,7 +974,7 @@ TABLE_LIST* find_dup_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list, if (table->table) { /* All MyISAMMRG children are plain MyISAM tables. */ - DBUG_ASSERT(table->table->file->ht->db_type != DB_TYPE_MRG_MYISAM); + DBUG_ASSERT(!(table->table->file->ht->flags & HTON_CAN_MERGE)); table= table->find_underlying_table(table->table); /* @@ -1080,7 +1080,8 @@ unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list, table= table->find_table_for_update(); if (table->table && - table->table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE) + ((table->table->file->ht->flags & HTON_CAN_MERGE) || + (table->table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE))) { TABLE_LIST *child; dup= NULL; @@ -1089,7 +1090,8 @@ unique_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list, child= child->next_global) { if (child->table && - child->table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE) + ((child->table->file->ht->flags & HTON_CAN_MERGE) || + (child->table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE))) continue; /* @@ -4059,7 +4061,8 @@ restart: continue; /* Schema tables may not have a TABLE object here. */ - if (tbl->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE) + if ((tbl->file->ht->flags & HTON_CAN_MERGE) || + (tbl->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE)) { /* MERGE tables need to access parent and child TABLE_LISTs. */ DBUG_ASSERT(tbl->pos_in_table_list == tables); @@ -4604,7 +4607,8 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type, */ DBUG_ASSERT(table_list->table); table= table_list->table; - if (table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE) + if ((table->file->ht->flags & HTON_CAN_MERGE) || + (table->file->ha_table_flags() & HA_CAN_MULTISTEP_MERGE)) { /* A MERGE table must not come here. */ /* purecov: begin tested */ diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc index 3d91aa67793..8689205a21e 100644 --- a/storage/myisammrg/ha_myisammrg.cc +++ b/storage/myisammrg/ha_myisammrg.cc @@ -1755,7 +1755,7 @@ static int myisammrg_init(void *p) myisammrg_hton->db_type= DB_TYPE_MRG_MYISAM; myisammrg_hton->create= myisammrg_create_handler; myisammrg_hton->panic= myisammrg_panic; - myisammrg_hton->flags= HTON_NO_PARTITION; + myisammrg_hton->flags= HTON_NO_PARTITION | HTON_CAN_MERGE; myisammrg_hton->tablefile_extensions= ha_myisammrg_exts; return 0; |