List:Commits« Previous MessageNext Message »
From:He Zhenxing Date:July 7 2008 5:31am
Subject:bzr commit into mysql-6.0-semi-sync-1.0 branch (hezx:2637) WL#4398
View as plain text  
#At file:///media/sda3/work/mysql/bzrwork/semisync/mysql-6.0-semi-sync-1.0/

 2637 He Zhenxing	2008-07-07
      WL#4398 Replication interface for semi-synchronous replication
      
      Removed thd_net_/read/write/flush and mysql_net/read/write/flush
      functions from the interface.
      
      Pass down password and ssl related information by Binlog_relay_IO_param,
      so that the plug-in can use this information to connect to master.
modified:
  include/mysql/plugin.h
  sql/replication.h
  sql/rpl_handler.cc
  sql/rpl_handler.h

per-file messages:
  include/mysql/plugin.h
    Removed thd_net_/read/write/flush and mysql_net/read/write/flush
    functions from the interface.
  sql/replication.h
    Add password and ssl related members to Binlog_relay_IO_param.
  sql/rpl_handler.cc
    Removed thd_net_/read/write/flush and mysql_net/read/write/flush
    functions from the interface.
    Pass down password and ssl related members by  Binlog_relay_IO_param.
  sql/rpl_handler.h
    Add init_param to Binlog_relay_IO_param to initialize parameters.
=== modified file 'include/mysql/plugin.h'
--- a/include/mysql/plugin.h	2008-06-26 14:22:39 +0000
+++ b/include/mysql/plugin.h	2008-07-07 05:30:27 +0000
@@ -630,86 +630,6 @@ void mysql_query_cache_invalidate4(MYSQL
                                    int using_trx);
 
 /**
-   Read a packet from the current thread connection.
-
-   @note The packet buffer will be allocated and freed automatically,
-   the memory pointed to by @a packet will be overwritten or freed by
-   the next read or write using current thread connection.
-
-   @param packet   return the pointer to the packet read
-   @param len      return the length of packet read
-
-   @retval 0 Success
-   @retval 1 Failure
-*/
-int thd_net_read(const unsigned char **packet, size_t *len);
-
-/**
-   Write a packet to the current thread connection.
-
-   @note The packet buffer will be allocated and freed automatically,
-   the memory pointed to by @a packet will be overwritten or freed by
-   the next read or write using current thread connection.
-
-   @param packet   packet to write to the connection
-   @param len      length of the packet
-
-   @retval 0 Success
-   @retval 1 Failure
-*/
-int thd_net_write(const unsigned char *packet, size_t len);
-
-/**
-   Flush write buffer of current thread connection.
-
-   @retval 0 Success
-   @retval 1 Failure
-*/
-int thd_net_flush();
-
-/**
-   Read a packet from the connection.
-
-   @note The packet buffer will be allocated and freed automatically,
-   the memory pointed to by @a packet will be overwritten or freed by
-   the next read or write using the same @a mysql connection.
-
-   @param mysql    mysql client connection
-   @param packet   return the pointer to the packet read
-   @param len      return the length of packet read
-
-   @retval 0 Success
-   @retval 1 Failure
-*/
-int mysql_net_read(MYSQL *mysql, const unsigned char **packet, size_t *len);
-
-/**
-   Write a packet to the connection.
-
-   @note The packet buffer will be allocated and freed automatically,
-   the memory pointed to by @a packet will be overwritten or freed by
-   the next read or write using the same @a mysql connection.
-
-   @param mysql    mysql client connection
-   @param packet   packet to write to the connection
-   @param len      length of the packet
-
-   @retval 0 Success
-   @retval 1 Failure
-*/
-int mysql_net_write(MYSQL *mysql, const unsigned char *packet, size_t len);
-
-/**
-   Flush write buffer of connection.
-
-   @param mysql    mysql client connection
-
-   @retval 0 Success
-   @retval 1 Failure
-*/
-int mysql_net_flush(MYSQL *mysql);
-
-/**
    Get the value of user variable as an integer.
 
    This function will return the value of variable @a name as an

=== modified file 'sql/replication.h'
--- a/sql/replication.h	2008-06-26 14:22:39 +0000
+++ b/sql/replication.h	2008-07-07 05:30:27 +0000
@@ -241,10 +241,20 @@ enum Binlog_relay_IO_flags {
 typedef struct Binlog_relay_IO_param {
   uint32 server_id;
 
-  /* Master host, user and port */
+  /* Master host, password, user and port */
   char *host;
   char *user;
-  uint port;
+  char *password;
+  unsigned int port;
+
+  /* Master SSL connection */
+  int use_ssl;
+  char *ssl_ca;
+  char *ssl_capath;
+  char *ssl_cert;
+  char *ssl_cipher;
+  char *ssl_key;
+  int ssl_verify_server_cert;
 
   char *master_log_name;
   my_off_t master_log_pos;

=== modified file 'sql/rpl_handler.cc'
--- a/sql/rpl_handler.cc	2008-06-26 14:22:39 +0000
+++ b/sql/rpl_handler.cc	2008-07-07 05:30:27 +0000
@@ -29,47 +29,6 @@ Binlog_transmit_delegate *binlog_transmi
 Binlog_relay_IO_delegate *binlog_relay_io_delegate;
 #endif /* HAVE_REPLICATION */
 
