diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/ha_partition.cc | 12 | ||||
-rw-r--r-- | sql/handler.cc | 3 | ||||
-rw-r--r-- | sql/handler.h | 10 | ||||
-rw-r--r-- | sql/sql_admin.cc | 9 |
4 files changed, 31 insertions, 3 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 9700810f3b8..61eeb885091 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1192,7 +1192,17 @@ int ha_partition::analyze(THD *thd, HA_CHECK_OPT *check_opt) { DBUG_ENTER("ha_partition::analyze"); - DBUG_RETURN(handle_opt_partitions(thd, check_opt, ANALYZE_PARTS)); + int result= handle_opt_partitions(thd, check_opt, ANALYZE_PARTS); + + if ((result == 0) && m_file[0] + && (m_file[0]->ha_table_flags() & HA_ONLINE_ANALYZE)) + { + /* If this is ANALYZE TABLE that will not force table definition cache + eviction, update statistics for the partition handler. */ + this->info(HA_STATUS_CONST | HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); + } + + DBUG_RETURN(result); } diff --git a/sql/handler.cc b/sql/handler.cc index 1af0157783e..64d7fae1f1a 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3103,6 +3103,9 @@ int handler::ha_index_next(uchar * buf) table->update_virtual_fields(this, VCOL_UPDATE_FOR_READ); } table->status=result ? STATUS_NOT_FOUND: 0; + + DEBUG_SYNC(ha_thd(), "handler_ha_index_next_end"); + DBUG_RETURN(result); } diff --git a/sql/handler.h b/sql/handler.h index f592c635c5d..f8482501b3f 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -342,7 +342,15 @@ enum chf_create_flags { /* Support native hash index */ #define HA_CAN_HASH_KEYS (1ULL << 57) #define HA_CRASH_SAFE (1ULL << 58) -#define HA_LAST_TABLE_FLAG HA_CRASH_SAFE + +/* + There is no need to evict the table from the table definition cache having + run ANALYZE TABLE on it + */ +#define HA_ONLINE_ANALYZE (1ULL << 59) + +#define HA_LAST_TABLE_FLAG HA_ONLINE_ANALYZE + /* bits in index_flags(index_number) for what you can do with index */ #define HA_READ_NEXT 1 /* TODO really use this flag */ diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index 03822acf564..71939936da0 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -1141,6 +1141,13 @@ send_result_message: } if (table->table && !table->view) { + /* + Don't skip flushing if we are collecting EITS statistics. + */ + const bool skip_flush= + (operator_func == &handler::ha_analyze) && + (table->table->file->ha_table_flags() & HA_ONLINE_ANALYZE) && + !collect_eis; if (table->table->s->tmp_table) { /* @@ -1150,7 +1157,7 @@ send_result_message: if (open_for_modify && !open_error) table->table->file->info(HA_STATUS_CONST); } - else if (open_for_modify || fatal_error) + else if ((!skip_flush && open_for_modify) || fatal_error) { table->table->s->tdc->flush_unused(true); /* |