Commit 31385576 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup

* use compile_time_assert instead of DBUG_ASSERT

* don't use thd->clear_error(), because
  * the error was already consumed by the error handler, so there is
     nothing to clear
  * it's dangerous to clear errors indiscriminately, if the error came
    from outside of read_statistics_for_tables() it must not be cleared
parent 5392b4a3
...@@ -257,10 +257,8 @@ index_stat_def= {INDEX_STAT_N_FIELDS, index_stat_fields, 4, index_stat_pk_col}; ...@@ -257,10 +257,8 @@ index_stat_def= {INDEX_STAT_N_FIELDS, index_stat_fields, 4, index_stat_pk_col};
Open all statistical tables and lock them Open all statistical tables and lock them
*/ */
static static int open_stat_tables(THD *thd, TABLE_LIST *tables,
inline int open_stat_tables(THD *thd, TABLE_LIST *tables, Open_tables_backup *backup, bool for_write)
Open_tables_backup *backup,
bool for_write)
{ {
int rc; int rc;
...@@ -275,7 +273,7 @@ inline int open_stat_tables(THD *thd, TABLE_LIST *tables, ...@@ -275,7 +273,7 @@ inline int open_stat_tables(THD *thd, TABLE_LIST *tables,
/* If the number of tables changes, we should revise the check below. */ /* If the number of tables changes, we should revise the check below. */
DBUG_ASSERT(STATISTICS_TABLES == 3); compile_time_assert(STATISTICS_TABLES == 3);
if (!rc && if (!rc &&
(stat_table_intact.check(tables[TABLE_STAT].table, &table_stat_def) || (stat_table_intact.check(tables[TABLE_STAT].table, &table_stat_def) ||
...@@ -3258,10 +3256,7 @@ int read_statistics_for_tables(THD *thd, TABLE_LIST *tables) ...@@ -3258,10 +3256,7 @@ int read_statistics_for_tables(THD *thd, TABLE_LIST *tables)
DBUG_RETURN(0); DBUG_RETURN(0);
if (open_stat_tables(thd, stat_tables, &open_tables_backup, FALSE)) if (open_stat_tables(thd, stat_tables, &open_tables_backup, FALSE))
{
thd->clear_error();
DBUG_RETURN(1); DBUG_RETURN(1);
}
for (TABLE_LIST *tl= tables; tl; tl= tl->next_global) for (TABLE_LIST *tl= tables; tl; tl= tl->next_global)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment