List:Commits« Previous MessageNext Message »
From:Alfranio Correia Date:November 23 2010 9:03am
Subject:bzr commit into mysql-next-mr.crash-safe branch (alfranio.correia:3216)
View as plain text  
#At file:///home/acorreia/workspace.oracle/repository.mysql/bzrwork/wl-5569/mysql-next-mr-wl5569/ based on revid:andrei.elkin@stripped

 3216 Alfranio Correia	2010-11-23
      This patch has the following changes:
      
        . as the coordinator is being created several times due to the use of a fake
        relay log we have made the performance schema information dinamyc.
      
        . fixed the use of a worker as a repository by calling worker->init_info and
        worker->end_info.
      
        . created a dummy repository that does not have disk access and can be used
        as base line while running performance tests and can be configured to detect
        invalid attempts to access disk.
        

    added:
      mysql-test/suite/rpl/t/rpl_parallel-slave.opt
      mysql-test/suite/rpl/t/rpl_parallel_start_stop-slave.opt
      sql/rpl_info_dummy.cc
      sql/rpl_info_dummy.h
    modified:
      sql/CMakeLists.txt
      sql/Makefile.am
      sql/mysqld.cc
      sql/rpl_info.cc
      sql/rpl_info.h
      sql/rpl_info_factory.cc
      sql/rpl_mi.cc
      sql/rpl_mi.h
      sql/rpl_rli.cc
      sql/rpl_rli.h
      sql/rpl_rli_pdb.h
      sql/rpl_slave.cc
=== added file 'mysql-test/suite/rpl/t/rpl_parallel-slave.opt'
--- a/mysql-test/suite/rpl/t/rpl_parallel-slave.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_parallel-slave.opt	2010-11-23 09:03:37 +0000
@@ -0,0 +1 @@
+--relay-log-info-repository=FILE

=== added file 'mysql-test/suite/rpl/t/rpl_parallel_start_stop-slave.opt'
--- a/mysql-test/suite/rpl/t/rpl_parallel_start_stop-slave.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_parallel_start_stop-slave.opt	2010-11-23 09:03:37 +0000
@@ -0,0 +1 @@
+--relay-log-info-repository=FILE

=== modified file 'sql/CMakeLists.txt'
--- a/sql/CMakeLists.txt	2010-11-09 13:04:14 +0000
+++ b/sql/CMakeLists.txt	2010-11-23 09:03:37 +0000
@@ -106,7 +106,8 @@ ADD_DEPENDENCIES(master GenError)
 SET (SLAVE_SOURCE rpl_slave.cc rpl_reporting.cc rpl_mi.cc rpl_rli.cc
 		  rpl_info_handler.cc rpl_info_file.cc rpl_info_table.cc
 		  rpl_info_values.cc rpl_info.cc rpl_info_factory.cc
-		  rpl_info_table_access.cc server_ids.h rpl_rli_pdb.cc)
+		  rpl_info_table_access.cc server_ids.h rpl_rli_pdb.cc
+		  rpl_info_dummy.cc)
 ADD_LIBRARY(slave ${SLAVE_SOURCE})
 ADD_DEPENDENCIES(slave GenError)
 ADD_LIBRARY(sqlgunitlib mdl.cc sql_list.cc sql_string.cc thr_malloc.cc)

=== modified file 'sql/Makefile.am'
--- a/sql/Makefile.am	2010-11-09 13:04:14 +0000
+++ b/sql/Makefile.am	2010-11-23 09:03:37 +0000
@@ -110,7 +110,7 @@ noinst_HEADERS =	item.h item_func.h item
 			rpl_info_handler.h \
 			log.h sql_show.h rpl_info.h rpl_info_file.h \
 			rpl_info_table.h rpl_rli.h rpl_mi.h rpl_info_values.h \
-			rpl_info_table_access.h \
+			rpl_info_table_access.h rpl_info_dummy.h \
 			rpl_info_factory.h server_ids.h rpl_rli_pdb.h \
 			sql_select.h structs.h table.h sql_udf.h hash_filo.h \
 			lex.h lex_symbol.h sql_acl.h sql_crypt.h sql_base.h \
@@ -196,7 +196,7 @@ librpl_la_SOURCES    =  rpl_handler.cc r
 libmaster_la_SOURCES =	rpl_master.cc
 libslave_la_SOURCES = 	rpl_slave.cc rpl_reporting.cc rpl_rli.cc rpl_mi.cc \
 			rpl_info.cc rpl_info_factory.cc rpl_info_file.cc \
