mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Fixed bug mdev-485.
RBR should be turned off when statistical tables are modified in the result of the execution of a DDL statement. Revised the fix for bug mdev-463. Ensured suppression of RBR for the modifications of the statistical tables triggered by the execution of any analyze operation.
This commit is contained in:
@@ -2171,6 +2171,7 @@ int update_statistics_for_table(THD *thd, TABLE *table)
|
||||
Open_tables_backup open_tables_backup;
|
||||
uint i;
|
||||
int err;
|
||||
bool save_binlog_row_based;
|
||||
int rc= 0;
|
||||
TABLE *stat_table;
|
||||
|
||||
@@ -2187,6 +2188,9 @@ int update_statistics_for_table(THD *thd, TABLE *table)
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
|
||||
/* Update the statistical table table_stat */
|
||||
stat_table= tables[TABLE_STAT].table;
|
||||
Table_stat table_stat(stat_table, table);
|
||||
@@ -2231,6 +2235,9 @@ int update_statistics_for_table(THD *thd, TABLE *table)
|
||||
}
|
||||
}
|
||||
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
|
||||
close_system_tables(thd, &open_tables_backup);
|
||||
|
||||
DBUG_RETURN(rc);
|
||||
@@ -2510,6 +2517,7 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables)
|
||||
int delete_statistics_for_table(THD *thd, LEX_STRING *db, LEX_STRING *tab)
|
||||
{
|
||||
int err;
|
||||
bool save_binlog_row_based;
|
||||
TABLE *stat_table;
|
||||
TABLE_LIST tables[STATISTICS_TABLES];
|
||||
Open_tables_backup open_tables_backup;
|
||||
@@ -2528,6 +2536,9 @@ int delete_statistics_for_table(THD *thd, LEX_STRING *db, LEX_STRING *tab)
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
|
||||
/* Delete statistics on table from the statistical table index_stat */
|
||||
stat_table= tables[INDEX_STAT].table;
|
||||
Index_stat index_stat(stat_table, db, tab);
|
||||
@@ -2561,6 +2572,9 @@ int delete_statistics_for_table(THD *thd, LEX_STRING *db, LEX_STRING *tab)
|
||||
rc= 1;
|
||||
}
|
||||
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
|
||||
close_system_tables(thd, &open_tables_backup);
|
||||
|
||||
DBUG_RETURN(rc);
|
||||
@@ -2595,6 +2609,7 @@ int delete_statistics_for_table(THD *thd, LEX_STRING *db, LEX_STRING *tab)
|
||||
int delete_statistics_for_column(THD *thd, TABLE *tab, Field *col)
|
||||
{
|
||||
int err;
|
||||
bool save_binlog_row_based;
|
||||
TABLE *stat_table;
|
||||
TABLE_LIST tables;
|
||||
Open_tables_backup open_tables_backup;
|
||||
@@ -2613,6 +2628,9 @@ int delete_statistics_for_column(THD *thd, TABLE *tab, Field *col)
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
|
||||
stat_table= tables.table;
|
||||
Column_stat column_stat(stat_table, tab);
|
||||
column_stat.set_key_fields(col);
|
||||
@@ -2623,6 +2641,9 @@ int delete_statistics_for_column(THD *thd, TABLE *tab, Field *col)
|
||||
rc= 1;
|
||||
}
|
||||
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
|
||||
close_system_tables(thd, &open_tables_backup);
|
||||
|
||||
DBUG_RETURN(rc);
|
||||
@@ -2657,6 +2678,7 @@ int delete_statistics_for_column(THD *thd, TABLE *tab, Field *col)
|
||||
int delete_statistics_for_index(THD *thd, TABLE *tab, KEY *key_info)
|
||||
{
|
||||
int err;
|
||||
bool save_binlog_row_based;
|
||||
TABLE *stat_table;
|
||||
TABLE_LIST tables;
|
||||
Open_tables_backup open_tables_backup;
|
||||
@@ -2675,6 +2697,9 @@ int delete_statistics_for_index(THD *thd, TABLE *tab, KEY *key_info)
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
|
||||
stat_table= tables.table;
|
||||
Index_stat index_stat(stat_table, tab);
|
||||
index_stat.set_index_prefix_key_fields(key_info);
|
||||
@@ -2685,6 +2710,9 @@ int delete_statistics_for_index(THD *thd, TABLE *tab, KEY *key_info)
|
||||
rc= 1;
|
||||
}
|
||||
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
|
||||
close_system_tables(thd, &open_tables_backup);
|
||||
|
||||
DBUG_RETURN(rc);
|
||||
@@ -2722,6 +2750,7 @@ int rename_table_in_stat_tables(THD *thd, LEX_STRING *db, LEX_STRING *tab,
|
||||
LEX_STRING *new_db, LEX_STRING *new_tab)
|
||||
{
|
||||
int err;
|
||||
bool save_binlog_row_based;
|
||||
TABLE *stat_table;
|
||||
TABLE_LIST tables[STATISTICS_TABLES];
|
||||
Open_tables_backup open_tables_backup;
|
||||
@@ -2740,6 +2769,9 @@ int rename_table_in_stat_tables(THD *thd, LEX_STRING *db, LEX_STRING *tab,
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
|
||||
/* Rename table in the statistical table index_stat */
|
||||
stat_table= tables[INDEX_STAT].table;
|
||||
Index_stat index_stat(stat_table, db, tab);
|
||||
@@ -2775,6 +2807,9 @@ int rename_table_in_stat_tables(THD *thd, LEX_STRING *db, LEX_STRING *tab,
|
||||
rc= 1;
|
||||
}
|
||||
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
|
||||
close_system_tables(thd, &open_tables_backup);
|
||||
|
||||
DBUG_RETURN(rc);
|
||||
@@ -2812,6 +2847,7 @@ int rename_column_in_stat_tables(THD *thd, TABLE *tab, Field *col,
|
||||
const char *new_name)
|
||||
{
|
||||
int err;
|
||||
bool save_binlog_row_based;
|
||||
TABLE *stat_table;
|
||||
TABLE_LIST tables;
|
||||
Open_tables_backup open_tables_backup;
|
||||
@@ -2830,6 +2866,9 @@ int rename_column_in_stat_tables(THD *thd, TABLE *tab, Field *col,
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
|
||||
/* Rename column in the statistical table table_stat */
|
||||
stat_table= tables.table;
|
||||
Column_stat column_stat(stat_table, tab);
|
||||
@@ -2840,6 +2879,10 @@ int rename_column_in_stat_tables(THD *thd, TABLE *tab, Field *col,
|
||||
if (err & !rc)
|
||||
rc= 1;
|
||||
}
|
||||
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
|
||||
close_system_tables(thd, &open_tables_backup);
|
||||
|
||||
DBUG_RETURN(rc);
|
||||
|
||||
Reference in New Issue
Block a user