List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:September 20 2010 3:08pm
Subject:bzr push into mysql-next-mr-rpl-merge branch (aelkin:3193 to 3194)
WL#5563
View as plain text  
 3194 Andrei Elkin	2010-09-20
      wl#5563
      
      stop slave handling is corrected.
      Workers clean up their assignement to decrement rli->pending_jobs as well.
      The latter counter is checked on zero to signal to the SQL thread by the last remained worker to clean up remained worker areas

    modified:
      sql/rpl_slave.cc
 3193 Andrei Elkin	2010-09-18 [merge]
      wl#5563
      
      merging from mysql-next-mr.wl-5563.wl-2775 to mysql-next-mr-wl5563-labs.

    removed:
      mysql-test/suite/perfschema/r/ddl_threads.result
      mysql-test/suite/perfschema/r/dml_threads.result
      mysql-test/suite/perfschema/t/ddl_threads.test
      mysql-test/suite/perfschema/t/dml_threads.test
      mysql-test/suite/perfschema/t/schema.test
      storage/perfschema/table_threads.cc
      storage/perfschema/table_threads.h
    added:
      mysql-test/collections/mysql-next-mr.crash-safe.daily
      mysql-test/collections/mysql-next-mr.crash-safe.push
      mysql-test/collections/mysql-next-mr.crash-safe.weekly
      mysql-test/extra/rpl_tests/rpl_crash_safe.inc
      mysql-test/extra/rpl_tests/rpl_crash_safe.test
      mysql-test/extra/rpl_tests/rpl_parallel_load.test
      mysql-test/include/not_master_info_table.inc
      mysql-test/include/not_relay_log_info_table.inc
      mysql-test/suite/perfschema/include/schema.inc
      mysql-test/suite/perfschema/r/ddl_setup_actors.result
      mysql-test/suite/perfschema/r/ddl_threads.result
      mysql-test/suite/perfschema/r/dml_setup_actors.result
      mysql-test/suite/perfschema/r/dml_threads.result
      mysql-test/suite/perfschema/r/schema_lc0.result
      mysql-test/suite/perfschema/r/schema_lc1.result
      mysql-test/suite/perfschema/r/schema_lc2.result
      mysql-test/suite/perfschema/r/setup_actors.result
      mysql-test/suite/perfschema/r/start_server_no_setup_actors.result
      mysql-test/suite/perfschema/r/threads_events.result
      mysql-test/suite/perfschema/r/threads_innodb.result
      mysql-test/suite/perfschema/r/threads_insert_delayed.result
      mysql-test/suite/perfschema/r/threads_mysql.result
      mysql-test/suite/perfschema/t/ddl_setup_actors.test
      mysql-test/suite/perfschema/t/ddl_threads.test
      mysql-test/suite/perfschema/t/dml_setup_actors.test
      mysql-test/suite/perfschema/t/dml_threads.test
      mysql-test/suite/perfschema/t/schema_lc0.test
      mysql-test/suite/perfschema/t/schema_lc1.test
      mysql-test/suite/perfschema/t/schema_lc2.test
      mysql-test/suite/perfschema/t/setup_actors.test
      mysql-test/suite/perfschema/t/start_server_no_setup_actors-master.opt
      mysql-test/suite/perfschema/t/start_server_no_setup_actors.test
      mysql-test/suite/perfschema/t/threads_innodb.test
      mysql-test/suite/perfschema/t/threads_insert_delayed.test
      mysql-test/suite/perfschema/t/threads_mysql-master.opt
      mysql-test/suite/perfschema/t/threads_mysql.test
      mysql-test/suite/rpl/r/rpl_mixed_crash_safe.result
      mysql-test/suite/rpl/r/rpl_parallel.result
      mysql-test/suite/rpl/r/rpl_row_crash_safe.result
      mysql-test/suite/rpl/r/rpl_serial.result
      mysql-test/suite/rpl/r/rpl_stm_crash_safe.result
      mysql-test/suite/rpl/t/rpl_mixed_crash_safe-slave.opt
      mysql-test/suite/rpl/t/rpl_mixed_crash_safe.test
      mysql-test/suite/rpl/t/rpl_parallel.test
      mysql-test/suite/rpl/t/rpl_row_crash_safe-slave.opt
      mysql-test/suite/rpl/t/rpl_row_crash_safe.test
      mysql-test/suite/rpl/t/rpl_serial.test
      mysql-test/suite/rpl/t/rpl_stm_crash_safe-slave.opt
      mysql-test/suite/rpl/t/rpl_stm_crash_safe.test
      mysql-test/suite/sys_vars/r/master_info_repository_basic.result
      mysql-test/suite/sys_vars/r/pfs_setup_actors_size_basic.result
      mysql-test/suite/sys_vars/r/relay_log_info_repository_basic.result
      mysql-test/suite/sys_vars/t/master_info_repository_basic.test
      mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic-master.opt
      mysql-test/suite/sys_vars/t/pfs_setup_actors_size_basic.test
      mysql-test/suite/sys_vars/t/relay_log_info_repository_basic.test
      sql/rpl_info.cc
      sql/rpl_info.h
      sql/rpl_info_factory.cc
      sql/rpl_info_factory.h
      sql/rpl_info_fields.cc
      sql/rpl_info_fields.h
      sql/rpl_info_file.cc
      sql/rpl_info_file.h
      sql/rpl_info_handler.cc
      sql/rpl_info_handler.h
      sql/rpl_info_table.cc
      sql/rpl_info_table.h
      sql/rpl_info_table_access.cc
      sql/rpl_info_table_access.h
      sql/rpl_rli_pdb.cc
      sql/rpl_rli_pdb.h
      sql/server_ids.h
      storage/perfschema/pfs_defaults.cc
      storage/perfschema/pfs_defaults.h
      storage/perfschema/pfs_setup_actor.cc
      storage/perfschema/pfs_setup_actor.h
      storage/perfschema/table_setup_actors.cc
      storage/perfschema/table_setup_actors.h
      storage/perfschema/table_threads.cc
      storage/perfschema/table_threads.h
    modified:
      .bzr-mysql/default.conf
      client/CMakeLists.txt
      client/mysqldump.c
      include/CMakeLists.txt
      include/Makefile.am
      include/mysql/psi/psi.h
      include/mysql/psi/psi_abi_v1.h.pp
      libmysqld/lib_sql.cc
      mysql-test/extra/rpl_tests/rpl_flsh_tbls.test
      mysql-test/include/show_binlog_using_logname.inc
      mysql-test/r/1st.result
      mysql-test/r/connect.result
      mysql-test/r/information_schema.result
      mysql-test/r/log_tables.result
      mysql-test/r/log_tables_upgrade.result
      mysql-test/r/mysql_upgrade.result
      mysql-test/r/mysql_upgrade_ssl.result
      mysql-test/r/mysqlcheck.result
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/sp-destruct.result
      mysql-test/r/system_mysql_db.result
      mysql-test/suite/funcs_1/r/is_columns_mysql.result
      mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result
      mysql-test/suite/funcs_1/r/is_key_column_usage.result
      mysql-test/suite/funcs_1/r/is_statistics.result
      mysql-test/suite/funcs_1/r/is_statistics_mysql.result
      mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result
      mysql-test/suite/funcs_1/r/is_table_constraints.result
      mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result
      mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result
      mysql-test/suite/funcs_1/r/is_tables_mysql.result
      mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result
      mysql-test/suite/ndb_team/r/rpl_ndb_mix_innodb.result
      mysql-test/suite/perfschema/include/setup_helper.inc
      mysql-test/suite/perfschema/include/start_server_common.inc
      mysql-test/suite/perfschema/r/func_file_io.result
      mysql-test/suite/perfschema/r/information_schema.result
      mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result
      mysql-test/suite/perfschema/r/pfs_upgrade_lc1.result
      mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result
      mysql-test/suite/perfschema/r/selects.result
      mysql-test/suite/perfschema/r/start_server_no_cond_class.result
      mysql-test/suite/perfschema/r/start_server_no_cond_inst.result
      mysql-test/suite/perfschema/r/start_server_no_file_class.result
      mysql-test/suite/perfschema/r/start_server_no_file_inst.result
      mysql-test/suite/perfschema/r/start_server_no_mutex_class.result
      mysql-test/suite/perfschema/r/start_server_no_mutex_inst.result
      mysql-test/suite/perfschema/r/start_server_no_rwlock_class.result
      mysql-test/suite/perfschema/r/start_server_no_rwlock_inst.result
      mysql-test/suite/perfschema/r/start_server_no_table_hdl.result
      mysql-test/suite/perfschema/r/start_server_no_table_inst.result
      mysql-test/suite/perfschema/r/start_server_no_thread_class.result
      mysql-test/suite/perfschema/r/start_server_no_thread_inst.result
      mysql-test/suite/perfschema/r/start_server_nothing.result
      mysql-test/suite/perfschema/r/start_server_off.result
      mysql-test/suite/perfschema/r/start_server_on.result
      mysql-test/suite/perfschema/t/disabled.def
      mysql-test/suite/perfschema/t/func_file_io.test
      mysql-test/suite/perfschema/t/selects.test
      mysql-test/suite/perfschema/t/start_server_nothing.test
      mysql-test/suite/perfschema/t/thread_cache.test
      mysql-test/suite/rpl/r/rpl_flushlog_loop.result
      mysql-test/suite/rpl/r/rpl_rotate_logs.result
      mysql-test/suite/rpl/r/rpl_server_uuid.result
      mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result
      mysql-test/suite/rpl/t/rpl_flushlog_loop.test
      mysql-test/suite/rpl/t/rpl_rotate_logs.test
      mysql-test/suite/rpl/t/rpl_server_uuid.test
      mysql-test/suite/rpl/t/rpl_show_master_info_file.test
      mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test
      mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test
      mysql-test/suite/rpl/t/rpl_sync.test
      mysql-test/suite/rpl_ndb/r/rpl_ndb_stm_innodb.result
      mysql-test/suite/sys_vars/r/all_vars.result
      mysql-test/t/information_schema.test
      mysql-test/t/mysqldump.test
      mysql-test/t/sp-destruct.test
      mysql-test/t/system_mysql_db_fix40123.test
      mysql-test/t/system_mysql_db_fix50030.test
      mysql-test/t/system_mysql_db_fix50117.test
      mysys/my_new.cc
      scripts/CMakeLists.txt
      scripts/make_win_bin_dist
      scripts/mysql_install_db.pl.in
      scripts/mysql_install_db.sh
      scripts/mysql_system_tables.sql
      sql/CMakeLists.txt
      sql/Makefile.am
      sql/binlog.cc
      sql/binlog.h
      sql/event_scheduler.cc
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster_binlog.cc
      sql/item_func.cc
      sql/lock.cc
      sql/log.cc
      sql/log_event.cc
      sql/log_event.h
      sql/log_event_old.cc
      sql/mdl.cc
      sql/mdl.h
      sql/mysqld.cc
      sql/mysqld.h
      sql/rpl_handler.cc
      sql/rpl_master.cc
      sql/rpl_mi.cc
      sql/rpl_mi.h
      sql/rpl_reporting.h
      sql/rpl_rli.cc
      sql/rpl_rli.h
      sql/rpl_slave.cc
      sql/rpl_slave.h
      sql/rpl_utility.h
      sql/share/errmsg-utf8.txt
      sql/sp.cc
      sql/sql_base.cc
      sql/sql_base.h
      sql/sql_binlog.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_connect.cc
      sql/sql_insert.cc
      sql/sql_load.cc
      sql/sql_parse.cc
      sql/sql_prepare.cc
      sql/sql_show.cc
      sql/sql_table.cc
      sql/sys_vars.cc
      sql/table.cc
      storage/perfschema/CMakeLists.txt
      storage/perfschema/Makefile.am
      storage/perfschema/ha_perfschema.cc
      storage/perfschema/ha_perfschema.h
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_engine_table.cc
      storage/perfschema/pfs_engine_table.h
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      storage/perfschema/pfs_lock.h
      storage/perfschema/pfs_server.cc
      storage/perfschema/pfs_server.h
      storage/perfschema/table_events_waits.cc
      storage/perfschema/table_events_waits.h
      storage/perfschema/table_events_waits_summary.cc
      storage/perfschema/table_events_waits_summary.h
      storage/perfschema/table_ews_global_by_event_name.cc
      storage/perfschema/table_file_instances.cc
      storage/perfschema/table_file_instances.h
      storage/perfschema/table_file_summary.cc
      storage/perfschema/table_file_summary.h
      storage/perfschema/table_performance_timers.cc
      storage/perfschema/table_setup_consumers.cc
      storage/perfschema/table_setup_instruments.cc
      storage/perfschema/table_setup_timers.cc
      storage/perfschema/table_sync_instances.cc
      storage/perfschema/table_sync_instances.h
      storage/perfschema/unittest/pfs-t.cc
      storage/perfschema/unittest/pfs_instr-oom-t.cc
      storage/perfschema/unittest/pfs_instr-t.cc
      storage/perfschema/unittest/stub_pfs_global.h
