← Back to team overview

maria-developers team mailing list archive

Re: [Commits] Rev 2971: MBug#643463: Slow XtraDB shutdown: Fix more sleeps delaying shutdown. in http://bazaar.launchpad.net/~maria-captains/maria/5.1

 

Hi Codership,

Can you do a review of this patch for InnoDB (XtraDB)?

It is https://bugs.launchpad.net/percona-server/+bug/643463, it fixes a
problem that a number of threads in the InnoDB code used sleep() for several
seconds, which unnecessarily delays shutdown (this is especially annoying when
doing testing, eg. the test suite).

 - Kristian.

knielsen@xxxxxxxxxxxxxxx writes:

> At http://bazaar.launchpad.net/~maria-captains/maria/5.1
>
> ------------------------------------------------------------
> revno: 2971
> revision-id: knielsen@xxxxxxxxxxxxxxx-20101109140357-2obql1onnmjg6to9
> parent: monty@xxxxxxxxxxxx-20101107122529-sl5sup1m9gjxlzte
> committer: knielsen@xxxxxxxxxxxxxxx
> branch nick: mariadb-5.1
> timestamp: Tue 2010-11-09 15:03:57 +0100
> message:
>   MBug#643463: Slow XtraDB shutdown: Fix more sleeps delaying shutdown.
>   
>   This patch removes most remaining delays due to uninteruptible sleep()
>   during shutdown, as found using PMP. This makes standard test run very
>   close in speed to with --loose-innodb-fast-shutdown=2, and greatly
>   speeds up running the test suite.
> === modified file 'storage/xtradb/include/srv0srv.h'
> --- a/storage/xtradb/include/srv0srv.h	2010-11-03 21:40:53 +0000
> +++ b/storage/xtradb/include/srv0srv.h	2010-11-09 14:03:57 +0000
> @@ -57,8 +57,8 @@ extern const char	srv_mysql50_table_name
>  thread starts running */
>  extern os_event_t       srv_lock_timeout_thread_event;
>  
> -/* This event is set to tell the purge thread to shut down */
> -extern os_event_t       srv_purge_thread_event;
> +/* This event is set at shutdown to wakeup threads from sleep */
> +extern os_event_t       srv_shutdown_event;
>  
>  /* If the last data file is auto-extended, we add this many pages to it
>  at a time */
>
> === modified file 'storage/xtradb/log/log0log.c'
> --- a/storage/xtradb/log/log0log.c	2010-11-03 21:40:53 +0000
> +++ b/storage/xtradb/log/log0log.c	2010-11-09 14:03:57 +0000
> @@ -3102,7 +3102,7 @@ logs_empty_and_mark_files_at_shutdown(vo
>          algorithm only works if the server is idle at shutdown */
>  
>          srv_shutdown_state = SRV_SHUTDOWN_CLEANUP;
> -        os_event_set(srv_purge_thread_event);
> +        os_event_set(srv_shutdown_event);
>  loop:
>          os_thread_sleep(100000);
>  
>
> === modified file 'storage/xtradb/srv/srv0srv.c'
> --- a/storage/xtradb/srv/srv0srv.c	2010-11-03 21:40:53 +0000
> +++ b/storage/xtradb/srv/srv0srv.c	2010-11-09 14:03:57 +0000
> @@ -704,7 +704,7 @@ UNIV_INTERN srv_slot_t*	srv_mysql_table 
>  
>  UNIV_INTERN os_event_t  srv_lock_timeout_thread_event;
>  
> -UNIV_INTERN os_event_t  srv_purge_thread_event;
> +UNIV_INTERN os_event_t  srv_shutdown_event;
>  
>  UNIV_INTERN srv_sys_t*  srv_sys = NULL;
>  
> @@ -1011,7 +1011,7 @@ srv_init(void)
>          }
>  
>          srv_lock_timeout_thread_event = os_event_create(NULL);
> -        srv_purge_thread_event = os_event_create(NULL);
> +        srv_shutdown_event = os_event_create(NULL);
>  
>          for (i = 0; i < SRV_MASTER + 1; i++) {
>                  srv_n_threads_active[i] = 0;
> @@ -2239,7 +2239,7 @@ loop:
>          /* Wake up every 5 seconds to see if we need to print
>          monitor information. */
>  
> -        os_thread_sleep(5000000);
> +        os_event_wait_time(srv_shutdown_event, 5000000);
>  
>          current_time = time(NULL);
>  
> @@ -2381,7 +2381,7 @@ loop:
>          /* When someone is waiting for a lock, we wake up every second
>          and check if a timeout has passed for a lock wait */
>  
> -        os_thread_sleep(1000000);
> +        os_event_wait_time(srv_shutdown_event, 1000000);
>  
>          srv_lock_timeout_active = TRUE;
>  
> @@ -2546,7 +2546,7 @@ loop:
>  
>          fflush(stderr);
>  
> -        os_thread_sleep(1000000);
> +        os_event_wait_time(srv_shutdown_event, 1000000);
>  
>          if (srv_shutdown_state < SRV_SHUTDOWN_CLEANUP) {
>  
> @@ -2590,7 +2590,7 @@ srv_LRU_dump_restore_thread(
>          last_dump_time = time(NULL);
>  
>  loop:
> -        os_thread_sleep(5000000);
> +        os_event_wait_time(srv_shutdown_event, 5000000);
>  
>          if (srv_shutdown_state >= SRV_SHUTDOWN_CLEANUP) {
>                  goto exit_func;
> @@ -2754,7 +2754,7 @@ loop:
>  
>                  if (!skip_sleep) {
>  
> -                        os_thread_sleep(1000000);
> +                        os_event_wait_time(srv_shutdown_event, 1000000);
>                          srv_main_sleeps++;
>  
>                          /*
> @@ -3340,10 +3340,10 @@ loop:
>                  mutex_exit(&kernel_mutex);
>  
>                  sleep_ms = 10;
> -                os_event_reset(srv_purge_thread_event);
> +                os_event_reset(srv_shutdown_event);
>          }
>  
> -        os_event_wait_time(srv_purge_thread_event, sleep_ms * 1000);
> +        os_event_wait_time(srv_shutdown_event, sleep_ms * 1000);
>  
>          history_len = trx_sys->rseg_history_len;
>          if (history_len > 1000)
>
> _______________________________________________
> commits mailing list
> commits@xxxxxxxxxxx
> https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits