List:Commits« Previous MessageNext Message »
From:Andrei Elkin Date:September 11 2006 9:19pm
Subject:bk commit into 4.1 tree (aelkin:1.2481) BUG#19402
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of elkin. When elkin does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-09-12 00:19:05+03:00, aelkin@stripped +7 -0
  BUG#19402 SQL close to the size of the max_allowed_packet fails on the slave
  
  A communication packet can also be a binlog event sent from the master to the slave.
  To be sent by master dump and accepted by slave io thread both have to have
  the value of max_allowed_packet bigger than one that client connection had.
  
  In the patch there is the MAX possible replicatio header size estimation for events
  in binlog that embedded user query. Only these events of query_log_event type, i.e
  just plain queries, require attention. 

  mysql-test/r/rpl_packet.result@stripped, 2006-09-12 00:19:02+03:00, aelkin@stripped +21 -0
    BitKeeper file /home/elkin/MySQL/TEAM/FIXES/4.1/bug19402-max_allowed/mysql-test/r/rpl_packet.result

  mysql-test/r/rpl_packet.result@stripped, 2006-09-12 00:19:02+03:00, aelkin@stripped +0 -0

  mysql-test/t/rpl_packet-master.opt@stripped, 2006-09-12 00:19:02+03:00, aelkin@stripped +1 -0
    BitKeeper file /net/koti/usr_rh9/home/elkin.rh9/MySQL/TEAM/FIXES/4.1/bug19402-max_allowed/mysql-test/t/rpl_packet-master.opt

  mysql-test/t/rpl_packet-master.opt@stripped, 2006-09-12 00:19:02+03:00, aelkin@stripped +0 -0

  mysql-test/t/rpl_packet-slave.opt@stripped, 2006-09-12 00:19:02+03:00, aelkin@stripped +1 -0
    BitKeeper file /net/koti/usr_rh9/home/elkin.rh9/MySQL/TEAM/FIXES/4.1/bug19402-max_allowed/mysql-test/t/rpl_packet-slave.opt

  mysql-test/t/rpl_packet-slave.opt@stripped, 2006-09-12 00:19:02+03:00, aelkin@stripped +0 -0

  mysql-test/t/rpl_packet.test@stripped, 2006-09-12 00:19:02+03:00, aelkin@stripped +40 -0
    test examines repliation of a max-sized query when database name is set to have
    NAME_LEN bytes. This makes replication header size the maximum.

  mysql-test/t/rpl_packet.test@stripped, 2006-09-12 00:19:02+03:00, aelkin@stripped +0 -0

  sql/log_event.h@stripped, 2006-09-12 00:19:01+03:00, aelkin@stripped +6 -0
    MAX value of the header of the replication packet, i.e the value of exceeding
    the query string part.

  sql/slave.cc@stripped, 2006-09-12 00:19:01+03:00, aelkin@stripped +10 -4
    Private value of max allowed packet slave io, sql threads can accept from master.
    The value is increased by the MAX possible size of replication event header.
    
    Note, that my_net_init is redundant for slave io because the thread uses instance of
    NET struct, embedded into MYSQL, as a client to server. We have left old code and even
    increment, redundantly as well, thd->net.max_packet_size just for the sake of
    consistency. TODO: eliminate my_net_init from execution path of slave io.

  sql/sql_repl.cc@stripped, 2006-09-12 00:19:01+03:00, aelkin@stripped +2 -0
    Increasing the private max allowed packet that the dump thread reads from master
    binlog and sends to net. Note, that happened prior this writting to binlog is
    safe from the current artifact because it is done by steps that each chunk can not
    exceed @@global.max_allowed_packet.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	aelkin
# Host:	dsl-hkigw8-fe00f800-98.dhcp.inet.fi
# Root:	/home/elkin/MySQL/TEAM/FIXES/4.1/bug19402-max_allowed

--- 1.99/sql/log_event.h	2006-09-12 00:19:11 +03:00
+++ 1.100/sql/log_event.h	2006-09-12 00:19:11 +03:00
@@ -147,6 +147,12 @@ struct sql_ex_info
 #define EXEC_LOAD_HEADER_LEN   4
 #define DELETE_FILE_HEADER_LEN 4
 
