diff options
author | unknown <tsmith@siva.hindu.god> | 2007-04-18 14:55:42 -0600 |
---|---|---|
committer | unknown <tsmith@siva.hindu.god> | 2007-04-18 14:55:42 -0600 |
commit | 4177856a56bae216184595f5c18987e2abe31957 (patch) | |
tree | 6095a90eae7e27fd721699fb2a8fef7d74ac69a6 /client | |
parent | 9508b781eff5a2a6857f1467b0a39dbde06e4446 (diff) | |
parent | 9340cb193e40516d051f02cdd074dd30b99816a4 (diff) | |
download | mariadb-git-4177856a56bae216184595f5c18987e2abe31957.tar.gz |
Merge siva.hindu.god:/home/tsmith/m/bk/51
into siva.hindu.god:/home/tsmith/m/bk/maint/51
client/mysql_upgrade.c:
Auto merged
client/mysqltest.c:
Auto merged
mysql-test/lib/mtr_cases.pl:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/r/type_datetime.result:
Auto merged
mysys/my_alloc.c:
Auto merged
sql/field.h:
Auto merged
sql/item.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
Diffstat (limited to 'client')
-rw-r--r-- | client/client_priv.h | 2 | ||||
-rw-r--r-- | client/mysql.cc | 9 | ||||
-rw-r--r-- | client/mysqladmin.cc | 9 | ||||
-rw-r--r-- | client/mysqlbinlog.cc | 33 | ||||
-rw-r--r-- | client/mysqlcheck.c | 9 | ||||
-rw-r--r-- | client/mysqldump.c | 35 | ||||
-rw-r--r-- | client/mysqlimport.c | 9 | ||||
-rw-r--r-- | client/mysqlshow.c | 9 | ||||
-rw-r--r-- | client/mysqlslap.c | 11 | ||||
-rw-r--r-- | client/mysqltest.c | 12 |
10 files changed, 67 insertions, 71 deletions
diff --git a/client/client_priv.h b/client/client_priv.h index 9a678eb7d2a..ddc0e50b723 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -67,5 +67,5 @@ enum options_client OPT_SLAP_POST_QUERY, OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID, OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT, - OPT_DEBUG_INFO, OPT_COLUMN_TYPES, OPT_WRITE_BINLOG + OPT_DEBUG_INFO, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE, OPT_WRITE_BINLOG }; diff --git a/client/mysql.cc b/client/mysql.cc index d2c7bd8812c..55efa9d22be 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -885,14 +885,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_nopager= 1; break; case OPT_MYSQL_PROTOCOL: - { - if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) - { - fprintf(stderr, "Unknown option to protocol: %s\n", argument); - exit(1); - } + opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, + opt->name); break; - } break; case 'A': opt_rehash= 0; diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index cb704d716cc..03b37f2ba3a 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -287,15 +287,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), #endif break; case OPT_MYSQL_PROTOCOL: - { - if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) - { - fprintf(stderr, "Unknown option to protocol: %s\n", argument); - exit(1); - } + opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, + opt->name); break; } - } if (error) { usage(); diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index dec750d7313..06ae20da8cf 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -944,14 +944,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), remote_opt= 1; break; case OPT_MYSQL_PROTOCOL: - { - if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) - { - fprintf(stderr, "Unknown option to protocol: %s\n", argument); - exit(1); - } + opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, + opt->name); break; - } case OPT_START_DATETIME: start_datetime= convert_str_to_timestamp(start_datetime_str); break; @@ -1167,7 +1162,7 @@ could be out of memory"); } if (len < 8 && net->read_pos[0] == 254) break; // end of data - DBUG_PRINT("info",( "len: %lu, net->read_pos[5]: %d\n", + DBUG_PRINT("info",( "len: %lu net->read_pos[5]: %d\n", len, net->read_pos[5])); if (!(ev= Log_event::read_log_event((const char*) net->read_pos + 1 , len - 1, &error_msg, @@ -1222,6 +1217,18 @@ could be out of memory"); len= 1; // fake Rotate, so don't increment old_off } } + else if (type == FORMAT_DESCRIPTION_EVENT) + { + /* + This could be an fake Format_description_log_event that server + (5.0+) automatically sends to a slave on connect, before sending + a first event at the requested position. If this is the case, + don't increment old_off. Real Format_description_log_event always + starts from BIN_LOG_HEADER_SIZE position. + */ + if (old_off != BIN_LOG_HEADER_SIZE) + len= 1; // fake event, don't increment old_off + } if ((error= process_event(print_event_info, ev, old_off))) { error= ((error < 0) ? 0 : 1); @@ -1234,16 +1241,16 @@ could be out of memory"); const char *old_fname= le->fname; uint old_len= le->fname_len; File file; - + if ((file= load_processor.prepare_new_file_for_old_format(le,fname)) < 0) { error= 1; goto err; } - + if ((error= process_event(print_event_info, ev, old_off))) { - my_close(file,MYF(MY_WME)); + my_close(file,MYF(MY_WME)); error= ((error < 0) ? 0 : 1); goto err; } @@ -1256,8 +1263,8 @@ could be out of memory"); } } /* - Let's adjust offset for remote log as for local log to produce - similar text. + Let's adjust offset for remote log as for local log to produce + similar text and to have --stop-position to work identically. */ old_off+= len-1; } diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 2f5d435d0a5..43a938badbe 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -315,15 +315,10 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; case 'V': print_version(); exit(0); case OPT_MYSQL_PROTOCOL: - { - if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) - { - fprintf(stderr, "Unknown option to protocol: %s\n", argument); - exit(1); - } + opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, + opt->name); break; } - } return 0; } diff --git a/client/mysqldump.c b/client/mysqldump.c index 99415a5a593..1506fb0bf19 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -109,7 +109,8 @@ static char *opt_password=0,*current_user=0, *lines_terminated=0, *enclosed=0, *opt_enclosed=0, *escaped=0, *where=0, *order_by=0, *opt_compatible_mode_str= 0, - *err_ptr= 0; + *err_ptr= 0, + *log_error_file= NULL; static char **defaults_argv= 0; static char compatible_mode_normal_str[255]; static ulong opt_compatible_mode= 0; @@ -120,7 +121,9 @@ static my_string opt_mysql_unix_port=0; static int first_error=0; static DYNAMIC_STRING extended_row; #include <sslopt-vars.h> -FILE *md_result_file= 0; +FILE *md_result_file= 0; +FILE *stderror_file=0; + #ifdef HAVE_SMEM static char *shared_memory_base_name=0; #endif @@ -320,6 +323,9 @@ static struct my_option my_long_options[] = 0, 0, 0, 0, 0, 0}, {"lock-tables", 'l', "Lock all tables for read.", (gptr*) &lock_tables, (gptr*) &lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, + {"log-error", OPT_ERROR_LOG_FILE, "Append warnings and errors to given file.", + (gptr*) &log_error_file, (gptr*) &log_error_file, 0, GET_STR, + REQUIRED_ARG, 0, 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" @@ -801,14 +807,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; } case (int) OPT_MYSQL_PROTOCOL: - { - if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) - { - fprintf(stderr, "Unknown option to protocol: %s\n", argument); - exit(1); - } - break; - } + opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, + opt->name); + break; } return 0; } @@ -4210,6 +4211,16 @@ int main(int argc, char **argv) free_resources(0); exit(exit_code); } + + if (log_error_file) + { + if(!(stderror_file= freopen(log_error_file, "a+", stderr))) + { + free_resources(0); + exit(EX_MYSQLERR); + } + } + if (connect_to_db(current_host, current_user, opt_password)) { free_resources(0); @@ -4273,5 +4284,9 @@ err: if (!path) write_footer(md_result_file); free_resources(); + + if (stderror_file) + fclose(stderror_file); + return(first_error); } /* main */ diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 3e054fba308..c037da9c0b9 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -231,14 +231,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), break; #endif case OPT_MYSQL_PROTOCOL: - { - if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) - { - fprintf(stderr, "Unknown option to protocol: %s\n", argument); - exit(1); - } + opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, + opt->name); break; - } case '#': DBUG_PUSH(argument ? argument : "d:t:o"); break; diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 1c714cc640f..0c6a6229964 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -287,14 +287,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), #endif break; case OPT_MYSQL_PROTOCOL: - { - if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) - { - fprintf(stderr, "Unknown option to protocol: %s\n", argument); - exit(1); - } + opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, + opt->name); break; - } case '#': DBUG_PUSH(argument ? argument : "d:t:o"); break; diff --git a/client/mysqlslap.c b/client/mysqlslap.c index ef11f4bab5b..0335922881a 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -689,14 +689,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), #endif break; case OPT_MYSQL_PROTOCOL: - { - if ((opt_protocol= find_type(argument, &sql_protocol_typelib,0)) <= 0) - { - fprintf(stderr, "Unknown option to protocol: %s\n", argument); - exit(1); - } - break; - } + opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib, + opt->name); + break; case '#': DBUG_PUSH(argument ? argument : default_dbug_option); break; diff --git a/client/mysqltest.c b/client/mysqltest.c index 6f6412e1f02..c36adaa8db6 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -2535,17 +2535,20 @@ wait_for_position: if (!(res= mysql_store_result(mysql))) die("mysql_store_result() returned NULL for '%s'", query_buf); if (!(row= mysql_fetch_row(res))) + { + mysql_free_result(res); die("empty result in %s", query_buf); + } if (!row[0]) { /* It may be that the slave SQL thread has not started yet, though START SLAVE has been issued ? */ + mysql_free_result(res); if (tries++ == 30) die("could not sync with master ('%s' returned NULL)", query_buf); sleep(1); /* So at most we will wait 30 seconds and make 31 tries */ - mysql_free_result(res); goto wait_for_position; } mysql_free_result(res); @@ -2586,6 +2589,7 @@ int do_save_master_pos() MYSQL *mysql = &cur_con->mysql; const char *query; int rpl_parse; + DBUG_ENTER("do_save_master_pos"); rpl_parse = mysql_rpl_parse_enabled(mysql); mysql_disable_rpl_parse(mysql); @@ -2743,7 +2747,7 @@ int do_save_master_pos() if (rpl_parse) mysql_enable_rpl_parse(mysql); - return 0; + DBUG_RETURN(0); } @@ -3198,7 +3202,7 @@ struct st_connection * find_connection_by_name(const char *name) int select_connection_name(const char *name) { - DBUG_ENTER("select_connection2"); + DBUG_ENTER("select_connection_name"); DBUG_PRINT("enter",("name: '%s'", name)); if (!(cur_con= find_connection_by_name(name))) @@ -3221,7 +3225,7 @@ int select_connection(struct st_command *command) if (*p) *p++= 0; command->last_argument= p; - return select_connection_name(name); + DBUG_RETURN(select_connection_name(name)); } |