Below is the list of changes that have just been committed into a local
5.1 repository of andrey. When andrey does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2379 06/05/15 23:13:18 andrey@lmy004. +5 -0
Merge mysqldev@stripped:my/mysql-5.1-release
into lmy004.:/work/mysql-5.1-bug17619-new-with_system_thread_fixed_bulk_drop
sql/sql_parse.cc
1.545 06/05/15 23:13:14 andrey@lmy004. +0 -0
Auto merged
sql/sql_class.h
1.294 06/05/15 23:13:13 andrey@lmy004. +0 -0
Auto merged
sql/sql_class.cc
1.259 06/05/15 23:13:13 andrey@lmy004. +0 -0
Auto merged
sql/set_var.cc
1.184 06/05/15 23:13:13 andrey@lmy004. +0 -0
Auto merged
sql/mysqld.cc
1.556 06/05/15 23:13:12 andrey@lmy004. +0 -0
Auto merged
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: andrey
# Host: lmy004.
# Root: /work/mysql-5.1-bug17619-new-with_system_thread_fixed_bulk_drop/RESYNC
--- 1.555/sql/mysqld.cc 2006-05-15 23:10:20 +02:00
+++ 1.556/sql/mysqld.cc 2006-05-15 23:13:12 +02:00
@@ -3090,7 +3090,7 @@ with --log-bin instead.");
}
if (global_system_variables.binlog_format == BINLOG_FORMAT_UNSPEC)
{
-#ifdef HAVE_NDB_BINLOG
+#if defined(HAVE_NDB_BINLOG) && defined(HAVE_ROW_BASED_REPLICATION)
if (opt_bin_log && have_ndbcluster == SHOW_OPTION_YES)
global_system_variables.binlog_format= BINLOG_FORMAT_ROW;
else
--- 1.258/sql/sql_class.cc 2006-05-12 10:09:24 +02:00
+++ 1.259/sql/sql_class.cc 2006-05-15 23:13:13 +02:00
@@ -253,7 +253,8 @@ THD::THD()
net.last_error[0]=0; // If error on boot
net.query_cache_query=0; // If error on boot
ull=0;
- system_thread= cleanup_done= abort_on_warning= no_warnings_for_error= 0;
+ system_thread= NON_SYSTEM_THREAD;
+ cleanup_done= abort_on_warning= no_warnings_for_error= 0;
peer_port= 0; // For SHOW PROCESSLIST
#ifdef HAVE_ROW_BASED_REPLICATION
transaction.m_pending_rows_event= 0;
@@ -512,6 +513,8 @@ void add_to_status(STATUS_VAR *to_var, S
void THD::awake(THD::killed_state state_to_set)
{
+ DBUG_ENTER("THD::awake");
+ DBUG_PRINT("enter", ("this=0x%lx", this));
THD_CHECK_SENTRY(this);
safe_mutex_assert_owner(&LOCK_delete);
@@ -549,12 +552,14 @@ void THD::awake(THD::killed_state state_
*/
if (mysys_var->current_cond && mysys_var->current_mutex)
{
+ DBUG_PRINT("info", ("broadcasting mysys_var->current_cond"));
pthread_mutex_lock(mysys_var->current_mutex);
pthread_cond_broadcast(mysys_var->current_cond);
pthread_mutex_unlock(mysys_var->current_mutex);
}
pthread_mutex_unlock(&mysys_var->mutex);
}
+ DBUG_VOID_RETURN;
}
/*
--- 1.293/sql/sql_class.h 2006-05-12 10:09:25 +02:00
+++ 1.294/sql/sql_class.h 2006-05-15 23:13:13 +02:00
@@ -770,6 +770,19 @@ public:
};
+/* Flags for the THD::system_thread variable */
+enum enum_system_thread
+{
+ NON_SYSTEM_THREAD= 0,
+ SYSTEM_THREAD_DELAYED_INSERT= 1,
+ SYSTEM_THREAD_SLAVE_IO= 2,
+ SYSTEM_THREAD_SLAVE_SQL= 4,
+ SYSTEM_THREAD_NDBCLUSTER_BINLOG= 8,
+ SYSTEM_THREAD_EVENT_SCHEDULER= 16,
+ SYSTEM_THREAD_EVENT_WORKER= 32
+};
+
+
/*
For each client connection we create a separate thread with THD serving as
a thread/connection descriptor
@@ -1103,7 +1116,8 @@ public:
long dbug_thread_id;
pthread_t real_id;
uint tmp_table, global_read_lock;
- uint server_status,open_options,system_thread;
+ uint server_status,open_options;
+ enum enum_system_thread system_thread;
uint32 db_length;
uint select_number; //number of select (used for EXPLAIN)
/* variables.transaction_isolation is reset to this after each commit */
@@ -1404,11 +1418,6 @@ public:
#define reenable_binlog(A) (A)->options= tmp_disable_binlog__save_options;}
-/* Flags for the THD::system_thread (bitmap) variable */
-#define SYSTEM_THREAD_DELAYED_INSERT 1
-#define SYSTEM_THREAD_SLAVE_IO 2
-#define SYSTEM_THREAD_SLAVE_SQL 4
-#define SYSTEM_THREAD_NDBCLUSTER_BINLOG 8
/*
Used to hold information about file and file structure in exchainge
--- 1.544/sql/sql_parse.cc 2006-05-12 10:09:25 +02:00
+++ 1.545/sql/sql_parse.cc 2006-05-15 23:13:14 +02:00
@@ -2049,7 +2049,7 @@ bool dispatch_command(enum enum_server_c
{
statistic_increment(thd->status_var.com_stat[SQLCOM_KILL], &LOCK_status);
ulong id=(ulong) uint4korr(packet);
- kill_one_thread(thd,id,false);
+ sql_kill(thd,id,false);
break;
}
case COM_SET_OPTION:
@@ -3882,6 +3882,13 @@ end_with_restore_list:
res= evex_show_create_event(thd, lex->spname, lex->et->definer);
break;
}
+#ifndef DBUG_OFF
+ case SQLCOM_SHOW_SCHEDULER_STATUS:
+ {
+ res= Event_scheduler::dump_internal_status(thd);
+ break;
+ }
+#endif
case SQLCOM_CREATE_FUNCTION: // UDF function
{
if (check_access(thd,INSERT_ACL,"mysql",0,1,0,0))
@@ -4121,7 +4128,7 @@ end_with_restore_list:
MYF(0));
goto error;
}
- kill_one_thread(thd, (ulong)it->val_int(), lex->type & ONLY_KILL_QUERY);
+ sql_kill(thd, (ulong)it->val_int(), lex->type & ONLY_KILL_QUERY);
break;
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
@@ -6914,22 +6921,26 @@ bool reload_acl_and_cache(THD *thd, ulon
return result;
}
+
/*
- kill on thread
+ kills a thread
SYNOPSIS
kill_one_thread()
thd Thread class
id Thread id
+ only_kill_query Should it kill the query or the connection
NOTES
This is written such that we have a short lock on LOCK_thread_count
*/
-void kill_one_thread(THD *thd, ulong id, bool only_kill_query)
+uint kill_one_thread(THD *thd, ulong id, bool only_kill_query)
{
THD *tmp;
uint error=ER_NO_SUCH_THREAD;
+ DBUG_ENTER("kill_one_thread");
+ DBUG_PRINT("enter", ("id=%lu only_kill=%d", id, only_kill_query));
VOID(pthread_mutex_lock(&LOCK_thread_count)); // For unlink from list
I_List_iterator<THD> it(threads);
while ((tmp=it++))
@@ -6955,8 +6966,25 @@ void kill_one_thread(THD *thd, ulong id,
error=ER_KILL_DENIED_ERROR;
pthread_mutex_unlock(&tmp->LOCK_delete);
}
+ DBUG_PRINT("exit", ("%d", error));
+ DBUG_RETURN(error);
+}
+
- if (!error)
+/*
+ kills a thread and sends response
+
+ SYNOPSIS
+ sql_kill()
+ thd Thread class
+ id Thread id
+ only_kill_query Should it kill the query or the connection
+*/
+
+void sql_kill(THD *thd, ulong id, bool only_kill_query)
+{
+ uint error;
+ if (!(error= kill_one_thread(thd, id, only_kill_query)))
send_ok(thd);
else
my_error(error, MYF(0), id);
--- 1.183/sql/set_var.cc 2006-05-02 11:35:55 +02:00
+++ 1.184/sql/set_var.cc 2006-05-15 23:13:13 +02:00
@@ -222,9 +222,11 @@ sys_var_long_ptr sys_delayed_insert_time
&delayed_insert_timeout);
sys_var_long_ptr sys_delayed_queue_size("delayed_queue_size",
&delayed_queue_size);
+
+#include "event_scheduler.h"
sys_var_event_executor sys_event_executor("event_scheduler",
(my_bool *)
- &event_executor_running_global_var);
+ &Event_scheduler::scheduler_working);
sys_var_long_ptr sys_expire_logs_days("expire_logs_days",
&expire_logs_days);
sys_var_bool_ptr sys_flush("flush", &myisam_flush);
@@ -3578,6 +3580,42 @@ byte *sys_var_thd_dbug::value_ptr(THD *t
DBUG_EXPLAIN(buf, sizeof(buf));
return (byte*) thd->strdup(buf);
}
+
+
+/*
+ The update method of the global variable event_scheduler.
+ If event_scheduler is switched from 0 to 1 then the scheduler main
+ thread is started and if from 1 to 0 the scheduler thread is stopped
+
+ SYNOPSIS
+ sys_var_event_executor::update()
+ thd Thread context (unused)
+ var The new value
+
+ Returns
+ 0 OK (always)
+*/
+
+bool
+sys_var_event_executor::update(THD *thd, set_var *var)
+{
+ enum Event_scheduler::enum_error_code res;
+ /* here start the thread if not running. */
+ DBUG_ENTER("sys_var_event_executor::update");
+
+ DBUG_PRINT("new_value", ("%lu", (bool)var->save_result.ulong_value));
+ if ((res= Event_scheduler::get_instance()->
+ suspend_or_resume(var->save_result.ulong_value?
+ Event_scheduler::RESUME:
+ Event_scheduler::SUSPEND)))
+ my_error(ER_EVENT_SET_VAR_ERROR, MYF(0), (uint) res);
+#if ANREY0
+ if ((res= Event_scheduler::start_or_stop(var->save_result.ulong_value)))
+ my_error(ER_EVENT_SET_VAR_ERROR, MYF(0), (uint) res);
+#endif
+ DBUG_RETURN((bool) res);
+}
+
/****************************************************************************
Used templates
| Thread |
|---|
| • bk commit into 5.1 tree (andrey:1.2379) | ahristov | 15 May |