[Commits] Rev 3568: MDEV-531 : Warning: Forcing close of thread ... in rpl_binlog_index in file:///H:/bzr/5.5/

Vladislav Vaintroub wlad at montyprogram.com
Fri Nov 2 11:44:00 EET 2012


At file:///H:/bzr/5.5/

------------------------------------------------------------
revno: 3568
revision-id: wlad at montyprogram.com-20121102094352-vku8sp2ddp4v9bnc
parent: knielsen at knielsen-hq.org-20121031114725-hrc7jil8cy13dkj2
committer: Vladislav Vaintroub <wlad at montyprogram.com>
branch nick: 5.5
timestamp: Fri 2012-11-02 10:43:52 +0100
message:
  MDEV-531 : Warning: Forcing close of thread ... in rpl_binlog_index
  
  Use post_kill_notification in for one_thread_per_connection scheduler, 
  the same as already used in threadpool, to reliably wake a thread  stuck in 
  read() or in different poll() variations.
-------------- next part --------------
=== modified file 'include/violite.h'
--- a/include/violite.h	2012-06-14 18:05:31 +0000
+++ b/include/violite.h	2012-11-02 09:43:52 +0000
@@ -177,6 +177,12 @@
 #endif /* !defined(DONT_MAP_VIO) */
 
 #ifdef _WIN32
+
+/* shutdown(2) flags */
+#ifndef SHUT_RD
+#define SHUT_RD SD_BOTH
+#endif
+
 /*
   Set thread id for io cancellation (required on Windows XP only,
   and should to be removed if XP is no more supported)

=== modified file 'mysql-test/include/mtr_warnings.sql'
--- a/mysql-test/include/mtr_warnings.sql	2012-01-16 20:13:05 +0000
+++ b/mysql-test/include/mtr_warnings.sql	2012-11-02 09:43:52 +0000
@@ -97,7 +97,6 @@
  ("Failed to open log"),
  ("Failed to open the existing master info file"),
  ("Forcing shutdown of [0-9]* plugins"),
- ("Forcing close of thread"),
 
  /*
    Due to timing issues, it might be that this warning

=== modified file 'sql/scheduler.cc'
--- a/sql/scheduler.cc	2012-02-28 17:53:05 +0000
+++ b/sql/scheduler.cc	2012-11-02 09:43:52 +0000
@@ -79,11 +79,34 @@
                              scheduler_wait_sync_end);
 }
 
+
+/**
+  Kill notification callback,  used by  one-thread-per-connection
+  and threadpool scheduler.
+
+  Wakes up a thread that is stuck in read/poll/epoll/event-poll 
+  routines used by threadpool, such that subsequent attempt to 
+  read from  client connection will result in IO error.
+*/
+
+void post_kill_notification(THD *thd)
+{
+  DBUG_ENTER("post_kill_notification");
+  if (current_thd == thd || thd->system_thread)
+    DBUG_VOID_RETURN;
+
+  if (thd->net.vio)
+    vio_shutdown(thd->net.vio, SHUT_RD);
+  DBUG_VOID_RETURN;
+}
+
 /*
   Initialize scheduler for --thread-handling=one-thread-per-connection
 */
 
 #ifndef EMBEDDED_LIBRARY
+
+
 void one_thread_per_connection_scheduler(scheduler_functions *func,
     ulong *arg_max_connections,
     uint *arg_connection_count)
@@ -95,6 +118,7 @@
   func->init_new_connection_thread= init_new_connection_handler_thread;
   func->add_connection= create_thread_to_handle_connection;
   func->end_thread= one_thread_per_connection_end;
+  func->post_kill_notification= post_kill_notification;
 }
 #endif
 

=== modified file 'sql/scheduler.h'
--- a/sql/scheduler.h	2012-02-28 17:53:05 +0000
+++ b/sql/scheduler.h	2012-11-02 09:43:52 +0000
@@ -78,7 +78,7 @@
 void one_thread_scheduler(scheduler_functions *func);
 
 extern void scheduler_init();
-
+extern void post_kill_notification(THD *);
 /*
  To be used for pool-of-threads (implemeneted differently on various OSs)
 */

=== modified file 'sql/threadpool_common.cc'
--- a/sql/threadpool_common.cc	2012-05-03 00:47:06 +0000
+++ b/sql/threadpool_common.cc	2012-11-02 09:43:52 +0000
@@ -257,7 +257,7 @@
   tp_add_connection,                  // add_connection
   tp_wait_begin,                      // thd_wait_begin
   tp_wait_end,                        // thd_wait_end
-  tp_post_kill_notification,          // post_kill_notification
+  post_kill_notification,             // post_kill_notification
   NULL,                               // end_thread
   tp_end                              // end
 };

=== modified file 'sql/threadpool_unix.cc'
--- a/sql/threadpool_unix.cc	2012-04-11 23:40:44 +0000
+++ b/sql/threadpool_unix.cc	2012-11-02 09:43:52 +0000
@@ -173,7 +173,6 @@
 static void *worker_main(void *param);
 static void check_stall(thread_group_t *thread_group);
 static void connection_abort(connection_t *connection);
-void tp_post_kill_notification(THD *thd);
 static void set_wait_timeout(connection_t *connection);
 static void set_next_timeout_check(ulonglong abstime);
 static void print_pool_blocked_message(bool);
@@ -444,7 +443,7 @@
       /* Wait timeout exceeded, kill connection. */
       mysql_mutex_lock(&thd->LOCK_thd_data);
       thd->killed = KILL_CONNECTION;
-      tp_post_kill_notification(thd);
+      post_kill_notification(thd);
       mysql_mutex_unlock(&thd->LOCK_thd_data);
     }
     else 
@@ -1259,21 +1258,6 @@
 
 
 /**
-  MySQL scheduler callback : kill connection
-*/
-
-void tp_post_kill_notification(THD *thd)
-{
-  DBUG_ENTER("tp_post_kill_notification");
-  if (current_thd == thd || thd->system_thread)
-    DBUG_VOID_RETURN;
-  
-  if (thd->net.vio)
-    vio_shutdown(thd->net.vio, SHUT_RD);
-  DBUG_VOID_RETURN;
-}
-
-/**
   MySQL scheduler callback: wait begin
 */
 

=== modified file 'sql/threadpool_win.cc'
--- a/sql/threadpool_win.cc	2012-05-03 00:47:06 +0000
+++ b/sql/threadpool_win.cc	2012-11-02 09:43:52 +0000
@@ -544,22 +544,6 @@
   }
 }
 
-/**
-  Notify pool about connection being killed.
-*/
-void tp_post_kill_notification(THD *thd)
-{
-   if (current_thd == thd)
-    return; /* There is nothing to do.*/
-
-  if (thd->system_thread)
-   return; /* Will crash if we attempt to kill system thread. */
-
-  Vio *vio= thd->net.vio;
-
-  vio_shutdown(vio, SD_BOTH);
-
-}
 
 /*
   Handle read completion/notification.



More information about the commits mailing list