-			rpl_info_handler.cc rpl_info_table.cc \
+			rpl_info_handler.cc rpl_info_table.cc rpl_info_dummy.cc \
 			rpl_info_table_access.cc rpl_info_values.cc rpl_rli_pdb.cc
 libndb_la_CPPFLAGS=	@ndbcluster_includes@
 libndb_la_SOURCES=	ha_ndbcluster.cc \

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2010-11-09 13:04:14 +0000
+++ b/sql/mysqld.cc	2010-11-23 09:03:37 +0000
@@ -7836,9 +7836,8 @@ PSI_mutex_key key_BINLOG_LOCK_index, key
   key_LOCK_server_started, key_LOCK_status,
   key_LOCK_system_variables_hash, key_LOCK_table_share, key_LOCK_thd_data,
   key_LOCK_user_conn, key_LOCK_uuid_generator, key_LOG_LOCK_log,
-  key_master_info_data_lock, key_master_info_run_lock,
-  key_mutex_slave_reporting_capability_err_lock, key_relay_log_info_data_lock,
-  key_relay_log_info_log_space_lock, key_relay_log_info_run_lock,
+  key_mutex_slave_reporting_capability_err_lock,
+  key_relay_log_info_log_space_lock,
   key_structure_guard_mutex, key_TABLE_SHARE_LOCK_ha_data,
   key_LOCK_error_messages, key_LOG_INFO_lock, key_LOCK_thread_count,
   key_PARTITION_LOCK_auto_inc;
@@ -7880,12 +7879,8 @@ static PSI_mutex_info all_server_mutexes
   { &key_LOCK_user_conn, "LOCK_user_conn", PSI_FLAG_GLOBAL},
   { &key_LOCK_uuid_generator, "LOCK_uuid_generator", PSI_FLAG_GLOBAL},
   { &key_LOG_LOCK_log, "LOG::LOCK_log", 0},
-  { &key_master_info_data_lock, "Master_info::data_lock", 0},
-  { &key_master_info_run_lock, "Master_info::run_lock", 0},
   { &key_mutex_slave_reporting_capability_err_lock, "Slave_reporting_capability::err_lock", 0},
-  { &key_relay_log_info_data_lock, "Relay_log_info::data_lock", 0},
   { &key_relay_log_info_log_space_lock, "Relay_log_info::log_space_lock", 0},
-  { &key_relay_log_info_run_lock, "Relay_log_info::run_lock", 0},
   { &key_structure_guard_mutex, "Query_cache::structure_guard_mutex", 0},
   { &key_TABLE_SHARE_LOCK_ha_data, "TABLE_SHARE::LOCK_ha_data", 0},
   { &key_LOCK_error_messages, "LOCK_error_messages", PSI_FLAG_GLOBAL},
@@ -7919,10 +7914,8 @@ PSI_cond_key key_BINLOG_COND_prep_xids,
   key_COND_cache_status_changed, key_COND_global_read_lock, key_COND_manager,
   key_COND_server_started,
   key_delayed_insert_cond, key_delayed_insert_cond_client,
-  key_item_func_sleep_cond, key_master_info_data_cond,
-  key_master_info_start_cond, key_master_info_stop_cond,
-  key_relay_log_info_data_cond, key_relay_log_info_log_space_cond,
-  key_relay_log_info_start_cond, key_relay_log_info_stop_cond,
+  key_item_func_sleep_cond,
+  key_relay_log_info_log_space_cond,
   key_TABLE_SHARE_cond, key_user_level_lock_cond,
   key_COND_thread_count, key_COND_thread_cache, key_COND_flush_thread_cache;
 
@@ -7945,13 +7938,7 @@ static PSI_cond_info all_server_conds[]=
   { &key_delayed_insert_cond, "Delayed_insert::cond", 0},
   { &key_delayed_insert_cond_client, "Delayed_insert::cond_client", 0},
   { &key_item_func_sleep_cond, "Item_func_sleep::cond", 0},
-  { &key_master_info_data_cond, "Master_info::data_cond", 0},
-  { &key_master_info_start_cond, "Master_info::start_cond", 0},
-  { &key_master_info_stop_cond, "Master_info::stop_cond", 0},
-  { &key_relay_log_info_data_cond, "Relay_log_info::data_cond", 0},
   { &key_relay_log_info_log_space_cond, "Relay_log_info::log_space_cond", 0},
-  { &key_relay_log_info_start_cond, "Relay_log_info::start_cond", 0},
-  { &key_relay_log_info_stop_cond, "Relay_log_info::stop_cond", 0},
   { &key_TABLE_SHARE_cond, "TABLE_SHARE::cond", 0},
   { &key_user_level_lock_cond, "User_level_lock::cond", 0},
   { &key_COND_thread_count, "COND_thread_count", PSI_FLAG_GLOBAL},

=== modified file 'sql/rpl_info.cc'
--- a/sql/rpl_info.cc	2010-11-11 11:53:01 +0000
+++ b/sql/rpl_info.cc	2010-11-23 09:03:37 +0000
@@ -48,36 +48,101 @@ void Rpl_info::set_rpl_info_handler(Rpl_
   handler= param_handler;
 }
 
