diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2013-05-27 13:53:18 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2013-05-27 13:53:18 +0400 |
commit | 9718b9763deeaa41008aeca31c24548e556401cc (patch) | |
tree | 3d04a4ce3dff93a241a8b533fa5d4f3a78e0b8e8 /sql | |
parent | 99890bafe3cfa4974970b153a1a0736b5eddec1a (diff) | |
download | mariadb-git-9718b9763deeaa41008aeca31c24548e556401cc.tar.gz |
SHOW EXPLAIN DELETE, post merge fixes
- Fix asserts, make sure that mysql_delete() operates on
thd->apc_target correctly* in all kinds of special cases
* - correctly means that one must switch it OFF iff it
was switched ON.
- Added a few asserts to catch similar errors.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/my_apc.cc | 1 | ||||
-rw-r--r-- | sql/sql_parse.cc | 3 | ||||
-rw-r--r-- | sql/sql_update.cc | 7 |
3 files changed, 11 insertions, 0 deletions
diff --git a/sql/my_apc.cc b/sql/my_apc.cc index 3bad1331364..dcb1e3d99b1 100644 --- a/sql/my_apc.cc +++ b/sql/my_apc.cc @@ -70,6 +70,7 @@ void Apc_target::enable() void Apc_target::disable() { bool process= FALSE; + DBUG_ASSERT(enabled); mysql_mutex_lock(LOCK_thd_data_ptr); if (!(--enabled)) process= TRUE; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3b088616984..74981eb907b 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -807,7 +807,9 @@ bool do_command(THD *thd) my_net_set_read_timeout(net, thd->variables.net_read_timeout); DBUG_ASSERT(packet_length); + DBUG_ASSERT(!thd->apc_target.is_enabled()); return_value= dispatch_command(command, thd, packet+1, (uint) (packet_length-1)); + DBUG_ASSERT(!thd->apc_target.is_enabled()); out: DBUG_RETURN(return_value); @@ -1109,6 +1111,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ulong length= (ulong)(packet_end - beginning_of_next_stmt); log_slow_statement(thd); + DBUG_ASSERT(!thd->apc_target.is_enabled()); /* Remove garbage at start of query */ while (length > 0 && my_isspace(thd->charset(), *beginning_of_next_stmt)) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index ba3ee41909f..8b1b042e6df 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -279,6 +279,7 @@ int mysql_update(THD *thd, Update_plan query_plan; query_plan.index= MAX_KEY; query_plan.using_filesort= FALSE; + bool apc_target_enabled= false; // means was enabled *by code this function* DBUG_ENTER("mysql_update"); if (open_tables(thd, &table_list, &table_count, 0)) @@ -497,6 +498,7 @@ int mysql_update(THD *thd, goto exit_without_my_ok; thd->apc_target.enable(); + apc_target_enabled= true; DBUG_EXECUTE_IF("show_explain_probe_update_exec_start", dbug_serve_apcs(thd, 1);); @@ -923,6 +925,7 @@ int mysql_update(THD *thd, thd->transaction.stmt.modified_non_trans_table= TRUE; thd->apc_target.disable(); //psergey-todo. + apc_target_enabled= false; end_read_record(&info); delete select; thd_proc_info(thd, "end"); @@ -996,6 +999,9 @@ int mysql_update(THD *thd, DBUG_RETURN((error >= 0 || thd->is_error()) ? 1 : 0); err: + if (apc_target_enabled) + thd->apc_target.disable(); + delete select; free_underlaid_joins(thd, select_lex); table->disable_keyread(); @@ -1003,6 +1009,7 @@ err: DBUG_RETURN(1); exit_without_my_ok: + DBUG_ASSERT(!apc_target_enabled); thd->lex->upd_del_plan= &query_plan; select_send *result; |