diff options
-rw-r--r-- | include/thr_alarm.h | 1 | ||||
-rw-r--r-- | include/violite.h | 13 | ||||
-rw-r--r-- | mysql-test/include/mysqld--help.inc | 2 | ||||
-rw-r--r-- | mysql-test/r/kill.result | 3 | ||||
-rw-r--r-- | mysql-test/r/mysqld--help-win.result | 4 | ||||
-rw-r--r-- | mysql-test/t/flush_read_lock_kill.test | 2 | ||||
-rw-r--r-- | mysql-test/t/kill.test | 5 | ||||
-rw-r--r-- | sql/sql_class.cc | 6 | ||||
-rw-r--r-- | sql/sql_class.h | 5 | ||||
-rw-r--r-- | vio/vio.c | 2 | ||||
-rw-r--r-- | vio/vio_priv.h | 1 | ||||
-rw-r--r-- | vio/viosocket.c | 11 |
12 files changed, 31 insertions, 24 deletions
diff --git a/include/thr_alarm.h b/include/thr_alarm.h index 66e344d10fd..8de70d4cdb8 100644 --- a/include/thr_alarm.h +++ b/include/thr_alarm.h @@ -93,7 +93,6 @@ typedef struct st_alarm { extern uint thr_client_alarm; extern pthread_t alarm_thread; - #define thr_alarm_init(A) (*(A))=0 #define thr_alarm_in_use(A) (*(A)!= 0) void init_thr_alarm(uint max_alarm); diff --git a/include/violite.h b/include/violite.h index 05b20245c5a..f28f72662ff 100644 --- a/include/violite.h +++ b/include/violite.h @@ -175,6 +175,17 @@ void vio_end(void); #define vio_is_connected(vio) (vio)->is_connected(vio) #endif /* !defined(DONT_MAP_VIO) */ +#ifdef _WIN32 +/* + Set thread id for io cancellation (required on Windows XP only, + and should to be removed if XP is no more supported) +*/ + +#define vio_set_thread_id(vio, tid) if(vio) vio->thread_id= tid +#else +#define vio_set_thread_id(vio, tid) +#endif + /* This enumerator is used in parser - should be always visible */ enum SSL_type { @@ -237,7 +248,7 @@ struct st_vio char *shared_memory_pos; #endif /* HAVE_SMEM */ #ifdef _WIN32 - DWORD thread_id; /* Used to XP only in vio_shutdown */ + DWORD thread_id; /* Used on XP only by vio_shutdown() */ OVERLAPPED pipe_overlapped; DWORD read_timeout_ms; DWORD write_timeout_ms; diff --git a/mysql-test/include/mysqld--help.inc b/mysql-test/include/mysqld--help.inc index a037f255a3e..85f420f3c7b 100644 --- a/mysql-test/include/mysqld--help.inc +++ b/mysql-test/include/mysqld--help.inc @@ -18,7 +18,7 @@ perl; # their paths may vary: @skipvars=qw/basedir open-files-limit general-log-file log plugin-dir log-slow-queries pid-file slow-query-log-file log-basename - datadir slave-load-tmpdir tmpdir socket /; + datadir slave-load-tmpdir tmpdir socket/; # Plugins which may or may not be there: @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster feedback debug temp-pool ssl des-key-file diff --git a/mysql-test/r/kill.result b/mysql-test/r/kill.result index e1a33faa7ee..e91db0c9036 100644 --- a/mysql-test/r/kill.result +++ b/mysql-test/r/kill.result @@ -60,6 +60,9 @@ SET DEBUG_SYNC= 'now WAIT_FOR in_sync'; KILL @id; SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; Got one of the listed errors +SELECT 1; +1 +1 SET DEBUG_SYNC = 'RESET'; DROP TABLE t1, t2; SET DEBUG_SYNC= 'before_acos_function SIGNAL in_sync WAIT_FOR kill'; diff --git a/mysql-test/r/mysqld--help-win.result b/mysql-test/r/mysqld--help-win.result index 2cfa2221d1a..05cbcda7129 100644 --- a/mysql-test/r/mysqld--help-win.result +++ b/mysql-test/r/mysqld--help-win.result @@ -941,7 +941,7 @@ lower-case-table-names 1 master-info-file master.info master-retry-count 86400 master-verify-checksum FALSE -max-allowed-packet 8388608 +max-allowed-packet 1048576 max-binlog-cache-size 18446744073709547520 max-binlog-size 1073741824 max-binlog-stmt-cache-size 18446744073709547520 @@ -952,7 +952,7 @@ max-error-count 64 max-heap-table-size 16777216 max-join-size 18446744073709551615 max-length-for-sort-data 1024 -max-long-data-size 8388608 +max-long-data-size 1048576 max-prepared-stmt-count 16382 max-relay-log-size 0 max-seeks-for-key 18446744073709551615 diff --git a/mysql-test/t/flush_read_lock_kill.test b/mysql-test/t/flush_read_lock_kill.test index e0a772d9fbb..a672fa5dfc5 100644 --- a/mysql-test/t/flush_read_lock_kill.test +++ b/mysql-test/t/flush_read_lock_kill.test @@ -65,7 +65,7 @@ KILL CONNECTION @id; connection con1; --echo # Try to reap FLUSH TABLES WITH READ LOCK, --echo # it fail due to killed statement and connection. ---error 1317,2013,1927 +--error 1317,2013 reap; --echo # Switching to 'con2'. diff --git a/mysql-test/t/kill.test b/mysql-test/t/kill.test index 9e7a67a725f..7c6c37ecfc6 100644 --- a/mysql-test/t/kill.test +++ b/mysql-test/t/kill.test @@ -142,10 +142,9 @@ KILL @id; SET DEBUG_SYNC= 'now WAIT_FOR con1_end'; connection con1; ---error 1317,1053,2006,2013,1927 +--error 1317,1053,2006,2013 reap; ---error 0,2013 -let $ignore= `SELECT 1`; +SELECT 1; connection default; SET DEBUG_SYNC = 'RESET'; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 0eb5c784859..fc1c05c236f 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1701,11 +1701,7 @@ bool THD::store_globals() real_id= pthread_self(); // For debugging mysys_var->stack_ends_here= thread_stack + // for consistency, see libevent_thread_proc STACK_DIRECTION * (long)my_thread_stack_size; - -#ifdef _WIN32 - if (net.vio) - net.vio->thread_id= real_id; /* Required to support IO cancelation on XP */ -#endif + vio_set_thread_id(net.vio, real_id); /* We have to call thr_lock_info_init() again here as THD may have been created in another thread diff --git a/sql/sql_class.h b/sql/sql_class.h index c98ee4d6180..7c7ae1eb2af 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2341,10 +2341,7 @@ public: { mysql_mutex_lock(&LOCK_thd_data); active_vio = vio; -#ifdef _WIN32 - /* Required to support cancelation on XP */ - active_vio->thread_id = pthread_self(); -#endif + vio_set_thread_id(vio, pthread_self()); mysql_mutex_unlock(&LOCK_thd_data); } inline void clear_active_vio() diff --git a/vio/vio.c b/vio/vio.c index aa0d2012afa..415e3e23768 100644 --- a/vio/vio.c +++ b/vio/vio.c @@ -64,7 +64,7 @@ int vio_shared_memory_shutdown(Vio *vio, int how) int vio_pipe_shutdown(Vio *vio, int how) { - return vio_socket_shutdown(vio, how); /* cancels io */ + return cancel_io(vio->hPipe, vio->thread_id); } #endif diff --git a/vio/vio_priv.h b/vio/vio_priv.h index 3f62c508375..c390f8ea42e 100644 --- a/vio/vio_priv.h +++ b/vio/vio_priv.h @@ -39,6 +39,7 @@ size_t vio_read_pipe(Vio *vio, uchar * buf, size_t size); size_t vio_write_pipe(Vio *vio, const uchar * buf, size_t size); my_bool vio_is_connected_pipe(Vio *vio); int vio_close_pipe(Vio * vio); +int cancel_io(HANDLE handle, DWORD thread_id); int vio_shutdown_pipe(Vio *vio,int how); #endif diff --git a/vio/viosocket.c b/vio/viosocket.c index b554eec7d4f..e656d1809e4 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -144,7 +144,7 @@ static void CALLBACK cancel_io_apc(ULONG_PTR data) IO. On Vista+, simpler cancelation is done with CancelIoEx. */ -static int cancel_io(HANDLE handle, DWORD thread_id) +int cancel_io(HANDLE handle, DWORD thread_id) { static BOOL (WINAPI *fp_CancelIoEx) (HANDLE, OVERLAPPED *); static volatile int first_time= 1; @@ -177,11 +177,12 @@ static int cancel_io(HANDLE handle, DWORD thread_id) int vio_socket_shutdown(Vio *vio, int how) { -#ifdef _WIN32 - return cancel_io((HANDLE)vio->sd, vio->thread_id); -#else - return shutdown(vio->sd, how); + int ret= shutdown(vio->sd, how); +#ifdef _WIN32 + /* Cancel possible IO in progress (shutdown does not do that on Windows). */ + (void) cancel_io((HANDLE)vio->sd, vio->thread_id); #endif + return ret; } |