From 8f739cd674ad03cc19f92038bb4e29dd7995a82f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 19 Mar 2003 15:16:51 +0100 Subject: [PATCH 01/24] Do not silently do RESET MASTER when one does 'mysqldump --master-data' ; only do it if the user specifies --delete-master-logs (new option). Safer + fixes bug #159. client/client_priv.h: New option --delete-master-logs for mysqldump client/mysqldump.c: New option --delete-master-logs for mysqldump BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + client/client_priv.h | 3 ++- client/mysqldump.c | 25 +++++++++++++++++-------- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 3f58a7aea48..a6699f7c515 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -5,6 +5,7 @@ bar@bar.mysql.r18.ru bar@bar.udmsearch.izhnet.ru bell@sanja.is.com.ua bk@admin.bk +guilhem@mysql.com heikki@donna.mysql.fi heikki@hundin.mysql.fi jani@hynda.mysql.fi diff --git a/client/client_priv.h b/client/client_priv.h index 56eaf311070..147670005f2 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -30,4 +30,5 @@ enum options { OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET, OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS, OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE, OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES, - OPT_MASTER_DATA, OPT_AUTOCOMMIT, OPT_LOCAL_INFILE}; + OPT_MASTER_DATA, OPT_AUTOCOMMIT, OPT_LOCAL_INFILE, + OPT_DELETE_MASTER_LOGS}; diff --git a/client/mysqldump.c b/client/mysqldump.c index d7d54a13c57..34f01e1581b 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -73,7 +73,8 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick=0, extended_insert = 0, ignore=0,opt_drop=0,opt_keywords=0,opt_lock=0,opt_compress=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_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, + opt_delete_master_logs=0; static MYSQL mysql_connection,*sock=0; static char insert_pat[12 * 1024],*opt_password=0,*current_user=0, *current_host=0,*path=0,*fields_terminated=0, @@ -101,6 +102,7 @@ static struct option long_options[] = {"debug", optional_argument, 0, '#'}, {"default-character-set", required_argument, 0, OPT_DEFAULT_CHARSET}, {"delayed-insert", no_argument, 0, OPT_DELAYED}, + {"delete-master-logs", no_argument, 0, OPT_DELETE_MASTER_LOGS}, {"disable-keys", no_argument, 0, 'K'}, {"extended-insert", no_argument, 0, 'e'}, {"fields-terminated-by", required_argument, 0, (int) OPT_FTB}, @@ -206,9 +208,12 @@ static void usage(void) --add-locks Add locks around insert statements.\n\ --allow-keywords Allow creation of column names that are keywords.\n\ --delayed-insert Insert rows with INSERT DELAYED.\n\ + --delete-master-logs Issue RESET MASTER on the master just after taking\n\ + the dump, and before unlocking tables.\n\ + This will automatically enable --first-slave.\n\ --master-data This will cause the master position and filename to \n\ - be appended to your output. This will automagically \n\ - enable --first-slave.\n\ + be appended to your output, before unlocking tables.\n\ + This will automatically enable --first-slave.\n\ -F, --flush-logs Flush logs file in server before starting dump.\n\ -f, --force Continue even if we get an sql-error.\n\ -h, --host=... Connect to host.\n"); @@ -317,6 +322,10 @@ static int get_options(int *argc,char ***argv) opt_master_data=1; opt_first_slave=1; break; + case OPT_DELETE_MASTER_LOGS: + opt_delete_master_logs=1; + opt_first_slave=1; + break; case OPT_AUTOCOMMIT: opt_autocommit=1; break; @@ -1489,6 +1498,11 @@ int main(int argc, char **argv) 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 (mysql_query(sock, "SHOW MASTER STATUS") || @@ -1511,11 +1525,6 @@ int main(int argc, char **argv) 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")) { my_printf_error(0, "Error: Couldn't execute 'UNLOCK TABLES': %s", From 2ec4163759bc19f5fc03cd5a0b1072afcdb16947 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 21 Mar 2003 16:45:39 -0500 Subject: [PATCH 02/24] Post-4.0.12 changes from Novell: mostly NetWare-related code changes to utilize new LibC client/mysql.cc: Remove unnecessary pthread_yield calls for NetWare client/mysqldump.c: Remove unnecessary pthread_yield calls for NetWare include/my_pthread.h: Special extern my_pthread_cond_timedwait no longer required for NetWare mysql-test/t/backup.test: replace_result added so test passes correctly on NetWare mysys/default.c: Add conditional to avoid non-applicable file checking on NetWare mysys/my_init.c: Remove working directory change from netware_init() mysys/my_pthread.c: Remove unnecessary NetWare version of my_pthread_cond_timedwait mysys/thr_mutex.c: Remove unnecessary NetWare block scripts/make_binary_distribution.sh: Changes to clear up extraneous EXTRA_BIN_FILES, NetWare sections --- client/mysql.cc | 29 +--------- client/mysqldump.c | 8 --- include/my_pthread.h | 8 --- mysql-test/t/backup.test | 4 +- mysys/default.c | 2 +- mysys/my_init.c | 14 +---- mysys/my_pthread.c | 13 ----- mysys/thr_mutex.c | 5 -- scripts/make_binary_distribution.sh | 82 +++++++++++++++++++---------- 9 files changed, 61 insertions(+), 104 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 4f7548afc92..377f4f08f63 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -811,8 +811,8 @@ static int read_lines(bool execute_commands) /* Remove the '\n' */ { char *p = strrchr(line, '\n'); - if (p != NULL) - *p = '\0'; + if (p != NULL) + *p = '\0'; } #else linebuffer[0]= (char) sizeof(linebuffer); @@ -1597,9 +1597,6 @@ print_table_data(MYSQL_RES *result) MYSQL_ROW cur; MYSQL_FIELD *field; bool *num_flag; -#ifdef __NETWARE__ - uint lines= 0; -#endif num_flag=(bool*) my_alloca(sizeof(bool)*mysql_num_fields(result)); if (info_flag) @@ -1655,10 +1652,6 @@ print_table_data(MYSQL_RES *result) length, str); } (void) tee_fputs("\n", PAGER); -#ifdef __NETWARE__ - // on a long result the screen could hog the cpu - if ((lines++ & 1023) == 0) pthread_yield(); -#endif } tee_puts(separator.c_ptr(), PAGER); my_afree((gptr) num_flag); @@ -1670,9 +1663,6 @@ print_table_data_html(MYSQL_RES *result) { MYSQL_ROW cur; MYSQL_FIELD *field; -#ifdef __NETWARE__ - uint lines= 0; -#endif mysql_field_seek(result,0); (void) tee_fputs("", PAGER); @@ -1697,10 +1687,6 @@ print_table_data_html(MYSQL_RES *result) (void) tee_fputs("", PAGER); } (void) tee_fputs("", PAGER); -#ifdef __NETWARE__ - // on a long result the screen could hog the cpu - if ((lines++ & 1023) == 0) pthread_yield(); -#endif } (void) tee_fputs("
", PAGER); } @@ -1711,9 +1697,6 @@ print_table_data_xml(MYSQL_RES *result) { MYSQL_ROW cur; MYSQL_FIELD *fields; -#ifdef __NETWARE__ - uint lines= 0; -#endif mysql_field_seek(result,0); @@ -1737,10 +1720,6 @@ print_table_data_xml(MYSQL_RES *result) "   ") : "NULL")); } (void) tee_fputs(" \n", PAGER); -#ifdef __NETWARE__ - // on a long result the screen could hog the cpu - if ((lines++ & 1023) == 0) pthread_yield(); -#endif } (void) tee_fputs("\n", PAGER); } @@ -1773,10 +1752,6 @@ print_table_data_vertically(MYSQL_RES *result) tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name); tee_fprintf(PAGER, "%s\n",cur[off] ? (char*) cur[off] : "NULL"); } -#ifdef __NETWARE__ - // on a long result the screen could hog the cpu - if ((row_count & 1023) == 0) pthread_yield(); -#endif } } diff --git a/client/mysqldump.c b/client/mysqldump.c index f242b55159d..7b7c60c3c56 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -897,9 +897,6 @@ static void dumpTable(uint numFields, char *table) MYSQL_FIELD *field; MYSQL_ROW row; ulong rownr, row_break, total_length, init_length; -#if defined(__NETWARE__) && defined(THREAD) - uint lines= 0; -#endif if (verbose) fprintf(stderr, "-- Sending SELECT query...\n"); @@ -1126,11 +1123,6 @@ static void dumpTable(uint numFields, char *table) } else if (!opt_xml) fputs(");\n", md_result_file); -#if defined(__NETWARE__) && defined(THREAD) - /* on a long result the screen could hog the cpu */ - if ((lines++ & 1023) == 0) - pthread_yield(); -#endif } /* XML - close table tag and supress regular output */ diff --git a/include/my_pthread.h b/include/my_pthread.h index a7fa38349dc..0b41dc18fe1 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -356,14 +356,6 @@ extern int my_pthread_cond_timedwait(pthread_cond_t *cond, #define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C)) #endif - -#ifdef __NETWARE__ -extern int my_pthread_cond_timedwait(pthread_cond_t *cond, - pthread_mutex_t *mutex, - struct timespec *abstime); -#define pthread_cond_timedwait(A,B,C) my_pthread_cond_timedwait((A),(B),(C)) -#endif /* __NETWARE__ */ - #if defined(OS2) #define my_pthread_getspecific(T,A) ((T) &(A)) #define pthread_setspecific(A,B) win_pthread_setspecific(&(A),(B),sizeof(A)) diff --git a/mysql-test/t/backup.test b/mysql-test/t/backup.test index 0346e6ba456..650b85477f5 100644 --- a/mysql-test/t/backup.test +++ b/mysql-test/t/backup.test @@ -7,10 +7,10 @@ connect (con2,localhost,root,,); connection con1; set SQL_LOG_BIN=0; create table t4(n int); ---replace_result "errno: 2" "errno: X" "errno: 22" "errno: X" "errno: 23" "errno: X" +--replace_result "errno: 1" "errno: X" "errno: 2" "errno: X" "errno: 22" "errno: X" "errno: 23" "errno: X" backup table t4 to '../bogus'; backup table t4 to '../tmp'; ---replace_result "errno: 17" "errno: X" +--replace_result "errno: 7" "errno: X" "errno: 17" "errno: X" backup table t4 to '../tmp'; drop table t4; restore table t4 from '../tmp'; diff --git a/mysys/default.c b/mysys/default.c index cfdda17fb5f..a3942425b7d 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -244,7 +244,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc, strmov(name,config_file); } fn_format(name,name,"","",4); -#if !defined(__WIN__) && !defined(OS2) +#if !defined(__WIN__) && !defined(OS2) && !defined(__NETWARE__) { MY_STAT stat_info; if (!my_stat(name,&stat_info,MYF(0))) diff --git a/mysys/my_init.c b/mysys/my_init.c index 61d9f4a4b2b..a8a184a2cb4 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -381,23 +381,13 @@ static void netware_init() { if (*name == '\\') { - *name = '/'; + *name = '/'; } else { - *name = tolower(*name); + *name = tolower(*name); } } - /* - Set the current working directory to the base directory of the file - name (assuming the binary is in 'base-file-name/bin/' - */ - strmov(cwd, my_progname); - if ((name= strindex(cwd, "/bin/")) != NULL) - { - *name= 0; - chdir(cwd); - } } } #endif /* __NETWARE__ */ diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index 7ad4852558e..1eb15d92bc9 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -426,19 +426,6 @@ int my_pthread_cond_init(pthread_cond_t *mp, const pthread_condattr_t *attr) #endif -#ifdef __NETWARE__ -/* NetWare does not re-acquire the lock if the condition fails */ -int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, - struct timespec *abstime) -{ - int err= pthread_cond_timedwait(cond, mutex, abstime); - if (err) - pthread_mutex_lock(mutex); - return err; -} -#endif /* __NETWARE__ */ - - /***************************************************************************** Patches for HPUX We need these because the pthread_mutex.. code returns -1 on error, diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c index 2aabe2f500a..3abac2dc737 100644 --- a/mysys/thr_mutex.c +++ b/mysys/thr_mutex.c @@ -241,11 +241,6 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, fflush(stderr); abort(); } -#ifdef __NETWARE__ - /* NetWare doesn't re-acquire the mutex on an error */ - if (error && pthread_mutex_lock(&mp->mutex)) - mp->count--; -#endif /* __NETWARE__ */ mp->thread=pthread_self(); mp->file= (char*) file; mp->line=line; diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index f0113ee1780..58328a5be3d 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -47,33 +47,29 @@ if [ -d $BASE ] ; then rm -r -f $BASE fi -BS="" -EXTRA_BIN_FILES="" BASE_SYSTEM="any" MYSQL_SHARE=$BASE/share/mysql +BIN_FILES="" case $system in *netware*) BASE_SYSTEM="netware" - BS=".nlm" MYSQL_SHARE=$BASE/share - EXTRA_BIN_FILES="netware/mysqld_safe.nlm netware/mysql_install_db.nlm \ - netware/init_db.sql netware/test_db.sql netware/mysql_explain_log.nlm \ - netware/mysqlhotcopy.nlm netware/libmysql.nlm netware/init_secure_db.sql" ;; esac -mkdir $BASE $BASE/bin $BASE/data $BASE/data/mysql $BASE/data/test \ +mkdir $BASE $BASE/bin \ $BASE/include $BASE/lib $BASE/support-files $BASE/share $BASE/scripts \ $BASE/mysql-test $BASE/mysql-test/t $BASE/mysql-test/r \ $BASE/mysql-test/include $BASE/mysql-test/std_data if [ $BASE_SYSTEM != "netware" ] ; then - mkdir $BASE/share/mysql $BASE/tests $BASE/sql-bench $BASE/man $BASE/man/man1 -fi + mkdir $BASE/share/mysql $BASE/tests $BASE/sql-bench $BASE/man \ + $BASE/man/man1 $BASE/data $BASE/data/mysql $BASE/data/test -chmod o-rwx $BASE/data $BASE/data/* + chmod o-rwx $BASE/data $BASE/data/* +fi for i in ChangeLog COPYING COPYING.LIB README Docs/INSTALL-BINARY \ MySQLEULA.txt Docs/manual.html Docs/manual.txt Docs/manual_toc.html \ @@ -85,23 +81,47 @@ do fi done -for i in extra/comp_err$BS extra/replace$BS extra/perror$BS \ - extra/resolveip$BS extra/my_print_defaults$BS \ - extra/resolve_stack_dump$BS extra/mysql_waitpid$BS \ - isam/isamchk$BS isam/pack_isam$BS \ - myisam/myisamchk$BS myisam/myisampack$BS myisam/myisamlog$BS \ - sql/mysqld$BS \ - client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \ - client/mysqldump$BS client/mysqlimport$BS \ - client/mysqltest$BS client/mysqlcheck$BS \ - client/mysqlbinlog$BS client/mysqlmanagerc$BS \ - client/mysqlmanager-pwgen$BS tools/mysqlmanager$BS \ - client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin \ - client/.libs/mysqldump client/.libs/mysqlimport \ - client/.libs/mysqltest client/.libs/mysqlcheck \ - client/.libs/mysqlbinlog client/.libs/mysqlmanagerc \ - client/.libs/mysqlmanager-pwgen tools/.libs/mysqlmanager \ - $EXTRA_BIN_FILES +if [ $BASE_SYSTEM = "netware" ] ; then + + BIN_FILES="\ + extra/comp_err.nlm extra/replace.nlm extra/perror.nlm \ + extra/resolveip.nlm extra/my_print_defaults.nlm \ + isam/isamchk.nlm isam/pack_isam.nlm \ + myisam/myisamchk.nlm myisam/myisampack.nlm myisam/myisamlog.nlm \ + sql/mysqld.nlm \ + client/mysql.nlm client/mysqlshow.nlm client/mysqladmin.nlm \ + client/mysqldump.nlm client/mysqlimport.nlm \ + client/mysqltest.nlm client/mysqlcheck.nlm \ + client/mysqlbinlog.nlm + netware/mysqld_safe.nlm netware/mysql_install_db.nlm \ + netware/init_db.sql netware/test_db.sql netware/mysql_explain_log.nlm \ + netware/mysqlhotcopy.nlm netware/libmysql.nlm netware/init_secure_db.sql \ + "; + +else + + BIN_FILES="\ + extra/comp_err extra/replace extra/perror \ + extra/resolveip extra/my_print_defaults \ + extra/resolve_stack_dump extra/mysql_waitpid \ + isam/isamchk isam/pack_isam \ + myisam/myisamchk myisam/myisampack myisam/myisamlog \ + sql/mysqld \ + client/mysql client/mysqlshow client/mysqladmin \ + client/mysqldump client/mysqlimport \ + client/mysqltest client/mysqlcheck \ + client/mysqlbinlog client/mysqlmanagerc \ + client/mysqlmanager-pwgen tools/mysqlmanager \ + client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin \ + client/.libs/mysqldump client/.libs/mysqlimport \ + client/.libs/mysqltest client/.libs/mysqlcheck \ + client/.libs/mysqlbinlog client/.libs/mysqlmanagerc \ + client/.libs/mysqlmanager-pwgen tools/.libs/mysqlmanager \ + "; + +fi + +for i in $BIN_FILES do if [ -f $i ] then @@ -126,7 +146,13 @@ if [ $BASE_SYSTEM = "netware" ] ; then $CP -r netware/*.pl $BASE/scripts fi -for i in libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a libmysqld/.libs/libmysqld.a libmysqld/.libs/libmysqld.so* libmysqld/libmysqld.a netware/libmysql.imp +for i in \ + libmysql/.libs/libmysqlclient.a libmysql/.libs/libmysqlclient.so* \ + libmysql/libmysqlclient.* libmysql_r/.libs/libmysqlclient_r.a \ + libmysql_r/.libs/libmysqlclient_r.so* libmysql_r/libmysqlclient_r.* \ + mysys/libmysys.a strings/libmystrings.a dbug/libdbug.a \ + libmysqld/.libs/libmysqld.a libmysqld/.libs/libmysqld.so* \ + libmysqld/libmysqld.a netware/libmysql.imp do if [ -f $i ] then From 3b0438c8dd343da6ff77480ce3a814dbc11a0e42 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 24 Mar 2003 23:24:45 +0200 Subject: [PATCH 03/24] Fixed bug that binary log was not locked during a DELETE FROM TABLE_NAME; --- sql/sql_delete.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 278e98533c9..2372e908152 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -30,6 +30,7 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table) char path[FN_REFLEN]; int error; TABLE **table_ptr; + my_bool lock_open_locked= 0; DBUG_ENTER("generate_table"); thd->proc_info="generate_table"; @@ -102,7 +103,7 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table) error= ha_create_table(path,&create_info,1) ? -1 : 0; if (thd->locked_tables && reopen_tables(thd,1,0)) error= -1; - VOID(pthread_mutex_unlock(&LOCK_open)); + lock_open_locked= 1; // Unlock mutex before return } if (!error) { @@ -114,6 +115,8 @@ int generate_table(THD *thd, TABLE_LIST *table_list, TABLE *locked_table) } send_ok(&thd->net); // This should return record count } + if (lock_open_locked) + VOID(pthread_mutex_unlock(&LOCK_open)); DBUG_RETURN(error ? -1 : 0); } From f9df0feecbdd8c576d043731558a8d1b80b78be2 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Mar 2003 14:49:43 +0200 Subject: [PATCH 04/24] A fix for a bug in MyISAM with large number of NULL columns and at least one BLOB column. --- myisam/mi_dynrec.c | 4 ++-- mysql-test/t/myisam.test | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c index c9fe493744d..4f321c268f1 100644 --- a/myisam/mi_dynrec.c +++ b/myisam/mi_dynrec.c @@ -62,8 +62,8 @@ int _mi_write_blob_record(MI_INFO *info, const byte *record) extra=ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER)+MI_SPLIT_LENGTH+ MI_DYN_DELETE_BLOCK_HEADER+1; - reclength=info->s->base.pack_reclength+ - _my_calc_total_blob_length(info,record)+ extra; + reclength= (info->s->base.pack_reclength+ info->s->base.pack_bits+ + _my_calc_total_blob_length(info,record)+ extra); if (reclength > MI_DYN_MAX_ROW_LENGTH) { my_errno=HA_ERR_TO_BIG_ROW; diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test index 92f22d35b81..c9cb77d2a3a 100644 --- a/mysql-test/t/myisam.test +++ b/mysql-test/t/myisam.test @@ -244,7 +244,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, 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, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -283,6 +283,6 @@ 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, "Sergei"); drop table if exists t1; From 4291001df9ebb77ed7763e0875b9a95c581c3261 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Mar 2003 16:52:48 +0100 Subject: [PATCH 05/24] Fix for small bug #186 (If a connection has temporary tables and does RESET MASTER, this breaks replication). In the slave SQL thread, any DROP TEMPORARY TABLE is silently converted to DROP TEMPORARY TABLE IF EXISTS, not to have irrelevant "table does not exist". See comments in code or bug #186 for an example of how irrelevant errors like this can arise. --- sql/sql_parse.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ad7ccaf8f38..1bb1fd9d39a 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2061,6 +2061,16 @@ mysql_execute_command(void) { if (check_table_access(thd,DROP_ACL,tables)) goto error; /* purecov: inspected */ + /* + If this is a slave thread, we may sometimes execute some + DROP / * 40005 TEMPORARY * / TABLE + that come from parts of binlogs (likely if we use RESET SLAVE or CHANGE + MASTER TO), while the temporary table has already been dropped. + To not generate such irrelevant "table does not exist errors", we silently + add IF EXISTS if TEMPORARY was used. + */ + if (thd->slave_thread && lex->drop_temporary) + lex->drop_if_exists= 1; if (end_active_trans(thd)) res= -1; else From 5ed61c1121681ab600ed757047c02481d66ad8e1 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 26 Mar 2003 00:19:56 +0500 Subject: [PATCH 06/24] crash-me.sh: add new parameter checks length_of_varchar_field, add new auxilary functions: get_recordset compare_recordset print_recordset sql-bench/crash-me.sh: add new parameter checks length_of_varchar_field, add new auxilary functions: get_recordset compare_recordset print_recordset --- sql-bench/crash-me.sh | 109 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh index 79090e3e6db..61468d69fb1 100644 --- a/sql-bench/crash-me.sh +++ b/sql-bench/crash-me.sh @@ -2210,6 +2210,40 @@ if ($limits{'foreign_key'} eq 'yes') } } +if ($limits{'func_sql_character_length'} eq 'yes') +{ + my $result = 'error'; + my ($resultset); + my $key = 'length_of_varchar_field'; + my $prompt='CHARACTER_LENGTH(varchar_field)'; + print $prompt," = "; + if (!defined($limits{$key})) { + save_incomplete($key,$prompt); + safe_query_l($key,[ + "CREATE TABLE crash_me1 (S1 VARCHAR(100))", + "INSERT INTO crash_me1 VALUES ('X')" + ]); + my $recset = get_recordset($key, + "SELECT CHARACTER_LENGTH(S1) FROM crash_me1"); + print_recordset($key,$recset); + if (defined($recset)){ + if ( $recset->[0][0] eq 1 ) { + $result = 'actual length'; + } elsif( $recset->[0][0] eq 100 ) { + $result = 'defined length'; + }; + } else { + add_log($key,$DBI::errstr); + } + safe_query_l($key, "drop table crash_me1 $drop_attr"); + save_config_data($key,$result,$prompt); + } else { + $result = $limits{$key}; + }; + print "$result\n"; +} + + check_constraint("Column constraints","constraint_check", "create table crash_q (a int check (a>0))", "insert into crash_q values(0)", @@ -2873,6 +2907,81 @@ sub make_date { } +sub print_recordset{ + my ($key,$recset) = @_; + my $rec; + foreach $rec (@$recset) + { + add_log($key, " > ".join(',', map(repr($_), @$rec))); + } +} + +# +# read result recordset from sql server. +# returns arrayref to (arrayref to) values +# or undef (in case of sql errors) +# +sub get_recordset{ + my ($key,$query) = @_; + add_log($key, "< $query"); + return $dbh->selectall_arrayref($query); +} + +# function for comparing recordset (that was returned by get_recordset) +# and arrayref of (arrayref of) values. +# +# returns : zero if recordset equal that array, 1 if it doesn't equal +# +# parameters: +# $key - current operation (for logging) +# $recset - recordset +# $mustbe - array of values that we expect +# +# example: $a=get_recordset('some_parameter','select a,b from c'); +# if (compare_recordset('some_parameter',$a,[[1,1],[1,2],[1,3]]) neq 0) +# { +# print "unexpected result\n"; +# } ; +# +sub compare_recordset { + my ($key,$recset,$mustbe) = @_; + my $rec,$recno,$fld,$fldno,$fcount; + add_log($key,"\n Check recordset:"); + $recno=0; + foreach $rec (@$recset) + { + add_log($key," " . join(',', map(repr($_),@$rec)) . " expected: " . + join(',', map(repr($_), @{$mustbe->[$recno]} ) )); + $fcount = @$rec; + $fcount--; + foreach $fldno (0 .. $fcount ) + { + if ($mustbe->[$recno][$fldno] ne $rec->[$fldno]) + { + add_log($key," Recordset doesn't correspond with template"); + return 1; + }; + } + $recno++; + } + add_log($key," Recordset corresponds with template"); + return 0; +} + +# +# converts inner perl value to printable representation +# for example: undef maps to 'NULL', +# string -> 'string' +# int -> int +# +sub repr { + my $s = shift; + return "'$s'"if ($s =~ /\D/); + return 'NULL'if ( not defined($s)); + return $s; +} + + sub version { print "$0 Ver $version\n"; From f3a5d5aa98d8125cfdeaeda8bfac56fda9ce002c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Mar 2003 22:20:07 +0100 Subject: [PATCH 07/24] - added new option "--build-command" to be able to use different commands for building the sources - removed duplicate option "--revision" - added help for new option and reformatted help text a bit --- Build-tools/Bootstrap | 76 +++++++++++++++++++++++++------------------ 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap index 969ab748e80..34a30f4bc30 100755 --- a/Build-tools/Bootstrap +++ b/Build-tools/Bootstrap @@ -30,6 +30,7 @@ chomp ($LOGFILE= `pwd`); $LOGFILE.= "/Bootstrap.log"; chomp ($opt_directory= `pwd`); $opt_docdir= $opt_directory . "/mysqldoc"; +$opt_build_command= undef; $opt_changelog= undef; $opt_delete= undef; $opt_dry_run= undef; @@ -44,6 +45,7 @@ $opt_skip_manual= undef; $version= "unknown"; GetOptions( + "build_command|b=s", "changelog|c:s", "directory|d=s", "delete", @@ -54,7 +56,6 @@ GetOptions( "log|l:s", "mail|m=s", "revision|r=s", - "revision|r=s", "skip-check|s", "skip-manual", "suffix=s", @@ -81,6 +82,14 @@ if (defined $opt_log) } } +# +# Override predefined build command +# +if (defined $opt_build_command) +{ + $build_command= $opt_build_command; +} + print_help("") if ($opt_help); defined($REPO=$ARGV[0]) || print_help("Please enter the BK repository to be used!"); @@ -329,36 +338,41 @@ archive is being created. Options: --c, --changelog[=] Add a ChangeLog [down to revision ] - This will automatically be included in the source - distribution. To get a ChangeLog down to the last - tagged Changeset, simply use "last" as the revision - number. ---delete Delete an already existing distribution directory - in the target directory instead of renaming it. --d, --directory= Specify the target directory - (default is "$opt_directory") ---docdir= Use the MySQL documentation BK tree located in in - (default is "$opt_docdir") ---dry-run Dry run without executing --e, --export-only Just export (and add the ChangeLog, if requested), - do not build or test the source distribution --h, --help Print this help message --l, --log[=] Write a log file [to ] - (default is "$LOGFILE") --m, --mail=
Mail a failure report to the given address (and - include a log file snippet, if logging is enabled) - Note that the \@-Sign needs to be quoted! - Example: --mail=user\\\@domain.com --r, --revision= Export the tree as of revision - (default is up to the latest revision) --s, --skip-check Skip checking the distribution with "make distcheck" ---skip-manual Skip updating the manual from the mysqldoc tree ---suffix= Append to the version number in configure.in. - Using the special suffix "YMD" will add the current - date as the suffix (e.g. "-20020518"). --t, --test Run the test suite after build --v, --verbose Be verbose +-b, --build-command= Use to compile the sources before packing + the distribution. + (default is "$build_command") +-c, --changelog[=] Add a ChangeLog [down to revision ] + This will automatically be included in the source + distribution. To get a ChangeLog down to the last + tagged Changeset, simply use "last" as the revision + number. +--delete Delete an already existing distribution directory + in the target directory instead of renaming it. +-d, --directory= Specify the target directory + (default is "$opt_directory") +--docdir= Use the MySQL documentation BK tree located + in + (default is "$opt_docdir") +--dry-run Dry run without executing +-e, --export-only Just export (and add the ChangeLog, if requested), + do not build or test the source distribution +-h, --help Print this help message +-l, --log[=] Write a log file [to ] + (default is "$LOGFILE") +-m, --mail=
Mail a failure report to the given address (and + include a log file snippet, if logging is enabled) + Note that the \@-Sign needs to be quoted! + Example: --mail=user\\\@domain.com +-r, --revision= Export the tree as of revision + (default is up to the latest revision) +-s, --skip-check Skip checking the distribution with "make distcheck" +--skip-manual Skip updating the manual from the mysqldoc tree +--suffix= Append to the version number in + configure.in. Using the special suffix "YMD" will + add the current date as the suffix + (e.g. "-20020518"). +-t, --test Run the test suite after build +-v, --verbose Be verbose Example: From 3d6dcd6567d70a80a01b47f179a7670572846556 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Mar 2003 22:38:12 +0100 Subject: [PATCH 08/24] - fixed typo (build_command -> build-command) --- Build-tools/Bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build-tools/Bootstrap b/Build-tools/Bootstrap index 34a30f4bc30..9f5fc37736d 100755 --- a/Build-tools/Bootstrap +++ b/Build-tools/Bootstrap @@ -45,7 +45,7 @@ $opt_skip_manual= undef; $version= "unknown"; GetOptions( - "build_command|b=s", + "build-command|b=s", "changelog|c:s", "directory|d=s", "delete", From f4305a899ade995cde96cfe137cca30b668192a8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 25 Mar 2003 19:57:38 -0400 Subject: [PATCH 09/24] fix bug with parameters of LOAD DATA INFILE in exec_event BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + sql/log_event.cc | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 70aaa8d2a52..9d0489e34f8 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -90,6 +90,7 @@ tonu@volk.internalnet tonu@x153.internalnet tonu@x3.internalnet venu@work.mysql.com +vva@eagle.mysql.r18.ru vva@genie.(none) walrus@kishkin.ru walrus@mysql.com diff --git a/sql/log_event.cc b/sql/log_event.cc index e243a953c63..51d9bd74adc 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1858,6 +1858,11 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, String line_term(sql_ex.line_term,sql_ex.line_term_len); String line_start(sql_ex.line_start,sql_ex.line_start_len); String escaped(sql_ex.escaped,sql_ex.escaped_len); + ex.field_term= &field_term; + ex.enclosed= &enclosed; + ex.line_term= &line_term; + ex.line_start= &line_start; + ex.escaped= &escaped; ex.opt_enclosed = (sql_ex.opt_flags & OPT_ENCLOSED_FLAG); if (sql_ex.empty_flags & FIELD_TERM_EMPTY) From f149c2776d48cfe53baff16b39157199a81bbfce Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 26 Mar 2003 22:04:20 +0200 Subject: [PATCH 10/24] fixed problem of port without host in SHOW PROCESSLIST (bug 189) sql/sql_show.cc: fixed problem of port without host in SHOW PROCESSLIST --- sql/sql_show.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 23e5049636a..6e1cf2e8217 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1060,7 +1060,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose) thd_info->user=thd->strdup(tmp->user ? tmp->user : (tmp->system_thread ? "system user" : "unauthenticated user")); - if (tmp->peer_port && (tmp->host || tmp->ip)) + if (tmp->peer_port && (tmp->host || tmp->ip) && thd->host_or_ip[0]) { if ((thd_info->host= thd->alloc(LIST_PROCESS_HOST_LEN+1))) my_snprintf((char *) thd_info->host, LIST_PROCESS_HOST_LEN, From 2e6c3197a931362d58c987098664783b2b8b54bf Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 27 Mar 2003 12:17:27 +0200 Subject: [PATCH 11/24] mysqld.cc: Make the default value of innodb_flush_log_at_trx_commit 1, not 0 which compromises the Durability of a transaction sql/mysqld.cc: Make the default value of innodb_flush_log_at_trx_commit 1, not 0 which compromises the Durability of a transaction --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e22d9b1dc67..7920a954eeb 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3293,7 +3293,7 @@ struct my_option my_long_options[] = "Set to 0 (write and flush once per second), 1 (write and flush at each commit) or 2 (write at commit, flush once per second)", (gptr*) &innobase_flush_log_at_trx_commit, (gptr*) &innobase_flush_log_at_trx_commit, - 0, GET_UINT, OPT_ARG, 0, 0, 2, 0, 0, 0}, + 0, GET_UINT, OPT_ARG, 1, 0, 2, 0, 0, 0}, {"innodb_flush_method", OPT_INNODB_FLUSH_METHOD, "With which method to flush data", (gptr*) &innobase_unix_file_flush_method, (gptr*) &innobase_unix_file_flush_method, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, From 420686dd8e363449f60813279ea6766660fe82c8 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 27 Mar 2003 18:13:37 -0500 Subject: [PATCH 12/24] Improve make_binary_distribution from Novell code at Monty's request netware/BUILD/create-patch: Change mode to -rwxrwxr-x scripts/make_binary_distribution.sh: Split BIN_FILES into more generic parts, with no repetition --- netware/BUILD/create-patch | 0 scripts/make_binary_distribution.sh | 55 +++++++++++++---------------- 2 files changed, 25 insertions(+), 30 deletions(-) mode change 100644 => 100755 netware/BUILD/create-patch diff --git a/netware/BUILD/create-patch b/netware/BUILD/create-patch old mode 100644 new mode 100755 diff --git a/scripts/make_binary_distribution.sh b/scripts/make_binary_distribution.sh index 58328a5be3d..73aa95a1100 100644 --- a/scripts/make_binary_distribution.sh +++ b/scripts/make_binary_distribution.sh @@ -47,13 +47,15 @@ if [ -d $BASE ] ; then rm -r -f $BASE fi +BS="" +BIN_FILES="" BASE_SYSTEM="any" MYSQL_SHARE=$BASE/share/mysql -BIN_FILES="" case $system in *netware*) BASE_SYSTEM="netware" + BS=".nlm" MYSQL_SHARE=$BASE/share ;; esac @@ -81,36 +83,30 @@ do fi done +# Non platform-specific bin dir files: +BIN_FILES="extra/comp_err$BS extra/replace$BS extra/perror$BS \ + extra/resolveip$BS extra/my_print_defaults$BS \ + extra/resolve_stack_dump$BS extra/mysql_waitpid$BS \ + isam/isamchk$BS isam/pack_isam$BS \ + myisam/myisamchk$BS myisam/myisampack$BS myisam/myisamlog$BS \ + sql/mysqld$BS \ + client/mysql$BS client/mysqlshow$BS client/mysqladmin$BS \ + client/mysqldump$BS client/mysqlimport$BS \ + client/mysqltest$BS client/mysqlcheck$BS \ + client/mysqlbinlog$BS +"; + +# Platform-specific bin dir files: if [ $BASE_SYSTEM = "netware" ] ; then - - BIN_FILES="\ - extra/comp_err.nlm extra/replace.nlm extra/perror.nlm \ - extra/resolveip.nlm extra/my_print_defaults.nlm \ - isam/isamchk.nlm isam/pack_isam.nlm \ - myisam/myisamchk.nlm myisam/myisampack.nlm myisam/myisamlog.nlm \ - sql/mysqld.nlm \ - client/mysql.nlm client/mysqlshow.nlm client/mysqladmin.nlm \ - client/mysqldump.nlm client/mysqlimport.nlm \ - client/mysqltest.nlm client/mysqlcheck.nlm \ - client/mysqlbinlog.nlm - netware/mysqld_safe.nlm netware/mysql_install_db.nlm \ - netware/init_db.sql netware/test_db.sql netware/mysql_explain_log.nlm \ - netware/mysqlhotcopy.nlm netware/libmysql.nlm netware/init_secure_db.sql \ - "; - + BIN_FILES="$BIN_FILES \ + netware/mysqld_safe$BS netware/mysql_install_db$BS \ + netware/init_db.sql netware/test_db.sql netware/mysql_explain_log$BS \ + netware/mysqlhotcopy$BS netware/libmysql$BS netware/init_secure_db.sql + "; else - - BIN_FILES="\ - extra/comp_err extra/replace extra/perror \ - extra/resolveip extra/my_print_defaults \ - extra/resolve_stack_dump extra/mysql_waitpid \ - isam/isamchk isam/pack_isam \ - myisam/myisamchk myisam/myisampack myisam/myisamlog \ - sql/mysqld \ - client/mysql client/mysqlshow client/mysqladmin \ - client/mysqldump client/mysqlimport \ - client/mysqltest client/mysqlcheck \ - client/mysqlbinlog client/mysqlmanagerc \ + # For all other platforms: + BIN_FILES="$BIN_FILES \ + client/mysqlmanagerc \ client/mysqlmanager-pwgen tools/mysqlmanager \ client/.libs/mysql client/.libs/mysqlshow client/.libs/mysqladmin \ client/.libs/mysqldump client/.libs/mysqlimport \ @@ -118,7 +114,6 @@ else client/.libs/mysqlbinlog client/.libs/mysqlmanagerc \ client/.libs/mysqlmanager-pwgen tools/.libs/mysqlmanager \ "; - fi for i in $BIN_FILES From 5380411728be50eb7a4d8fbcb337e6c2f14a9e7a Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 30 Mar 2003 18:36:01 +0500 Subject: [PATCH 13/24] truncating REPLACE result bug fix mysql-test/r/func_str.result: test result for truncating REPLACE result mysql-test/t/func_str.test: test with long arguments for REPLACE sql/item_strfunc.cc: fix for counting REPLACE result length --- mysql-test/r/func_str.result | 3 +++ mysql-test/t/func_str.test | 1 + sql/item_strfunc.cc | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 9e8f2b90f07..a72d32d39f8 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -225,6 +225,9 @@ CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"' SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter) FROM t1; CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter) Link";"1";"1";"1";"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";"2001-02-28 08:40:16";"20010228084016";"0";"4 +SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') from t1 group by bugdesc; +bugdesc REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa drop table t1; CREATE TABLE t1 (id int(11) NOT NULL auto_increment, tmp text NOT NULL, KEY id (id)) TYPE=MyISAM; INSERT INTO t1 VALUES (1, 'a545f661efdd1fb66fdee3aab79945bf'); diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index f95cd901dfb..118de6cd01e 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -114,6 +114,7 @@ INSERT INTO t1 VALUES (1,'Link',1,1,1,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter), '"') FROM t1; SELECT CONCAT('"',CONCAT_WS('";"',title,prio,category,program,bugstatus,submitter), '"') FROM t1; SELECT CONCAT_WS('";"',title,prio,category,program,bugdesc,created,modified,bugstatus,submitter) FROM t1; +SELECT bugdesc, REPLACE(bugdesc, 'xxxxxxxxxxxxxxxxxxxx', 'bbbbbbbbbbbbbbbbbbbb') from t1 group by bugdesc; drop table t1; # diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index bff8bc7e3f4..0f1ce8adba6 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -780,8 +780,8 @@ void Item_func_replace::fix_length_and_dec() int diff=(int) (args[2]->max_length - args[1]->max_length); if (diff > 0 && args[1]->max_length) { // Calculate of maxreplaces - max_length= max_length/args[1]->max_length; - max_length= (max_length+1)*(uint) diff; + uint max_substrs= max_length/args[1]->max_length; + max_length+= max_substrs * (uint)diff; } if (max_length > MAX_BLOB_WIDTH) { From 45802e08b1ecb4a5d01ae9a0a24665d55df51f67 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 31 Mar 2003 14:50:29 +0200 Subject: [PATCH 14/24] - Fix for bug #200 (added missing @WRAPLIBS@ to LIBS in libmysqld/examples/Makefile.am (thanks to Christian Hammers from Debian for pointing this out) libmysqld/examples/Makefile.am: - added missing @WRAPLIBS@ to LIBS --- libmysqld/examples/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmysqld/examples/Makefile.am b/libmysqld/examples/Makefile.am index 2b52b133133..f741ddf0191 100644 --- a/libmysqld/examples/Makefile.am +++ b/libmysqld/examples/Makefile.am @@ -10,7 +10,7 @@ link_sources: DEFS = -DEMBEDDED_LIBRARY INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir) \ -I$(top_srcdir) -I$(top_srcdir)/client $(openssl_includes) -LIBS = @LIBS@ +LIBS = @LIBS@ @WRAPLIBS@ LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @innodb_system_libs@ @LIBDL@ $(CXXLDFLAGS) mysqltest_SOURCES = mysqltest.c From 3294aac1bf17f7abe25067382c51f127f44d319a Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 31 Mar 2003 11:28:20 -0500 Subject: [PATCH 15/24] Add new XDC file for NetWare pre-emption, drop old build scripts, libmysqld.def BitKeeper/deleted/.del-mysqld.xdc~1befdfee55e31716: Delete: netware/mysqld.xdc BitKeeper/deleted/.del-nwbootstrap~f3bc723dad4ed7e: Delete: netware/nwbootstrap BitKeeper/deleted/.del-nwconfigure~86da352b5e031ed9: Delete: netware/nwconfigure BitKeeper/deleted/.del-libmysqld.def~6ca0fa0537a3431c: Delete: netware/libmysqld.def --- netware/libmysqld.def | 65 -------------- netware/{mysqld.xdc => mysql.xdc} | Bin 128 -> 128 bytes netware/nwbootstrap | 145 ------------------------------ netware/nwconfigure | 23 ----- 4 files changed, 233 deletions(-) delete mode 100644 netware/libmysqld.def rename netware/{mysqld.xdc => mysql.xdc} (50%) delete mode 100755 netware/nwbootstrap delete mode 100644 netware/nwconfigure diff --git a/netware/libmysqld.def b/netware/libmysqld.def deleted file mode 100644 index c6615ee971c..00000000000 --- a/netware/libmysqld.def +++ /dev/null @@ -1,65 +0,0 @@ -LIBRARY LIBMYSQLD -DESCRIPTION 'MySQL 4.0 Embedded Server Library' -VERSION 4.0 -EXPORTS - mysql_server_end - mysql_server_init - mysql_use_result - mysql_thread_safe - mysql_thread_id - mysql_store_result - mysql_stat - mysql_shutdown - mysql_select_db - mysql_row_tell - mysql_row_seek - mysql_real_query - mysql_real_connect - mysql_query - mysql_ping - mysql_options - mysql_num_rows - mysql_num_fields - mysql_list_tables - mysql_list_processes - mysql_list_fields - mysql_list_dbs - mysql_kill - mysql_insert_id - mysql_init - mysql_info - mysql_get_server_info - mysql_get_proto_info - mysql_get_host_info - mysql_get_client_info - mysql_free_result - mysql_field_tell - mysql_field_count - mysql_field_seek - mysql_fetch_row - mysql_fetch_lengths - mysql_fetch_fields - mysql_fetch_field_direct - mysql_fetch_field - mysql_escape_string - mysql_real_escape_string - mysql_error - mysql_errno - mysql_eof - mysql_dump_debug_info - mysql_drop_db - mysql_debug - mysql_data_seek - mysql_create_db - mysql_character_set_name - mysql_change_user - mysql_connect - mysql_close - mysql_affected_rows - mysql_thread_init - mysql_thread_end - mysql_send_query - mysql_read_query_result - mysql_refresh - mysql_odbc_escape_string - myodbc_remove_escape diff --git a/netware/mysqld.xdc b/netware/mysql.xdc similarity index 50% rename from netware/mysqld.xdc rename to netware/mysql.xdc index 12a7f6ba2df41eccb047c2884088c022f9395540..a6c430f731455d7031ebd0a467b835fbbea28d7a 100644 GIT binary patch delta 23 RcmZo*Y+#&FAi&Ik3IHk*0u}%O delta 23 RcmZo*Y+#&FAi&6g3IHkb0u%rM diff --git a/netware/nwbootstrap b/netware/nwbootstrap deleted file mode 100755 index 3e4b03de0f5..00000000000 --- a/netware/nwbootstrap +++ /dev/null @@ -1,145 +0,0 @@ -#! /bin/sh - -# show executed commands -# set -x - -# stop on errors -set -e - -BD=`pwd` - -build=0 -build_debug=0 -skip_linux=0 - -# parse arguments -for arg do - case "$arg" in - --build) build=1 ;; - --build-debug) build_debug=1 ;; - --skip-linux) skip_linux=1 ;; - *) echo "$0: unrecognized option: $arg" ;; - esac -done - -# run the auto tools -autotools() -{ - for package in $BD $BD/innobase - do - echo "cd $package" - cd $package - rm -f config.cache - echo "aclocal" - aclocal - echo "autoheader" - autoheader - echo "libtoolize --force" - libtoolize --force - echo "aclocal" - aclocal - echo "automake --add-missing --force-missing" - automake --add-missing --force-missing - echo "autoconf" - autoconf - done - - cd $BD -} - -# check the source direcotry -echo "looking for \"$BD/sql/mysqld.cc\"..." -if test ! -r ./sql/mysqld.cc -then - echo "./netware/nwbootstrap must be started from the top source directory" - exit 1 -fi - -# clean -# make -j 2 -k distclean -rm -f NEW-RPMS/* -rm -f */.deps/*.P - -# make files writeable -chmod -R u+rw,g+rw . - -# skip linux? -if test $skip_linux -ne 1 -then - echo "starting linux build..." - - echo "autotools..." - autotools - - echo "configuring for linux..." - ./configure --without-docs --without-innodb - - echo "building for linux..." - make clean all - - echo "copying required linux binaries..." - rm -f */*.linux - cp extra/comp_err extra/comp_err.linux - cp libmysql/conf_to_src libmysql/conf_to_src.linux - cp libmysql/conf_to_src libmysql_r/conf_to_src.linux - cp sql/gen_lex_hash sql/gen_lex_hash.linux - cp strings/conf_to_src strings/conf_to_src.linux - - echo "cleaning linux build..." - make clean distclean -fi - -echo "starting netware build..." - -# remove stale Makefile.in.bk files -rm -rf Makefile.in.bk - -# start mw enviornment -chmod +x ./netware/nwconfigure -chmod +x ./netware/mw/mwenv -chmod +x ./netware/mw/mwasmnlm -chmod +x ./netware/mw/mwccnlm -chmod +x ./netware/mw/mwldnlm - -. ./netware/mw/mwenv - -# link nwconfigure -rm -f ./nwconfigure -ln ./netware/nwconfigure ./nwconfigure - -# save old builds from previous run -if test -e *.tar.gz -then - rm -f *.tar.gz.old - rename .tar.gz .tar.gz.old *.tar.gz -fi - -echo "autotools..." -autotools - -# debug build -if test $build_debug -eq 1 -then - echo "configuring for netware (debug)..." - ./nwconfigure --with-debug=full - - echo "building for netware (debug)..." - make clean bin-dist - - # mark the debug build - rename .tar.gz -debug.tar.gz *.tar.gz -fi - -# release build -if test $build -eq 1 -then - echo "configuring for netware..." - ./nwconfigure - - echo "building for netware..." - make clean bin-dist -fi - -echo "done" - - diff --git a/netware/nwconfigure b/netware/nwconfigure deleted file mode 100644 index aeb68ada5b8..00000000000 --- a/netware/nwconfigure +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh -CMD="\ - AR='mwldnlm' \ - AR_FLAGS='-type library -o' \ - AS='mwasmnlm' \ - CC='mwccnlm -gccincludes' \ - CFLAGS='-dialect c -proc 686 -bool on -relax_pointers -DUSE_OLD_FUNCTIONS' \ - CXX='mwccnlm -gccincludes' \ - CXXFLAGS='-dialect c++ -proc 686 -bool on -relax_pointers' \ - LD='mwldnlm' \ - LDFLAGS='-entry _LibCPrelude -exit _LibCPostlude -flags pseudopreemption' \ - RANLIB=: \ - STRIP=: \ - ./configure --host=i686-pc-netware $* \ - --without-docs \ - --enable-local-infile \ - --with-extra-charsets=all \ - --prefix=N:/mysql \ - " -#rm -f config.cache config.log config.status -echo $CMD -eval $CMD - From 241b6c058dc24f67687a6c9a5e6411066b6a5eca Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 1 Apr 2003 18:19:15 +0200 Subject: [PATCH 16/24] Small-and-safe fix for bug #218: "LOAD DATA INFILE IGNORE is well logged, but read as LOAD DATA INFILE REPLACE" This was just bad && instead of &, but nasty consequences. This should be merged to 4.0 BUT it will not be automatic (some code has moved from log_event.h to log_event.cc, and log_event.cc has changed); please Merging Man, do 'bk grep REPLACE_FLAG' in 4.0/sql to find all the new places. sql/log_event.cc: & instead of && when testing flags sql/slave.cc: & instead of && when testing flags --- sql/log_event.cc | 6 +++--- sql/slave.cc | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index c30d03adaf5..7c4c893a823 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -671,9 +671,9 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db) fprintf(file, "LOAD DATA INFILE '%s' ", fname); - if(sql_ex.opt_flags && REPLACE_FLAG ) + if(sql_ex.opt_flags & REPLACE_FLAG ) fprintf(file," REPLACE "); - else if(sql_ex.opt_flags && IGNORE_FLAG ) + else if(sql_ex.opt_flags & IGNORE_FLAG ) fprintf(file," IGNORE "); fprintf(file, "INTO TABLE %s ", table_name); @@ -685,7 +685,7 @@ void Load_log_event::print(FILE* file, bool short_form, char* last_db) if(!(sql_ex.empty_flags & ENCLOSED_EMPTY)) { - if(sql_ex.opt_flags && OPT_ENCLOSED_FLAG ) + if(sql_ex.opt_flags & OPT_ENCLOSED_FLAG ) fprintf(file," OPTIONALLY "); fprintf(file, " ENCLOSED BY "); pretty_print_char(file, sql_ex.enclosed); diff --git a/sql/slave.cc b/sql/slave.cc index 358a908e0cc..ac65bd2bdc3 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1100,9 +1100,9 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) else { enum enum_duplicates handle_dup = DUP_IGNORE; - if(lev->sql_ex.opt_flags && REPLACE_FLAG) + if(lev->sql_ex.opt_flags & REPLACE_FLAG) handle_dup = DUP_REPLACE; - sql_exchange ex((char*)lev->fname, lev->sql_ex.opt_flags && + sql_exchange ex((char*)lev->fname, lev->sql_ex.opt_flags & DUMPFILE_FLAG ); String field_term(&lev->sql_ex.field_term, 1), enclosed(&lev->sql_ex.enclosed, 1), From 3258bb7248c11d319469a37d2e589b79302d424e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 1 Apr 2003 22:49:40 +0200 Subject: [PATCH 17/24] Sprint task #856 : make table exclusion rules (in replication) apply to GRANT and REVOKE too. For example if replicate-wild-ignore-table=mysql.%, GRANT and REVOKE will not be replicated on the slave. --- sql/sql_acl.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ee9d3f1c1ea..e8cbba8aefa 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -28,6 +28,9 @@ #include "mysql_priv.h" #include "sql_acl.h" #include "hash_filo.h" +#ifdef HAVE_REPLICATION +#include "sql_repl.h" //for tables_ok() +#endif #include #include #include @@ -2052,6 +2055,15 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_WRITE; tables[0].db=tables[1].db=tables[2].db=(char*) "mysql"; +#ifdef HAVE_REPLICATION + /* + GRANT and REVOKE are applied the slave in/exclusion rules as they are + some kind of updates to the mysql.% tables. + */ + if (thd->slave_thread && table_rules_on && !tables_ok(0, tables)) + DBUG_RETURN(0); +#endif + if (open_and_lock_tables(thd,tables)) { // Should never happen close_thread_tables(thd); /* purecov: deadcode */ @@ -2214,6 +2226,16 @@ int mysql_grant (THD *thd, const char *db, List &list, tables[0].lock_type=tables[1].lock_type=TL_WRITE; tables[0].db=tables[1].db=(char*) "mysql"; tables[0].table=tables[1].table=0; + +#ifdef HAVE_REPLICATION + /* + GRANT and REVOKE are applied the slave in/exclusion rules as they are + some kind of updates to the mysql.% tables. + */ + if (thd->slave_thread && table_rules_on && !tables_ok(0, tables)) + DBUG_RETURN(0); +#endif + if (open_and_lock_tables(thd,tables)) { // This should never happen close_thread_tables(thd); /* purecov: deadcode */ From 584b4caa661aa0f0962cce45f0d54abd79847f3b Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Apr 2003 11:29:10 +0300 Subject: [PATCH 18/24] Safer stack checking --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c407fccf00b..bc5334ce674 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2105,7 +2105,7 @@ int main(int argc, char **argv) size_t stack_size= 0; pthread_attr_getstacksize(&connection_attrib, &stack_size); /* We must check if stack_size = 0 as Solaris 2.9 can return 0 here */ - if (stack_size && stack_size != thread_stack) + if (stack_size && stack_size < thread_stack) { if (global_system_variables.log_warnings) sql_print_error("Warning: Asked for %ld thread stack, but got %ld", From 68fc04c4236b57a3a83d5731fb991329d6be95ef Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Apr 2003 12:10:38 +0300 Subject: [PATCH 19/24] Portability fix (for AMD hammer) sql/log.cc: Portability fix (for hammer) --- sql/log.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/log.cc b/sql/log.cc index 5e5d5b9368e..f72917427b7 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1067,6 +1067,7 @@ void sql_print_error(const char *format,...) char buff[1024]; my_vsnprintf(buff,sizeof(buff)-1,format,args); DBUG_PRINT("error",("%s",buff)); + va_start(args,format); } #endif skr=time(NULL); From 2090bc6e4347fe69189302a5b520ae3051785746 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Apr 2003 13:07:42 +0300 Subject: [PATCH 20/24] Fixed bug in memory allocation that could affect 64 bit systems (affected hammer) mysys/my_vsnprintf.c: safety fix sql/log.cc: safety fix --- mysys/my_vsnprintf.c | 9 ++++++++- sql/ha_myisam.cc | 2 +- sql/log.cc | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mysys/my_vsnprintf.c b/mysys/my_vsnprintf.c index ab8edec4d7b..9bc33e28ba1 100644 --- a/mysys/my_vsnprintf.c +++ b/mysys/my_vsnprintf.c @@ -21,13 +21,18 @@ #include #include + int my_snprintf(char* to, size_t n, const char* fmt, ...) { + int result; va_list args; va_start(args,fmt); - return my_vsnprintf(to, n, fmt, args); + result= my_vsnprintf(to, n, fmt, args); + va_end(args); + return result; } + int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) { char *start=to, *end=to+n-1; @@ -79,6 +84,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) return (uint) (to - start); } + #ifdef MAIN static void my_printf(const char * fmt, ...) { @@ -92,6 +98,7 @@ static void my_printf(const char * fmt, ...) va_end(ar); } + int main() { diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 895558320fd..d0d68156bac 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -953,7 +953,7 @@ int ha_myisam::create(const char *name, register TABLE *form, &keydef, form->keys*sizeof(MI_KEYDEF), &keyseg, ((form->key_parts + form->keys) * sizeof(MI_KEYSEG)), - 0))) + NullS))) DBUG_RETURN(1); pos=form->key_info; diff --git a/sql/log.cc b/sql/log.cc index f72917427b7..d189f1f1fe3 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1067,6 +1067,7 @@ void sql_print_error(const char *format,...) char buff[1024]; my_vsnprintf(buff,sizeof(buff)-1,format,args); DBUG_PRINT("error",("%s",buff)); + va_end(args); va_start(args,format); } #endif From 1834b6ff4955a0e7f19638a1abd5de5ab9eaed73 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Apr 2003 13:21:39 +0300 Subject: [PATCH 21/24] Updated results after merge --- mysql-test/r/myisam.result | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 3a3558eedcb..9a653aff99e 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -246,7 +246,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, 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, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -285,7 +285,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, "Sergei"); drop table if exists t1; CREATE TABLE `t1` ( `post_id` mediumint(8) unsigned NOT NULL auto_increment, From 4a1542d056456a872b94d9cece6f148687f24ea7 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Apr 2003 12:54:08 -0400 Subject: [PATCH 22/24] added test for replication load data into temporary table with additional options sql/log_event.cc: fix bug #183 (Replication of temporary tables not working) --- mysql-test/r/rpl_loaddata.result | 11 +++++++++++ mysql-test/t/rpl_loaddata.test | 20 +++++++++++++++++++- sql/log_event.cc | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result index 27f3d185f63..c1518e8e29a 100644 --- a/mysql-test/r/rpl_loaddata.result +++ b/mysql-test/r/rpl_loaddata.result @@ -6,8 +6,19 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; slave start; create table t1(a int not null auto_increment, b int, primary key(a) ); load data infile '../../std_data/rpl_loaddata.dat' into table t1; +create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60)); +load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' ignore 1 lines; +create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60)); +insert into t3 select * from t2; select * from t1; a b 1 10 2 15 +select * from t3; +day id category name +2003-02-22 2461 b a a a @ %  ' " a +2003-03-22 2161 c asdf +2003-04-22 2416 a bbbbb drop table t1; +drop table t2; +drop table t3; diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test index d7fc2a10ca4..2acb67dfce2 100644 --- a/mysql-test/t/rpl_loaddata.test +++ b/mysql-test/t/rpl_loaddata.test @@ -1,16 +1,34 @@ # See if replication of a "LOAD DATA in an autoincrement column" # Honours autoincrement values # i.e. if the master and slave have the same sequence +# +# check replication of load data for temporary tables with additional parameters +# source include/master-slave.inc; create table t1(a int not null auto_increment, b int, primary key(a) ); load data infile '../../std_data/rpl_loaddata.dat' into table t1; + +create temporary table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60)); +#load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionaly enclosed by '%' escaped by '@' lines terminated by '\n%%\n' ignore 1 lines; + load data infile '../../std_data/rpl_loaddata2.dat' into table t2 fields terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by '\n##\n' ignore 1 lines; + +create table t3 (day date,id int(9),category enum('a','b','c'),name varchar(60)); +insert into t3 select * from t2; + save_master_pos; connection slave; sync_with_master; -select * from t1; + +select * from t1; +select * from t3; + connection master; + drop table t1; +drop table t2; +drop table t3; + save_master_pos; connection slave; sync_with_master; diff --git a/sql/log_event.cc b/sql/log_event.cc index bb885ead3df..c8eb4026120 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1881,7 +1881,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, ex.skip_lines = skip_lines; List field_list; set_fields(field_list); - thd->slave_proxy_id = thd->thread_id; + thd->slave_proxy_id = thread_id; if (net) { // mysql_load will use thd->net to read the file From 5b67416a0b7b42279cd5ddb8ef53c60f66d59761 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Apr 2003 14:19:09 -0400 Subject: [PATCH 23/24] add test file for rpl_loaddata.test --- mysql-test/std_data/rpl_loaddata2.dat | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 mysql-test/std_data/rpl_loaddata2.dat diff --git a/mysql-test/std_data/rpl_loaddata2.dat b/mysql-test/std_data/rpl_loaddata2.dat new file mode 100644 index 00000000000..7a3d4ea7695 --- /dev/null +++ b/mysql-test/std_data/rpl_loaddata2.dat @@ -0,0 +1,8 @@ +2003-01-21,6328,%a%,%aaaaa% +## +2003-02-22,2461,b,%a a a @@ @% @b ' " a% +## +2003-03-22,2161,%c%,%asdf% +## +2003-04-22,2416,%a%,%bbbbb% +## From dba3a0b03181126cfc46048396b96e5cd768fe5a Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Apr 2003 21:19:11 +0300 Subject: [PATCH 24/24] After merge fix sql/log_event.cc: Fixed a wrong && test -> & --- sql/log_event.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 9ed672d8d4e..2040cebf17e 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1146,9 +1146,9 @@ Load_log_event::Load_log_event(THD* thd_arg, sql_exchange* ex, sql_ex.cached_new_format = -1; if (ex->dumpfile) - sql_ex.opt_flags |= DUMPFILE_FLAG; + sql_ex.opt_flags|= DUMPFILE_FLAG; if (ex->opt_enclosed) - sql_ex.opt_flags |= OPT_ENCLOSED_FLAG; + sql_ex.opt_flags|= OPT_ENCLOSED_FLAG; sql_ex.empty_flags = 0; @@ -1159,15 +1159,15 @@ Load_log_event::Load_log_event(THD* thd_arg, sql_exchange* ex, } if (!ex->field_term->length()) - sql_ex.empty_flags |= FIELD_TERM_EMPTY; + sql_ex.empty_flags|= FIELD_TERM_EMPTY; if (!ex->enclosed->length()) - sql_ex.empty_flags |= ENCLOSED_EMPTY; + sql_ex.empty_flags|= ENCLOSED_EMPTY; if (!ex->line_term->length()) - sql_ex.empty_flags |= LINE_TERM_EMPTY; + sql_ex.empty_flags|= LINE_TERM_EMPTY; if (!ex->line_start->length()) - sql_ex.empty_flags |= LINE_START_EMPTY; + sql_ex.empty_flags|= LINE_START_EMPTY; if (!ex->escaped->length()) - sql_ex.empty_flags |= ESCAPED_EMPTY; + sql_ex.empty_flags|= ESCAPED_EMPTY; skip_lines = ex->skip_lines; @@ -1860,9 +1860,8 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, char llbuff[22]; enum enum_duplicates handle_dup = DUP_IGNORE; if (sql_ex.opt_flags & REPLACE_FLAG) - handle_dup = DUP_REPLACE; - sql_exchange ex((char*)fname, sql_ex.opt_flags && - DUMPFILE_FLAG ); + handle_dup= DUP_REPLACE; + sql_exchange ex((char*)fname, sql_ex.opt_flags & DUMPFILE_FLAG); String field_term(sql_ex.field_term,sql_ex.field_term_len); String enclosed(sql_ex.enclosed,sql_ex.enclosed_len); String line_term(sql_ex.line_term,sql_ex.line_term_len);