Commit 618857b6 authored by monty@narttu.mysql.fi's avatar monty@narttu.mysql.fi

Merge with 3.23 to get fixes for:

mysqldump --delete-master-logs
Portability fix for hammer
Memory overrun for MyISAM
LOAD DATA LOCAL replication bug fix.
parents bf315f30 3cdc8ae5
...@@ -37,4 +37,5 @@ enum options { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, ...@@ -37,4 +37,5 @@ enum options { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
OPT_SELECT_LIMIT, OPT_MAX_JOIN_SIZE, OPT_SSL_SSL, OPT_SELECT_LIMIT, OPT_MAX_JOIN_SIZE, OPT_SSL_SSL,
OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH, OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH,
OPT_SSL_CIPHER, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE, OPT_SSL_CIPHER, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE,
OPT_DELETE_MASTER_LOGS,
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION, OPT_FRM }; OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION, OPT_FRM };
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
** Added --single-transaction option 06/06/2002 by Peter Zaitsev ** Added --single-transaction option 06/06/2002 by Peter Zaitsev
*/ */
#define DUMP_VERSION "9.07" #define DUMP_VERSION "9.08"
#include <my_global.h> #include <my_global.h>
#include <my_sys.h> #include <my_sys.h>
...@@ -77,7 +77,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0, ...@@ -77,7 +77,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0,
opt_delayed=0,create_options=0,opt_quoted=0,opt_databases=0, opt_delayed=0,create_options=0,opt_quoted=0,opt_databases=0,
opt_alldbs=0,opt_create_db=0,opt_first_slave=0, opt_alldbs=0,opt_create_db=0,opt_first_slave=0,
opt_autocommit=0,opt_master_data,opt_disable_keys=0,opt_xml=0, opt_autocommit=0,opt_master_data,opt_disable_keys=0,opt_xml=0,
tty_password=0,opt_single_transaction=0; opt_delete_master_logs=0, tty_password=0,
opt_single_transaction=0;
static MYSQL mysql_connection,*sock=0; static MYSQL mysql_connection,*sock=0;
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
*current_host=0,*path=0,*fields_terminated=0, *current_host=0,*path=0,*fields_terminated=0,
...@@ -129,6 +130,9 @@ static struct my_option my_long_options[] = ...@@ -129,6 +130,9 @@ static struct my_option my_long_options[] =
{"delayed-insert", OPT_DELAYED, "Insert rows with INSERT DELAYED.", {"delayed-insert", OPT_DELAYED, "Insert rows with INSERT DELAYED.",
(gptr*) &opt_delayed, (gptr*) &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, (gptr*) &opt_delayed, (gptr*) &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0}, 0, 0},
{"delete-master-logs", OPT_DELETE_MASTER_LOGS,
"Delete logs on master after backup. This will automagically enable --first-slave.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"disable-keys", 'K', {"disable-keys", 'K',
"'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put in the output.", (gptr*) &opt_disable_keys, "'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER TABLE tb_name ENABLE KEYS */; will be put in the output.", (gptr*) &opt_disable_keys,
(gptr*) &opt_disable_keys, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, (gptr*) &opt_disable_keys, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
...@@ -318,15 +322,20 @@ static void write_footer(FILE *sql_file) ...@@ -318,15 +322,20 @@ static void write_footer(FILE *sql_file)
fputs("\n", sql_file); fputs("\n", sql_file);
} /* write_footer */ } /* write_footer */
static my_bool static my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)), get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
char *argument) char *argument)
{ {
switch(optid) { switch (optid) {
case OPT_MASTER_DATA: case OPT_MASTER_DATA:
opt_master_data=1; opt_master_data=1;
opt_first_slave=1; opt_first_slave=1;
break; break;
case OPT_DELETE_MASTER_LOGS:
opt_delete_master_logs=1;
opt_first_slave=1;
break;
case 'p': case 'p':
if (argument) if (argument)
{ {
...@@ -1431,6 +1440,11 @@ int main(int argc, char **argv) ...@@ -1431,6 +1440,11 @@ int main(int argc, char **argv)
if (opt_first_slave) if (opt_first_slave)
{ {
if (opt_delete_master_logs && mysql_query(sock, "FLUSH MASTER"))
{
my_printf_error(0, "Error: Couldn't execute 'FLUSH MASTER': %s",
MYF(0), mysql_error(sock));
}
if (opt_master_data) if (opt_master_data)
{ {
if (mysql_query(sock, "SHOW MASTER STATUS") || if (mysql_query(sock, "SHOW MASTER STATUS") ||
...@@ -1452,9 +1466,6 @@ int main(int argc, char **argv) ...@@ -1452,9 +1466,6 @@ int main(int argc, char **argv)
mysql_free_result(master); mysql_free_result(master);
} }
} }
if (mysql_query(sock, "FLUSH MASTER"))
my_printf_error(0, "Error: Couldn't execute 'FLUSH MASTER': %s",
MYF(0), mysql_error(sock));
if (mysql_query(sock, "UNLOCK TABLES")) if (mysql_query(sock, "UNLOCK TABLES"))
my_printf_error(0, "Error: Couldn't execute 'UNLOCK TABLES': %s", my_printf_error(0, "Error: Couldn't execute 'UNLOCK TABLES': %s",
MYF(0), mysql_error(sock)); MYF(0), mysql_error(sock));
......
...@@ -62,7 +62,7 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record) ...@@ -62,7 +62,7 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record)
extra= (ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+ extra= (ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+
MI_DYN_DELETE_BLOCK_HEADER+1); MI_DYN_DELETE_BLOCK_HEADER+1);
reclength= (info->s->base.pack_reclength+ reclength= (info->s->base.pack_reclength + info->s->base.pack_bits +
_my_calc_total_blob_length(info,record)+ extra); _my_calc_total_blob_length(info,record)+ extra);
#ifdef NOT_USED /* We now support big rows */ #ifdef NOT_USED /* We now support big rows */
if (reclength > MI_DYN_MAX_ROW_LENGTH) if (reclength > MI_DYN_MAX_ROW_LENGTH)
......
...@@ -252,7 +252,7 @@ int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974 ...@@ -252,7 +252,7 @@ int, i967 int, i968 int, i969 int, i970 int, i971 int, i972 int, i973 int, i974
int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982 int, i975 int, i976 int, i977 int, i978 int, i979 int, i980 int, i981 int, i982
int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990 int, i983 int, i984 int, i985 int, i986 int, i987 int, i988 int, i989 int, i990
int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998 int, i991 int, i992 int, i993 int, i994 int, i995 int, i996 int, i997 int, i998
int, i999 int, i1000 int) row_format=dynamic; int, i999 int, i1000 int, b blob) row_format=dynamic;
insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
...@@ -291,7 +291,7 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...@@ -291,7 +291,7 @@ insert into t1 values (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "Sergei");
drop table if exists t1; drop table if exists t1;
# #
......
...@@ -1560,6 +1560,7 @@ void sql_print_error(const char *format,...) ...@@ -1560,6 +1560,7 @@ void sql_print_error(const char *format,...)
char buff[1024]; char buff[1024];
my_vsnprintf(buff,sizeof(buff)-1,format,args); my_vsnprintf(buff,sizeof(buff)-1,format,args);
DBUG_PRINT("error",("%s",buff)); DBUG_PRINT("error",("%s",buff));
va_start(args,format);
} }
#endif #endif
skr=time(NULL); skr=time(NULL);
......
...@@ -282,9 +282,9 @@ void Load_log_event::pack_info(String* packet) ...@@ -282,9 +282,9 @@ void Load_log_event::pack_info(String* packet)
tmp.append("LOAD DATA INFILE '"); tmp.append("LOAD DATA INFILE '");
tmp.append(fname, fname_len); tmp.append(fname, fname_len);
tmp.append("' ", 2); tmp.append("' ", 2);
if (sql_ex.opt_flags && REPLACE_FLAG ) if (sql_ex.opt_flags & REPLACE_FLAG)
tmp.append(" REPLACE "); tmp.append(" REPLACE ");
else if (sql_ex.opt_flags && IGNORE_FLAG ) else if (sql_ex.opt_flags & IGNORE_FLAG)
tmp.append(" IGNORE "); tmp.append(" IGNORE ");
tmp.append("INTO TABLE "); tmp.append("INTO TABLE ");
...@@ -297,7 +297,7 @@ void Load_log_event::pack_info(String* packet) ...@@ -297,7 +297,7 @@ void Load_log_event::pack_info(String* packet)
if (sql_ex.enclosed_len) if (sql_ex.enclosed_len)
{ {
if (sql_ex.opt_flags && OPT_ENCLOSED_FLAG ) if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG )
tmp.append(" OPTIONALLY "); tmp.append(" OPTIONALLY ");
tmp.append( " ENCLOSED BY "); tmp.append( " ENCLOSED BY ");
pretty_print_str(&tmp, sql_ex.enclosed, sql_ex.enclosed_len); pretty_print_str(&tmp, sql_ex.enclosed, sql_ex.enclosed_len);
...@@ -1153,8 +1153,8 @@ Load_log_event::Load_log_event(THD* thd_arg, sql_exchange* ex, ...@@ -1153,8 +1153,8 @@ Load_log_event::Load_log_event(THD* thd_arg, sql_exchange* ex,
sql_ex.empty_flags = 0; sql_ex.empty_flags = 0;
switch (handle_dup) { switch (handle_dup) {
case DUP_IGNORE: sql_ex.opt_flags |= IGNORE_FLAG; break; case DUP_IGNORE: sql_ex.opt_flags|= IGNORE_FLAG; break;
case DUP_REPLACE: sql_ex.opt_flags |= REPLACE_FLAG; break; case DUP_REPLACE: sql_ex.opt_flags|= REPLACE_FLAG; break;
case DUP_ERROR: break; case DUP_ERROR: break;
} }
...@@ -1273,9 +1273,9 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db) ...@@ -1273,9 +1273,9 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
fprintf(file, "LOAD DATA INFILE '%-*s' ", fname_len, fname); fprintf(file, "LOAD DATA INFILE '%-*s' ", fname_len, fname);
if (sql_ex.opt_flags && REPLACE_FLAG ) if (sql_ex.opt_flags & REPLACE_FLAG )
fprintf(file," REPLACE "); fprintf(file," REPLACE ");
else if (sql_ex.opt_flags && IGNORE_FLAG ) else if (sql_ex.opt_flags & IGNORE_FLAG )
fprintf(file," IGNORE "); fprintf(file," IGNORE ");
fprintf(file, "INTO TABLE %s ", table_name); fprintf(file, "INTO TABLE %s ", table_name);
...@@ -1287,7 +1287,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db) ...@@ -1287,7 +1287,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db)
if (sql_ex.enclosed) if (sql_ex.enclosed)
{ {
if (sql_ex.opt_flags && OPT_ENCLOSED_FLAG ) if (sql_ex.opt_flags & OPT_ENCLOSED_FLAG )
fprintf(file," OPTIONALLY "); fprintf(file," OPTIONALLY ");
fprintf(file, " ENCLOSED BY "); fprintf(file, " ENCLOSED BY ");
pretty_print_str(file, sql_ex.enclosed, sql_ex.enclosed_len); pretty_print_str(file, sql_ex.enclosed, sql_ex.enclosed_len);
...@@ -1859,7 +1859,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, ...@@ -1859,7 +1859,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
{ {
char llbuff[22]; char llbuff[22];
enum enum_duplicates handle_dup = DUP_IGNORE; enum enum_duplicates handle_dup = DUP_IGNORE;
if (sql_ex.opt_flags && REPLACE_FLAG) if (sql_ex.opt_flags & REPLACE_FLAG)
handle_dup = DUP_REPLACE; handle_dup = DUP_REPLACE;
sql_exchange ex((char*)fname, sql_ex.opt_flags && sql_exchange ex((char*)fname, sql_ex.opt_flags &&
DUMPFILE_FLAG ); DUMPFILE_FLAG );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment