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/03/24 12:41:41 mats@stripped +2 -0
Merge mysql.com:/home/bkroot/mysql-4.1
into mysql.com:/home/bk/b8368-mysql-4.1
mysql-test/mysql-test-run.sh
1.248 05/03/24 12:41:40 mats@stripped +0 -0
Auto merged
client/mysqldump.c
1.184 05/03/24 12:41:40 mats@stripped +0 -0
Auto merged
# 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/RESYNC
--- 1.183/client/mysqldump.c 2005-03-16 21:56:38 +01:00
+++ 1.184/client/mysqldump.c 2005-03-24 12:41:40 +01:00
@@ -97,6 +97,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;
@@ -277,6 +280,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 slave 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 "
+ "--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,
@@ -603,6 +619,10 @@
if (!argument) /* work like in old versions */
opt_master_data= MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL;
break;
+ case (int) OPT_SLAVE_DATA:
+ if (!argument) /* work like in old versions */
+ 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 +761,7 @@
"--lock-all-tables at the same time.\n", my_progname);
return(1);
}
- if (opt_master_data)
+ 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;
@@ -2217,8 +2237,11 @@
{
if (opt_comments)
fprintf(md_result_file,
- "\n--\n-- Position to start replication or point-in-time "
- "recovery from\n--\n\n");
+ "\n--"
+ "\n-- Position to start replication or point-in-time recovery from"
+ "\n-- [extracted from SHOW MASTER STATUS output]"
+ "\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]);
@@ -2229,6 +2252,63 @@
return 0;
}
+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) ? "-- " : "";
+ 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;
+ }
+ else
+ {
+ row = mysql_fetch_row(slave);
+ if (row)
+ {
+ unsigned int f = 0;
+ int host_idx = -1, port_idx = -1;
+ int log_file_idx = -1, log_pos_idx = -1;
+ for (f = 0 ; f < slave->field_count ; ++f)
+ {
+ if (strcmp(slave->fields[f].name, "Master_Host") == 0)
+ host_idx = f;
+ else if (strcmp(slave->fields[f].name, "Master_Port") == 0)
+ port_idx = f;
+ else if (strcmp(slave->fields[f].name, "Relay_Master_Log_File") == 0)
+ log_file_idx = f;
+ else if (strcmp(slave->fields[f].name, "Exec_Master_Log_Pos") == 0)
+ log_pos_idx = f;
+ }
+ if (host_idx >= 0 && row[host_idx]
+ && port_idx >= 0 && row[port_idx]
+ && log_file_idx >= 0 && row[log_file_idx]
+ && log_pos_idx >= 0 && row[log_pos_idx])
+ {
+ if (opt_comments)
+ fprintf(md_result_file,
+ "\n--"
+ "\n-- Position to start replication or point-in-time recovery from"
+ "\n-- [extracted forom SHOW SLAVE STATUS output]"
+ "\n--"
+ "\n\n");
+ fprintf(md_result_file,
+ "%sCHANGE MASTER TO MASTER_HOST='%s', MASTER_PORT=%s, "
+ "MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n",
+ comment_prefix,
+ row[host_idx],row[port_idx],
+ row[log_file_idx],row[log_pos_idx]);
+ check_io(md_result_file);
+ }
+ }
+ mysql_free_result(slave);
+ }
+ return 0;
+}
+
static int do_flush_tables_read_lock(MYSQL *mysql_con)
{
@@ -2497,20 +2577,23 @@
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))
+ goto err;
+ if (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-03-24 12:41:40 +01: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
| Thread |
|---|
| • bk commit into 4.1 tree (mats:1.2146) | Mats Kindahl | 24 Mar |