diff options
author | Varun Gupta <varun.gupta@mariadb.com> | 2020-04-26 15:42:57 +0530 |
---|---|---|
committer | Varun Gupta <varun.gupta@mariadb.com> | 2020-05-06 17:19:58 +0530 |
commit | 4539d3ea77fc5fde63f515a97bc679afd7b614c7 (patch) | |
tree | 4d3381ab3e1330af957b66541adccd388d8d0b73 /sql/handler.h | |
parent | 8ad3c6154b90314980faf1cdd4c317c9bbf5f84c (diff) | |
download | mariadb-git-bb-10.5-mdev7317.tar.gz |
MDEV-7317: Make an index ignorable to the optimizerbb-10.5-mdev7317
Diffstat (limited to 'sql/handler.h')
-rw-r--r-- | sql/handler.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/sql/handler.h b/sql/handler.h index afad986c883..50ba52a8cd1 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -769,6 +769,12 @@ typedef bool Log_func(THD*, TABLE*, bool, const uchar*, const uchar*); */ #define ALTER_COLUMN_INDEX_LENGTH (1ULL << 60) + +/** + Means that the ignorability of an index is changed. +*/ +#define ALTER_INDEX_IGNORABILITY (1ULL << 61) + /* Flags set in partition_flags when altering partitions */ @@ -2318,6 +2324,26 @@ struct Table_specification_st: public HA_CREATE_INFO, /** + Structure describing changes to an index to be caused by ALTER TABLE. +*/ + +struct KEY_PAIR +{ + /** + Pointer to KEY object describing old version of index in + TABLE::key_info array for TABLE instance representing old + version of table. + */ + KEY *old_key; + /** + Pointer to KEY object describing new version of index in + Alter_inplace_info::key_info_buffer array. + */ + KEY *new_key; +}; + + +/** In-place alter handler context. This is a superclass intended to be subclassed by individual handlers @@ -2416,6 +2442,11 @@ public: */ uint *index_add_buffer; + KEY_PAIR *index_altered_ignorability_buffer; + + /** Size of index_altered_ignorability_buffer array. */ + uint index_altered_ignorability_count; + /** Old and new index names. Used for index rename. */ @@ -2521,6 +2552,18 @@ public: */ void report_unsupported_error(const char *not_supported, const char *try_instead) const; + void add_altered_index_ignorability(KEY *old_key, KEY *new_key) + { + KEY_PAIR *key_pair= index_altered_ignorability_buffer + + index_altered_ignorability_count++; + key_pair->old_key= old_key; + key_pair->new_key= new_key; + DBUG_PRINT("info", ("index had ignorability altered: %i to %i", + old_key->is_ignored, + new_key->is_ignored)); + } + + }; @@ -2537,6 +2580,7 @@ typedef struct st_key_create_information directly by the user (set by the parser). */ bool check_for_duplicate_indexes; + bool is_ignored; } KEY_CREATE_INFO; |