mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
BUG#51021: current_stmt_binlog_row_based not removed in next-mr
As part of BUG@39934 fix, the public: - THD::current_stmt_binlog_row_based variable had been removed and replaced by a private variable: - THD::current_stmt_binlog_format. THD was refactored and some modifiers and accessors were implemented for the new variable. However, due to a bad merge, the THD::current_stmt_binlog_row_based variable is back as a public member of THD. This in itself is already potentially harmful. What's even worse is that while merging some more patches and resolving conflicts, the variable started being used again, which is obviously wrong. To fix this we: 1. remove the extraneous variable from sql_class.h 2. revert a bad merge for BUG#49132 3. merge BUG#49132 properly again (actually, making use of the cset used to merge the original patch to mysql-pe).
This commit is contained in:
@ -3119,8 +3119,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
||||
row-based replication. The flag will be reset at the end of the
|
||||
statement.
|
||||
*/
|
||||
save_binlog_row_based= thd->is_current_stmt_binlog_format_row();
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
|
||||
#ifdef HAVE_REPLICATION
|
||||
/*
|
||||
@ -3137,7 +3137,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
||||
if (!(thd->spcont || rpl_filter->tables_ok(0, tables)))
|
||||
{
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
}
|
||||
@ -3153,7 +3154,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
||||
{ // Should never happen
|
||||
close_thread_tables(thd); /* purecov: deadcode */
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
DBUG_RETURN(TRUE); /* purecov: deadcode */
|
||||
}
|
||||
|
||||
@ -3281,7 +3283,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
||||
/* Tables are automatically closed */
|
||||
thd->lex->restore_backup_query_tables_list(&backup);
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
@ -3346,8 +3349,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
|
||||
row-based replication. The flag will be reset at the end of the
|
||||
statement.
|
||||
*/
|
||||
save_binlog_row_based= thd->is_current_stmt_binlog_format_row();
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
|
||||
#ifdef HAVE_REPLICATION
|
||||
/*
|
||||
@ -3364,7 +3367,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
|
||||
if (!(thd->spcont || rpl_filter->tables_ok(0, tables)))
|
||||
{
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
}
|
||||
@ -3374,7 +3378,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
|
||||
{ // Should never happen
|
||||
close_thread_tables(thd);
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
@ -3452,7 +3457,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
|
||||
|
||||
mysql_rwlock_unlock(&LOCK_grant);
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
|
||||
/* Tables are automatically closed */
|
||||
DBUG_RETURN(result);
|
||||
@ -3496,8 +3502,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
|
||||
row-based replication. The flag will be reset at the end of the
|
||||
statement.
|
||||
*/
|
||||
save_binlog_row_based= thd->is_current_stmt_binlog_format_row();
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
|
||||
#ifdef HAVE_REPLICATION
|
||||
/*
|
||||
@ -3514,7 +3520,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
|
||||
if (!(thd->spcont || rpl_filter->tables_ok(0, tables)))
|
||||
{
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
}
|
||||
@ -3524,7 +3531,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
|
||||
{ // This should never happen
|
||||
close_thread_tables(thd); /* purecov: deadcode */
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
DBUG_RETURN(TRUE); /* purecov: deadcode */
|
||||
}
|
||||
|
||||
@ -3585,7 +3593,8 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
|
||||
if (!result)
|
||||
my_ok(thd);
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
@ -5797,14 +5806,15 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
|
||||
row-based replication. The flag will be reset at the end of the
|
||||
statement.
|
||||
*/
|
||||
save_binlog_row_based= thd->is_current_stmt_binlog_format_row();
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
|
||||
/* CREATE USER may be skipped on replication client. */
|
||||
if ((result= open_grant_tables(thd, tables)))
|
||||
{
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
DBUG_RETURN(result != 1);
|
||||
}
|
||||
|
||||
@ -5850,7 +5860,8 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
|
||||
mysql_rwlock_unlock(&LOCK_grant);
|
||||
close_thread_tables(thd);
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
@ -5885,14 +5896,15 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
|
||||
row-based replication. The flag will be reset at the end of the
|
||||
statement.
|
||||
*/
|
||||
save_binlog_row_based= thd->is_current_stmt_binlog_format_row();
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
|
||||
/* DROP USER may be skipped on replication client. */
|
||||
if ((result= open_grant_tables(thd, tables)))
|
||||
{
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
DBUG_RETURN(result != 1);
|
||||
}
|
||||
|
||||
@ -5932,7 +5944,8 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
|
||||
close_thread_tables(thd);
|
||||
thd->variables.sql_mode= old_sql_mode;
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
@ -5967,14 +5980,15 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
|
||||
row-based replication. The flag will be reset at the end of the
|
||||
statement.
|
||||
*/
|
||||
save_binlog_row_based= thd->is_current_stmt_binlog_format_row();
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
|
||||
/* RENAME USER may be skipped on replication client. */
|
||||
if ((result= open_grant_tables(thd, tables)))
|
||||
{
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
DBUG_RETURN(result != 1);
|
||||
}
|
||||
|
||||
@ -6024,7 +6038,8 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
|
||||
mysql_rwlock_unlock(&LOCK_grant);
|
||||
close_thread_tables(thd);
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
@ -6057,13 +6072,14 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
||||
row-based replication. The flag will be reset at the end of the
|
||||
statement.
|
||||
*/
|
||||
save_binlog_row_based= thd->is_current_stmt_binlog_format_row();
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
|
||||
if ((result= open_grant_tables(thd, tables)))
|
||||
{
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
DBUG_RETURN(result != 1);
|
||||
}
|
||||
|
||||
@ -6219,7 +6235,8 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
|
||||
if (result && !binlog_error)
|
||||
my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0));
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
|
||||
DBUG_RETURN(result || binlog_error);
|
||||
}
|
||||
@ -6328,8 +6345,8 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
|
||||
row-based replication. The flag will be reset at the end of the
|
||||
statement.
|
||||
*/
|
||||
save_binlog_row_based= thd->is_current_stmt_binlog_format_row();
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row()))
|
||||
thd->clear_current_stmt_binlog_format_row();
|
||||
|
||||
/* Remove procedure access */
|
||||
do
|
||||
@ -6366,7 +6383,8 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
|
||||
|
||||
thd->pop_internal_handler();
|
||||
/* Restore the state of binlog format */
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
if (save_binlog_row_based)
|
||||
thd->set_current_stmt_binlog_format_row();
|
||||
|
||||
DBUG_RETURN(error_handler.has_errors());
|
||||
}
|
||||
|
Reference in New Issue
Block a user