-Rpl_info_coordinator::Rpl_info_coordinator(const char* type,
-                   PSI_mutex_key *param_key_info_run_lock,
-                   PSI_mutex_key *param_key_info_data_lock,
-                   PSI_mutex_key *param_key_info_data_cond,
-                   PSI_mutex_key *param_key_info_start_cond,
-                   PSI_mutex_key *param_key_info_stop_cond)
-  : Rpl_info(type),
-  key_info_run_lock(param_key_info_run_lock),
-  key_info_data_lock(param_key_info_data_lock),
-  key_info_data_cond(param_key_info_data_cond),
-  key_info_start_cond(param_key_info_start_cond),
-  key_info_stop_cond(param_key_info_stop_cond)
+Rpl_info_coordinator::Rpl_info_coordinator(const char* type)
+  : Rpl_info(type)
 {
-  mysql_mutex_init(*key_info_run_lock, &run_lock, MY_MUTEX_INIT_FAST);
-  mysql_mutex_init(*key_info_data_lock,
-                   &data_lock, MY_MUTEX_INIT_FAST);
-  mysql_cond_init(*key_info_data_cond, &data_cond, NULL);
-  mysql_cond_init(*key_info_start_cond, &start_cond, NULL);
-  mysql_cond_init(*key_info_stop_cond, &stop_cond, NULL);
+  register_mutexes(type);
+}
+
+bool Rpl_info_coordinator::register_mutexes(const char* description)
+{
+  PSI_mutex_info *mutex_info= NULL;
+  PSI_cond_info *cond_info= NULL;
+  PSI_mutex_key *key_mutex_info= NULL;
+  PSI_cond_key *key_cond_info= NULL;
+
+  const int NUMBER_MUTEX_INFO= 2;
+  const int RUN_LOCK_IDX=   0;
+  const int DATA_LOCK_IDX=  1;
+
+  const int NUMBER_COND_INFO= 3;
+  const int DATA_COND_IDX=  0;
+  const int START_COND_IDX= 1;
+  const int STOP_COND_IDX=  2;
+
+  if (!(key_mutex_info= new PSI_mutex_key[NUMBER_MUTEX_INFO]) ||
+      !(key_cond_info= new PSI_cond_key[NUMBER_COND_INFO]) ||
+      !(mutex_info= new PSI_mutex_info[NUMBER_MUTEX_INFO]) ||
+      !(cond_info= new PSI_cond_info[NUMBER_COND_INFO]))
+    goto err;
+
+  mutex_info[RUN_LOCK_IDX].m_key= (PSI_mutex_key *) &(key_mutex_info[RUN_LOCK_IDX]);
+  mutex_info[RUN_LOCK_IDX].m_name= "Rpl_info_coordinator::run_lock";
+  mutex_info[RUN_LOCK_IDX].m_flags= 0;
+  mutex_info[DATA_LOCK_IDX].m_key= (PSI_mutex_key *) &(key_mutex_info[DATA_LOCK_IDX]);
+  mutex_info[DATA_LOCK_IDX].m_name= "Rpl_info_coordinator::data_lock";
+  mutex_info[DATA_LOCK_IDX].m_flags= 0;
+
+  cond_info[DATA_COND_IDX].m_key= (PSI_cond_key *) &(key_cond_info[DATA_COND_IDX]);
+  cond_info[DATA_COND_IDX].m_name= "Rpl_info_coordinator::data_cond";
+  cond_info[DATA_COND_IDX].m_flags= 0;
+  cond_info[START_COND_IDX].m_key= (PSI_cond_key *) &(key_cond_info[START_COND_IDX]);
+  cond_info[START_COND_IDX].m_name= "Rpl_info_coordinator::start_cond";
+  cond_info[START_COND_IDX].m_flags= 0;
+  cond_info[STOP_COND_IDX].m_key= (PSI_cond_key *) &(key_cond_info[STOP_COND_IDX]);
+  cond_info[STOP_COND_IDX].m_name= "Rpl_info_coordinator::stop_cond";
+  cond_info[STOP_COND_IDX].m_flags= 0;
+
+  if (PSI_server)
+  {
+    PSI_server->register_mutex(description, mutex_info,
+                               NUMBER_MUTEX_INFO);
+
+    PSI_server->register_cond(description, cond_info,
+                              NUMBER_MUTEX_INFO);
+  }
+
+  mysql_mutex_init(key_mutex_info[RUN_LOCK_IDX], &run_lock,
+                   MY_MUTEX_INIT_FAST);
+  mysql_mutex_init(key_mutex_info[DATA_LOCK_IDX], &data_lock,
+                   MY_MUTEX_INIT_FAST);
+
+  mysql_cond_init(key_cond_info[DATA_COND_IDX], &data_cond, NULL);
+  mysql_cond_init(key_cond_info[START_COND_IDX], &start_cond, NULL);
+  mysql_cond_init(key_cond_info[STOP_COND_IDX], &stop_cond, NULL);
+
+  registered_mutexes= TRUE; 
+
+  return (FALSE);
+
+err:
+  if (key_mutex_info)
+    delete []key_mutex_info;
+  
+  if (key_cond_info)
+    delete []key_cond_info;
+
+  if (mutex_info)
+    delete []mutex_info;
+
+  if (mutex_info)
+    delete []mutex_info;
+
+  return (TRUE);
 }
 
 Rpl_info_coordinator::~Rpl_info_coordinator()
 {
   DBUG_ENTER("Rpl_info_coordinator::~Rpl_info_coordinator");
 
-  mysql_mutex_destroy(&run_lock);
-  mysql_mutex_destroy(&data_lock);
-  mysql_cond_destroy(&data_cond);
-  mysql_cond_destroy(&start_cond);
-  mysql_cond_destroy(&stop_cond);
+  if (registered_mutexes)
+  {
+    mysql_mutex_destroy(&run_lock);
+    mysql_mutex_destroy(&data_lock);
+    mysql_cond_destroy(&data_cond);
+    mysql_cond_destroy(&start_cond);
+    mysql_cond_destroy(&stop_cond);
+  }
 
   DBUG_VOID_RETURN;
 }