=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2010-09-17 22:28:23 +0000
+++ b/sql/rpl_slave.cc	2010-09-20 15:07:56 +0000
@@ -3433,6 +3433,7 @@ pthread_handler_t handle_slave_worker(vo
   mysql_mutex_unlock(&LOCK_thread_count);
 
   DBUG_ASSERT(thd->is_slave_error == 0);
+
   while (!thd->killed)
   {
       error= slave_worker_exec_job(w, rli);
@@ -3440,7 +3441,9 @@ pthread_handler_t handle_slave_worker(vo
  
 err:
   mysql_mutex_lock(&rli->pending_jobs_lock);
-  rli->pending_jobs= 0;
+  rli->pending_jobs--;
+  if (rli->pending_jobs == 0)
+    mysql_cond_signal(&rli->pending_jobs_cond);
   mysql_mutex_unlock(&rli->pending_jobs_lock);
   mysql_cond_signal(&rli->pending_jobs_cond); // informing the parent
   mysql_mutex_lock(&LOCK_thread_count);
@@ -3508,69 +3511,41 @@ err:
 /* 
    Worker threads ends one-by-one with synch through rli->pending_jobs
 */
-#if 0
 void slave_stop_workers(Relay_log_info *rli)
 {
   int i;
-  int wait_times= rli->workers.elements;
 
   mysql_mutex_lock(&rli->pending_jobs_lock);
+  rli->pending_jobs += rli->workers.elements;
 
   for (i= rli->workers.elements - 1; i >= 0; i--)
   {
-    struct slave_worker *w;
+    Slave_worker *w;
     get_dynamic((DYNAMIC_ARRAY*)&rli->workers, (uchar*) &w, i);
     mysql_mutex_lock(&w->thd->LOCK_thd_data);
     w->thd->awake(THD::KILL_QUERY);
     mysql_mutex_unlock(&w->thd->LOCK_thd_data);
   }
   
-  while (wait_times > 0)
+  while (rli->pending_jobs > 0)
   {
-    thd_proc_info(rli->sql_thd, "Waiting for workers to exit");
+    thd_proc_info(rli->info_thd, "Waiting for workers to exit");
     mysql_cond_wait(&rli->pending_jobs_cond, &rli->pending_jobs_lock);
-    wait_times--;
   }
 
   mysql_mutex_unlock(&rli->pending_jobs_lock);
 
   for (i= rli->workers.elements - 1; i >= 0; i--)
   {
-    struct slave_worker *w;
-    get_dynamic((DYNAMIC_ARRAY*)&rli->workers, (uchar*) &w, i);
-    mysql_mutex_destroy(&w->jobs_lock);
-    mysql_cond_destroy(&w->jobs_cond);
-    free_root(&w->mem_root, MYF(0));
-    delete_dynamic_element(&rli->workers, i);
-    delete w;
-  }
-  destroy_hash_worker();
-}
-#endif
-void slave_stop_workers(Relay_log_info *rli)
-{
-  int i;
-  for (i= rli->workers.elements - 1; i >= 0; i--)
-  {
     Slave_worker *w;
     get_dynamic((DYNAMIC_ARRAY*)&rli->workers, (uchar*) &w, i);
-    mysql_mutex_lock(&rli->pending_jobs_lock);
-    rli->pending_jobs= 1;
-    while (rli->pending_jobs > 0)
-    {
-      thd_proc_info(rli->info_thd, "Waiting for worker to exit");
-      mysql_mutex_lock(&w->thd->LOCK_thd_data);
-      w->thd->awake(THD::KILL_QUERY);
-      mysql_mutex_unlock(&w->thd->LOCK_thd_data);
-      mysql_cond_wait(&rli->pending_jobs_cond, &rli->pending_jobs_lock);
-    }
-    mysql_mutex_unlock(&rli->pending_jobs_lock);
     mysql_mutex_destroy(&w->jobs_lock);
     mysql_cond_destroy(&w->jobs_cond);
     free_root(&w->mem_root, MYF(0));
     delete_dynamic_element(&rli->workers, i);
     delete w;
   }
+  destroy_hash_workers();
 }
 
 /**


Attachment: [text/bzr-bundle] bzr/aelkin@mysql.com-20100920150756-f2hl1vep0i10ghhb.bundle
Thread
bzr push into mysql-next-mr-rpl-merge branch (aelkin:3193 to 3194)WL#5563Andrei Elkin20 Sep