Skip to content

Commit 7d213e8

Browse files
author
Luis Soares
committed
BUG#51021: current_stmt_binlog_row_based not removed in next-mr
Deployed DBUG_ASSERT before the conditional binlog format restore.
1 parent 9ba5583 commit 7d213e8

File tree

5 files changed

+32
-0
lines changed

5 files changed

+32
-0
lines changed

sql/event_db_repository.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,7 @@ update_timing_fields_for_event(THD *thd,
10971097
if (table)
10981098
close_thread_tables(thd);
10991099
/* Restore the state of binlog format */
1100+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
11001101
if (save_binlog_row_based)
11011102
thd->set_current_stmt_binlog_format_row();
11021103

sql/events.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
377377
sql_print_error("Event Error: An error occurred while creating query string, "
378378
"before writing it into binary log.");
379379
/* Restore the state of binlog format */
380+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
380381
if (save_binlog_row_based)
381382
thd->set_current_stmt_binlog_format_row();
382383
DBUG_RETURN(TRUE);
@@ -388,6 +389,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
388389
}
389390
mysql_mutex_unlock(&LOCK_event_metadata);
390391
/* Restore the state of binlog format */
392+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
391393
if (save_binlog_row_based)
392394
thd->set_current_stmt_binlog_format_row();
393395

@@ -511,6 +513,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
511513
}
512514
mysql_mutex_unlock(&LOCK_event_metadata);
513515
/* Restore the state of binlog format */
516+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
514517
if (save_binlog_row_based)
515518
thd->set_current_stmt_binlog_format_row();
516519

@@ -588,6 +591,7 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
588591
}
589592
mysql_mutex_unlock(&LOCK_event_metadata);
590593
/* Restore the state of binlog format */
594+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
591595
if (save_binlog_row_based)
592596
thd->set_current_stmt_binlog_format_row();
593597
DBUG_RETURN(ret);

sql/sp.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,6 +1136,7 @@ sp_create_routine(THD *thd, int type, sp_head *sp)
11361136

11371137
close_thread_tables(thd);
11381138
/* Restore the state of binlog format */
1139+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
11391140
if (save_binlog_row_based)
11401141
thd->set_current_stmt_binlog_format_row();
11411142
DBUG_RETURN(ret);
@@ -1195,6 +1196,7 @@ sp_drop_routine(THD *thd, int type, sp_name *name)
11951196

11961197
close_thread_tables(thd);
11971198
/* Restore the state of binlog format */
1199+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
11981200
if (save_binlog_row_based)
11991201
thd->set_current_stmt_binlog_format_row();
12001202
DBUG_RETURN(ret);
@@ -1271,6 +1273,7 @@ sp_update_routine(THD *thd, int type, sp_name *name, st_sp_chistics *chistics)
12711273

12721274
close_thread_tables(thd);
12731275
/* Restore the state of binlog format */
1276+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
12741277
if (save_binlog_row_based)
12751278
thd->set_current_stmt_binlog_format_row();
12761279
DBUG_RETURN(ret);