=== modified file 'sql/rpl_info.h'
--- a/sql/rpl_info.h	2010-11-11 11:53:01 +0000
+++ b/sql/rpl_info.h	2010-11-23 09:03:37 +0000
@@ -89,6 +89,7 @@ public:
     run_lock, data_lock, relay_log.LOCK_log, relay_log.LOCK_index
   */
   mysql_mutex_t data_lock,run_lock;
+
   /*
     start_cond is broadcast when SQL thread is started
     stop_cond - when stopped
@@ -96,22 +97,31 @@ public:
   */
   mysql_cond_t data_cond, start_cond, stop_cond;
 
-  PSI_mutex_key *key_info_run_lock, *key_info_data_lock;
-
-  PSI_mutex_key *key_info_data_cond, *key_info_start_cond, *key_info_stop_cond;
-
 #ifndef DBUG_OFF
   int events_until_exit;
 #endif
 
-  Rpl_info_coordinator(const char* type,
-           PSI_mutex_key *param_key_info_run_lock,
-           PSI_mutex_key *param_key_info_data_lock,
-           PSI_mutex_key *param_key_info_data_cond,
-           PSI_mutex_key *param_key_info_start_cond,
-           PSI_mutex_key *param_key_info_stop_cond);
+  Rpl_info_coordinator(const char* type);
   virtual ~Rpl_info_coordinator();
 
+  /**
+    Identifies if mutexes and condition variables were successfuly
+    created and registered. 
+  */
+  bool registered_mutexes;
+
+protected:
+  /**
+    Registers mutexes and condition variables in the performance
+    schema.
+
+    @param description identifier to ease its localization in
+    the peformance schema.
+
+    @return FALSE if success, TRUE if error.
+  */
+  bool register_mutexes(const char* description);
+
 private:
   Rpl_info_coordinator& operator=(const Rpl_info_coordinator& info);
   Rpl_info_coordinator(const Rpl_info_coordinator& info);

