From ecce9f23ae1c569191a02734be80239f4bf62ed3 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Fri, 17 Oct 2003 09:15:30 +0200 Subject: [PATCH 1/3] test update: what we want to detect in this test is if the slave stopped. --- mysql-test/r/rpl_trunc_binlog.result | 4 ---- mysql-test/t/rpl_trunc_binlog.test | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/mysql-test/r/rpl_trunc_binlog.result b/mysql-test/r/rpl_trunc_binlog.result index a006437207a..19d5e30addb 100644 --- a/mysql-test/r/rpl_trunc_binlog.result +++ b/mysql-test/r/rpl_trunc_binlog.result @@ -8,7 +8,3 @@ stop slave; flush logs; reset slave; start slave; -show slave status; -Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.002 4 slave-relay-bin.002 161 master-bin.001 Yes No 0 Rolling back unfinished transaction (no COMMIT or ROLLBACK) from relay log. Probably cause is that the master died while writing the transaction to it's binary log. 0 79 317 -reset master; diff --git a/mysql-test/t/rpl_trunc_binlog.test b/mysql-test/t/rpl_trunc_binlog.test index 2c34b7a442f..59d8aed288c 100644 --- a/mysql-test/t/rpl_trunc_binlog.test +++ b/mysql-test/t/rpl_trunc_binlog.test @@ -20,5 +20,4 @@ reset slave; start slave; # can't sync_with_master so we must sleep sleep 3; ---replace_result $MASTER_MYPORT MASTER_PORT -show slave status; +wait_for_slave_to_stop; From fad448bddd3a149aa9318af8b9a80486143e6e6a Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Fri, 17 Oct 2003 09:26:38 +0200 Subject: [PATCH 2/3] cancelling a previous change I made in rpl_trunc_binlog.test (which I did not push), to enable SHOW SLAVE STATUS again. --- mysql-test/r/rpl_trunc_binlog.result | 3 +++ mysql-test/t/rpl_trunc_binlog.test | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/rpl_trunc_binlog.result b/mysql-test/r/rpl_trunc_binlog.result index 19d5e30addb..eb5dcf7c593 100644 --- a/mysql-test/r/rpl_trunc_binlog.result +++ b/mysql-test/r/rpl_trunc_binlog.result @@ -8,3 +8,6 @@ stop slave; flush logs; reset slave; start slave; +show slave status; +Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space +127.0.0.1 root MASTER_PORT 1 master-bin.002 4 slave-relay-bin.002 161 master-bin.001 Yes No 0 Rolling back unfinished transaction (no COMMIT or ROLLBACK) from relay log. Probably cause is that the master died while writing the transaction to it's binary log. 0 79 317 diff --git a/mysql-test/t/rpl_trunc_binlog.test b/mysql-test/t/rpl_trunc_binlog.test index 59d8aed288c..2c34b7a442f 100644 --- a/mysql-test/t/rpl_trunc_binlog.test +++ b/mysql-test/t/rpl_trunc_binlog.test @@ -20,4 +20,5 @@ reset slave; start slave; # can't sync_with_master so we must sleep sleep 3; -wait_for_slave_to_stop; +--replace_result $MASTER_MYPORT MASTER_PORT +show slave status; From c93f69e9dd41b73e8dd76adba367bb86277ff688 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Tue, 21 Oct 2003 12:22:24 +0200 Subject: [PATCH 3/3] Fix for Bug #1595 "mysqlbinlog can't read a password from the console". ** I already fixed it in 3.23; I fix it in 4.0 separately because the code is a bit different (so the changeset 1.1422 of 3.23 should not be merged here) ** Make mysqlbinlog prompt for the password if mysqlbinlog -p instead of printing the usage(). This makes mysqlbinlog behave like other clients. This new code was almost copied from mysqldump. Note that before, one could use mysqlbinlog -p pass and now one must use mysqlbinlog -ppass (putting a space will ask for the password). --- client/mysqlbinlog.cc | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 298521b5aa7..34b7ae11f74 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -52,7 +52,7 @@ static const char* host = 0; static int port = MYSQL_PORT; static const char* sock= 0; static const char* user = 0; -static const char* pass = ""; +static char* pass = 0; static ulonglong position = 0; static short binlog_flags = 0; static MYSQL* mysql = NULL; @@ -227,7 +227,7 @@ static struct my_option my_long_options[] = {"offset", 'o', "Skip the first N entries.", (gptr*) &offset, (gptr*) &offset, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"password", 'p', "Password to connect to remote server.", - 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, {"port", 'P', "Use port to connect to the remote server.", (gptr*) &port, (gptr*) &port, 0, GET_INT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0}, @@ -267,6 +267,11 @@ void sql_print_error(const char *format,...) va_end(args); } +static void cleanup() +{ + my_free(pass,MYF(MY_ALLOW_ZERO_PTR)); +} + static void die(const char* fmt, ...) { va_list args; @@ -275,6 +280,7 @@ static void die(const char* fmt, ...) vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); va_end(args); + cleanup(); exit(1); } @@ -334,6 +340,7 @@ extern "C" my_bool get_one_option(int optid, const struct my_option *opt __attribute__((unused)), char *argument) { + bool tty_password=0; switch (optid) { #ifndef DBUG_OFF case '#': @@ -344,7 +351,17 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), one_database = 1; break; case 'p': - pass = my_strdup(argument, MYF(0)); + if (argument) + { + my_free(pass,MYF(MY_ALLOW_ZERO_PTR)); + char *start=argument; + pass= my_strdup(argument,MYF(MY_FAE)); + while (*argument) *argument++= 'x'; /* Destroy argument */ + if (*start) + start[1]=0; /* Cut length of argument */ + } + else + tty_password=1; break; case 'r': if (!(result_file = my_fopen(argument, O_WRONLY | O_BINARY, MYF(MY_WME)))) @@ -360,6 +377,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), usage(); exit(0); } + if (tty_password) + pass= get_tty_password(NullS); + return 0; } @@ -778,6 +798,7 @@ int main(int argc, char** argv) my_fclose(result_file, MYF(0)); if (remote_opt) mysql_close(mysql); + cleanup(); free_defaults(defaults_argv); my_end(0); return 0;