diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-09-21 22:02:21 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-09-21 22:02:21 +0200 |
commit | 2e3a16e3666ee1c4bdb15f9525eefe7e78ce1d91 (patch) | |
tree | b6ae5d8147b45f46e2e9b46ab1c7c0954231b711 /sql | |
parent | bb7a70c9551c1756b1d1736ca4f6a0a965795873 (diff) | |
parent | 8d0448d5075fe822e37f81b740e83f03ab318448 (diff) | |
download | mariadb-git-2e3a16e3666ee1c4bdb15f9525eefe7e78ce1d91.tar.gz |
Merge branch '10.0' into 10.1
Diffstat (limited to 'sql')
-rw-r--r-- | sql/log.cc | 2 | ||||
-rw-r--r-- | sql/sql_class.h | 23 | ||||
-rw-r--r-- | sql/table.cc | 34 |
3 files changed, 45 insertions, 14 deletions
diff --git a/sql/log.cc b/sql/log.cc index bb93b723a41..a9f486d88c1 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -9645,6 +9645,8 @@ binlog_background_thread(void *arg __attribute__((unused))) { THD_STAGE_INFO(thd, stage_binlog_processing_checkpoint_notify); DEBUG_SYNC(thd, "binlog_background_thread_before_mark_xid_done"); + /* Set the thread start time */ + thd->set_time(); /* Grab next pointer first, as mark_xid_done() may free the element. */ next= queue->next_in_queue; mysql_bin_log.mark_xid_done(queue->binlog_id, true); diff --git a/sql/sql_class.h b/sql/sql_class.h index f64e7cb5a3f..4556487bdfe 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1549,6 +1549,29 @@ public: /** + Implements the trivial error handler which counts errors as they happen. +*/ + +class Counting_error_handler : public Internal_error_handler +{ +public: + int errors; + bool handle_condition(THD *thd, + uint sql_errno, + const char* sqlstate, + Sql_condition::enum_warning_level level, + const char* msg, + Sql_condition ** cond_hdl) + { + if (level == Sql_condition::WARN_LEVEL_ERROR) + errors++; + return false; + } + Counting_error_handler() : errors(0) {} +}; + + +/** This class is an internal error handler implementation for DROP TABLE statements. The thing is that there may be warnings during execution of these statements, which should not be exposed to the user. diff --git a/sql/table.cc b/sql/table.cc index 68961fbecaa..94b3bc9d526 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -4715,24 +4715,30 @@ void TABLE_LIST::cleanup_items() int TABLE_LIST::view_check_option(THD *thd, bool ignore_failure) { - if (check_option && check_option->val_int() == 0) + if (check_option) { - TABLE_LIST *main_view= top_table(); - if (ignore_failure) + Counting_error_handler ceh; + thd->push_internal_handler(&ceh); + bool res= check_option->val_int() == 0; + thd->pop_internal_handler(); + if (ceh.errors) + return(VIEW_CHECK_ERROR); + if (res) { - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_VIEW_CHECK_FAILED, - ER_THD(thd, ER_VIEW_CHECK_FAILED), - main_view->view_db.str, main_view->view_name.str); - return(VIEW_CHECK_SKIP); + TABLE_LIST *main_view= top_table(); + if (ignore_failure) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_VIEW_CHECK_FAILED, + ER_THD(thd, ER_VIEW_CHECK_FAILED), + main_view->view_db.str, main_view->view_name.str); + return(VIEW_CHECK_SKIP); + } + my_error(ER_VIEW_CHECK_FAILED, MYF(0), main_view->view_db.str, + main_view->view_name.str); + return(VIEW_CHECK_ERROR); } - my_error(ER_VIEW_CHECK_FAILED, MYF(0), main_view->view_db.str, - main_view->view_name.str); - return(VIEW_CHECK_ERROR); } - /* We check thd->error() because it can be set by conversion problem. */ - if (thd->is_error()) - return(VIEW_CHECK_ERROR); return(VIEW_CHECK_OK); } |