diff options
author | Sergei Golubchik <sergii@pisem.net> | 2011-10-19 22:55:43 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2011-10-19 22:55:43 +0200 |
commit | 9f40bfbe6ae4e24edba7be5846a832e360a5a9a3 (patch) | |
tree | 7c770af75422c77fd04e9c91783aa62de3d72bba | |
parent | a078f131215320b8b85081b878154909e9bb76e2 (diff) | |
download | mariadb-git-9f40bfbe6ae4e24edba7be5846a832e360a5a9a3.tar.gz |
bugfix: progress reporting and sub-statements
(a stored function or TRIGGER, that runs LOAD DATA, which, itself,
invokes another trigger, that also does LOAD DATA, etc).
-rw-r--r-- | sql/sql_class.cc | 17 | ||||
-rw-r--r-- | sql/sql_class.h | 1 |
2 files changed, 13 insertions, 5 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 160c8902701..cde5a431ec1 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -788,6 +788,7 @@ THD::THD() user_time.val= start_time= start_time_sec_part= 0; start_utime= prior_thr_create_utime= 0L; utime_after_lock= 0L; + progress.arena= 0; progress.report_to_client= 0; progress.max_counter= 0; current_linfo = 0; @@ -1236,11 +1237,6 @@ void THD::update_all_stats() ulonglong end_cpu_time, end_utime; double busy_time, cpu_time; - /* Reset status variables used by information_schema.processlist */ - progress.max_counter= 0; - progress.max_stage= 0; - progress.report= 0; - /* This is set at start of query if opt_userstat_running was set */ if (!userstat_running) return; @@ -3741,6 +3737,9 @@ static void thd_send_progress(THD *thd) extern "C" void thd_progress_init(MYSQL_THD thd, uint max_stage) { + DBUG_ASSERT(thd->stmt_arena != thd->progress.arena); + if (thd->progress.arena) + return; // already initialized /* Send progress reports to clients that supports it, if the command is a high level command (like ALTER TABLE) and we are not in a @@ -3753,6 +3752,7 @@ extern "C" void thd_progress_init(MYSQL_THD thd, uint max_stage) thd->progress.stage= 0; thd->progress.counter= thd->progress.max_counter= 0; thd->progress.max_stage= max_stage; + thd->progress.arena= thd->stmt_arena; } @@ -3761,6 +3761,8 @@ extern "C" void thd_progress_init(MYSQL_THD thd, uint max_stage) extern "C" void thd_progress_report(MYSQL_THD thd, ulonglong progress, ulonglong max_progress) { + if (thd->stmt_arena != thd->progress.arena) + return; if (thd->progress.max_counter != max_progress) // Simple optimization { mysql_mutex_lock(&thd->LOCK_thd_data); @@ -3784,6 +3786,8 @@ extern "C" void thd_progress_report(MYSQL_THD thd, extern "C" void thd_progress_next_stage(MYSQL_THD thd) { + if (thd->stmt_arena != thd->progress.arena) + return; mysql_mutex_lock(&thd->LOCK_thd_data); thd->progress.stage++; thd->progress.counter= 0; @@ -3810,11 +3814,14 @@ extern "C" void thd_progress_next_stage(MYSQL_THD thd) extern "C" void thd_progress_end(MYSQL_THD thd) { + if (thd->stmt_arena != thd->progress.arena) + return; /* It's enough to reset max_counter to set disable progress indicator in processlist. */ thd->progress.max_counter= 0; + thd->progress.arena= 0; } diff --git a/sql/sql_class.h b/sql/sql_class.h index abaa7d4d9cb..e2786356ac1 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1654,6 +1654,7 @@ public: uint stage, max_stage; ulonglong counter, max_counter; ulonglong next_report_time; + Query_arena *arena; } progress; thr_lock_type update_lock_default; |