-int thd_net_read(const unsigned char **packet, size_t *len)
-{
-  THD *thd= current_thd;
-  ulong ret= my_net_read(&thd->net);
-  if (ret == packet_error)
-    return 1;
-  *len= ret;
-  *packet= thd->net.read_pos;
-  return 0;
-}
-
-int thd_net_write(const unsigned char *packet, size_t len)
-{
-  return my_net_write(&current_thd->net, packet, len);
-}
-
-int thd_net_flush()
-{
-  return net_flush(&current_thd->net);
-}
-
-int mysql_net_read(MYSQL *mysql, const unsigned char **packet, size_t *len)
-{
-  ulong ret= my_net_read(&mysql->net);
-  if (ret == packet_error)
-    return 1;
-  *len= ret;
-  *packet= mysql->net.read_pos;
-  return 0;
-}
-
-int mysql_net_write(MYSQL *mysql, const unsigned char *packet, size_t len)
-{
-  return my_net_write(&mysql->net, packet, len);
-}
-
-int mysql_net_flush(MYSQL *mysql)
-{
-  return net_flush(&mysql->net);
-}
-
 int get_user_var_int(const char *name,
                      long long int *value, int *null_value)
 {
@@ -315,29 +274,43 @@ int Binlog_transmit_delegate::after_rese
   FOREACH_OBSERVER(after_reset_master, thd, (&param));
 }
 
+void Binlog_relay_IO_delegate::init_param(Binlog_relay_IO_param *param,
+                                          Master_info *mi)
+{
+  param->mysql= mi->mysql;
+  param->user= mi->user;
+  param->password= mi->password;
+  param->host= mi->host;
+  param->port= mi->port;
+#ifdef HAVE_OPENSSL   
+  param->use_ssl= mi->ssl;
+  param->ssl_ca= mi->ssl_ca;
+  param->ssl_capath= mi->ssl_capath;
+  param->ssl_cert= mi->ssl_cert;
+  param->ssl_cipher= mi->ssl_cipher;
+  param->ssl_key= mi->ssl_key;
+  param->ssl_verify_server_cert= mi->ssl_verify_server_cert;
+#else
+  param->use_ssl= 0;
+#endif
+  param->master_log_name= mi->master_log_name;
+  param->master_log_pos= mi->master_log_pos;
+}
+
 int Binlog_relay_IO_delegate::thread_start(THD *thd, Master_info *mi)
 {
   Binlog_relay_IO_param param;
-  param.mysql= mi->mysql;
-  param.user= mi->user;
-  param.host= mi->host;
-  param.port= mi->port;
-  param.master_log_name= mi->master_log_name;
-  param.master_log_pos= mi->master_log_pos;
+  init_param(&param, mi);
 
   FOREACH_OBSERVER(thread_start, thd, (&param));
 }
 
+
 int Binlog_relay_IO_delegate::thread_stop(THD *thd, Master_info *mi)
 {
 
   Binlog_relay_IO_param param;
-  param.mysql= mi->mysql;
-  param.user= mi->user;
-  param.host= mi->host;
-  param.port= mi->port;
-  param.master_log_name= mi->master_log_name;
-  param.master_log_pos= mi->master_log_pos;
+  init_param(&param, mi);
 
   FOREACH_OBSERVER(thread_stop, thd, (&param));
 }
@@ -347,12 +320,7 @@ int Binlog_relay_IO_delegate::before_req
                                                       ushort flags)
 {
   Binlog_relay_IO_param param;
-  param.mysql= mi->mysql;
-  param.user= mi->user;
-  param.host= mi->host;
-  param.port= mi->port;
-  param.master_log_name= mi->master_log_name;
-  param.master_log_pos= mi->master_log_pos;
+  init_param(&param, mi);
 
   FOREACH_OBSERVER(before_request_transmit, thd, (&param, (uint32)flags));
 }
@@ -363,12 +331,7 @@ int Binlog_relay_IO_delegate::after_read
                                                ulong *event_len)
 {
   Binlog_relay_IO_param param;
-  param.mysql= mi->mysql;
-  param.user= mi->user;
-  param.host= mi->host;
-  param.port= mi->port;
-  param.master_log_name= mi->master_log_name;
-  param.master_log_pos= mi->master_log_pos;
+  init_param(&param, mi);
 
   FOREACH_OBSERVER(after_read_event, thd,
                    (&param, packet, len, event_buf, event_len));
@@ -380,12 +343,7 @@ int Binlog_relay_IO_delegate::after_queu
                                                 bool synced)
 {
   Binlog_relay_IO_param param;
-  param.mysql= mi->mysql;
-  param.user= mi->user;
-  param.host= mi->host;
-  param.port= mi->port;
-  param.master_log_name= mi->master_log_name;
-  param.master_log_pos= mi->master_log_pos;
+  init_param(&param, mi);
 
   uint32 flags=0;
   if (synced)
@@ -399,12 +357,7 @@ int Binlog_relay_IO_delegate::after_rese
 
 {
   Binlog_relay_IO_param param;
-  param.mysql= mi->mysql;
-  param.user= mi->user;
-  param.host= mi->host;
-  param.port= mi->port;
-  param.master_log_name= mi->master_log_name;
-  param.master_log_pos= mi->master_log_pos;
+  init_param(&param, mi);
 
   FOREACH_OBSERVER(after_reset_slave, thd, (&param));
 }

=== modified file 'sql/rpl_handler.h'
--- a/sql/rpl_handler.h	2008-06-26 14:22:39 +0000
+++ b/sql/rpl_handler.h	2008-07-07 05:30:27 +0000
@@ -187,6 +187,8 @@ public:
                         const char *event_buf, ulong event_len,
                         bool synced);
   int after_reset_slave(THD *thd, Master_info *mi);
+private:
+  void init_param(Binlog_relay_IO_param *param, Master_info *mi);
 };
 #endif /* HAVE_REPLICATION */
 

Thread
bzr commit into mysql-6.0-semi-sync-1.0 branch (hezx:2637) WL#4398He Zhenxing7 Jul