=== added file 'sql/rpl_info_dummy.cc'
--- a/sql/rpl_info_dummy.cc	1970-01-01 00:00:00 +0000
+++ b/sql/rpl_info_dummy.cc	2010-11-23 09:03:37 +0000
@@ -0,0 +1,156 @@
+/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+#include <my_global.h>
+#include "rpl_info_dummy.h"
+
+Rpl_info_dummy::Rpl_info_dummy(bool param_abort)
+  :Rpl_info_handler(0),  abort(param_abort)
+{
+}
+
+int Rpl_info_dummy::do_init_info(const ulong *uidx __attribute__((unused)),
+                                const uint nidx __attribute__((unused)))
+{
+  return 0;
+}
+
+int Rpl_info_dummy::do_prepare_info_for_read()
+{
+  if (abort) DBUG_ASSERT(0);
+  return 0;
+}
+
+int Rpl_info_dummy::do_prepare_info_for_write()
+{
+  if (abort) DBUG_ASSERT(0);
+  return 0;
+}
+
+int Rpl_info_dummy::do_check_info(const ulong *uidx __attribute__((unused)),
+                                 const uint nidx __attribute__((unused)))
+{
+  if (abort) DBUG_ASSERT(0);
+  return 0;
+}
+
+int Rpl_info_dummy::do_flush_info(const ulong *uidx __attribute__((unused)),
+                                 const uint nidx __attribute__((unused)),
+                                 const bool force __attribute__((unused)))
+{
+  if (abort) DBUG_ASSERT(0);
+  return 0;
+}
+
+void Rpl_info_dummy::do_end_info(const ulong *uidx __attribute__((unused)),
+                                const uint nidx __attribute__((unused)))
+{
+  return;
+}
+
+int Rpl_info_dummy::do_remove_info(const ulong *uidx __attribute__((unused)),
+                                  const uint nidx __attribute__((unused)))
+{
+  if (abort) DBUG_ASSERT(0);
+  return 0;
+}
+
+bool Rpl_info_dummy::do_set_info(const int pos __attribute__((unused)),
+                                const char *value __attribute__((unused)))
+{
+  if (abort) DBUG_ASSERT(0);
+  return FALSE;
+}
+
+bool Rpl_info_dummy::do_set_info(const int pos __attribute__((unused)),
+                                const ulong value __attribute__((unused)))
+{
+  if (abort) DBUG_ASSERT(0);
+  return FALSE;
+}
+
+bool Rpl_info_dummy::do_set_info(const int pos __attribute__((unused)),
+                                const int value __attribute__((unused)))
+{
+  if (abort) DBUG_ASSERT(0);
+  return FALSE;
+}
+
+bool Rpl_info_dummy::do_set_info(const int pos __attribute__((unused)),
+                                const float value __attribute__((unused)))
+{
+  if (abort) DBUG_ASSERT(0);
+  return FALSE;
+}
+
+bool Rpl_info_dummy::do_set_info(const int pos __attribute__((unused)),
+                                const Server_ids *value __attribute__((unused)))
+{
+  if (abort) DBUG_ASSERT(0);
+  return FALSE;
+}
+
+bool Rpl_info_dummy::do_get_info(const int pos __attribute__((unused)),
+                                char *value __attribute__((unused)),
+                                const size_t size __attribute__((unused)),
+                                const char *default_value __attribute__((unused)))
+{
+  if (abort) DBUG_ASSERT(0);
+  return FALSE;
+}
+
+bool Rpl_info_dummy::do_get_info(const int pos __attribute__((unused)),
+                                ulong *value __attribute__((unused)),
+                                const ulong default_value __attribute__((unused)))
+{
+  if (abort) DBUG_ASSERT(0);
+  return FALSE;
+}
+
+bool Rpl_info_dummy::do_get_info(const int pos __attribute__((unused)),
+                                int *value __attribute__((unused)),
+                                const int default_value __attribute__((unused)))
+{
+  if (abort) DBUG_ASSERT(0);
+  return FALSE;
+}
+
+bool Rpl_info_dummy::do_get_info(const int pos __attribute__((unused)),
+                                float *value __attribute__((unused)),
+                                const float default_value __attribute__((unused)))
+{
+  if (abort) DBUG_ASSERT(0);
+  return FALSE;
+}
+
+bool Rpl_info_dummy::do_get_info(const int pos __attribute__((unused)),
+                                Server_ids *value __attribute__((unused)),
+                                const Server_ids *default_value __attribute__((unused)))
+{
+  if (abort) DBUG_ASSERT(0);
+  return FALSE;
+}
+
+char* Rpl_info_dummy::do_get_description_info()
+{
+  if (abort) DBUG_ASSERT(0);
+  return NULL;
+}
+
+bool Rpl_info_dummy::do_is_transactional()
+{
+  if (abort) DBUG_ASSERT(0);
+  return FALSE;
+}

=== added file 'sql/rpl_info_dummy.h'
--- a/sql/rpl_info_dummy.h	1970-01-01 00:00:00 +0000
+++ b/sql/rpl_info_dummy.h	2010-11-23 09:03:37 +0000
@@ -0,0 +1,69 @@
+/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+#ifndef RPL_INFO_DUMMY_H
+#define RPL_INFO_DUMMY_H
+
+#include <my_global.h>
+#include <sql_priv.h>
+#include "rpl_info_handler.h"
+
+/**
+  Defines a dummy handler that should only be internally accessed.
+  This class is useful for debugging and performance tests.
+
+  The flag abort indicates if the execution should abort if some
+  methods are called. See the code for further details.
+*/
+class Rpl_info_dummy : public Rpl_info_handler
+{
+public:
+  Rpl_info_dummy(bool param_abort);
+  virtual ~Rpl_info_dummy() { };
+
+private:
+  int do_init_info(const ulong *uidx, const uint nidx);
+  int do_check_info(const ulong *uidx, const uint nidx);
+  void do_end_info(const ulong *uidx, const uint nidx);
+  int do_flush_info(const ulong *uidx, const uint nidx,
+                    const bool force);
+  int do_remove_info(const ulong *uidx, const uint nidx);
+
+  int do_prepare_info_for_read();
+  int do_prepare_info_for_write();
+  bool do_set_info(const int pos, const char *value);
+  bool do_set_info(const int pos, const int value);
+  bool do_set_info(const int pos, const ulong value);
+  bool do_set_info(const int pos, const float value);
+  bool do_set_info(const int pos, const Server_ids *value);
+  bool do_get_info(const int pos, char *value, const size_t size,
+                   const char *default_value);
+  bool do_get_info(const int pos, int *value,
+                   const int default_value);
+  bool do_get_info(const int pos, ulong *value,
+                   const ulong default_value);
+  bool do_get_info(const int pos, float *value,
+                   const float default_value);
+  bool do_get_info(const int pos, Server_ids *value,
+                   const Server_ids *default_value);
+  char* do_get_description_info();
+  bool do_is_transactional();
+
+  bool abort;
+
+  Rpl_info_dummy& operator=(const Rpl_info_dummy& info);
+  Rpl_info_dummy(const Rpl_info_dummy& info);
+};
+#endif /* RPL_INFO_DUMMY_H */

