Below is the list of changes that have just been committed into a local
4.1 repository of mats. When mats does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2146 05/05/18 10:42:26 mats@stripped +5 -0
Bug#8368:
Adding --slave-data option to mysqldump.
Adding warning on missing fields when using --master-data option.
mysql-test/t/rpl_mysqldump.test
1.1 05/05/18 10:42:21 mats@stripped +52 -0
mysql-test/r/rpl_mysqldump.result
1.1 05/05/18 10:42:21 mats@stripped +166 -0
mysql-test/t/rpl_mysqldump.test
1.0 05/05/18 10:42:21 mats@stripped +0 -0
BitKeeper file /home/bk/b8368-mysql-4.1-v2/mysql-test/t/rpl_mysqldump.test
mysql-test/r/rpl_mysqldump.result
1.0 05/05/18 10:42:21 mats@stripped +0 -0
BitKeeper file /home/bk/b8368-mysql-4.1-v2/mysql-test/r/rpl_mysqldump.result
mysql-test/mysql-test-run.sh
1.248 05/05/18 10:42:21 mats@stripped +3 -0
Extending with MYSQL_DUMP_SLAVE and MYSQL_DUMP_MASTER.
Keeping MYSQL_DUMP since that is used by other tests.
client/mysqldump.c
1.184 05/05/18 10:42:21 mats@stripped +263 -18
Added --slave-data option.
Added warnings if fields are not available from SHOW {MASTER,SLAVE} STATUS.
client/client_priv.h
1.34 05/05/18 10:42:21 mats@stripped +1 -0
New option --slave-data.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: mats
# Host: romeo.kindahl.net
# Root: /home/bk/b8368-mysql-4.1-v2
--- 1.183/client/mysqldump.c 2005-03-16 21:56:38 +01:00
+++ 1.184/client/mysqldump.c 2005-05-18 10:42:21 +02:00
@@ -69,6 +69,9 @@
/* Size of buffer for dump's select query */
#define QUERY_LENGTH 1536
+/* Convenience typedef for a show function */
+typedef char const* show_t(char const*);
+
static char *add_load_option(char *ptr, const char *object,
const char *statement);
static ulong find_set(TYPELIB *lib, const char *x, uint length,
@@ -97,6 +100,9 @@
#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
#define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
static uint opt_mysql_port= 0, err_len= 0, opt_master_data;
+#define MYSQL_OPT_SLAVE_DATA_EFFECTIVE_SQL 1
+#define MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL 2
+static uint opt_slave_data;
static my_string opt_mysql_unix_port=0;
static int first_error=0;
static DYNAMIC_STRING extended_row;
@@ -267,9 +273,9 @@
(gptr*) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"master-data", OPT_MASTER_DATA,
"This causes the binary log position and filename to be appended to the "
- "output. If equal to 1, will print it as a CHANGE MASTER command; if equal"
- " to 2, that command will be prefixed with a comment symbol. "
- "This option will turn --lock-all-tables on, unless "
+ "output. If equal to 1 (default), will print it as a CHANGE MASTER "
+ "command; if equal to 2, that command will be prefixed with a comment "
+ "symbol. This option will turn --lock-all-tables on, unless "
"--single-transaction is specified too (in which case a "
"global read lock is only taken a short time at the beginning of the dump "
"- don't forget to read about --single-transaction below). In all cases "
@@ -277,6 +283,19 @@
"Option automatically turns --lock-tables off.",
(gptr*) &opt_master_data, (gptr*) &opt_master_data, 0,
GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_MASTER_DATA_COMMENTED_SQL, 0, 0, 0},
+ {"slave-data", OPT_SLAVE_DATA,
+ "This causes the binary log position and filename of the master of this "
+ "slave to be appended to the output. If equal to 1 (default), will "
+ "print it as a CHANGE MASTER command; if equal to 2, that command will "
+ "be prefixed with a comment symbol. "
+ "This option will turn --lock-all-tables on, unless "
+ "--single-transaction is specified too (in which case a "
+ "global read lock is only taken a short time at the beginning of the dump "
+ "- don't forget to read about --single-transaction below). In all cases "
+ "any action on logs will happen at the exact moment of the dump."
+ "Option automatically turns --lock-tables off.",
+ (gptr*) &opt_slave_data, (gptr*) &opt_slave_data, 0,
+ GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL, 0, 0, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET, "",
(gptr*) &opt_max_allowed_packet, (gptr*) &opt_max_allowed_packet, 0,
GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096,
@@ -600,9 +619,13 @@
usage();
exit(0);
case (int) OPT_MASTER_DATA:
- if (!argument) /* work like in old versions */
+ if (!argument) /* If no argument, works as if user supplied 1 */
opt_master_data= MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL;
break;
+ case (int) OPT_SLAVE_DATA:
+ if (!argument) /* If no argument, works as if user supplied 1 */
+ opt_slave_data= MYSQL_OPT_SLAVE_DATA_EFFECTIVE_SQL;
+ break;
case (int) OPT_OPTIMIZE:
extended_insert= opt_drop= opt_lock= quick= create_options=
opt_disable_keys= lock_tables= opt_set_charset= 1;
@@ -741,7 +764,13 @@
"--lock-all-tables at the same time.\n", my_progname);
return(1);
}
- if (opt_master_data)
+ if (opt_master_data && opt_master_data)
+ {
+ fprintf(stderr, "%s: You can't use both --slave-data and "
+ "--master-data at the same time.\n", my_progname);
+ return(1);
+ }
+ if (opt_master_data || opt_slave_data)
opt_lock_all_tables= !opt_single_transaction;
if (opt_single_transaction || opt_lock_all_tables)
lock_tables= 0;
@@ -2210,22 +2239,232 @@
MYF(0), mysql_error(mysql_con));
return 1;
}
+
+ row = mysql_fetch_row(master);
+ if (row && row[0] && row[1])
+ {
+ if (opt_comments)
+ fprintf(md_result_file,
+ "\n--"
+ "\n-- Position to start replication or point-in-time recovery from"
+ "\n-- [extracted from SHOW MASTER STATUS output on master]"
+ "\n--"
+ "\n\n");
+ fprintf(md_result_file,
+ "%sCHANGE MASTER TO MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n",
+ comment_prefix, row[0], row[1]);
+ check_io(md_result_file);
+ }
else
{
- row = mysql_fetch_row(master);
- if (row && row[0] && row[1])
+ fprintf(stderr,
+ "Warning: SHOW MASTER STATUS is missing essential fields\n");
+ }
+ mysql_free_result(master);
+
+ return 0;
+}
+
+/*
+ Struct for handling field data.
+*/
+struct st_field_data {
+ /* Name of the field as given by the SHOW SLAVE STATUS statement */
+ char const *const name;
+
+ /* Corresponding name of the variable to use to the CHANGE MASTER
+ statement */
+ char const *const var;
+
+ /* Pointer to function that optionally will change the appearance of
+ the data into something else. */
+ show_t *const f_show;
+
+ /* Index of the field in the array returned by mysql_fetch_row(). */
+ int idx;
+};
+
+/*
+ The show functions below can all assume that the function will not
+ be passed a NULL argument. However, it might be a good idea to add
+ an assert if the function depends on this for correct behaviour.
+*/
+
+static char const *show_same(char const *str)
+{
+ return str;
+}
+
+
+char const *show_ssl_allowed(char const *str)
+{
+ DBUG_ASSERT(strcmp(str, "Yes") == 0 ||
+ strcmp(str, "No") == 0 ||
+ strcmp(str,"Ignored") == 0);
+ if (strcmp(str, "No") == 0)
+ return "0"; /* 'No' */
+ return "1"; /* 'Yes' and 'Ignore' */
+}
+
+
+char const *show_empty_as_null(char const *str)
+{
+ DBUG_ASSERT(str != NULL);
+ if (*str == '\0')
+ return NULL;
+ return str;
+}
+
+/*
+ It is very important that the order of the enumeration
+ constants match the order in the field[] array below. Also, the
+ IDX_COUNT should *always* be last in the list of enumeration
+ constants.
+*/
+enum {
+ HOST_IDX, PORT_IDX, LOG_FILE_IDX, LOG_POS_IDX, SSL_ALLOWED_IDX,
+ SSL_CA_FILE_IDX, SSL_CA_PATH_IDX, SSL_CERT_IDX, SSL_CIPHER_IDX,
+ SSL_KEY_IDX,
+ IDX_COUNT
+};
+
+/*
+ Array of information about the fields from the SHOW SLAVE STATUS
+ statement that should be extracted and what they should be
+ translated to in the CHANGE MASTER command. Three of the fields are
+ constant, the last one is not constant and will be set to the
+ correct index in the code below.
+*/
+struct st_field_data field[]= {
+ { "Master_Host", "MASTER_HOST", show_same, -1 },
+ { "Master_Port", "MASTER_PORT", show_same, -1 },
+ { "Relay_Master_Log_File", "MASTER_LOG_FILE", show_same, -1 },
+ { "Exec_Master_Log_Pos", "MASTER_LOG_POS", show_same, -1 },
+ { "Master_SSL_Allowed", "MASTER_SSL", show_ssl_allowed, -1 },
+ { "Master_SSL_CA_File", "MASTER_SSL_CA", show_empty_as_null, -1 },
+ { "Master_SSL_CA_Path", "MASTER_SSL_CAPATH", show_empty_as_null, -1 },
+ { "Master_SSL_Cert", "MASTER_SSL_CERT", show_empty_as_null, -1 },
+ { "Master_SSL_Cipher", "MASTER_SSL_KEY", show_empty_as_null, -1 },
+ { "Master_SSL_Key", "MASTER_SSL_CIPHER", show_empty_as_null, -1 }
+};
+
+static int do_show_slave_status(MYSQL *mysql_con)
+{
+ MYSQL_ROW row;
+ MYSQL_RES *slave;
+
+ const char *comment_prefix=
+ (opt_slave_data == MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL) ? "-- " : "";
+
+ DBUG_ASSERT(sizeof(field) / sizeof(field[0]) == IDX_COUNT);
+
+ if (mysql_query_with_error_report(mysql_con, &slave, "SHOW SLAVE STATUS"))
+ {
+ my_printf_error(0, "Error: Couldn't execute 'SHOW SLAVE STATUS': %s",
+ MYF(0), mysql_error(mysql_con));
+ return 1;
+ }
+
+ if ((row= mysql_fetch_row(slave)))
+ {
+ unsigned int f;
+
+ for (f= 0 ; f < slave->field_count ; ++f)
+ {
+ struct st_field_data *field_ptr;
+ for (field_ptr= field ; field_ptr < (field + IDX_COUNT) ; ++field_ptr)
+ {
+ if (strcmp(slave->fields[f].name, field_ptr->name) == 0)
+ {
+ field_ptr->idx= f;
+ break;
+ }
+ }
+ }
+
+ if (field[HOST_IDX].idx >= 0 && row[field[HOST_IDX].idx] &&
+ field[PORT_IDX].idx >= 0 && row[field[PORT_IDX].idx] &&
+ field[LOG_FILE_IDX].idx >= 0 && row[field[LOG_FILE_IDX].idx] &&
+ field[LOG_POS_IDX].idx >= 0 && row[field[LOG_POS_IDX].idx])
{
+ struct st_field_data *field_ptr;
+ char const *separator= "";
if (opt_comments)
- fprintf(md_result_file,
- "\n--\n-- Position to start replication or point-in-time "
- "recovery from\n--\n\n");
- fprintf(md_result_file,
- "%sCHANGE MASTER TO MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n",
- comment_prefix, row[0], row[1]);
+ fprintf(md_result_file,
+ "\n--"
+ "\n-- Position to start replication or point-in-time recovery from"
+ "\n-- [extracted from SHOW SLAVE STATUS output on slave]"
+ "\n--"
+ "\n\n");
+ fprintf(md_result_file, "%sCHANGE MASTER TO", comment_prefix);
+ for (field_ptr= field ; field_ptr < (field + IDX_COUNT) ; ++field_ptr)
+ {
+ if (field_ptr->idx >= 0 && row[field_ptr->idx])
+ {
+ int k, is_int= TRUE;
+
+ /*
+ Apply the field's show function to the actual column data
+ to get the data that might be printed.
+ */
+ char const *const the_row= (*field_ptr->f_show)(row[field_ptr->idx]);
+
+ /*
+ If the show function decided this is NULL, the field
+ shouldn't be shown and we skip the field.
+ */
+ if (the_row != NULL)
+ {
+ /*
+ We need to call strlen() here since we don't know the
+ length of the string returned by the show function. We
+ can add more advanced logic to save some cycles, but
+ since this program is I/O bound, we will not save much
+ time anyway.
+ */
+ for (k= strlen(the_row) ; k-- > 0 ; )
+ {
+ if (!my_isdigit(charset_info, the_row[k]))
+ {
+ is_int= FALSE;
+ break;
+ }
+ }
+
+ fprintf(md_result_file, "%s\n%s %s=%s%s%s",
+ separator,
+ comment_prefix,
+ field_ptr->var,
+ is_int ? "" : "'",
+ the_row,
+ is_int ? "" : "'");
+
+ /*
+ First lap the separator is an empty string, remaining
+ laps the separator is is ","
+ */
+ separator= ",";
+ }
+ }
+ }
+ fprintf(md_result_file, ";\n");
check_io(md_result_file);
}
- mysql_free_result(master);
}
+ else
+ {
+ fprintf(stderr, "Warning: SHOW SLAVE STATUS missing fields ");
+ if (field[HOST_IDX].idx == -1 || row[field[HOST_IDX].idx] == NULL)
+ fprintf(stderr, "%s ", field[HOST_IDX].name);
+ if (field[PORT_IDX].idx == -1 || row[field[PORT_IDX].idx] == NULL)
+ fprintf(stderr, "%s ", field[PORT_IDX].name);
+ if (field[LOG_FILE_IDX].idx == -1 || row[field[LOG_FILE_IDX].idx] == NULL)
+ fprintf(stderr, "%s ", field[LOG_FILE_IDX].name);
+ if (field[LOG_POS_IDX].idx == -1 || row[field[LOG_POS_IDX].idx] == NULL)
+ fprintf(stderr, "%s ", field[LOG_POS_IDX].name);
+ }
+ mysql_free_result(slave);
+
return 0;
}
@@ -2497,21 +2736,27 @@
if (!path)
write_header(md_result_file, *argv);
- if ((opt_lock_all_tables || opt_master_data) &&
+ if ((opt_lock_all_tables || opt_master_data || opt_slave_data) &&
do_flush_tables_read_lock(sock))
goto err;
- if (opt_single_transaction && start_transaction(sock, test(opt_master_data)))
+ if (opt_single_transaction
+ && start_transaction(sock, test(opt_master_data || opt_slave_data)))
goto err;
if (opt_delete_master_logs && do_reset_master(sock))
goto err;
- if (opt_lock_all_tables || opt_master_data)
+ if (opt_lock_all_tables || opt_master_data || opt_slave_data)
{
if (flush_logs && mysql_refresh(sock, REFRESH_LOG))
goto err;
flush_logs= 0; /* not anymore; that would not be sensible */
}
- if (opt_master_data && do_show_master_status(sock))
+
+ if (opt_master_data && do_show_master_status(sock) ||
+ opt_slave_data && do_show_slave_status(sock))
+ {
goto err;
+ }
+
if (opt_single_transaction && do_unlock_tables(sock)) /* unlock but no commit!
*/
goto err;
--- 1.247/mysql-test/mysql-test-run.sh 2005-03-22 15:57:11 +01:00
+++ 1.248/mysql-test/mysql-test-run.sh 2005-05-18 10:42:21 +02:00
@@ -688,11 +688,14 @@
fi
MYSQL_CLIENT_TEST="$MYSQL_CLIENT_TEST --no-defaults --testcase --user=root
--socket=$MASTER_MYSOCK --port=$MYSQL_TCP_PORT --silent $EXTRA_MYSQL_CLIENT_TEST_OPT"
+MYSQL_DUMP_SLAVE="$MYSQL_DUMP --no-defaults -uroot --socket=$SLAVE_MYSOCK
--password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
+MYSQL_DUMP_MASTER="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK
--password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD
$EXTRA_MYSQLDUMP_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR
$EXTRA_MYSQLBINLOG_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost
--port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD
--basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root
--password=$DBPASSWD"
export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES
+export MYSQL_DUMP_MASTER MYSQL_DUMP_SLAVE
export CLIENT_BINDIR MYSQL_CLIENT_TEST CHARSETSDIR
export NDB_TOOLS_DIR
export NDB_MGM
--- New file ---
+++ mysql-test/r/rpl_mysqldump.result 05/05/18 10:42:21
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,2), (2,3);
### No CHANGE MASTER statement ###
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES (1,2),(2,3);
UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
### Show CHANGE MASTER statement ###
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CHANGE MASTER TO
MASTER_HOST='127.0.0.1',
MASTER_PORT=MASTER_MYPORT,
MASTER_LOG_FILE='master-bin.000001',
MASTER_LOG_POS=227,
MASTER_SSL=0;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES (1,2),(2,3);
UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
### Show CHANGE MASTER statement as comment ###
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-- CHANGE MASTER TO
-- MASTER_HOST='127.0.0.1',
-- MASTER_PORT=MASTER_MYPORT,
-- MASTER_LOG_FILE='master-bin.000001',
-- MASTER_LOG_POS=227,
-- MASTER_SSL=0;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES (1,2),(2,3);
UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
STOP SLAVE;
GRANT REPLICATION SLAVE ON *.* TO replssl@'%' REQUIRE SSL;
CHANGE MASTER TO MASTER_SSL=1,
MASTER_SSL_CA ='MYSQL_TEST_DIR/std_data/cacert.pem',
MASTER_SSL_CERT='MYSQL_TEST_DIR/std_data/client-cert.pem',
MASTER_SSL_KEY='MYSQL_TEST_DIR/std_data/client-key.pem';
Warnings:
Note 1274 SSL parameters in CHANGE MASTER are ignored because this MySQL slave was
compiled without SSL support; they can be used later if MySQL slave with SSL is started
START SLAVE;
### Show CHANGE MASTER statement ###
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CHANGE MASTER TO
MASTER_HOST='127.0.0.1',
MASTER_PORT=MASTER_MYPORT,
MASTER_LOG_FILE='master-bin.000001',
MASTER_LOG_POS=319,
MASTER_SSL=1,
MASTER_SSL_CA='MYSQL_TEST_DIR/std_data/cacert.pem',
MASTER_SSL_CERT='MYSQL_TEST_DIR/std_data/client-cert.pem',
MASTER_SSL_CIPHER='MYSQL_TEST_DIR/std_data/client-key.pem';
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES (1,2),(2,3);
UNLOCK TABLES;
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- New file ---
+++ mysql-test/t/rpl_mysqldump.test 05/05/18 10:42:21
source include/master-slave.inc;
#
# Bug#8368: mysqldump needs --slave-data option
#
connection master;
CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,2), (2,3);
sync_slave_with_master;
--disable_query_log
select "### No CHANGE MASTER statement ###" as "";
--enable_query_log
--exec $MYSQL_DUMP_SLAVE --skip-comments --slave-data=0 test t1
--disable_query_log
select "### Show CHANGE MASTER statement ###" as "";
--enable_query_log
--replace_result $SLAVE_MYPORT SLAVE_MYPORT $MASTER_MYPORT MASTER_MYPORT
--exec $MYSQL_DUMP_SLAVE --skip-comments --slave-data=1 test t1
--disable_query_log
select "### Show CHANGE MASTER statement as comment ###" as "";
--enable_query_log
--replace_result $SLAVE_MYPORT SLAVE_MYPORT $MASTER_MYPORT MASTER_MYPORT
--exec $MYSQL_DUMP_SLAVE --skip-comments --slave-data=2 test t1
STOP SLAVE;
connection master;
GRANT REPLICATION SLAVE ON *.* TO replssl@'%' REQUIRE SSL;
save_master_pos;
connection slave;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval CHANGE MASTER TO MASTER_SSL=1,
MASTER_SSL_CA ='$MYSQL_TEST_DIR/std_data/cacert.pem',
MASTER_SSL_CERT='$MYSQL_TEST_DIR/std_data/client-cert.pem',
MASTER_SSL_KEY='$MYSQL_TEST_DIR/std_data/client-key.pem';
START SLAVE;
sync_with_master;
# No need to test all alternatives, we just want to check that the
# data for the CHANGE MASTER statement is correct.
--disable_query_log
select "### Show CHANGE MASTER statement ###" as "";
--enable_query_log
--replace_result $SLAVE_MYPORT SLAVE_MYPORT $MASTER_MYPORT MASTER_MYPORT $MYSQL_TEST_DIR
MYSQL_TEST_DIR
--exec $MYSQL_DUMP_SLAVE --skip-comments --slave-data=1 test t1
--- 1.33/client/client_priv.h 2004-12-27 19:10:26 +01:00
+++ 1.34/client/client_priv.h 2005-05-18 10:42:21 +02:00
@@ -50,4 +50,5 @@
,OPT_NDBCLUSTER,OPT_NDB_CONNECTSTRING
#endif
,OPT_IGNORE_TABLE
+ ,OPT_SLAVE_DATA
};
| Thread |
|---|
| • bk commit into 4.1 tree (mats:1.2146) BUG#8368 | Mats Kindahl | 18 May |