List:Commits« Previous MessageNext Message »
From:Alfranio Correia Date:October 13 2011 2:56pm
Subject:bzr push into mysql-trunk branch (alfranio.correia:3491 to 3492)
View as plain text  
 3492 Alfranio Correia	2011-10-13 [merge]
      merge mysql-trunk (local) --> mysql-trunk

    added:
      mysql-test/suite/rpl/r/rpl_alter_repository.result
      mysql-test/suite/rpl/t/rpl_alter_repository.test
    modified:
      client/mysqldump.c
      mysql-test/r/cast.result
      mysql-test/r/packet.result
      mysql-test/r/read_only_innodb.result
      mysql-test/r/variables-notembedded.result
      mysql-test/r/variables.result
      mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
      mysql-test/suite/rpl/r/rpl_packet.result
      mysql-test/suite/rpl/r/rpl_parallel_start_stop.result
      mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result
      mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
      mysql-test/suite/rpl/t/rpl_parallel_start_stop.test
      mysql-test/suite/rpl/t/rpl_rotate_logs.test
      mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result
      mysql-test/suite/sys_vars/r/max_allowed_packet_func.result
      mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result
      sql/lock.cc
      sql/log_event.cc
      sql/rpl_info.h
      sql/rpl_info_dummy.cc
      sql/rpl_info_dummy.h
      sql/rpl_info_factory.cc
      sql/rpl_info_file.cc
      sql/rpl_info_file.h
      sql/rpl_info_handler.h
      sql/rpl_info_table.cc
      sql/rpl_info_table.h
      sql/rpl_info_table_access.cc
      sql/rpl_mi.cc
      sql/rpl_rli.cc
      sql/rpl_rli.h
      sql/rpl_rli_pdb.cc
      sql/rpl_slave.cc
      sql/share/errmsg-utf8.txt
      sql/sql_class.h
      sql/sql_parse.cc
      sql/sql_parse.h
 3491 Andrei Elkin	2011-10-13
      Bug#13033076 - OCCASIONAL CRASH OF RPL.RPL_PARALLEL_DDL
      
      refining the test once more to print out all files in db dir right
      befre the db is drop-ed.

    modified:
      mysql-test/suite/rpl/r/rpl_parallel_ddl.result
      mysql-test/suite/rpl/t/rpl_parallel_ddl.test
=== modified file 'client/mysqldump.c'
--- a/client/mysqldump.c	2011-08-19 18:16:46 +0000
+++ b/client/mysqldump.c	2011-10-13 14:01:50 +0000
@@ -914,13 +914,7 @@ static int get_options(int *argc, char *
       my_hash_insert(&ignore_table,
                      (uchar*) my_strdup("mysql.general_log", MYF(MY_WME))) ||
       my_hash_insert(&ignore_table,
-                     (uchar*) my_strdup("mysql.slow_log", MYF(MY_WME))) ||
-      my_hash_insert(&ignore_table,
-                     (uchar*) my_strdup("mysql.slave_master_info", MYF(MY_WME))) ||
-      my_hash_insert(&ignore_table,
-                     (uchar*) my_strdup("mysql.slave_relay_log_info", MYF(MY_WME))) ||
-      my_hash_insert(&ignore_table,
-                     (uchar*) my_strdup("mysql.slave_worker_info", MYF(MY_WME))))
+                     (uchar*) my_strdup("mysql.slow_log", MYF(MY_WME))))
     return(EX_EOM);
 
   if ((ho_error= handle_options(argc, argv, my_long_options, get_one_option)))

=== modified file 'mysql-test/r/cast.result'
--- a/mysql-test/r/cast.result	2011-07-19 15:11:15 +0000
+++ b/mysql-test/r/cast.result	2011-10-13 14:01:50 +0000
@@ -456,7 +456,7 @@ DROP TABLE t1;
 #   DOESN'T ADHERE TO MAX_ALLOWED_PACKET
 SET @@GLOBAL.max_allowed_packet=2048;
 Warnings:
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 SELECT CONVERT('a', BINARY(2049));
 CONVERT('a', BINARY(2049))
 NULL

=== modified file 'mysql-test/r/packet.result'
--- a/mysql-test/r/packet.result	2011-03-25 14:35:13 +0000
+++ b/mysql-test/r/packet.result	2011-10-13 14:01:50 +0000
@@ -3,7 +3,7 @@ set @net_buffer_length=@@global.net_buff
 set global max_allowed_packet=100;
 Warnings:
 Warning	1292	Truncated incorrect max_allowed_packet value: '100'
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 set global net_buffer_length=100;
 Warnings:
 Warning	1292	Truncated incorrect net_buffer_length value: '100'

=== modified file 'mysql-test/r/read_only_innodb.result'
--- a/mysql-test/r/read_only_innodb.result	2011-05-12 17:29:19 +0000
+++ b/mysql-test/r/read_only_innodb.result	2011-10-13 14:01:50 +0000
@@ -97,7 +97,7 @@ a
 2
 ROLLBACK;
 Warnings:
-Warning	1734	The creation of some temporary tables could not be rolled back.
+Warning	1733	The creation of some temporary tables could not be rolled back.
 SELECT * FROM temp;
 a
 DROP TABLE temp;

=== modified file 'mysql-test/r/variables-notembedded.result'
--- a/mysql-test/r/variables-notembedded.result	2011-03-28 11:10:42 +0000
+++ b/mysql-test/r/variables-notembedded.result	2011-10-13 14:01:50 +0000
@@ -154,10 +154,10 @@ ERROR HY000: Variable 'slave_skip_errors
 CREATE TABLE t1 (a MEDIUMTEXT);
 SET GLOBAL max_allowed_packet=2048;
 Warnings:
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 SET GLOBAL net_buffer_length=4096;
 Warnings:
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 SHOW SESSION VARIABLES LIKE 'max_allowed_packet';
 Variable_name	Value
 max_allowed_packet	2048

=== modified file 'mysql-test/r/variables.result'
--- a/mysql-test/r/variables.result	2011-08-19 13:24:24 +0000
+++ b/mysql-test/r/variables.result	2011-10-13 14:01:50 +0000
@@ -504,7 +504,7 @@ set low_priority_updates=1;
 set global max_allowed_packet=100;
 Warnings:
 Warning	1292	Truncated incorrect max_allowed_packet value: '100'
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 set global max_binlog_cache_size=100;
 Warnings:
 Warning	1292	Truncated incorrect max_binlog_cache_size value: '100'
@@ -1056,7 +1056,7 @@ set global myisam_data_pointer_size  =@m
 set global myisam_max_sort_file_size =@my_myisam_max_sort_file_size;
 set global net_buffer_length         =@my_net_buffer_length;
 Warnings:
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 set global net_write_timeout         =@my_net_write_timeout;
 set global net_read_timeout          =@my_net_read_timeout;
 set global query_cache_limit         =@my_query_cache_limit;