sql/sql_acl.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3137,6 +3137,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
31373137
if (!(thd->spcont || rpl_filter->tables_ok(0, tables)))
31383138
{
31393139
/* Restore the state of binlog format */
3140+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
31403141
if (save_binlog_row_based)
31413142
thd->set_current_stmt_binlog_format_row();
31423143
DBUG_RETURN(FALSE);
@@ -3154,6 +3155,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
31543155
{ // Should never happen
31553156
close_thread_tables(thd); /* purecov: deadcode */
31563157
/* Restore the state of binlog format */
3158+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
31573159
if (save_binlog_row_based)
31583160
thd->set_current_stmt_binlog_format_row();
31593161
DBUG_RETURN(TRUE); /* purecov: deadcode */
@@ -3283,6 +3285,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
32833285
/* Tables are automatically closed */
32843286
thd->lex->restore_backup_query_tables_list(&backup);
32853287
/* Restore the state of binlog format */
3288+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
32863289
if (save_binlog_row_based)
32873290
thd->set_current_stmt_binlog_format_row();
32883291
DBUG_RETURN(result);
@@ -3367,6 +3370,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
33673370
if (!(thd->spcont || rpl_filter->tables_ok(0, tables)))
33683371
{
33693372
/* Restore the state of binlog format */
3373+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
33703374
if (save_binlog_row_based)
33713375
thd->set_current_stmt_binlog_format_row();
33723376
DBUG_RETURN(FALSE);
@@ -3378,6 +3382,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
33783382
{ // Should never happen
33793383
close_thread_tables(thd);
33803384
/* Restore the state of binlog format */
3385+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
33813386
if (save_binlog_row_based)
33823387
thd->set_current_stmt_binlog_format_row();
33833388
DBUG_RETURN(TRUE);
@@ -3457,6 +3462,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
34573462

34583463
mysql_rwlock_unlock(&LOCK_grant);
34593464
/* Restore the state of binlog format */
3465+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
34603466
if (save_binlog_row_based)
34613467
thd->set_current_stmt_binlog_format_row();
34623468

@@ -3520,6 +3526,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
35203526
if (!(thd->spcont || rpl_filter->tables_ok(0, tables)))
35213527
{
35223528
/* Restore the state of binlog format */
3529+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
35233530
if (save_binlog_row_based)
35243531
thd->set_current_stmt_binlog_format_row();
35253532
DBUG_RETURN(FALSE);
@@ -3531,6 +3538,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
35313538
{ // This should never happen
35323539
close_thread_tables(thd); /* purecov: deadcode */
35333540
/* Restore the state of binlog format */
3541+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
35343542
if (save_binlog_row_based)
35353543
thd->set_current_stmt_binlog_format_row();
35363544
DBUG_RETURN(TRUE); /* purecov: deadcode */
@@ -3593,6 +3601,7 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
35933601
if (!result)
35943602
my_ok(thd);
35953603
/* Restore the state of binlog format */
3604+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
35963605
if (save_binlog_row_based)
35973606
thd->set_current_stmt_binlog_format_row();
35983607

@@ -5813,6 +5822,7 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
58135822
if ((result= open_grant_tables(thd, tables)))
58145823
{
58155824
/* Restore the state of binlog format */
5825+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
58165826
if (save_binlog_row_based)
58175827
thd->set_current_stmt_binlog_format_row();
58185828
DBUG_RETURN(result != 1);
@@ -5860,6 +5870,7 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list)
58605870
mysql_rwlock_unlock(&LOCK_grant);
58615871
close_thread_tables(thd);
58625872
/* Restore the state of binlog format */
5873+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
58635874
if (save_binlog_row_based)
58645875
thd->set_current_stmt_binlog_format_row();
58655876
DBUG_RETURN(result);
@@ -5903,6 +5914,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
59035914
if ((result= open_grant_tables(thd, tables)))
59045915
{
59055916
/* Restore the state of binlog format */
5917+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
59065918
if (save_binlog_row_based)
59075919
thd->set_current_stmt_binlog_format_row();
59085920
DBUG_RETURN(result != 1);
@@ -5944,6 +5956,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
59445956
close_thread_tables(thd);
59455957
thd->variables.sql_mode= old_sql_mode;
59465958
/* Restore the state of binlog format */
5959+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
59475960
if (save_binlog_row_based)
59485961
thd->set_current_stmt_binlog_format_row();
59495962
DBUG_RETURN(result);
@@ -5987,6 +6000,7 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
59876000
if ((result= open_grant_tables(thd, tables)))
59886001
{
59896002
/* Restore the state of binlog format */
6003+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
59906004
if (save_binlog_row_based)
59916005
thd->set_current_stmt_binlog_format_row();
59926006
DBUG_RETURN(result != 1);
@@ -6038,6 +6052,7 @@ bool mysql_rename_user(THD *thd, List <LEX_USER> &list)
60386052
mysql_rwlock_unlock(&LOCK_grant);
60396053
close_thread_tables(thd);
60406054
/* Restore the state of binlog format */
6055+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
60416056
if (save_binlog_row_based)
60426057
thd->set_current_stmt_binlog_format_row();
60436058
DBUG_RETURN(result);
@@ -6078,6 +6093,7 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
60786093
if ((result= open_grant_tables(thd, tables)))
60796094
{
60806095
/* Restore the state of binlog format */
6096+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
60816097
if (save_binlog_row_based)
60826098
thd->set_current_stmt_binlog_format_row();
60836099
DBUG_RETURN(result != 1);
@@ -6235,6 +6251,7 @@ bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
62356251
if (result && !binlog_error)
62366252
my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0));
62376253
/* Restore the state of binlog format */
6254+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
62386255
if (save_binlog_row_based)
62396256
thd->set_current_stmt_binlog_format_row();
62406257

@@ -6383,6 +6400,7 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
63836400

63846401
thd->pop_internal_handler();
63856402
/* Restore the state of binlog format */
6403+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
63866404
if (save_binlog_row_based)
63876405
thd->set_current_stmt_binlog_format_row();
63886406

sql/sql_udf.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,11 +533,13 @@ int mysql_create_function(THD *thd,udf_func *udf)
533533
if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
534534
{
535535
/* Restore the state of binlog format */
536+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
536537
if (save_binlog_row_based)
537538
thd->set_current_stmt_binlog_format_row();
538539
DBUG_RETURN(1);
539540
}
540541
/* Restore the state of binlog format */
542+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
541543
if (save_binlog_row_based)
542544
thd->set_current_stmt_binlog_format_row();
543545
DBUG_RETURN(0);
@@ -547,6 +549,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
547549
dlclose(dl);
548550
mysql_rwlock_unlock(&THR_LOCK_udf);
549551
/* Restore the state of binlog format */
552+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
550553
if (save_binlog_row_based)
551554
thd->set_current_stmt_binlog_format_row();
552555
DBUG_RETURN(1);
@@ -620,17 +623,20 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
620623
if (write_bin_log(thd, TRUE, thd->query(), thd->query_length()))
621624
{
622625
/* Restore the state of binlog format */
626+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
623627
if (save_binlog_row_based)
624628
thd->set_current_stmt_binlog_format_row();
625629
DBUG_RETURN(1);
626630
}
627631
/* Restore the state of binlog format */
632+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
628633
if (save_binlog_row_based)
629634
thd->set_current_stmt_binlog_format_row();
630635
DBUG_RETURN(0);
631636
err:
632637
mysql_rwlock_unlock(&THR_LOCK_udf);
633638
/* Restore the state of binlog format */
639+
DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
634640
if (save_binlog_row_based)
635641
thd->set_current_stmt_binlog_format_row();
636642
DBUG_RETURN(1);

0 commit comments

Comments
 (0)