+/* amount of byte is contribution of replicaton protocol to a query
+   received from user when the query goes to binlog */
+#define MAX_LOG_EVENT_HEADER   (LOG_EVENT_HEADER_LEN + /* write_header */ \
+				QUERY_HEADER_LEN     + /* write_data */   \
+				NAME_LEN + 1)
+
 /* 
    Event header offsets; 
    these point to places inside the fixed header.

--- 1.279/sql/slave.cc	2006-09-12 00:19:11 +03:00
+++ 1.280/sql/slave.cc	2006-09-12 00:19:11 +03:00
@@ -2618,6 +2618,8 @@ static int init_slave_thread(THD* thd, S
     SYSTEM_THREAD_SLAVE_SQL : SYSTEM_THREAD_SLAVE_IO; 
   thd->host_or_ip= "";
   my_net_init(&thd->net, 0);
+  thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
+    + MAX_LOG_EVENT_HEADER;  /* reentering secured through using global */
   thd->net.read_timeout = slave_net_timeout;
   thd->master_access= ~(ulong)0;
   thd->priv_user = 0;
@@ -3143,16 +3145,20 @@ slave_begin:
     sql_print_error("Slave I/O thread: error in mysql_init()");
     goto err;
   }
-  
+
 
   thd->proc_info = "Connecting to master";
   // we can get killed during safe_connect
   if (!safe_connect(thd, mysql, mi))
+  {
     sql_print_information("Slave I/O thread: connected to master '%s@%s:%d',\
   replication started in log '%s' at position %s", mi->user,
-		    mi->host, mi->port,
-		    IO_RPL_LOG_NAME,
-		    llstr(mi->master_log_pos,llbuff));
+			  mi->host, mi->port,
+			  IO_RPL_LOG_NAME,
+			  llstr(mi->master_log_pos,llbuff));
+    /* post-net-init for slave */
+    mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
+  }
   else
   {
     sql_print_error("Slave I/O thread killed while connecting to master");
--- New file ---
+++ mysql-test/r/rpl_packet.result	06/09/12 00:19:02
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
select @@net_buffer_length, @@max_allowed_packet;
@@net_buffer_length	@@max_allowed_packet
1024	1024
drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
Warnings:
Note	1008	Can't drop database 'DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________'; database doesn't exist
create database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
create table `t1` (`f1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ERROR 08S01: Got a packet bigger than 'max_allowed_packet' bytes
select count(*) from `t1` /* must be 1 */;
count(*)
1
drop database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;

--- New file ---
+++ mysql-test/t/rpl_packet-master.opt	06/09/12 00:19:02
-O max_allowed_packet=1024 -O net_buffer_length=1024

--- New file ---
+++ mysql-test/t/rpl_packet-slave.opt	06/09/12 00:19:02
-O max_allowed_packet=1024 -O net_buffer_length=1024

--- New file ---
+++ mysql-test/t/rpl_packet.test	06/09/12 00:19:02
#
# Check replication protocol packet size handling
# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave
#

# max-out size db name 
source include/master-slave.inc;

let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;

connection master;
select @@net_buffer_length, @@max_allowed_packet;
eval drop database if exists $db;
eval create database $db;

# alas, can't use eval here
connect (master1,localhost,root,,DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________);

connection master1;
create table `t1` (`f1` LONGTEXT) ENGINE=MyISAM;

INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaa1024');

save_master_pos;

connection slave;
sync_with_master;
select count(*) from `t1` /* must be 1 */;

connection master1;
eval drop database $db;
save_master_pos;

connection slave;
sync_with_master;

# End of tests


--- 1.137/sql/sql_repl.cc	2006-09-12 00:19:11 +03:00
+++ 1.138/sql/sql_repl.cc	2006-09-12 00:19:11 +03:00
@@ -420,6 +420,8 @@ impossible position";
     goto err;
   }
   packet->set("\0", 1, &my_charset_bin);
+  /* dump thread  the whole header size of query_log_event */
+  thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
 
   while (!net->error && net->vio != 0 && !thd->killed)
   {
Thread
bk commit into 4.1 tree (aelkin:1.2481) BUG#19402Andrei Elkin11 Sep