=== added file 'mysql-test/suite/rpl/r/rpl_alter_repository.result'
--- a/mysql-test/suite/rpl/r/rpl_alter_repository.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_alter_repository.result	2011-10-13 14:01:50 +0000
@@ -0,0 +1,159 @@
+include/master-slave.inc
+[connection master]
+include/stop_slave.inc
+SHOW CREATE TABLE mysql.slave_relay_log_info;
+Table	Create Table
+slave_relay_log_info	CREATE TABLE `slave_relay_log_info` (
+  `Master_id` int(10) unsigned NOT NULL,
+  `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
+  `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',
+  `Relay_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The relay log position of the last executed event.',
+  `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
+  `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last executed event.',
+  `Sql_delay` int(11) NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
+  `Number_of_workers` int(10) unsigned NOT NULL,
+  PRIMARY KEY (`Master_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Relay Log Information'
+ALTER TABLE mysql.slave_relay_log_info ENGINE= Innodb;
+SHOW CREATE TABLE mysql.slave_relay_log_info;
+Table	Create Table
+slave_relay_log_info	CREATE TABLE `slave_relay_log_info` (
+  `Master_id` int(10) unsigned NOT NULL,
+  `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
+  `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',
+  `Relay_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The relay log position of the last executed event.',
+  `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
+  `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last executed event.',
+  `Sql_delay` int(11) NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
+  `Number_of_workers` int(10) unsigned NOT NULL,
+  PRIMARY KEY (`Master_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Relay Log Information'
+SET @@global.relay_log_info_repository="TABLE";
+SET @@global.master_info_repository="TABLE";
+SET @@global.sync_master_info= 1;
+include/start_slave.inc
+CREATE TABLE t_innodb (id INTEGER) engine= Innodb;
+call mtr.add_suppression("Error writing relay log configuration.");
+call mtr.add_suppression("Column count of mysql.slave_relay_log_info is wrong.");
+call mtr.add_suppression("Error running query, slave SQL thread aborted.");
+call mtr.add_suppression("Info table is not ready to be used.");
+call mtr.add_suppression("Error writing master configuration.");
+call mtr.add_suppression("Failed to flush master info.");
+call mtr.add_suppression(" Error while checking replication metadata.");
+INSERT INTO t_innodb VALUES (1), (2), (3);
+ALTER TABLE mysql.slave_relay_log_info DROP COLUMN Sql_delay;
+INSERT INTO t_innodb VALUES (1), (2), (3);
+include/wait_for_slave_sql_error.inc [errno=1701]
+Last_SQL_Error = 'Column count of mysql.slave_relay_log_info is wrong. Expected 8, found 7. The table is probably corrupted'
+include/stop_slave_io.inc
+include/rpl_restart_server.inc [server_number=2 parameters: --relay-log-info-repository=FILE --skip-slave-start]
+ALTER TABLE mysql.slave_relay_log_info ADD COLUMN (Sql_delay INTEGER NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.');
+include/rpl_restart_server.inc [server_number=2 parameters: --sync-master-info=1 --master-info-repository=TABLE --relay-log-info-repository=TABLE]
+include/start_slave.inc
+INSERT INTO t_innodb VALUES (1), (2), (3);
+ALTER TABLE mysql.slave_relay_log_info DROP COLUMN Sql_delay;
+INSERT INTO t_innodb VALUES (1), (2), (3);
+include/wait_for_slave_sql_error.inc [errno=1701]
+Last_SQL_Error = 'Column count of mysql.slave_relay_log_info is wrong. Expected 8, found 7. The table is probably corrupted'
+include/stop_slave_io.inc
+START SLAVE SQL_THREAD;
+ERROR HY000: Column count of mysql.slave_relay_log_info is wrong. Expected 8, found 7. The table is probably corrupted
+RESET SLAVE ALL;
+ERROR HY000: Column count of mysql.slave_relay_log_info is wrong. Expected 8, found 7. The table is probably corrupted
+CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT, MASTER_LOG_FILE= 'MASTER_LOG_FILE', MASTER_LOG_POS= MASTER_LOG_POS;
+ERROR HY000: Column count of mysql.slave_relay_log_info is wrong. Expected 8, found 7. The table is probably corrupted
+ALTER TABLE mysql.slave_relay_log_info ADD COLUMN (Sql_delay INTEGER NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.');
+RESET SLAVE ALL;
+CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT, MASTER_LOG_FILE= 'MASTER_LOG_FILE', MASTER_LOG_POS= MASTER_LOG_POS;
+include/start_slave.inc
+ALTER TABLE mysql.slave_master_info DROP COLUMN Retry_count;
+INSERT INTO t_innodb VALUES (1), (2), (3);
+include/wait_for_slave_io_error.inc [errno=1593]
+Last_IO_Error = 'Fatal error: Failed to flush master info.'
+include/stop_slave_sql.inc
+include/rpl_restart_server.inc [server_number=2 parameters: --master-info-repository=FILE --skip-slave-start]
+ALTER TABLE mysql.slave_master_info ADD COLUMN (Retry_count BIGINT UNSIGNED NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.');
+include/rpl_restart_server.inc [server_number=2 parameters: --sync-master-info=1 --master-info-repository=TABLE --relay-log-info-repository=TABLE]
+include/start_slave.inc
+ALTER TABLE mysql.slave_master_info DROP COLUMN Retry_count;
+INSERT INTO t_innodb VALUES (1), (2), (3);
+include/wait_for_slave_io_error.inc [errno=1593]
+Last_IO_Error = 'Fatal error: Failed to flush master info.'
+include/stop_slave_sql.inc
+START SLAVE SQL_THREAD;
+ERROR HY000: Column count of mysql.slave_master_info is wrong. Expected 23, found 22. The table is probably corrupted
+RESET SLAVE ALL;
+ERROR HY000: Column count of mysql.slave_master_info is wrong. Expected 23, found 22. The table is probably corrupted
+CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT, MASTER_LOG_FILE= 'MASTER_LOG_FILE', MASTER_LOG_POS= MASTER_LOG_POS;
+ERROR HY000: Column count of mysql.slave_master_info is wrong. Expected 23, found 22. The table is probably corrupted
+ALTER TABLE mysql.slave_master_info ADD COLUMN (Retry_count BIGINT UNSIGNED NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.');
+RESET SLAVE ALL;
+CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT, MASTER_LOG_FILE= 'MASTER_LOG_FILE', MASTER_LOG_POS= MASTER_LOG_POS;
+include/start_slave.inc
+ANALYZE TABLE mysql.slave_master_info, mysql.slave_relay_log_info;
+Table	Op	Msg_type	Msg_text
+mysql.slave_master_info	analyze	status	OK
+mysql.slave_relay_log_info	analyze	status	OK
+CHECK TABLE mysql.slave_master_info, mysql.slave_relay_log_info EXTENDED;
+Table	Op	Msg_type	Msg_text
+mysql.slave_master_info	check	status	OK
+mysql.slave_relay_log_info	check	status	OK
+OPTIMIZE TABLE mysql.slave_master_info, mysql.slave_relay_log_info;
+Table	Op	Msg_type	Msg_text
+mysql.slave_master_info	optimize	status	OK
+mysql.slave_relay_log_info	optimize	note	Table does not support optimize, doing recreate + analyze instead
+mysql.slave_relay_log_info	optimize	status	OK
+REPAIR TABLE mysql.slave_master_info, mysql.slave_relay_log_info EXTENDED;
+Table	Op	Msg_type	Msg_text
+mysql.slave_master_info	repair	status	OK
+mysql.slave_relay_log_info	repair	note	The storage engine for the table doesn't support repair
+SHOW CREATE TABLE mysql.slave_master_info;
+Table	Create Table
+slave_master_info	CREATE TABLE `slave_master_info` (
+  `Master_id` int(10) unsigned NOT NULL,
+  `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file.',
+  `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log currently being read from the master.',
+  `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last read event.',
+  `Host` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The host name of the master.',
+  `User_name` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The user name used to connect to the master.',
+  `User_password` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The password used to connect to the master.',
+  `Port` int(10) unsigned NOT NULL COMMENT 'The network port used to connect to the master.',
+  `Connect_retry` int(10) unsigned NOT NULL COMMENT 'The period (in seconds) that the slave will wait before trying to reconnect to the master.',
+  `Enabled_ssl` tinyint(1) NOT NULL COMMENT 'Indicates whether the server supports SSL connections.',
+  `Ssl_ca` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Authority (CA) certificate.',
+  `Ssl_capath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path to the Certificate Authority (CA) certificates.',
+  `Ssl_cert` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL certificate file.',
+  `Ssl_cipher` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the cipher in use for the SSL connection.',
+  `Ssl_key` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The name of the SSL key file.',
+  `Ssl_verify_server_cert` tinyint(1) NOT NULL COMMENT 'Whether to verify the server certificate.',
+  `Heartbeat` float NOT NULL,
+  `Bind` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'Displays which interface is employed when connecting to the MySQL server',
+  `Ignored_server_ids` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The number of server IDs to be ignored, followed by the actual server IDs',
+  `Uuid` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The master server uuid.',
+  `Ssl_crl` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The file used for the Certificate Revocation List (CRL)',
+  `Ssl_crlpath` text CHARACTER SET utf8 COLLATE utf8_bin COMMENT 'The path used for Certificate Revocation List (CRL) files',
+  `Retry_count` bigint(20) unsigned NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.',
+  PRIMARY KEY (`Master_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Master Information'
+SHOW CREATE TABLE mysql.slave_relay_log_info;
+Table	Create Table
+slave_relay_log_info	CREATE TABLE `slave_relay_log_info` (
+  `Master_id` int(10) unsigned NOT NULL,
+  `Number_of_lines` int(10) unsigned NOT NULL COMMENT 'Number of lines in the file or rows in the table. Used to version table definitions.',
+  `Relay_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the current relay log file.',
+  `Relay_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The relay log position of the last executed event.',
+  `Master_log_name` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'The name of the master binary log file from which the events in the relay log file were read.',
+  `Master_log_pos` bigint(20) unsigned NOT NULL COMMENT 'The master log position of the last executed event.',
+  `Number_of_workers` int(10) unsigned NOT NULL,
+  `Sql_delay` int(11) NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.',
+  PRIMARY KEY (`Master_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Relay Log Information'
+# Search for occurrences of slave_master_info in the output from mysqldump
+- Occurrences: 1
+DROP TABLE t_innodb;
+include/stop_slave.inc
+SET @@global.relay_log_info_repository=FILE;
+SET @@global.master_info_repository=FILE;
+SET @@global.sync_master_info=0;
+include/start_slave.inc
+include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result'
--- a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result	2011-10-13 14:01:50 +0000
@@ -8,7 +8,7 @@ Warning	1712	Option binlog_cache_size (3
 SET GLOBAL binlog_cache_size = 4096;
 SET GLOBAL max_binlog_stmt_cache_size = 4096;
 Warnings:
-Warning	1726	Option binlog_stmt_cache_size (32768) is greater than max_binlog_stmt_cache_size (4096); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size.
+Warning	1725	Option binlog_stmt_cache_size (32768) is greater than max_binlog_stmt_cache_size (4096); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size.
 SET GLOBAL binlog_stmt_cache_size = 4096;
 CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
 CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
@@ -133,7 +133,7 @@ Warning	1712	Option binlog_cache_size (3
 SET GLOBAL binlog_cache_size = 4096;
 SET GLOBAL max_binlog_stmt_cache_size = 4096;
 Warnings:
-Warning	1726	Option binlog_stmt_cache_size (32768) is greater than max_binlog_stmt_cache_size (4096); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size.
+Warning	1725	Option binlog_stmt_cache_size (32768) is greater than max_binlog_stmt_cache_size (4096); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size.
 SET GLOBAL binlog_stmt_cache_size = 4096;
 include/stop_slave.inc
 include/start_slave.inc

=== modified file 'mysql-test/suite/rpl/r/rpl_packet.result'
--- a/mysql-test/suite/rpl/r/rpl_packet.result	2011-10-03 11:49:38 +0000
+++ b/mysql-test/suite/rpl/r/rpl_packet.result	2011-10-13 14:01:50 +0000
@@ -73,7 +73,7 @@ WARNING: The range of printed events end
 DROP TABLE t1;
 SET @@global.max_allowed_packet= 1024;
 Warnings:
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 SET @@global.net_buffer_length= 1024;
 SET @@global.max_allowed_packet= 1024;
 DROP TABLE t1;

=== modified file 'mysql-test/suite/rpl/r/rpl_parallel_start_stop.result'
--- a/mysql-test/suite/rpl/r/rpl_parallel_start_stop.result	2011-09-26 15:39:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_parallel_start_stop.result	2011-10-13 14:01:50 +0000
@@ -16,7 +16,7 @@ include/wait_for_slave_sql_to_stop.inc
 include/start_slave.inc
 select id from coord_proc_list into @c_id;
 kill query @c_id;
-include/wait_for_slave_sql_error.inc [errno=1743]
+include/wait_for_slave_sql_error.inc [errno=1742]
 include/start_slave.inc
 CREATE TABLE t1 (a int primary key) engine=innodb;
 insert into t1 values (1),(2);
@@ -59,17 +59,17 @@ set @save.slave_transaction_retries= @@g
 set @@global.slave_transaction_retries= 1;
 start slave sql_thread;
 Warnings:
-Note	1740	slave_transaction_retries is not supported in multi-threaded slave mode. In the event of a transient failure, the slave will not retry the transaction and will stop.
+Note	1739	slave_transaction_retries is not supported in multi-threaded slave mode. In the event of a transient failure, the slave will not retry the transaction and will stop.
 include/stop_slave.inc
 create table t2 (a int);
 insert into t2 values (1);
 start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS;
 Warnings:
-Note	1740	UNTIL condtion is not supported in multi-threaded slave mode. Slave is started in the sequential execution mode.
+Note	1739	UNTIL condtion is not supported in multi-threaded slave mode. Slave is started in the sequential execution mode.
 include/wait_for_slave_sql_to_stop.inc
 include/start_slave.inc
 Warnings:
-Note	1740	slave_transaction_retries is not supported in multi-threaded slave mode. In the event of a transient failure, the slave will not retry the transaction and will stop.
+Note	1739	slave_transaction_retries is not supported in multi-threaded slave mode. In the event of a transient failure, the slave will not retry the transaction and will stop.
 drop table t1;
 drop table t2m;
 drop table t2;

=== modified file 'mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result'
--- a/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result	2011-10-13 14:01:50 +0000
@@ -8,7 +8,7 @@ Warning	1712	Option binlog_cache_size (3
 SET GLOBAL binlog_cache_size = 4096;
 SET GLOBAL max_binlog_stmt_cache_size = 4096;
 Warnings:
-Warning	1726	Option binlog_stmt_cache_size (32768) is greater than max_binlog_stmt_cache_size (4096); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size.
+Warning	1725	Option binlog_stmt_cache_size (32768) is greater than max_binlog_stmt_cache_size (4096); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size.
 SET GLOBAL binlog_stmt_cache_size = 4096;
 CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
 CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
@@ -134,7 +134,7 @@ Warning	1712	Option binlog_cache_size (3
 SET GLOBAL binlog_cache_size = 4096;
 SET GLOBAL max_binlog_stmt_cache_size = 4096;
 Warnings:
-Warning	1726	Option binlog_stmt_cache_size (32768) is greater than max_binlog_stmt_cache_size (4096); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size.
+Warning	1725	Option binlog_stmt_cache_size (32768) is greater than max_binlog_stmt_cache_size (4096); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size.
 SET GLOBAL binlog_stmt_cache_size = 4096;
 include/stop_slave.inc
 include/start_slave.inc

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result	2011-10-13 14:01:50 +0000
@@ -8,7 +8,7 @@ Warning	1712	Option binlog_cache_size (3
 SET GLOBAL binlog_cache_size = 4096;
 SET GLOBAL max_binlog_stmt_cache_size = 4096;
 Warnings:
-Warning	1726	Option binlog_stmt_cache_size (32768) is greater than max_binlog_stmt_cache_size (4096); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size.
+Warning	1725	Option binlog_stmt_cache_size (32768) is greater than max_binlog_stmt_cache_size (4096); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size.
 SET GLOBAL binlog_stmt_cache_size = 4096;
 CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
 CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
@@ -133,7 +133,7 @@ Warning	1712	Option binlog_cache_size (3
 SET GLOBAL binlog_cache_size = 4096;
 SET GLOBAL max_binlog_stmt_cache_size = 4096;
 Warnings:
-Warning	1726	Option binlog_stmt_cache_size (32768) is greater than max_binlog_stmt_cache_size (4096); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size.
+Warning	1725	Option binlog_stmt_cache_size (32768) is greater than max_binlog_stmt_cache_size (4096); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size.
 SET GLOBAL binlog_stmt_cache_size = 4096;
 include/stop_slave.inc
 include/start_slave.inc

=== added file 'mysql-test/suite/rpl/t/rpl_alter_repository.test'
--- a/mysql-test/suite/rpl/t/rpl_alter_repository.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_alter_repository.test	2011-10-13 14:01:50 +0000
@@ -0,0 +1,255 @@
+###############################################################################
+# Check that replication will fail safely if we inappropriately change
+# replication tables. Besides we check if some maintenance commands
+# can run without a problem.
+###############################################################################
+
+--source include/master-slave.inc
+--source include/have_innodb.inc
+--connection slave
+--source include/stop_slave.inc
+SHOW CREATE TABLE mysql.slave_relay_log_info;
+ALTER TABLE mysql.slave_relay_log_info ENGINE= Innodb;
+SHOW CREATE TABLE mysql.slave_relay_log_info;
+--let $saved_relay_repo= `SELECT @@global.relay_log_info_repository`
+--let $saved_master_repo= `SELECT @@global.master_info_repository`
+--let $saved_sync_master= `SELECT @@global.sync_master_info`
+SET @@global.relay_log_info_repository="TABLE";
+SET @@global.master_info_repository="TABLE";
+SET @@global.sync_master_info= 1;
+--source include/start_slave.inc
+
+--connection master
+CREATE TABLE t_innodb (id INTEGER) engine= Innodb;
+
+--connection slave
+call mtr.add_suppression("Error writing relay log configuration.");
+call mtr.add_suppression("Column count of mysql.slave_relay_log_info is wrong.");
+call mtr.add_suppression("Error running query, slave SQL thread aborted.");
+call mtr.add_suppression("Info table is not ready to be used.");
+call mtr.add_suppression("Error writing master configuration.");
+call mtr.add_suppression("Failed to flush master info.");
+call mtr.add_suppression(" Error while checking replication metadata.");
+
+###############################################################################
+#           Checking if replication can fail safely (SQL Thread)
+###############################################################################
+#
+# The test executes the following steps:
+#  1 - Changes mysql.slave_relay_log_info and SQL Thread stops gracefully.
+#  2 - Shows that it is possible to restart the server setting --skip-slave-start
+#      and a dummy repository while the problem is fixed.
+#  3 - Shows that after fixing the problem the server can be restared with the
+#      correct repository.
+#  4 - Shows that trying to fix the problem with START SLAVE, RESET SLAVE may
+#      not work and requires to manually back up positions to restart
+#      replication.
+#
+
+#
+#  1 - Changes mysql.slave_relay_log_info and SQL Thread stops gracefully.
+#
+--connection master
+INSERT INTO t_innodb VALUES (1), (2), (3);
+--sync_slave_with_master
+ALTER TABLE mysql.slave_relay_log_info DROP COLUMN Sql_delay;
+--connection master
+INSERT INTO t_innodb VALUES (1), (2), (3);
+--connection slave
+--let $slave_sql_errno= 1701
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
+--source include/stop_slave_io.inc
+
+#
+#  2 - Shows that it is possible to restart the server setting --skip-slave-start
+#      and a dummy repository while the problem is fixed.
+#
+--let $rpl_server_number= 2
+--let $rpl_server_parameters= --relay-log-info-repository=FILE --skip-slave-start
+--source include/rpl_restart_server.inc
+--connection slave
+ALTER TABLE mysql.slave_relay_log_info ADD COLUMN (Sql_delay INTEGER NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.');
+
+#
+#  3 - After fixing the problem the server is restared with the correct
+#      repository.
+#
+--let $rpl_server_number= 2
+--let $rpl_server_parameters= --sync-master-info=1 --master-info-repository=TABLE --relay-log-info-repository=TABLE
+--source include/rpl_restart_server.inc
+--connection slave
+--source include/start_slave.inc
+
+#  4 - Shows that trying to fix the problem with START SLAVE, RESET SLAVE may
+#      not work and requires to manually back up positions to restart
+#      replication.
+#
+--connection master
+INSERT INTO t_innodb VALUES (1), (2), (3);
+--sync_slave_with_master
+ALTER TABLE mysql.slave_relay_log_info DROP COLUMN Sql_delay;
+--connection master
+INSERT INTO t_innodb VALUES (1), (2), (3);
+--connection slave
+--let $slave_sql_errno= 1701
+--let $show_slave_sql_error= 1
+--source include/wait_for_slave_sql_error.inc
+--source include/stop_slave_io.inc
+--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
+START SLAVE SQL_THREAD;
+
+--let $_slave_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1)
+--let $_slave_master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1)
+--let $_slave_master_port= query_get_value(SHOW SLAVE STATUS, Master_Port, 1)
+--let $_slave_master_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1)
+--let $_slave_master_log_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
+--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
+RESET SLAVE ALL;
+--replace_result $_slave_master_host MASTER_HOST $_slave_master_user MASTER_USER $_slave_master_port MASTER_PORT $_slave_master_log_file MASTER_LOG_FILE $_slave_master_log_pos MASTER_LOG_POS
+--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
+--eval CHANGE MASTER TO MASTER_HOST= '$_slave_master_host', MASTER_USER= '$_slave_master_user', MASTER_PORT= $_slave_master_port, MASTER_LOG_FILE= '$_slave_master_log_file', MASTER_LOG_POS= $_slave_master_log_pos
+ALTER TABLE mysql.slave_relay_log_info ADD COLUMN (Sql_delay INTEGER NOT NULL COMMENT 'The number of seconds that the slave must lag behind the master.');
+RESET SLAVE ALL;
+--replace_result $_slave_master_host MASTER_HOST $_slave_master_user MASTER_USER $_slave_master_port MASTER_PORT $_slave_master_log_file MASTER_LOG_FILE $_slave_master_log_pos MASTER_LOG_POS
+--eval CHANGE MASTER TO MASTER_HOST= '$_slave_master_host', MASTER_USER= '$_slave_master_user', MASTER_PORT= $_slave_master_port, MASTER_LOG_FILE= '$_slave_master_log_file', MASTER_LOG_POS= $_slave_master_log_pos
+--source include/start_slave.inc
+--connection master
+--sync_slave_with_master
+
+###############################################################################
+#          Checking if replication can fail safely (I/O Thread)
+###############################################################################
+#
+# The test executes the following steps:
+#  1 - Changes mysql.slave_master_info and SQL Thread stops gracefully.
+#  2 - Shows that it is possible to restart the server setting --skip-slave-start
+#      and a dummy repository while the problem is fixed.
+#  3 - Shows that after fixing the problem the server can be restared with the
+#      correct repository.
+#  4 - Shows that trying to fix the problem with START SLAVE, RESET SLAVE may
+#      not work and requires to manually back up positions to restart
+#      replication.
+#
+
+#
+#  1 - Changes mysql.slave_relay_log_info and SQL Thread stops gracefully.
+#
+--connection slave
+ALTER TABLE mysql.slave_master_info DROP COLUMN Retry_count;
+--connection master
+INSERT INTO t_innodb VALUES (1), (2), (3);
+--connection slave
+--let $slave_io_errno= 1593
+--let $show_slave_io_error= 1
+--source include/wait_for_slave_io_error.inc
+--source include/stop_slave_sql.inc
+
+#
+#  2 - Shows that it is possible to restart the server setting --skip-slave-start
+#      and a dummy repository while the problem is fixed.
+#
+--let $rpl_server_number= 2
+--let $rpl_server_parameters= --master-info-repository=FILE --skip-slave-start
+--source include/rpl_restart_server.inc
+--connection slave
+ALTER TABLE mysql.slave_master_info ADD COLUMN (Retry_count BIGINT UNSIGNED NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.');
+
+#
+#  3 - After fixing the problem the server is restared with the correct
+#      repository.
+#
+--let $rpl_server_number= 2
+--let $rpl_server_parameters= --sync-master-info=1 --master-info-repository=TABLE --relay-log-info-repository=TABLE
+--source include/rpl_restart_server.inc
+--connection slave
+--source include/start_slave.inc
+
+#  4 - Shows that trying to fix the problem with START SLAVE, RESET SLAVE may
+#      not work and requires to manually back up positions to restart
+#      replication.
+#
+--connection slave
+ALTER TABLE mysql.slave_master_info DROP COLUMN Retry_count;
+--connection master
+INSERT INTO t_innodb VALUES (1), (2), (3);
+--connection slave
+--let $slave_io_errno= 1593
+--let $show_slave_io_error= 1
+--source include/wait_for_slave_io_error.inc
+--source include/stop_slave_sql.inc
+--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
+START SLAVE SQL_THREAD;
+
+--let $_slave_master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1)
+--let $_slave_master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1)
+--let $_slave_master_port= query_get_value(SHOW SLAVE STATUS, Master_Port, 1)
+--let $_slave_master_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1)
+--let $_slave_master_log_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
+--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
+RESET SLAVE ALL;
+--replace_result $_slave_master_host MASTER_HOST $_slave_master_user MASTER_USER $_slave_master_port MASTER_PORT $_slave_master_log_file MASTER_LOG_FILE $_slave_master_log_pos MASTER_LOG_POS
+--error ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2
+--eval CHANGE MASTER TO MASTER_HOST= '$_slave_master_host', MASTER_USER= '$_slave_master_user', MASTER_PORT= $_slave_master_port, MASTER_LOG_FILE= '$_slave_master_log_file', MASTER_LOG_POS= $_slave_master_log_pos
+ALTER TABLE mysql.slave_master_info ADD COLUMN (Retry_count BIGINT UNSIGNED NOT NULL COMMENT 'Number of reconnect attempts, to the master, before giving up.');
+RESET SLAVE ALL;
+--replace_result $_slave_master_host MASTER_HOST $_slave_master_user MASTER_USER $_slave_master_port MASTER_PORT $_slave_master_log_file MASTER_LOG_FILE $_slave_master_log_pos MASTER_LOG_POS
+--eval CHANGE MASTER TO MASTER_HOST= '$_slave_master_host', MASTER_USER= '$_slave_master_user', MASTER_PORT= $_slave_master_port, MASTER_LOG_FILE= '$_slave_master_log_file', MASTER_LOG_POS= $_slave_master_log_pos
+--source include/start_slave.inc
+--connection master
+--sync_slave_with_master
+
+###############################################################################
+# Checking ANALYZE TABLE, CHECK TABLE, CHECKSUM TABLE, OPTIMIZE TABLE,
+#          REPAIR TABLE, SHOW CREATE TABLE and MYSQLDUMP
+###############################################################################
+
+#
+# Check ANALYZE TABLE, CHECK TABLE and CHECKSUM TABLE
+#
+ANALYZE TABLE mysql.slave_master_info, mysql.slave_relay_log_info;
+CHECK TABLE mysql.slave_master_info, mysql.slave_relay_log_info EXTENDED;
+
+#
+# Check OPTIMIZE TABLE and REPAIR TABLE
+#
+OPTIMIZE TABLE mysql.slave_master_info, mysql.slave_relay_log_info;
+REPAIR TABLE mysql.slave_master_info, mysql.slave_relay_log_info EXTENDED;
+
+#
+# Check SHOW CREATE TABLE
+#
+SHOW CREATE TABLE mysql.slave_master_info;
+SHOW CREATE TABLE mysql.slave_relay_log_info;
+
+#
+# Check MYSQLDUMP
+#
+--echo # Search for occurrences of slave_master_info in the output from mysqldump
+--let $MYSQLD_DATADIR= `select @@datadir`
+--exec $MYSQL_DUMP mysql slave_master_info slave_relay_log_info > $MYSQLTEST_VARDIR/tmp/accessing_repository.sql
+--exec $MYSQL_DUMP mysql > accessing_repository.sql
+--let OUTF=$MYSQLTEST_VARDIR/tmp/accessing_repository.sql
+perl;
+  use strict;
+  my $outf= $ENV{'OUTF'} or die "OUTF not set";
+  open(FILE, "$outf") or die("Unable to open $outf: $!\n");
+  my $count = () = grep(/CREATE TABLE `slave_master_info`/gi,<FILE>);
+  print "- Occurrences: $count\n";
+  close(FILE);
+EOF
+--remove_file $MYSQLTEST_VARDIR/tmp/accessing_repository.sql
+
+###############################################################################
+# Cleaning up
+###############################################################################
+--connection master
+DROP TABLE t_innodb;
+--sync_slave_with_master
+
+--source include/stop_slave.inc
+--eval SET @@global.relay_log_info_repository=$saved_relay_repo
+--eval SET @@global.master_info_repository=$saved_master_repo
+--eval SET @@global.sync_master_info=$saved_sync_master
+--source include/start_slave.inc
+--source include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/t/rpl_parallel_start_stop.test'
--- a/mysql-test/suite/rpl/t/rpl_parallel_start_stop.test	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/rpl/t/rpl_parallel_start_stop.test	2011-10-13 14:01:50 +0000
@@ -67,7 +67,7 @@ let $count= 0;
 let $table= worker_proc_list;
 source include/wait_until_rows_count.inc;
 
-let $slave_sql_errno= 1743; # ER_MTS_PARALLEL_INCONSISTENT_DATA
+let $slave_sql_errno= 1742; # ER_MTS_PARALLEL_INCONSISTENT_DATA
 source include/wait_for_slave_sql_error.inc;
 
 source include/start_slave.inc;

=== modified file 'mysql-test/suite/rpl/t/rpl_rotate_logs.test'
--- a/mysql-test/suite/rpl/t/rpl_rotate_logs.test	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/rpl/t/rpl_rotate_logs.test	2011-10-13 14:01:50 +0000
@@ -37,19 +37,19 @@ CALL mtr.add_suppression("The slave coor
 # START SLAVE will fail because it can't read the file (mode 000)
 # (system error 13)
 --replace_result $MYSQL_TEST_DIR TESTDIR
---error 1105,1105,29
+--error ER_MASTER_INFO, 29
 start slave;
 chmod 0600  $MYSQLD_SLAVE_DATADIR/master.info;
 # It will fail again because the file is empty so the slave cannot get valuable
 # info about how to connect to the master from it (failure in
 # init_strvar_from_file() in init_master_info()).
---error 1201
+--error ER_MASTER_INFO
 start slave;
 --replace_result $MASTER_MYPORT MASTER_PORT
 
 # CHANGE MASTER will fail because it first parses master.info before changing
 # it (so when master.info is bad, people have to use RESET SLAVE first).
---error 1201
+--error ER_MASTER_INFO
 eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
 reset slave;
 --replace_result $MASTER_MYPORT MASTER_PORT
@@ -191,10 +191,10 @@ sync_slave_with_master;
 #
 # Bug #29420: crash with show and purge binlogs
 #
---error 1220
+--error ER_ERROR_WHEN_EXECUTING_COMMAND
 show binlog events in 'non existing_binlog_file';
 purge master logs before now();
---error 1220
+--error ER_ERROR_WHEN_EXECUTING_COMMAND
 show binlog events in '';
 purge master logs before now();
 

=== modified file 'mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result'
--- a/mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result	2011-03-25 14:35:13 +0000
+++ b/mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result	2011-10-13 14:01:50 +0000
@@ -7,7 +7,7 @@ SET @@global.max_allowed_packet = DEFAUL
 SET @@global.max_allowed_packet = 1000;
 Warnings:
 Warning	1292	Truncated incorrect max_allowed_packet value: '1000'
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 SET @@global.max_allowed_packet = DEFAULT;
 SELECT @@global.max_allowed_packet;
 @@global.max_allowed_packet
@@ -27,14 +27,14 @@ SELECT @@global.max_allowed_packet = 104
 '#--------------------FN_DYNVARS_070_03-------------------------#'
 SET @@global.max_allowed_packet = 1024;
 Warnings:
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 SELECT @@global.max_allowed_packet;
 @@global.max_allowed_packet
 1024
 SET @@global.max_allowed_packet = 1025;
 Warnings:
 Warning	1292	Truncated incorrect max_allowed_packet value: '1025'
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 SELECT @@global.max_allowed_packet;
 @@global.max_allowed_packet
 1024
@@ -78,21 +78,21 @@ SELECT @@session.max_allowed_packet;
 SET @@global.max_allowed_packet = 0;
 Warnings:
 Warning	1292	Truncated incorrect max_allowed_packet value: '0'
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 SELECT @@global.max_allowed_packet;
 @@global.max_allowed_packet
 1024
 SET @@global.max_allowed_packet = -1024;
 Warnings:
 Warning	1292	Truncated incorrect max_allowed_packet value: '-1024'
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 SELECT @@global.max_allowed_packet;
 @@global.max_allowed_packet
 1024
 SET @@global.max_allowed_packet = 1023;
 Warnings:
 Warning	1292	Truncated incorrect max_allowed_packet value: '1023'
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 SELECT @@global.max_allowed_packet;
 @@global.max_allowed_packet
 1024
@@ -155,21 +155,21 @@ WHERE VARIABLE_NAME='max_allowed_packet'
 SET @@global.max_allowed_packet = TRUE;
 Warnings:
 Warning	1292	Truncated incorrect max_allowed_packet value: '1'
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 SELECT @@global.max_allowed_packet;
 @@global.max_allowed_packet
 1024
 SET @@global.max_allowed_packet = FALSE;
 Warnings:
 Warning	1292	Truncated incorrect max_allowed_packet value: '0'
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 SELECT @@global.max_allowed_packet;
 @@global.max_allowed_packet
 1024
 '#---------------------FN_DYNVARS_070_09----------------------#'
 SET @@global.max_allowed_packet = 2048;
 Warnings:
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 SELECT @@max_allowed_packet = @@global.max_allowed_packet;
 @@max_allowed_packet = @@global.max_allowed_packet
 0

=== modified file 'mysql-test/suite/sys_vars/r/max_allowed_packet_func.result'
--- a/mysql-test/suite/sys_vars/r/max_allowed_packet_func.result	2011-03-25 14:35:13 +0000
+++ b/mysql-test/suite/sys_vars/r/max_allowed_packet_func.result	2011-10-13 14:01:50 +0000
@@ -24,7 +24,7 @@ SELECT @@session.net_buffer_length;
 ## Setting value of max_allowed packet and net_buffer_length to 1024 ##
 SET @@global.max_allowed_packet = 1024;
 Warnings:
-Warning	1732	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
+Warning	1731	The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
 SET @@global.net_buffer_length = 1024;
 SELECT @@global.max_allowed_packet;
 @@global.max_allowed_packet

=== modified file 'mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result'
--- a/mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result	2011-02-22 08:01:58 +0000
+++ b/mysql-test/suite/sys_vars/r/max_binlog_stmt_cache_size_basic.result	2011-10-13 14:01:50 +0000
@@ -10,7 +10,7 @@ SELECT @start_binlog_stmt_cache_size;
 SET @@global.max_binlog_stmt_cache_size = 5000;
 Warnings:
 Warning	1292	Truncated incorrect max_binlog_stmt_cache_size value: '5000'
-Warning	1726	Option binlog_stmt_cache_size (32768) is greater than max_binlog_stmt_cache_size (4096); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size.
+Warning	1725	Option binlog_stmt_cache_size (32768) is greater than max_binlog_stmt_cache_size (4096); setting binlog_stmt_cache_size equal to max_binlog_stmt_cache_size.
 SET @@global.max_binlog_stmt_cache_size = DEFAULT;
 SELECT @@global.max_binlog_stmt_cache_size;
 @@global.max_binlog_stmt_cache_size

=== modified file 'sql/lock.cc'
--- a/sql/lock.cc	2011-08-19 13:04:28 +0000
+++ b/sql/lock.cc	2011-10-13 14:01:50 +0000
@@ -115,22 +115,19 @@ static int thr_lock_errno_to_mysql[]=
 static int
 lock_tables_check(THD *thd, TABLE **tables, uint count, uint flags)
 {
-  uint system_count, i;
-  bool is_superuser;
+  uint system_count= 0, i= 0;
+  bool is_superuser= false;
   /*
     Identifies if the executed sql command can updated either a log
     or rpl info table.
   */
-  bool log_table_write_query, rpl_info_table_write_query;
+  bool log_table_write_query= false;
 
   DBUG_ENTER("lock_tables_check");
 
-  system_count= 0;
   is_superuser= thd->security_ctx->master_access & SUPER_ACL;
   log_table_write_query=
      is_log_table_write_query(thd->lex->sql_command);
-  rpl_info_table_write_query=
-     is_rpl_info_table_write_query(thd->lex->sql_command);
 
   for (i=0 ; i<count; i++)
   {
@@ -145,23 +142,6 @@ lock_tables_check(THD *thd, TABLE **tabl
       When a user is requesting a lock, the following
       constraints are enforced:
     */
-    if (t->s->table_category == TABLE_CATEGORY_RPL_INFO &&
-        (flags & MYSQL_LOCK_RPL_INFO_TABLE) == 0 &&
-        !rpl_info_table_write_query)
-    {
-      /*
-        A user should not be able to prevent writes,
-        or hold any type of lock in a session,
-        since this would be a DOS attack.
-      */
-      if ((t->reginfo.lock_type >= TL_READ_NO_INSERT ||
-          thd->lex->sql_command == SQLCOM_LOCK_TABLES))
-      {
-          my_error(ER_CANT_LOCK_RPL_INFO_TABLE, MYF(0));
-          DBUG_RETURN(1);
-      }
-    }
-
     if (t->s->table_category == TABLE_CATEGORY_LOG &&
         (flags & MYSQL_LOCK_LOG_TABLE) == 0 &&
         !log_table_write_query)

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2011-10-10 06:22:13 +0000
+++ b/sql/log_event.cc	2011-10-13 14:01:50 +0000
@@ -775,6 +775,7 @@ inline int Log_event::do_apply_event_wor
 
 int Log_event::do_update_pos(Relay_log_info *rli)
 {
+  int error= 0;
   DBUG_ASSERT(!rli->belongs_to_client());
   /*
     rli is null when (as far as I (Guilhem) know) the caller is
@@ -792,8 +793,8 @@ int Log_event::do_update_pos(Relay_log_i
   DBUG_ASSERT(!is_mts_worker(rli->info_thd));
 
   if (rli)
-    rli->stmt_done(log_pos);
-  return 0;                                   // Cannot fail currently
+    error= rli->stmt_done(log_pos);
+  return error;
 }
 
 
@@ -6254,6 +6255,7 @@ bool Rotate_log_event::write(IO_CACHE* f
 */
 int Rotate_log_event::do_update_pos(Relay_log_info *rli)
 {
+  int error= 0;
   DBUG_ENTER("Rotate_log_event::do_update_pos");
 #ifndef DBUG_OFF
   char buf[32];
@@ -6292,7 +6294,8 @@ int Rotate_log_event::do_update_pos(Rela
         synchronization point. For that reason, the checkpoint
         routine is being called here.
       */
-      (void) mts_checkpoint_routine(rli, 0, FALSE, TRUE); // TODO: ALFRANIO ERROR
+      if ((error= mts_checkpoint_routine(rli, 0, FALSE, TRUE)))
+        goto err;
     }
 
     mysql_mutex_lock(&rli->data_lock);
@@ -6304,7 +6307,11 @@ int Rotate_log_event::do_update_pos(Rela
     memcpy((void *)rli->get_group_master_log_name(),
            new_log_ident, ident_len + 1);
     rli->notify_group_master_log_name_update();
-    rli->inc_group_relay_log_pos(pos, TRUE /* skip_lock */);
+    if ((error=  rli->inc_group_relay_log_pos(pos, true)))
+    {
+      mysql_mutex_unlock(&rli->data_lock);
+      goto err;
+    }
 
     DBUG_PRINT("info", ("new group_master_log_name: '%s'  "
                         "new group_master_log_pos: %lu",
@@ -6330,8 +6337,8 @@ int Rotate_log_event::do_update_pos(Rela
   else
     rli->inc_event_relay_log_pos();
 
-
-  DBUG_RETURN(0);
+err:
+  DBUG_RETURN(error);
 }
 
 
@@ -6682,7 +6689,6 @@ void Xid_log_event::print(FILE* file, PR
 int Xid_log_event::do_apply_event_worker(Slave_worker *w)
 {
   int error= 0;
-  bool is_trans_repo= w->is_transactional();
   Slave_committed_queue *coordinator_gaq= w->c_rli->gaq;
 
   /* For a slave Xid_log_event is COMMIT */
@@ -6701,14 +6707,11 @@ int Xid_log_event::do_apply_event_worker
                   sql_print_information("Crashing crash_before_update_pos.");
                   DBUG_SUICIDE(););
 
-  if (is_trans_repo)
-  {
-    ulong gaq_idx= mts_group_idx;
-    Slave_job_group *ptr_group= coordinator_gaq->get_job_group(gaq_idx);
+  ulong gaq_idx= mts_group_idx;
+  Slave_job_group *ptr_group= coordinator_gaq->get_job_group(gaq_idx);
 
-    if ((error= w->commit_positions(this, ptr_group, true)))
-      goto err;
-  }
+  if ((error= w->commit_positions(this, ptr_group, true)))
+    goto err;
 
   DBUG_PRINT("mts", ("do_apply group master %s %llu  group relay %s %llu event %s %llu.",
                      w->get_group_master_log_name(),
@@ -6737,22 +6740,11 @@ int Xid_log_event::do_apply_event(Relay_
   int error= 0;
   Relay_log_info *rli_ptr= const_cast<Relay_log_info *>(rli);
 
-  /*
-    If the repository is transactional, i.e., created over a
-    transactional table, we need to update the positions within
-    the context of the current transaction in order to provide
-    data integrity. See sql/rpl_rli.h for further details.
-  */
-  bool is_trans_repo= rli_ptr->is_transactional();
-
   /* For a slave Xid_log_event is COMMIT */
   general_log_print(thd, COM_QUERY,
                     "COMMIT /* implicit, from Xid_log_event */");
 
-  if (is_trans_repo)
-  {
-    mysql_mutex_lock(&rli_ptr->data_lock);
-  }
+  mysql_mutex_lock(&rli_ptr->data_lock);
 
   DBUG_PRINT("info", ("do_apply group master %s %llu  group relay %s %llu event %s %llu\n",
     rli_ptr->get_group_master_log_name(),
@@ -6769,22 +6761,17 @@ int Xid_log_event::do_apply_event(Relay_
   /*
     We need to update the positions in here to make it transactional.  
   */
-  if (is_trans_repo)
-  {
-    rli_ptr->inc_event_relay_log_pos();
-    rli_ptr->set_group_relay_log_pos(rli_ptr->get_event_relay_log_pos());
-    rli_ptr->set_group_relay_log_name(rli_ptr->get_event_relay_log_name());
+  rli_ptr->inc_event_relay_log_pos();
+  rli_ptr->set_group_relay_log_pos(rli_ptr->get_event_relay_log_pos());
+  rli_ptr->set_group_relay_log_name(rli_ptr->get_event_relay_log_name());
 
-    rli_ptr->notify_group_relay_log_name_update();
+  rli_ptr->notify_group_relay_log_name_update();
 
-    if (log_pos) // 3.23 binlogs don't have log_posx
-    {
-      rli_ptr->set_group_master_log_pos(log_pos);
-    }
+  if (log_pos) // 3.23 binlogs don't have log_posx
+    rli_ptr->set_group_master_log_pos(log_pos);
   
-    if ((error= rli_ptr->flush_info(TRUE)))
-      goto err;
-  }
+  if ((error= rli_ptr->flush_info(TRUE)))
+    goto err;
 
   DBUG_PRINT("info", ("do_apply group master %s %llu  group relay %s %llu event %s %llu\n",
     rli_ptr->get_group_master_log_name(),
@@ -6805,11 +6792,9 @@ int Xid_log_event::do_apply_event(Relay_
   thd->mdl_context.release_transactional_locks();
 
 err:
-  if (is_trans_repo)
-  {
-    mysql_cond_broadcast(&rli_ptr->data_cond);
-    mysql_mutex_unlock(&rli_ptr->data_lock);
-  }
+  mysql_cond_broadcast(&rli_ptr->data_cond);
+  mysql_mutex_unlock(&rli_ptr->data_lock);
+
   return error;
 }
 
@@ -7310,6 +7295,8 @@ void Stop_log_event::print(FILE* file, P
 */
 int Stop_log_event::do_update_pos(Relay_log_info *rli)
 {
+  int error_inc= 0;
+  int error_flush= 0;
   /*
     We do not want to update master_log pos because we get a rotate event
     before stop, so by now group_master_log_name is set to the next log.
@@ -7321,10 +7308,10 @@ int Stop_log_event::do_update_pos(Relay_
     rli->inc_event_relay_log_pos();
   else
   {
-    rli->inc_group_relay_log_pos(0);
-    rli->flush_info(TRUE);
+    error_inc= rli->inc_group_relay_log_pos(false);
+    error_flush= rli->flush_info(TRUE);
   }
-  return 0;
+  return (error_inc || error_flush);
 }
 
 #endif /* !MYSQL_CLIENT */
@@ -9143,14 +9130,7 @@ Rows_log_event::do_update_pos(Relay_log_
       Step the group log position if we are not in a transaction,
       otherwise increase the event log position.
     */
-    rli->stmt_done(log_pos);
-    /*
-      Clear any errors in thd->net.last_err*. It is not known if this is
-      needed or not. It is believed that any errors that may exist in
-      thd->net.last_err* are allowed. Examples of errors are "key not
-      found", which is produced in the test case rpl_row_conflicts.test
-    */
-    thd->clear_error();
+    error= rli->stmt_done(log_pos);
   }
   else
   {

=== modified file 'sql/rpl_info.h'
--- a/sql/rpl_info.h	2011-08-19 13:04:28 +0000
+++ b/sql/rpl_info.h	2011-10-13 14:01:50 +0000
@@ -116,7 +116,7 @@ public:
     return (handler);
   }
 
-  int check_info()
+  enum_return_check check_info()
   {
     return (handler->check_info(uidx, nidx));
   }

=== modified file 'sql/rpl_info_dummy.cc'
--- a/sql/rpl_info_dummy.cc	2011-08-19 13:04:28 +0000
+++ b/sql/rpl_info_dummy.cc	2011-10-13 14:01:50 +0000
@@ -43,11 +43,11 @@ int Rpl_info_dummy::do_prepare_info_for_
   return 0;
 }
 
-int Rpl_info_dummy::do_check_info(const ulong *uidx __attribute__((unused)),
-                                 const uint nidx __attribute__((unused)))
+enum_return_check Rpl_info_dummy::do_check_info(const ulong *uidx __attribute__((unused)),
+                                                const uint nidx __attribute__((unused)))
 {
   if (abort) DBUG_ASSERT(0);
-  return 0;
+  return REPOSITORY_DOES_NOT_EXIST;
 }
 
 int Rpl_info_dummy::do_flush_info(const ulong *uidx __attribute__((unused)),

=== modified file 'sql/rpl_info_dummy.h'
--- a/sql/rpl_info_dummy.h	2011-08-19 13:04:28 +0000
+++ b/sql/rpl_info_dummy.h	2011-10-13 14:01:50 +0000
@@ -35,7 +35,7 @@ public:
 
 private:
   int do_init_info(const ulong *uidx, const uint nidx);
-  int do_check_info(const ulong *uidx, const uint nidx);
+  enum_return_check 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);

=== modified file 'sql/rpl_info_factory.cc'
--- a/sql/rpl_info_factory.cc	2011-08-19 13:04:28 +0000
+++ b/sql/rpl_info_factory.cc	2011-10-13 14:01:50 +0000
@@ -381,80 +381,104 @@ bool Rpl_info_factory::decide_repository
                                          Rpl_info_handler **handler_dest,
                                          const char **msg)
 {
-
-  DBUG_ENTER("Rpl_info_factory::decide_repository");
   bool error= TRUE;
+  enum_return_check return_check_src= ERROR_CHECKING_REPOSITORY;
+  enum_return_check return_check_dst= ERROR_CHECKING_REPOSITORY;
+  DBUG_ENTER("Rpl_info_factory::decide_repository");
 
-  DBUG_ASSERT((*handler_dest) != NULL);
   if (option == INFO_REPOSITORY_DUMMY)
     DBUG_RETURN(FALSE);
 
-  /*
-    check_info() returns FALSE if the repository exists. If a FILE, 
-    for example, this means that FALSE is returned if a file exists.
-    If a TABLE, for example, this means that FALSE is returned if
-    the table exists and is populated. Otherwise, TRUE is returned.
-
-    The check_info() behavior is odd and we are going to fix this
-    in the future.
-
-    So,
+  DBUG_ASSERT((*handler_src) != NULL && (*handler_dest) != NULL &&
+              (*handler_src) != (*handler_dest));
 
-      . is_src  == TRUE, means that the source repository exists.
-      . is_dest == TRUE, means that the destination repository
-        exists.
-
-    /Alfranio
-  */
-
-  bool is_src= !((*handler_src)->check_info(info->uidx, info->nidx));
-  bool is_dest= !((*handler_dest)->check_info(info->uidx, info->nidx));
-
-  DBUG_ASSERT((*handler_dest) != NULL && (*handler_dest) != NULL);
-  if (is_src && is_dest)
+  return_check_src= (*handler_src)->check_info(info->uidx, info->nidx);
+  return_check_dst= (*handler_dest)->check_info(info->uidx, info->nidx);
+  if (return_check_src == ERROR_CHECKING_REPOSITORY ||
+      return_check_dst == ERROR_CHECKING_REPOSITORY)
   {
-    *msg= "Multiple replication metadata repository instances "
-          "found with data in them. Unable to decide which is "
-          "the correct one to choose";
-    DBUG_RETURN(error);
-  }
-
-  if (!is_dest && is_src)
-  {
-    if ((*handler_src)->init_info(info->uidx, info->nidx) ||
-        (*handler_dest)->init_info(info->uidx, info->nidx))
-    {
-      *msg= "Error transfering information";
-      goto err;
-    }
     /*
-      Transfer the information from source to destination and delete the
-      source. Note this is not fault-tolerant and a crash before removing
-      source may cause the next restart to fail as is_src and is_dest may
-      be true. Moreover, any failure in removing the source may lead to
-      the same.
+      If there is an error, we cannot proceed with the normal operation.
+      In this case, we just pick the dest repository if check_info() has
+      not failed to execute against it in order to give users the chance
+      to fix the problem and restart the server.
 
-      /Alfranio
+      Notice that migration will not take place and the destination may
+      be empty.
     */
-    if (info->copy_info(*handler_src, *handler_dest) ||
-        (*handler_dest)->flush_info(info->uidx, info->nidx, TRUE))
+    if (opt_skip_slave_start && return_check_dst != ERROR_CHECKING_REPOSITORY)
     {
-      *msg= "Error transfering information";
+      sql_print_warning("Error while checking replication metadata. "
+                        "Setting the requested repository in order to "
+                        "give users the chance to fix the problem and "
+                        "restart the server.");
+      delete (*handler_src);
+      *handler_src= NULL;
+      info->set_rpl_info_handler(*handler_dest);
+      info->set_rpl_info_type(option);
+      error= FALSE;
       goto err;
     }
-    (*handler_src)->end_info(info->uidx, info->nidx);
-    if ((*handler_src)->remove_info(info->uidx, info->nidx))
+    else
     {
-      *msg= "Error removing old repository";
+      *msg= "Error while checking replication metadata.";
       goto err;
     }
   }
+  else
+  {
+    /*
+      If there is no error, we can proceed with the normal operation and
+      check if we need to do some migration between repositories.
+      However, if both repositories are set an error will be printed out.
+    */
+    if (return_check_src == REPOSITORY_EXISTS &&
+        return_check_dst == REPOSITORY_EXISTS)
+    {
+      *msg= "Multiple replication metadata repository instances "
+            "found with data in them. Unable to decide which is "
+            "the correct one to choose";
+      DBUG_RETURN(error);
+    }
 
-  delete (*handler_src);
-  *handler_src= NULL;
-  info->set_rpl_info_handler(*handler_dest);
-  info->set_rpl_info_type(option);
-  error= FALSE;
+    if (return_check_src == REPOSITORY_EXISTS &&
+        return_check_dst == REPOSITORY_DOES_NOT_EXIST)
+    {
+      if ((*handler_src)->init_info(info->uidx, info->nidx) ||
+          (*handler_dest)->init_info(info->uidx, info->nidx))
+      {
+        *msg= "Error transfering information";
+        goto err;
+      }
+      /*
+        Transfer the information from source to destination and delete the
+        source. Note this is not fault-tolerant and a crash before removing
+        source may cause the next restart to fail as is_src and is_dest may
+        be true. Moreover, any failure in removing the source may lead to
+        the same.
+
+        /Alfranio
+      */
+      if (info->copy_info(*handler_src, *handler_dest) ||
+          (*handler_dest)->flush_info(info->uidx, info->nidx, TRUE))
+      {
+        *msg= "Error transfering information";
+        goto err;
+      }
+      (*handler_src)->end_info(info->uidx, info->nidx);
+      if ((*handler_src)->remove_info(info->uidx, info->nidx))
+      {
+        *msg= "Error removing old repository";
+        goto err;
+      }
+    }
+
+    delete (*handler_src);
+    *handler_src= NULL;
+    info->set_rpl_info_handler(*handler_dest);
+    info->set_rpl_info_type(option);
+    error= FALSE;
+  }
 
 err:
   DBUG_RETURN(error); 
@@ -494,11 +518,13 @@ bool Rpl_info_factory::change_repository
                                          const char **msg)
 {
   bool error= TRUE;
-
+  enum_return_check return_check_src= ERROR_CHECKING_REPOSITORY;
   DBUG_ENTER("Rpl_info_factory::change_repository");
+  DBUG_ASSERT((*handler_src) != NULL && (*handler_dest) != NULL &&
+              (*handler_src) != (*handler_dest));
 
-  DBUG_ASSERT((*handler_dest) != NULL && (*handler_dest) != NULL);
-  if (!(*handler_src)->check_info(info->uidx, info->nidx))
+  return_check_src= (*handler_src)->check_info(info->uidx, info->nidx);
+  if (return_check_src == REPOSITORY_EXISTS)
   {
     if ((*handler_dest)->init_info(info->uidx, info->nidx))
     {
@@ -516,12 +542,19 @@ bool Rpl_info_factory::change_repository
       /Alfranio
     */
     if (info->copy_info(*handler_src, *handler_dest) ||
-        (*handler_dest)->flush_info(info->uidx, info->nidx, TRUE))
+        (*handler_dest)->flush_info(info->uidx, info->nidx, true))
     {
       *msg= "Error transfering information";
       goto err;
     }
   }
+
+  if (return_check_src == ERROR_CHECKING_REPOSITORY)
+  {
+    *msg= "Error checking old repository";
+    goto err;
+  }
+
   (*handler_src)->end_info(info->uidx, info->nidx);
   if ((*handler_src)->remove_info(info->uidx, info->nidx))
   {

=== modified file 'sql/rpl_info_file.cc'
--- a/sql/rpl_info_file.cc	2011-09-14 16:12:22 +0000
+++ b/sql/rpl_info_file.cc	2011-10-13 14:01:50 +0000
@@ -43,12 +43,11 @@ int Rpl_info_file::do_init_info(const ul
                                 const uint nidx __attribute__((unused)))
 {
   int error= 0;
-
-  /* Don't init if there is no storage */
   DBUG_ENTER("Rpl_info_file::do_init_info");
 
   /* does info file exist ? */
-  if (do_check_info(uidx, nidx))
+  enum_return_check ret_check= do_check_info(uidx, nidx);
+  if (ret_check == REPOSITORY_DOES_NOT_EXIST)
   {
     /*
       If someone removed the file from underneath our feet, just close
@@ -81,7 +80,7 @@ file '%s')", info_fname);
     }
   }
   /* file exists */
-  else
+  else if (ret_check == REPOSITORY_EXISTS)
   {
     if (info_fd >= 0)
       reinit_io_cache(&info_file, READ_CACHE, 0L,0,0);
@@ -108,6 +107,8 @@ file '%s')", info_fname);
       }
     }
   }
+  else
+    error= 1;
   DBUG_RETURN(error);
 }
 
@@ -127,18 +128,16 @@ int Rpl_info_file::do_prepare_info_for_w
   return (reinit_io_cache(&info_file, WRITE_CACHE, 0L, 0, 1));
 }
 
-int Rpl_info_file::do_check_info(const ulong *uidx __attribute__((unused)),
-                                 const uint nidx __attribute__((unused)))
+enum_return_check Rpl_info_file::do_check_info(const ulong *uidx __attribute__((unused)),
+                                               const uint nidx __attribute__((unused)))
 {
-  /*
-    This function is used by callers to check if the file exists.
+  if (my_access(info_fname, F_OK))
+    return REPOSITORY_DOES_NOT_EXIST;
 
-    If the file exists but users do not have the appropriated
-    rights to access it, callers will assume that the file does
-    not exist taking the appropriate actions and failing when
-    trying to create the file.
-  */
-  return my_access(info_fname, F_OK);
+  if (my_access(info_fname, F_OK | R_OK | W_OK))
+    return ERROR_CHECKING_REPOSITORY;
+    
+  return REPOSITORY_EXISTS;
 }
 
 int Rpl_info_file::do_flush_info(const ulong *uidx,

=== modified file 'sql/rpl_info_file.h'
--- a/sql/rpl_info_file.h	2011-08-19 13:04:28 +0000
+++ b/sql/rpl_info_file.h	2011-10-13 14:01:50 +0000
@@ -45,7 +45,7 @@ private:
   IO_CACHE info_file;
 
   int do_init_info(const ulong *uidx, const uint nidx);
-  int do_check_info(const ulong *uidx, const uint nidx);
+  enum_return_check 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);

=== modified file 'sql/rpl_info_handler.h'
--- a/sql/rpl_info_handler.h	2011-08-19 13:04:28 +0000
+++ b/sql/rpl_info_handler.h	2011-10-13 14:01:50 +0000
@@ -20,6 +20,11 @@
 #include <dynamic_ids.h>
 #include "rpl_info_values.h"
 
+/*
+  Defines status on the repository.
+*/
+enum enum_return_check { REPOSITORY_DOES_NOT_EXIST= 1, REPOSITORY_EXISTS, ERROR_CHECKING_REPOSITORY };
+
 class Rpl_info_handler
 {
 public:
@@ -41,16 +46,19 @@ public:
   }
 
   /**
-    Checks if any necessary dependency is satisfied such as a
-    file exists.
+    Checks the repository's status.
 
     @param[in] uidx Array of fields that identifies an object
     @param[in] nidx Number of fields in the array
 
-    @retval FALSE success,
-    @retval TRUE  otherwise error.
+    @retval REPOSITORY_EXISTS         reposistory is ready to
+                                       be used.
+    @retval REPOSITORY_DOES_NOT_EXIST repository needs to be 
+                                      configured.
+    @retval ERROR_CHECKING_REPOSITORY error while checking the
+                                      reposistory.
   */
-  int check_info(const ulong *uidx, const uint nidx)
+  enum_return_check check_info(const ulong *uidx, const uint nidx)
   {
     return do_check_info(uidx, nidx);
   }
@@ -334,7 +342,7 @@ protected:
 
 private:
   virtual int do_init_info(const ulong *uidx, const uint nidx)= 0;
-  virtual int do_check_info(const ulong *uidx, const uint nidx)= 0;
+  virtual enum_return_check do_check_info(const ulong *uidx, const uint nidx)= 0;
   virtual int do_flush_info(const ulong *uidx, const uint nidx,
                             const bool force)= 0;
   virtual int do_remove_info(const ulong *uidx, const uint nidx)= 0;

=== modified file 'sql/rpl_info_table.cc'
--- a/sql/rpl_info_table.cc	2011-08-19 13:04:28 +0000
+++ b/sql/rpl_info_table.cc	2011-10-13 14:01:50 +0000
@@ -271,17 +271,16 @@ end:
   DBUG_RETURN(error);
 }
 
-int Rpl_info_table::do_check_info(const ulong *uidx, const uint nidx)
+enum_return_check Rpl_info_table::do_check_info(const ulong *uidx, const uint nidx)
 {
-  int error= 1;
   TABLE *table= NULL;
   ulong saved_mode;
   Open_tables_backup backup;
+  enum_return_check return_check= ERROR_CHECKING_REPOSITORY;
 
   DBUG_ENTER("Rpl_info_table::do_check_info");
 
   THD *thd= access->create_thd();
-
   saved_mode= thd->variables.sql_mode;
 
   /*
@@ -294,6 +293,8 @@ int Rpl_info_table::do_check_info(const
     sql_print_warning("Info table is not ready to be used. Table "
                       "'%s.%s' cannot be opened.", str_schema.str,
                       str_table.str);
+
+    return_check= ERROR_CHECKING_REPOSITORY;
     goto end;
   }
 
@@ -309,18 +310,20 @@ int Rpl_info_table::do_check_info(const
        really means that there was a failure but only that the
        record was not found.
     */
+    return_check= REPOSITORY_DOES_NOT_EXIST;
     goto end;
   }
-  error= 0;
+  return_check= REPOSITORY_EXISTS;
 
 end:
   /*
     Unlocks and closes the rpl_info table.
   */
-  access->close_table(thd, table, &backup, error);
+  access->close_table(thd, table, &backup,
+                      return_check == ERROR_CHECKING_REPOSITORY);
   thd->variables.sql_mode= saved_mode;
   access->drop_thd(thd);
-  DBUG_RETURN(error);
+  DBUG_RETURN(return_check);
 }
 
 void Rpl_info_table::do_end_info(const ulong *uidx, const uint nidx)

=== modified file 'sql/rpl_info_table.h'
--- a/sql/rpl_info_table.h	2011-08-19 13:04:28 +0000
+++ b/sql/rpl_info_table.h	2011-10-13 14:01:50 +0000
@@ -60,7 +60,7 @@ private:
   bool is_transactional;       
 
   int do_init_info(const ulong *uidx, const uint nidx);
-  int do_check_info(const ulong *uidx, const uint nidx);
+  enum_return_check 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);

=== modified file 'sql/rpl_info_table_access.cc'
--- a/sql/rpl_info_table_access.cc	2011-08-19 13:04:28 +0000
+++ b/sql/rpl_info_table_access.cc	2011-10-13 14:01:50 +0000
@@ -92,11 +92,12 @@ bool Rpl_info_table_access::open_table(T
       Safety: this can only happen if someone started the server and then
       altered the table.
     */
+    ha_rollback_trans(thd, FALSE);
+    close_thread_tables(thd);
+    thd->restore_backup_open_tables_state(backup);
     my_error(ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2, MYF(0),
              tables.table->s->db.str, tables.table->s->table_name.str,
              max_num_field, tables.table->s->fields);
-    close_thread_tables(thd);
-    thd->restore_backup_open_tables_state(backup);
     DBUG_RETURN(TRUE);
   }
 

=== modified file 'sql/rpl_mi.cc'
--- a/sql/rpl_mi.cc	2011-08-19 23:44:34 +0000
+++ b/sql/rpl_mi.cc	2011-10-13 14:01:50 +0000
@@ -242,6 +242,9 @@ int Master_info::flush_info(bool force)
   DBUG_ENTER("Master_info::flush_info");
   DBUG_PRINT("enter",("master_pos: %lu", (ulong) master_log_pos));
 
+  if (!inited)
+    DBUG_RETURN(0);
+
   /*
     We update the sync_period at this point because only here we
     now that we are handling a master info. This needs to be
@@ -259,7 +262,7 @@ int Master_info::flush_info(bool force)
   DBUG_RETURN(0);
 
 err:
-  sql_print_error("Error writing master configuration");
+  sql_print_error("Error writing master configuration.");
   DBUG_RETURN(1);
 }
 
@@ -270,35 +273,39 @@ void Master_info::set_relay_log_info(Rel
 
 int Master_info::init_info()
 {
+  /*
+    The init_info() is used to either create or read information
+    from the repository, in order to initialize the Master_info.
+  */
   DBUG_ENTER("Master_info::init_info");
+  enum_return_check check_return= ERROR_CHECKING_REPOSITORY;
 
   if (inited)
     DBUG_RETURN(0);
 
-  /*
-    The init_info() is used to either create or read information
-    from the repository, in order to initialize the Master_info.
-  */
   mysql= 0; file_id= 1;
-  int necessary_to_configure= check_info();
+  check_return= check_info();
+  if (check_return == ERROR_CHECKING_REPOSITORY)
+    goto err;
   
   if (handler->init_info(uidx, nidx))
     goto err;
 
-  if (necessary_to_configure)
+  if (check_return == REPOSITORY_DOES_NOT_EXIST)
   {
     init_master_log_pos();
   }
   else if (read_info(handler))
     goto err;
 
+  inited= 1;
   if (flush_info(TRUE))
     goto err;
 
-  inited= 1;
   DBUG_RETURN(0);
 
 err:
+  inited= 0;
   sql_print_error("Error reading master configuration.");
   DBUG_RETURN(1);
 }

=== modified file 'sql/rpl_rli.cc'
--- a/sql/rpl_rli.cc	2011-08-19 13:04:28 +0000
+++ b/sql/rpl_rli.cc	2011-10-13 14:01:50 +0000
@@ -707,9 +707,10 @@ improper_arguments: %d  timed_out: %d",
   DBUG_RETURN( error ? error : event_count );
 }
 
-void Relay_log_info::inc_group_relay_log_pos(ulonglong log_pos,
-                                                bool skip_lock)
+int Relay_log_info::inc_group_relay_log_pos(ulonglong log_pos,
+                                            bool skip_lock)
 {
+  int error= 0;
   DBUG_ENTER("Relay_log_info::inc_group_relay_log_pos");
 
   if (skip_lock)
@@ -725,16 +726,6 @@ void Relay_log_info::inc_group_relay_log
   notify_group_relay_log_name_update();
 
   /*
-    If the slave does not support transactions and replicates a transaction,
-    users should not trust group_master_log_pos (which they can display with
-    SHOW SLAVE STATUS or read from relay-log.info), because to compute
-    group_master_log_pos the slave relies on log_pos stored in the master's
-    binlog, but if we are in a master's transaction these positions are always
-    the BEGIN's one (excepted for the COMMIT), so group_master_log_pos does
-    not advance as it should on the non-transactional slave (it advances by
-    big leaps, whereas it should advance by small leaps).
-  */
-  /*
     In 4.x we used the event's len to compute the positions here. This is
     wrong if the event was 3.23/4.0 and has been converted to 5.0, because
     then the event's len is not what is was in the master's binlog, so this
@@ -770,12 +761,22 @@ void Relay_log_info::inc_group_relay_log
   */
   DBUG_ASSERT(!is_parallel_exec() ||
               mts_group_status != Relay_log_info::MTS_IN_GROUP);
-  flush_info(is_transactional() ? TRUE : FALSE);  // todo: error branch
+  /*
+    We do not force synchronization at this point, note the
+    parameter false, because a non-transactional change is
+    being committed.
+
+    For that reason, the synchronization here is subjected to
+    the option sync_relay_log_info.
+
+    See sql/rpl_rli.h for further information on this behavior.
+  */
+  error= flush_info(FALSE);
 
   mysql_cond_broadcast(&data_cond);
   if (!skip_lock)
     mysql_mutex_unlock(&data_lock);
-  DBUG_VOID_RETURN;
+  DBUG_RETURN(error);
 }
 
 
@@ -1032,8 +1033,10 @@ bool Relay_log_info::cached_charset_comp
 }
 
 
-void Relay_log_info::stmt_done(my_off_t event_master_log_pos)
+int Relay_log_info::stmt_done(my_off_t event_master_log_pos)
 {
+  int error= 0;
+
   clear_flag(IN_STMT);
 
   DBUG_ASSERT(!belongs_to_client());
@@ -1041,27 +1044,34 @@ void Relay_log_info::stmt_done(my_off_t
   DBUG_ASSERT(!is_mts_worker(info_thd));
 
   /*
-    If in a transaction, and if the slave supports transactions, just
-    inc_event_relay_log_pos(). We only have to check for OPTION_BEGIN
-    (not OPTION_NOT_AUTOCOMMIT) as transactions are logged with
-    BEGIN/COMMIT, not with SET AUTOCOMMIT= .
-
-    CAUTION: opt_using_transactions means innodb || bdb ; suppose the
-    master supports InnoDB and BDB, but the slave supports only BDB,
-    problems will arise: - suppose an InnoDB table is created on the
-    master, - then it will be MyISAM on the slave - but as
-    opt_using_transactions is true, the slave will believe he is
-    transactional with the MyISAM table. And problems will come when
-    one does START SLAVE; STOP SLAVE; START SLAVE; (the slave will
-    resume at BEGIN whereas there has not been any rollback).  This is
-    the problem of using opt_using_transactions instead of a finer
-    "does the slave support _transactional handler used on the
-    master_".
-
-    More generally, we'll have problems when a query mixes a
-    transactional handler and MyISAM and STOP SLAVE is issued in the
-    middle of the "transaction". START SLAVE will resume at BEGIN
-    while the MyISAM table has already been updated.
+    Replication keeps event and group positions to specify the
+    set of events that were executed.
+    Event positions are incremented after processing each event
+    whereas group positions are incremented when an event or a
+    set of events is processed such as in a transaction and are
+    committed or rolled back.
+
+    A transaction can be ended with a Query Event, i.e. either
+    commit or rollback, or by a Xid Log Event. Query Event is
+    used to terminate pseudo-transactions that are executed
+    against non-transactional engines such as MyIsam. Xid Log
+    Event denotes though that a set of changes executed
+    against a transactional engine is about to commit.
+
+    Events' positions are incremented at stmt_done(). However,
+    transactions that are ended with Xid Log Event have their
+    group position incremented in the do_apply_event() and in
+    the do_apply_event_work().
+
+    Notice that the type of the engine, i.e. where data and
+    positions are stored, against what events are being applied
+    are not considered in this logic.
+
+    Regarding the code that follows, notice that the executed
+    group coordinates don't change if the current event is internal
+    to the group. The same applies to MTS Coordinator when it
+    handles a Format Descriptor event that appears in the middle
+    of a group that is about to be assigned.
   */
   if ((!is_parallel_exec() && is_in_group()) ||
       mts_group_status != MTS_NOT_IN_GROUP)
@@ -1081,10 +1091,13 @@ void Relay_log_info::stmt_done(my_off_t
         synchronization. For that reason, the checkpoint routine is
         called here.
       */
-      (void) mts_checkpoint_routine(this, 0, FALSE, FALSE); // TODO: ALFRANIO ERROR
+      error= mts_checkpoint_routine(this, 0, FALSE, FALSE);
     }
-    inc_group_relay_log_pos(event_master_log_pos);
+    if (!error)
+      error= inc_group_relay_log_pos(event_master_log_pos);
   }
+
+  return error;
 }
 
 #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
@@ -1214,6 +1227,7 @@ bool mysql_show_relaylog_events(THD* thd
 int Relay_log_info::init_info()
 {
   int error= 0;
+  enum_return_check check_return= ERROR_CHECKING_REPOSITORY;
   const char *msg= NULL;
 
   DBUG_ENTER("Relay_log_info::init_info");
@@ -1355,20 +1369,27 @@ a file name for --relay-log-index option
     }
   }
 
-  /*
+   /*
     This checks if the repository was created before and thus there
     will be values to be read. Please, do not move this call after
-    the handler->init_info().
+    the handler->init_info(). 
   */
-  int necessary_to_configure= check_info();
-  if ((error= handler->init_info(uidx, nidx)))
+  check_return= check_info();
+  if (check_return == ERROR_CHECKING_REPOSITORY)
+  {
+    msg= "Error checking relay log repository";
+    error= 1;
+    goto err;
+  }
+
+  if (handler->init_info(uidx, nidx))
   {
     msg= "Error reading relay log configuration";
     error= 1;
     goto err;
   }
 
-  if (necessary_to_configure)
+  if (check_return == REPOSITORY_DOES_NOT_EXIST)
   {
     /* Init relay log with first entry in the relay index file */
     if (init_relay_log_pos(NullS, BIN_LOG_HEADER_SIZE, 0 /* no data lock */,
@@ -1420,7 +1441,8 @@ a file name for --relay-log-index option
 #endif
   }
 
-  if ((error= flush_info(TRUE)))
+  inited= 1;
+  if (flush_info(TRUE))
   {
     msg= "Error reading relay log configuration";
     error= 1;
@@ -1434,11 +1456,11 @@ a file name for --relay-log-index option
     goto err;
   }
 
-  inited= 1;
   is_relay_log_recovery= FALSE;
   DBUG_RETURN(error);
 
 err:
+  inited= 0;
   sql_print_error("%s.", msg);
   relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
   DBUG_RETURN(error);
@@ -1548,6 +1570,9 @@ int Relay_log_info::flush_info(const boo
 {
   DBUG_ENTER("Relay_log_info::flush_info");
 
+  if (!inited)
+    DBUG_RETURN(0);
+
   /* 
     We update the sync_period at this point because only here we
     now that we are handling a relay log info. This needs to be

=== modified file 'sql/rpl_rli.h'
--- a/sql/rpl_rli.h	2011-08-29 07:59:18 +0000
+++ b/sql/rpl_rli.h	2011-10-13 14:01:50 +0000
@@ -50,18 +50,17 @@ is rotated, (ii) SQL Thread is stopped,
 any statement written to the binary log without a transaction context.
 
 The Xid_log_event is a commit for transactional engines and must be handled
-differently to provide reliability/data integrity. While committing updates to
-transactional engines the following behavior shall be implemented:
+differently to provide reliability/data integrity. In this case, positions
+are updated within the context of the current transaction. So
 
-  . If the relay.info is stored in a transactional repository, for instance, a
-  system table created using Innodb, the positions are updated in the context
-  of the transaction that updated data. Therefore, should the server crash 
-  before successfully committing the transaction the changes to the position 
-  table will be rolled back too.
+  . If the relay.info is stored in a transactional repository and the server
+  crashes before successfully committing the transaction the changes to the
+  position table will be rolled back along with the data.
 
   . If the relay.info is stored in a non-transactional repository, for instance,
-  a file or a system table created using MyIsam, the positions are update after
-  processing the commit as in (iv) and (v).
+  a file or a system table created using MyIsam, and the server crashes before
+  successfully committing the transaction the changes to the position table
+  will not be rolled back but data will.
 
 In particular, when there are mixed transactions, i.e a transaction that updates
 both transaction and non-transactional engines, the Xid_log_event is still used
@@ -361,7 +360,7 @@ public:
     event_relay_log_pos= future_event_relay_log_pos;
   }
 
-  void inc_group_relay_log_pos(ulonglong log_pos,
+  int inc_group_relay_log_pos(ulonglong log_pos,
 			       bool skip_lock= FALSE);
 
   int wait_for_pos(THD* thd, String* log_name, longlong log_pos, 
@@ -597,7 +596,7 @@ public:
     relay log info and used to produce information for <code>SHOW
     SLAVE STATUS</code>.
   */
-  void stmt_done(my_off_t event_log_pos);
+  int stmt_done(my_off_t event_log_pos);
 
 
   /**

=== modified file 'sql/rpl_rli_pdb.cc'
--- a/sql/rpl_rli_pdb.cc	2011-10-06 15:32:21 +0000
+++ b/sql/rpl_rli_pdb.cc	2011-10-13 14:01:50 +0000
@@ -151,7 +151,7 @@ int Slave_worker::init_worker(Relay_log_
 
 int Slave_worker::init_info()
 {
-  int necessary_to_configure= 0;
+  enum_return_check return_check= ERROR_CHECKING_REPOSITORY;
 
   DBUG_ENTER("Slave_worker::init_info");
 
@@ -159,24 +159,28 @@ int Slave_worker::init_info()
     DBUG_RETURN(0);
 
   /*
-    The init_info() is used to either create or read information
-    from the repository, in order to initialize the Slave_worker.
+    This checks if the repository was created before and thus there
+    will be values to be read. Please, do not move this call after
+    the handler->init_info(). 
   */
-  necessary_to_configure= check_info();
+  return_check= check_info(); 
+  if (return_check == ERROR_CHECKING_REPOSITORY)
+    goto err;
 
   if (handler->init_info(uidx, nidx))
     goto err;
 
-  if (!necessary_to_configure && read_info(handler))
+  if (return_check == REPOSITORY_EXISTS && read_info(handler))
     goto err;
 
+  inited= 1;
   if (flush_info(TRUE))
     goto err;
 
-  inited= 1;
   DBUG_RETURN(0);
 
 err:
+  inited= 0;
   sql_print_error("Error reading slave worker configuration");
   DBUG_RETURN(1);
 }
@@ -199,6 +203,9 @@ int Slave_worker::flush_info(const bool
 {
   DBUG_ENTER("Slave_worker::flush_info");
 
+  if (!inited)
+    DBUG_RETURN(0);
+
   /*
     We update the sync_period at this point because only here we
     now that we are handling a Slave_worker. This needs to be
@@ -895,7 +902,7 @@ void Slave_worker::slave_worker_ends_gro
                 ptr_g->group_relay_log_name != NULL);
     DBUG_ASSERT(ptr_g->worker_id == id);
 
-    if (!(ev->get_type_code() == XID_EVENT && is_transactional()))
+    if (ev->get_type_code() != XID_EVENT)
     {
       commit_positions(ev, ptr_g, false);
       DBUG_EXECUTE_IF("crash_after_commit_and_update_pos",

=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2011-10-06 11:06:34 +0000
+++ b/sql/rpl_slave.cc	2011-10-13 14:01:50 +0000
@@ -425,11 +425,10 @@ int init_recovery(Master_info* mi, const
 
 int init_info(Master_info* mi, bool ignore_if_no_info, int thread_mask)
 {
-  int error= 0;
-  int necessary_to_configure= 0;
-
   DBUG_ENTER("init_info");
   DBUG_ASSERT(mi != NULL && mi->rli != NULL);
+  int init_error= 0;
+  enum_return_check check_return= ERROR_CHECKING_REPOSITORY;
 
   /*
     We need a mutex while we are changing master info parameters to
@@ -445,26 +444,30 @@ int init_info(Master_info* mi, bool igno
     SLAVE_SQL thread is being started or was not initialized as it is
     required by the SLAVE_IO thread.
   */
-  necessary_to_configure= mi->check_info();
-  if (!(ignore_if_no_info && necessary_to_configure))
+  check_return= mi->check_info();
+  if (check_return == ERROR_CHECKING_REPOSITORY)
+    goto end;
+
+  if (!(ignore_if_no_info && check_return == REPOSITORY_DOES_NOT_EXIST))
   {
-    if ((thread_mask & SLAVE_IO) != 0 &&
-        mi->init_info())
-      error= 1;
+    if ((thread_mask & SLAVE_IO) != 0 && mi->init_info())
+      init_error= 1;
   }
 
-  necessary_to_configure= mi->rli->check_info();
-  if (!(ignore_if_no_info && necessary_to_configure))
+  check_return= mi->rli->check_info();
+  if (check_return == ERROR_CHECKING_REPOSITORY)
+    goto end;
+  if (!(ignore_if_no_info && check_return == REPOSITORY_DOES_NOT_EXIST))
   {
-     if (((thread_mask & SLAVE_SQL) != 0 || !(mi->rli->inited))
-         && mi->rli->init_info())
-    error= 1;
+    if (((thread_mask & SLAVE_SQL) != 0 || !(mi->rli->inited))
+        && mi->rli->init_info())
+      init_error= 1;
   }
 
+end:
   mysql_mutex_unlock(&mi->rli->data_lock);
   mysql_mutex_unlock(&mi->data_lock);
-
-  DBUG_RETURN(error);
+  DBUG_RETURN(check_return == ERROR_CHECKING_REPOSITORY || init_error);
 }
 
 void end_info(Master_info* mi)
@@ -742,7 +745,10 @@ int terminate_slave_threads(Master_info*
       Flushes the relay log info regardles of the sync_relay_log_info option.
     */
     if (mi->rli->flush_info(TRUE))
+    {
+      mysql_mutex_unlock(log_lock);
       DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS);
+    }
 
     mysql_mutex_unlock(log_lock);
   }
@@ -767,14 +773,20 @@ int terminate_slave_threads(Master_info*
       Flushes the master info regardles of the sync_master_info option.
     */
     if (mi->flush_info(TRUE))
+    {
+      mysql_mutex_unlock(log_lock);
       DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS);
+    }
 
     /*
       Flushes the relay log regardles of the sync_relay_log option.
     */
     if (mi->rli->relay_log.is_open() &&
         mi->rli->relay_log.flush_and_sync(0, TRUE))
+    {
+      mysql_mutex_unlock(log_lock);
       DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS);
+    }
 
     mysql_mutex_unlock(log_lock);
   }
@@ -2011,7 +2023,7 @@ static void write_ignored_events_info_to
                    " inaccurate");
       rli->relay_log.harvest_bytes_written(&rli->log_space_total);
       if (flush_master_info(mi, TRUE))
-        sql_print_error("Failed to flush master info file");
+        sql_print_error("Failed to flush master info file.");
       delete ev;
     }
     else
@@ -2917,20 +2929,19 @@ int apply_event_and_update_pos(Log_event
   if (exec_res == 0)
   {
     /*
-      Positions are not updated here when an XID is processed and the relay
-      log info is stored in a transactional engine such as Innodb. To make
-      a slave crash-safe, positions must be updated while processing a XID
-      event and as such do not need to be updated here again.
+      Positions are not updated here when an XID is processed. To make
+      a slave crash-safe, positions must be updated while processing a
+      XID event and as such do not need to be updated here again.
 
-      However, if the event needs to be skipped, this means that it will not
-      be processed and then positions need to be updated here.
+      However, if the event needs to be skipped, this means that it
+      will not be processed and then positions need to be updated here.
 
       See sql/rpl_rli.h for further details.
     */
     int error= 0;
     if (*ptr_ev &&
-        (!(ev->get_type_code() == XID_EVENT && rli->is_transactional()) ||
-         skip_event || (rli->is_mts_recovery() && 
+        (ev->get_type_code() != XID_EVENT ||
+         skip_event || (rli->is_mts_recovery() &&
          (ev->ends_group() || !rli->mts_recovery_group_seen_begin) &&
           bitmap_is_set(&rli->recovery_groups, rli->mts_recovery_index))))
     {
@@ -3644,7 +3655,9 @@ Stopping slave I/O thread due to out-of-
       mysql_mutex_lock(&mi->data_lock);
       if (flush_master_info(mi, FALSE))
       {
-        sql_print_error("Failed to flush master info file");
+        mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+                   ER(ER_SLAVE_FATAL_ERROR),
+                   "Failed to flush master info.");
         mysql_mutex_unlock(&mi->data_lock);
         goto err;
       }

=== modified file 'sql/share/errmsg-utf8.txt'
--- a/sql/share/errmsg-utf8.txt	2011-10-07 14:20:21 +0000
+++ b/sql/share/errmsg-utf8.txt	2011-10-13 14:01:50 +0000
@@ -6485,8 +6485,6 @@ ER_NO_SUCH_KEY_VALUE
   eng "Key value '%-.192s' was not found in table '%-.192s.%-.192s'"
 ER_RPL_INFO_DATA_TOO_LONG
   eng "Data for column '%s' too long"
-ER_CANT_LOCK_RPL_INFO_TABLE
-        eng "You can't use locks with rpl info tables."
 ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
   eng "Replication event checksum verification failed while reading from network."
 ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2011-09-27 08:24:44 +0000
+++ b/sql/sql_class.h	2011-10-13 14:01:50 +0000
@@ -4163,14 +4163,9 @@ public:
 #define CF_HA_CLOSE             (1U << 11)
 
 /**
-  Identifies statements that can directly update a rpl info table.
-*/
-#define CF_WRITE_RPL_INFO_COMMAND (1U << 12)
-
-/**
   Identifies statements that can be explained with EXPLAIN.
 */
-#define CF_CAN_BE_EXPLAINED       (1U << 13)
+#define CF_CAN_BE_EXPLAINED       (1U << 12)
 
 /** Identifies statements which may generate an optimizer trace */
 #define CF_OPTIMIZER_TRACE        (1U << 14)

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2011-10-05 13:16:38 +0000
+++ b/sql/sql_parse.cc	2011-10-13 14:01:50 +0000
@@ -302,8 +302,7 @@ void init_update_queries(void)
                                             CF_CAN_GENERATE_ROW_EVENTS;
   sql_command_flags[SQLCOM_CREATE_INDEX]=   CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
   sql_command_flags[SQLCOM_ALTER_TABLE]=    CF_CHANGES_DATA | CF_WRITE_LOGS_COMMAND |
-                                            CF_AUTO_COMMIT_TRANS |
-                                            CF_WRITE_RPL_INFO_COMMAND;
+                                            CF_AUTO_COMMIT_TRANS;
   sql_command_flags[SQLCOM_TRUNCATE]=       CF_CHANGES_DATA | CF_WRITE_LOGS_COMMAND |
                                             CF_AUTO_COMMIT_TRANS;
   sql_command_flags[SQLCOM_DROP_TABLE]=     CF_CHANGES_DATA | CF_AUTO_COMMIT_TRANS;
@@ -418,7 +417,6 @@ void init_update_queries(void)
                                                 CF_SHOW_TABLE_COMMAND |
                                                 CF_REEXECUTION_FRAGILE);
 
-
   sql_command_flags[SQLCOM_CREATE_USER]=       CF_CHANGES_DATA;
   sql_command_flags[SQLCOM_RENAME_USER]=       CF_CHANGES_DATA;
   sql_command_flags[SQLCOM_DROP_USER]=         CF_CHANGES_DATA;
@@ -448,14 +446,10 @@ void init_update_queries(void)
     The following admin table operations are allowed
     on log tables.
   */
-  sql_command_flags[SQLCOM_REPAIR]=    CF_WRITE_LOGS_COMMAND | CF_AUTO_COMMIT_TRANS |
-                                       CF_WRITE_RPL_INFO_COMMAND;
-  sql_command_flags[SQLCOM_OPTIMIZE]|= CF_WRITE_LOGS_COMMAND | CF_AUTO_COMMIT_TRANS |
-                                       CF_WRITE_RPL_INFO_COMMAND;
-  sql_command_flags[SQLCOM_ANALYZE]=   CF_WRITE_LOGS_COMMAND | CF_AUTO_COMMIT_TRANS |
-                                       CF_WRITE_RPL_INFO_COMMAND;
-  sql_command_flags[SQLCOM_CHECK]=     CF_WRITE_LOGS_COMMAND | CF_AUTO_COMMIT_TRANS |
-                                       CF_WRITE_RPL_INFO_COMMAND;
+  sql_command_flags[SQLCOM_REPAIR]=    CF_WRITE_LOGS_COMMAND | CF_AUTO_COMMIT_TRANS;
+  sql_command_flags[SQLCOM_OPTIMIZE]|= CF_WRITE_LOGS_COMMAND | CF_AUTO_COMMIT_TRANS;
+  sql_command_flags[SQLCOM_ANALYZE]=   CF_WRITE_LOGS_COMMAND | CF_AUTO_COMMIT_TRANS;
+  sql_command_flags[SQLCOM_CHECK]=     CF_WRITE_LOGS_COMMAND | CF_AUTO_COMMIT_TRANS;
 
   sql_command_flags[SQLCOM_CREATE_USER]|=       CF_AUTO_COMMIT_TRANS;
   sql_command_flags[SQLCOM_DROP_USER]|=         CF_AUTO_COMMIT_TRANS;
@@ -560,17 +554,6 @@ bool is_log_table_write_query(enum enum_
   return (sql_command_flags[command] & CF_WRITE_LOGS_COMMAND) != 0;
 }
 
-/**
-  Check if a sql command is allowed to write to rpl info tables.
-  @param command The SQL command
-  @return true if writing is allowed
-*/
-bool is_rpl_info_table_write_query(enum enum_sql_command command)
-{
-  DBUG_ASSERT(command >= 0 && command <= SQLCOM_END);
-  return (sql_command_flags[command] & CF_WRITE_RPL_INFO_COMMAND) != 0;
-}
-
 void execute_init_command(THD *thd, LEX_STRING *init_command,
                           mysql_rwlock_t *var_lock)
 {

=== modified file 'sql/sql_parse.h'
--- a/sql/sql_parse.h	2011-07-20 08:46:04 +0000
+++ b/sql/sql_parse.h	2011-10-13 14:01:50 +0000
@@ -84,7 +84,6 @@ bool mysql_test_parse_for_slave(THD *thd
 bool is_update_query(enum enum_sql_command command);
 bool is_explainable_query(enum enum_sql_command command);
 bool is_log_table_write_query(enum enum_sql_command command);
-bool is_rpl_info_table_write_query(enum enum_sql_command command);
 bool alloc_query(THD *thd, const char *packet, uint packet_length);
 void mysql_init_select(LEX *lex);
 void mysql_parse(THD *thd, char *rawbuf, uint length,

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (alfranio.correia:3491 to 3492) Alfranio Correia14 Oct