=== modified file 'sql/rpl_info_factory.cc'
--- a/sql/rpl_info_factory.cc	2010-11-12 17:58:12 +0000
+++ b/sql/rpl_info_factory.cc	2010-11-23 09:03:37 +0000
@@ -87,11 +87,8 @@ Master_info *Rpl_info_factory::create_mi
 
   DBUG_ENTER("Rpl_info_factory::create_mi");
 
-  if (!(mi= new Master_info(&key_master_info_run_lock,
-                            &key_master_info_data_lock,
-                            &key_master_info_data_cond,
-                            &key_master_info_start_cond,
-                            &key_master_info_stop_cond)))
+  if (!(mi= new Master_info()) ||
+      !(mi->registered_mutexes))
     goto err;
 
   /*
@@ -169,12 +166,8 @@ Relay_log_info *Rpl_info_factory::create
 
   DBUG_ENTER("Rpl_info_factory::create_rli");
 
-  if (!(rli= new Relay_log_info(is_slave_recovery,
-                                &key_relay_log_info_run_lock,
-                                &key_relay_log_info_data_lock,
-                                &key_relay_log_info_data_cond,
-                                &key_relay_log_info_start_cond,
-                                &key_relay_log_info_stop_cond)))
+  if (!(rli= new Relay_log_info(is_slave_recovery)) ||
+      !(rli->registered_mutexes))
     goto err;
 
   /*
@@ -397,35 +390,38 @@ Slave_worker *Rpl_info_factory::create_w
   if (!(worker= new Slave_worker(info_name)))
     goto err;
 
-  /*
-    Now we instantiate all info repos and later decide which one to take,
-    but not without first checking if there is already existing data for
-    a repo different from the one that is being requested.
-  */
-  if (!(w_file= new Rpl_info_file(worker->get_number_worker_fields(),
-                                  info_fname)))
-    goto err;
-
-  if (!(w_table= new Rpl_info_table(worker->get_number_worker_fields() + 1,
-                                    WORKER_SCHEMA, WORKER_TABLE)))
-    goto err;
-
-  DBUG_ASSERT(rli_option == RLI_REPOSITORY_FILE ||
-              rli_option == RLI_REPOSITORY_TABLE);
+  if (rli)
+  {
+    /*
+      Now we instantiate all info repos and later decide which one to take,
+      but not without first checking if there is already existing data for
+      a repo different from the one that is being requested.
+    */
+    if (!(w_file= new Rpl_info_file(worker->get_number_worker_fields(),
+                                    info_fname)))
+      goto err;
+
+    if (!(w_table= new Rpl_info_table(worker->get_number_worker_fields() + 1,
+                                      WORKER_SCHEMA, WORKER_TABLE)))
+      goto err;
 
-  /*
-   Check if this is conceptually right and what happens in case of
-   partial failures. Problems will not happen if we decide to use
-   only TABLES as repositories. /Alfranio
-  */
-  if (decide_repository(worker, idx, sizeof(idx), &w_table, &w_file,
-                        rli_option == MI_REPOSITORY_TABLE, &msg))
-    goto err;
+    DBUG_ASSERT(rli_option == RLI_REPOSITORY_FILE ||
+                rli_option == RLI_REPOSITORY_TABLE);
 
-  if ((rli_option == RLI_REPOSITORY_TABLE) &&
-       change_engine(static_cast<Rpl_info_table *>(w_table),
-                     relay_log_info_engine, &msg))
-    goto err;
+    /*
+     Check if this is conceptually right and what happens in case of
+     partial failures. Problems will not happen if we decide to use
+     only TABLES as repositories. /Alfranio
+    */
+    if (decide_repository(worker, idx, sizeof(idx), &w_table, &w_file,
+                          rli_option == MI_REPOSITORY_TABLE, &msg))
+      goto err;
+
+    if ((rli_option == RLI_REPOSITORY_TABLE) &&
+         change_engine(static_cast<Rpl_info_table *>(w_table),
+                       relay_log_info_engine, &msg))
+      goto err;
+  }
 
   DBUG_RETURN(worker);
 

=== modified file 'sql/rpl_mi.cc'
--- a/sql/rpl_mi.cc	2010-11-11 11:53:01 +0000
+++ b/sql/rpl_mi.cc	2010-11-23 09:03:37 +0000
@@ -76,15 +76,8 @@ const char *info_mi_fields []=
   "retry_count"
 };
 
-Master_info::Master_info(PSI_mutex_key *param_key_info_run_lock,
-                         PSI_mutex_key *param_key_info_data_lock,
-                         PSI_mutex_key *param_key_info_data_cond,
-                         PSI_mutex_key *param_key_info_start_cond,
-                         PSI_mutex_key *param_key_info_stop_cond)
-   :Rpl_info_coordinator("I/O",
-             param_key_info_run_lock, param_key_info_data_lock,
-             param_key_info_data_cond, param_key_info_start_cond,
-             param_key_info_stop_cond),
+Master_info::Master_info()
+   :Rpl_info_coordinator("I/O"),
    ssl(0), ssl_verify_server_cert(0),
    port(MYSQL_PORT), connect_retry(DEFAULT_CONNECT_RETRY),
    clock_diff_with_master(0), heartbeat_period(0),

=== modified file 'sql/rpl_mi.h'
--- a/sql/rpl_mi.h	2010-11-11 11:53:01 +0000
+++ b/sql/rpl_mi.h	2010-11-23 09:03:37 +0000
@@ -63,11 +63,7 @@ typedef struct st_mysql MYSQL;
 class Master_info : public Rpl_info_coordinator
 {
  public:
-  Master_info(PSI_mutex_key *param_key_info_run_lock,
-              PSI_mutex_key *param_key_info_data_lock,
-              PSI_mutex_key *param_key_info_data_cond,
-              PSI_mutex_key *param_key_info_start_cond,
-              PSI_mutex_key *param_key_info_stop_cond);
+  Master_info();
   virtual ~Master_info();
 
   /* the variables below are needed because we can change masters on the fly */

=== modified file 'sql/rpl_rli.cc'
--- a/sql/rpl_rli.cc	2010-11-18 14:00:52 +0000
+++ b/sql/rpl_rli.cc	2010-11-23 09:03:37 +0000
@@ -55,16 +55,8 @@ PSI_mutex_key key_mutex_slave_parallel_p
 PSI_cond_key *key_cond_slave_parallel_worker= NULL;
 PSI_cond_key key_cond_slave_parallel_pend_jobs;
 
-Relay_log_info::Relay_log_info(bool is_slave_recovery,
-                               PSI_mutex_key *param_key_info_run_lock,
-                               PSI_mutex_key *param_key_info_data_lock,
-                               PSI_mutex_key *param_key_info_data_cond,
-                               PSI_mutex_key *param_key_info_start_cond,
-                               PSI_mutex_key *param_key_info_stop_cond)
-   :Rpl_info_coordinator("SQL",
-             param_key_info_run_lock, param_key_info_data_lock,
-             param_key_info_data_cond, param_key_info_start_cond,
-             param_key_info_stop_cond),
+Relay_log_info::Relay_log_info(bool is_slave_recovery)
+   :Rpl_info_coordinator("SQL"),
    replicate_same_server_id(::replicate_same_server_id),
    cur_log_fd(-1), relay_log(&sync_relaylog_period),
    is_relay_log_recovery(is_slave_recovery),
@@ -115,10 +107,10 @@ Relay_log_info::Relay_log_info(bool is_s
   for (wi= 0; wi < slave_parallel_workers; wi++)
   {
      worker_mutexes[wi].m_key= (PSI_mutex_key *) &(key_mutex_slave_parallel_worker[wi]);
-     worker_mutexes[wi].m_name= "struct slave_worker::jobs_lock";
+     worker_mutexes[wi].m_name= "Slave_worker::jobs_lock";
      worker_mutexes[wi].m_flags= 0;
      worker_conds[wi].m_key= (PSI_cond_key *) &(key_cond_slave_parallel_worker[wi]);
-     worker_conds[wi].m_name= "struct slave_worker::jobs_cond";
+     worker_conds[wi].m_name= "Slave_worker::jobs_cond";
      worker_conds[wi].m_flags= 0;
   }
   if (PSI_server)
@@ -1030,8 +1022,12 @@ void Relay_log_info::stmt_done(my_off_t
     // Andrei: tried testing the worker's method but got a segfault
     // because in to->set_info(group_relay_log_name) the arg is NULL.
 
-    //else
-    //  w->flush_info(key_info_idx, key_info_size, is_transactional() ? TRUE : FALSE);
+    else
+    {
+      // ulong key_worker_idx[]= { server_id, w->id };
+      // w->flush_info(key_worker_idx, NUMBER_OF_FIELDS_TO_IDENTIFY_WORKER,
+      //              is_transactional() ? TRUE : FALSE);
+    }
   }
 }
 

=== modified file 'sql/rpl_rli.h'
--- a/sql/rpl_rli.h	2010-11-20 17:23:42 +0000
+++ b/sql/rpl_rli.h	2010-11-23 09:03:37 +0000
@@ -327,12 +327,7 @@ public:
   char slave_patternload_file[FN_REFLEN]; 
   size_t slave_patternload_file_size;  
 
-  Relay_log_info(bool is_slave_recovery,
-                 PSI_mutex_key *param_key_info_run_lock,
-                 PSI_mutex_key *param_key_info_data_lock,
-                 PSI_mutex_key *param_key_info_data_cond,
-                 PSI_mutex_key *param_key_info_start_cond,
-                 PSI_mutex_key *param_key_info_stop_cond);
+  Relay_log_info(bool is_slave_recovery);
   virtual ~Relay_log_info();
 
   /**

=== modified file 'sql/rpl_rli_pdb.h'
--- a/sql/rpl_rli_pdb.h	2010-11-20 17:23:42 +0000
+++ b/sql/rpl_rli_pdb.h	2010-11-23 09:03:37 +0000
@@ -20,6 +20,8 @@ Slave_worker *get_free_worker(DYNAMIC_AR
 #define SLAVE_WORKER_QUEUE_SIZE 8096
 #define SLAVE_INIT_DBS_IN_GROUP 4     // initial allocation for CGEP dynarray
 
+#define NUMBER_OF_FIELDS_TO_IDENTIFY_WORKER 2
+
 typedef struct slave_job_item
 {
   void *data;

=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2010-11-22 18:57:13 +0000
+++ b/sql/rpl_slave.cc	2010-11-23 09:03:37 +0000
@@ -41,6 +41,7 @@
 #include <mysqld_error.h>
 #include <mysys_err.h>
 #include "rpl_handler.h"
+#include "rpl_info_dummy.h"
 #include <signal.h>
 #include <mysql.h>
 #include <myisam.h>
@@ -3603,12 +3604,14 @@ int slave_start_single_worker(Relay_log_
 
   // fixme: experimenting to make Workers to run ev->update_pos(w->w_rli)
   // fixme: a real hack! part of Rpl_info_factory::create_rli(RLI_REPOSITORY_FILE, FALSE);
-  w->w_rli= new Relay_log_info(FALSE,
-                               &key_relay_log_info_run_lock,
-                               &key_relay_log_info_data_lock,
-                               &key_relay_log_info_data_cond,
-                               &key_relay_log_info_start_cond,
-                               &key_relay_log_info_stop_cond);
+  w->w_rli= new Relay_log_info(FALSE);
+  Rpl_info_dummy *dummy_handler= new Rpl_info_dummy(FALSE);
+  w->w_rli->set_rpl_info_handler(dummy_handler);
+  ulong key_worker_idx[]= { server_id, w->id };
+  w->init_info(key_worker_idx, NUMBER_OF_FIELDS_TO_IDENTIFY_WORKER);
+
+  // ALFRANIO --> The recovery procedure must be introduced here.
+
   w->w_rli->workers= rli->workers; // shallow copying is sufficient
   w->w_rli->this_worker= w;
 
@@ -3640,6 +3643,8 @@ int slave_start_single_worker(Relay_log_
   my_init_dynamic_array(&w->curr_group_exec_parts, NAME_LEN,
                         SLAVE_INIT_DBS_IN_GROUP, 1);
 
+  
+
   if (pthread_create(&th, &connection_attrib, handle_slave_worker,
                      (void*) w))
   {
@@ -3728,6 +3733,9 @@ void slave_stop_workers(Relay_log_info *
     Slave_worker *w;
     get_dynamic((DYNAMIC_ARRAY*)&rli->workers, (uchar*) &w, i);
 
+    ulong key_worker_idx[]= { server_id, w->id };
+    w->end_info(key_worker_idx, NUMBER_OF_FIELDS_TO_IDENTIFY_WORKER);
+
     mysql_mutex_lock(&w->jobs_lock);
     if (w->jobs.len != rli->slave_pending_jobs_max + 1)
       mysql_cond_wait(&w->jobs_cond, &w->jobs_lock);


Attachment: [text/bzr-bundle] bzr/alfranio.correia@oracle.com-20101123090337-ep1c4y5qca20qlug.bundle
Thread
bzr commit into mysql-next-mr.crash-safe branch (alfranio.correia:3216) Alfranio Correia23 Nov