diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 52013cfbd16..c3ca14ab929 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -80,6 +80,7 @@ jcole@mugatu.jcole.us jcole@mugatu.spaceapes.com jcole@sarvik.tfr.cafe.ee jcole@tetra.spaceapes.com +joerg@mysql.com joreland@mysql.com jorge@linux.jorge.mysql.com jplindst@t41.(none) diff --git a/Build-tools/Do-compile b/Build-tools/Do-compile index c17995f5779..f3c20c81a9f 100755 --- a/Build-tools/Do-compile +++ b/Build-tools/Do-compile @@ -376,7 +376,7 @@ if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest) log_timestamp(); system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir); safe_cd("${test_dir}/mysql-test"); - check_system("./mysql-test-run $flags --warnings --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --ndbcluster_port=$ndbcluster_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful"); + check_system("./mysql-test-run $flags --tmpdir=$bench_tmpdir --master_port=$mysql_tcp_port --slave_port=$slave_port --ndbcluster_port=$ndbcluster_port --manager-port=$manager_port --no-manager --sleep=10", "tests were successful"); } # diff --git a/VC++Files/sql/message.mc b/VC++Files/sql/message.mc new file mode 100644 index 00000000000..a1a7c8cff7e --- /dev/null +++ b/VC++Files/sql/message.mc @@ -0,0 +1,8 @@ +MessageId = 100 +Severity = Error +Facility = Application +SymbolicName = MSG_DEFAULT +Language = English +%1For more information, see Help and Support Center at http://www.mysql.com. + + diff --git a/VC++Files/sql/mysqld.dsp b/VC++Files/sql/mysqld.dsp index 9bcdb4be24f..31c52009d9f 100644 --- a/VC++Files/sql/mysqld.dsp +++ b/VC++Files/sql/mysqld.dsp @@ -920,6 +920,89 @@ SOURCE=.\log_event.cpp # End Source File # Begin Source File +SOURCE=.\message.mc + +!IF "$(CFG)" == "mysqld - Win32 Release" + +!ELSEIF "$(CFG)" == "mysqld - Win32 Debug" + +!ELSEIF "$(CFG)" == "mysqld - Win32 nt" + +# Begin Custom Build - Compiling messages +InputDir=. +InputPath=.\message.mc +InputName=message + +BuildCmds= \ + mc.exe "$(InputDir)\$(InputName).mc" + +"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build + +!ELSEIF "$(CFG)" == "mysqld - Win32 Max nt" +# Begin Custom Build - Compiling messages +InputDir=. +InputPath=.\message.mc +InputName=message + +BuildCmds= \ + mc.exe "$(InputDir)\$(InputName).mc" + +"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build +!ELSEIF "$(CFG)" == "mysqld - Win32 Max" + +!ELSEIF "$(CFG)" == "mysqld - Win32 classic" + +!ELSEIF "$(CFG)" == "mysqld - Win32 pro" + +!ELSEIF "$(CFG)" == "mysqld - Win32 classic nt" +# Begin Custom Build - Compiling messages +InputDir=. +InputPath=.\message.mc +InputName=message + +BuildCmds= \ + mc.exe "$(InputDir)\$(InputName).mc" + +"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build +!ELSEIF "$(CFG)" == "mysqld - Win32 pro nt" +# Begin Custom Build - Compiling messages +InputDir=. +InputPath=.\message.mc +InputName=message + +BuildCmds= \ + mc.exe "$(InputDir)\$(InputName).mc" + +"$(InputDir)\$(InputName).rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) + +"$(InputDir)\$(InputName).h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + $(BuildCmds) +# End Custom Build +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\message.rc +# End Source File +# Begin Source File + SOURCE=.\mf_iocache.cpp !IF "$(CFG)" == "mysqld - Win32 Release" diff --git a/client/mysql.cc b/client/mysql.cc index dd472041b34..51c84152298 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -44,7 +44,7 @@ #include #endif -const char *VER= "14.5"; +const char *VER= "14.6"; /* Don't try to make a nice table if the data is too big */ #define MAX_COLUMN_LENGTH 1024 @@ -792,6 +792,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), while (*argument) *argument++= 'x'; // Destroy argument if (*start) start[1]=0 ; + tty_password= 0; } else tty_password= 1; @@ -858,7 +859,7 @@ static int get_options(int argc, char **argv) opt_max_allowed_packet= *mysql_params->p_max_allowed_packet; opt_net_buffer_length= *mysql_params->p_net_buffer_length; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0))) exit(ho_error); *mysql_params->p_max_allowed_packet= opt_max_allowed_packet; @@ -1669,15 +1670,15 @@ static int com_server_help(String *buffer __attribute__((unused)), if (num_fields == 2) { put_info("Many help items for your request exist", INFO_INFO); - put_info("For more specific request please type 'help ' where item is one of next", INFO_INFO); + put_info("To make a more specific request, please type 'help ',\nwhere item is one of next", INFO_INFO); num_name= 0; num_cat= 1; last_char= '_'; } else if ((cur= mysql_fetch_row(result))) { - tee_fprintf(PAGER, "You asked help about help category: \"%s\"\n", cur[0]); - put_info("For a more information type 'help ' where item is one of the following", INFO_INFO); + tee_fprintf(PAGER, "You asked for help about help category: \"%s\"\n", cur[0]); + put_info("For more information, type 'help ', where item is one of the following", INFO_INFO); num_name= 1; num_cat= 2; print_help_item(&cur,1,2,&last_char); @@ -1691,7 +1692,7 @@ static int com_server_help(String *buffer __attribute__((unused)), else { put_info("\nNothing found", INFO_INFO); - put_info("Please try to run 'help contents' for list of all accessible topics\n", INFO_INFO); + put_info("Please try to run 'help contents' for a list of all accessible topics\n", INFO_INFO); } } @@ -1710,9 +1711,9 @@ com_help(String *buffer __attribute__((unused)), if (help_arg) return com_server_help(buffer,line,help_arg+1); - put_info("\nFor the complete MySQL Manual online visit:\n http://www.mysql.com/documentation\n", INFO_INFO); - put_info("For info on technical support from MySQL developers visit:\n http://www.mysql.com/support\n", INFO_INFO); - put_info("For info on MySQL books, utilities, consultants, etc. visit:\n http://www.mysql.com/portal\n", INFO_INFO); + put_info("\nFor the complete MySQL Manual online, visit:\n http://www.mysql.com/documentation\n", INFO_INFO); + put_info("For info on technical support from MySQL developers, visit:\n http://www.mysql.com/support\n", INFO_INFO); + put_info("For info on MySQL books, utilities, consultants, etc., visit:\n http://www.mysql.com/portal\n", INFO_INFO); put_info("List of all MySQL commands:", INFO_INFO); if (!named_cmds) put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO); diff --git a/client/mysqladmin.c b/client/mysqladmin.c index a3bb0fea180..9e5c698bb93 100644 --- a/client/mysqladmin.c +++ b/client/mysqladmin.c @@ -276,7 +276,7 @@ int main(int argc,char *argv[]) mysql_init(&mysql); load_defaults("my",load_default_groups,&argc,&argv); save_argv = argv; /* Save for free_defaults */ - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0))) { free_defaults(save_argv); exit(ho_error); diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 5f9a499bd31..6d8ff665393 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -666,7 +666,7 @@ static int parse_args(int *argc, char*** argv) result_file = stdout; load_defaults("my",load_default_groups,argc,argv); - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) exit(ho_error); return 0; diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 47512b2a277..882efff37a2 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -295,7 +295,7 @@ static int get_options(int *argc, char ***argv) load_defaults("my", load_default_groups, argc, argv); - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0))) exit(ho_error); if (!what_to_do) diff --git a/client/mysqldump.c b/client/mysqldump.c index 8fcf1bb1781..77c93e126e7 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -604,7 +604,7 @@ static int get_options(int *argc, char ***argv) md_result_file= stdout; load_defaults("my",load_default_groups,argc,argv); - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0))) exit(ho_error); *mysql_params->p_max_allowed_packet= opt_max_allowed_packet; diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 86f373d75fe..201bf51b1bd 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -228,7 +228,7 @@ static int get_options(int *argc, char ***argv) { int ho_error; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0))) exit(ho_error); if (enclosed && opt_enclosed) diff --git a/client/mysqlmanager-pwgen.c b/client/mysqlmanager-pwgen.c index 1d942e207ad..4c6fbf14dd9 100644 --- a/client/mysqlmanager-pwgen.c +++ b/client/mysqlmanager-pwgen.c @@ -95,7 +95,7 @@ int parse_args(int argc, char** argv) { int ho_error; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL))) exit(ho_error); return 0; diff --git a/client/mysqlmanagerc.c b/client/mysqlmanagerc.c index 0001a0266e6..78485427473 100644 --- a/client/mysqlmanagerc.c +++ b/client/mysqlmanagerc.c @@ -133,7 +133,7 @@ int parse_args(int argc, char **argv) load_defaults("my",load_default_groups,&argc,&argv); default_argv= argv; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL))) exit(ho_error); return 0; diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 05108bd03c8..35d61f1fa2f 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -297,7 +297,7 @@ get_options(int *argc,char ***argv) { int ho_error; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, 0))) exit(ho_error); if (tty_password) diff --git a/client/mysqltest.c b/client/mysqltest.c index 3287c9738d3..98818022047 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -2100,7 +2100,7 @@ int parse_args(int argc, char **argv) load_defaults("my",load_default_groups,&argc,&argv); default_argv= argv; - if ((handle_options(&argc, &argv, my_long_options, get_one_option))) + if ((handle_options(&argc, &argv, my_long_options, get_one_option, 0))) exit(1); if (argc > 1) diff --git a/cmd-line-utils/libedit/Makefile.am b/cmd-line-utils/libedit/Makefile.am index c532884ca7d..625f6431da1 100644 --- a/cmd-line-utils/libedit/Makefile.am +++ b/cmd-line-utils/libedit/Makefile.am @@ -23,10 +23,10 @@ libedit_a_DEPENDENCIES = @LIBEDIT_LOBJECTS@ pkginclude_HEADERS = readline/readline.h noinst_HEADERS = chared.h el.h histedit.h key.h parse.h refresh.h sig.h \ - sys.h tokenizer.h config.h hist.h map.h prompt.h \ - search.h tty.h + sys.h tokenizer.h config.h hist.h map.h prompt.h read.h \ + search.h tty.h libedit_term.h term.h -EXTRA_DIST = makelist.sh np/unvis.c np/strlcpy.c np/vis.c np/strlcat.c np/fgetln.c +EXTRA_DIST = makelist.sh np/unvis.c np/strlcpy.c np/vis.c np/vis.h np/strlcat.c np/fgetln.c CLEANFILES = makelist common.h emacs.h vi.h fcns.h help.h fcns.c help.c diff --git a/cmd-line-utils/libedit/history.c b/cmd-line-utils/libedit/history.c index 0294734b9a3..53648203bf0 100644 --- a/cmd-line-utils/libedit/history.c +++ b/cmd-line-utils/libedit/history.c @@ -661,12 +661,6 @@ history_load(History *h, const char *fname) if ((fp = fopen(fname, "r")) == NULL) return (i); - if ((line = fgetln(fp, &sz)) == NULL) - goto done; - - if (strncmp(line, hist_cookie, sz) != 0) - goto done; - ptr = h_malloc(max_size = 1024); if (ptr == NULL) goto done; @@ -720,8 +714,6 @@ history_save(History *h, const char *fname) if (fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1) goto done; - if (fputs(hist_cookie, fp) == EOF) - goto done; ptr = h_malloc(max_size = 1024); if (ptr == NULL) goto done; @@ -740,7 +732,7 @@ history_save(History *h, const char *fname) ptr = nptr; } (void) strvis(ptr, ev.str, VIS_WHITE); - (void) fprintf(fp, "%s\n", ptr); + (void) fprintf(fp, "%s\n", ev.str); } oomem: h_free((ptr_t)ptr); diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index f4da839f8e2..a0af98e5f1c 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -99,7 +99,7 @@ static int get_options(int *argc,char ***argv) { int ho_error; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) exit(ho_error); if (*argc < 1) diff --git a/extra/mysql_waitpid.c b/extra/mysql_waitpid.c index bff1752ec21..0894d81a5ae 100644 --- a/extra/mysql_waitpid.c +++ b/extra/mysql_waitpid.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -66,7 +67,7 @@ int main(int argc, char *argv[]) progname= argv[0]; - if (handle_options(&argc, &argv, my_long_options, get_one_option)) + if (handle_options(&argc, &argv, my_long_options, get_one_option, NULL)) exit(-1); if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 || (t= atoi(argv[1])) <= 0) diff --git a/extra/perror.c b/extra/perror.c index a28626fd873..b029d87040f 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -157,7 +157,7 @@ static int get_options(int *argc,char ***argv) { int ho_error; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) exit(ho_error); if (!*argc && !print_all_codes) diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index 06a670b935d..3c26c315dea 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -121,7 +121,7 @@ static int parse_args(int argc, char **argv) { int ho_error; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL))) exit(ho_error); /* diff --git a/extra/resolveip.c b/extra/resolveip.c index f8cff2a976c..a995b038770 100644 --- a/extra/resolveip.c +++ b/extra/resolveip.c @@ -90,7 +90,7 @@ static int get_options(int *argc,char ***argv) { int ho_error; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) exit(ho_error); if (*argc == 0) diff --git a/heap/hp_hash.c b/heap/hp_hash.c index 8feae19a480..71eecc8bdf2 100644 --- a/heap/hp_hash.c +++ b/heap/hp_hash.c @@ -246,12 +246,12 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key) if (seg->type == HA_KEYTYPE_TEXT) { CHARSET_INFO *cs= seg->charset; - uint length= ((uchar*)key) - pos; - uint char_length= length / cs->mbmaxlen; - if (length > char_length) + uint char_length= (uint) ((uchar*) key - pos); + if (cs->mbmaxlen > 1) { - char_length= my_charpos(cs, pos, pos + length, char_length); - set_if_smaller(char_length, length); + uint length= char_length; + char_length= my_charpos(cs, pos, pos + length, length/cs->mbmaxlen); + set_if_smaller(char_length, length); /* QQ: ok to remove? */ } cs->coll->hash_sort(cs, pos, char_length, &nr, &nr2); } @@ -289,11 +289,12 @@ ulong hp_rec_hashnr(register HP_KEYDEF *keydef, register const byte *rec) if (seg->type == HA_KEYTYPE_TEXT) { CHARSET_INFO *cs= seg->charset; - uint char_length= seg->length / cs->mbmaxlen; - if (seg->length > char_length) + uint char_length= seg->length; + if (cs->mbmaxlen > 1) { - char_length= my_charpos(cs, pos, pos + seg->length, char_length); - set_if_smaller(char_length, seg->length); + char_length= my_charpos(cs, pos, pos + char_length, + char_length / cs->mbmaxlen); + set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */ } cs->coll->hash_sort(cs, pos, char_length, &nr, &nr2); } @@ -417,17 +418,17 @@ int hp_rec_key_cmp(HP_KEYDEF *keydef, const byte *rec1, const byte *rec2) if (seg->type == HA_KEYTYPE_TEXT) { CHARSET_INFO *cs= seg->charset; - uint char_length= seg->length / cs->mbmaxlen; uint char_length1; uint char_length2; uchar *pos1= (uchar*)rec1 + seg->start; uchar *pos2= (uchar*)rec2 + seg->start; - if (seg->length > char_length) + if (cs->mbmaxlen > 1) { + uint char_length= seg->length / cs->mbmaxlen; char_length1= my_charpos(cs, pos1, pos1 + seg->length, char_length); - set_if_smaller(char_length1, seg->length); + set_if_smaller(char_length1, seg->length); /* QQ: ok to remove? */ char_length2= my_charpos(cs, pos2, pos2 + seg->length, char_length); - set_if_smaller(char_length2, seg->length); + set_if_smaller(char_length2, seg->length); /* QQ: ok to remove? */ } else { @@ -468,12 +469,12 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key) if (seg->type == HA_KEYTYPE_TEXT) { CHARSET_INFO *cs= seg->charset; - uint char_length= seg->length / cs->mbmaxlen; uint char_length_key; uint char_length_rec; uchar *pos= (uchar*) rec + seg->start; - if (seg->length > char_length) + if (cs->mbmaxlen > 1) { + uint char_length= seg->length / cs->mbmaxlen; char_length_key= my_charpos(cs, key, key + seg->length, char_length); set_if_smaller(char_length_key, seg->length); char_length_rec= my_charpos(cs, pos, pos + seg->length, char_length); @@ -509,21 +510,22 @@ void hp_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec) for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++) { CHARSET_INFO *cs= seg->charset; - uint char_length= (cs && cs->mbmaxlen > 1) ? seg->length / cs->mbmaxlen : - seg->length; + uint char_length= seg->length; uchar *pos= (uchar*) rec + seg->start; if (seg->null_bit) *key++= test(rec[seg->null_pos] & seg->null_bit); - if (seg->length > char_length) + if (cs->mbmaxlen > 1) { - char_length= my_charpos(cs, pos, pos + seg->length, char_length); - set_if_smaller(char_length, seg->length); + char_length= my_charpos(cs, pos, pos + seg->length, + char_length / cs->mbmaxlen); + set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */ } memcpy(key,rec+seg->start,(size_t) char_length); key+= char_length; } } + uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key, const byte *rec, byte *recpos) { @@ -575,13 +577,13 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key, } continue; } - char_length= seg->length / (seg->charset ? seg->charset->mbmaxlen : 1); - if (seg->length > char_length) + char_length= seg->length; + if (seg->charset->mbmaxlen > 1) { char_length= my_charpos(seg->charset, - rec + seg->start, rec + seg->start + seg->length, - char_length); - set_if_smaller(char_length, seg->length); + rec + seg->start, rec + seg->start + char_length, + char_length / seg->charset->mbmaxlen); + set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */ if (char_length < seg->length) seg->charset->cset->fill(seg->charset, key + char_length, seg->length - char_length, ' '); @@ -593,7 +595,9 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key, return key - start_key; } -uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint k_len) + +uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, + uint k_len) { HA_KEYSEG *seg, *endseg; uchar *start_key= key; @@ -623,11 +627,12 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint k_len) } continue; } - char_length= seg->length / (seg->charset ? seg->charset->mbmaxlen : 1); - if (seg->length > char_length) + char_length= seg->length; + if (seg->charset->mbmaxlen > 1) { - char_length= my_charpos(seg->charset, old, old+seg->length, char_length); - set_if_smaller(char_length, seg->length); + char_length= my_charpos(seg->charset, old, old+char_length, + char_length / seg->charset->mbmaxlen); + set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */ if (char_length < seg->length) seg->charset->cset->fill(seg->charset, key + char_length, seg->length - char_length, ' '); @@ -639,12 +644,14 @@ uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, uint k_len) return key - start_key; } + uint hp_rb_key_length(HP_KEYDEF *keydef, const byte *key __attribute__((unused))) { return keydef->length; } + uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key) { const byte *start_key= key; diff --git a/include/m_string.h b/include/m_string.h index 0709dbaffb4..97d34421537 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -238,6 +238,9 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error); #ifndef HAVE_STRTOULL #define HAVE_STRTOULL #endif +#ifndef HAVE_STRTOLL +#define HAVE_STRTOLL +#endif #else #ifdef HAVE_LONG_LONG extern char *longlong2str(longlong val,char *dst,int radix); diff --git a/include/my_getopt.h b/include/my_getopt.h index bf119892a31..9d6ef40b399 100644 --- a/include/my_getopt.h +++ b/include/my_getopt.h @@ -14,6 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef _my_getopt_h +#define _my_getopt_h + C_MODE_START #define GET_NO_ARG 1 @@ -54,11 +57,12 @@ struct my_option extern char *disabled_my_option; extern my_bool my_getopt_print_errors; +typedef my_bool (* my_get_one_option) (int, const struct my_option *, char * ); +typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... ); + extern int handle_options (int *argc, char ***argv, - const struct my_option *longopts, - my_bool (*get_one_option)(int, - const struct my_option *, - char *)); + const struct my_option *longopts, my_get_one_option, + my_error_reporter ); extern void my_print_help(const struct my_option *options); extern void my_print_variables(const struct my_option *options); extern void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint, @@ -66,4 +70,8 @@ extern void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint, ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp); my_bool getopt_compare_strings(const char *s, const char *t, uint length); + C_MODE_END + +#endif /* _my_getopt_h */ + diff --git a/include/my_sys.h b/include/my_sys.h index 922e6d8cff4..ad1966ba67f 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -244,6 +244,12 @@ typedef struct wild_file_pack /* Struct to hold info when selecting files */ my_string *wild; /* Pointer to wildcards */ } WF_PACK; +enum loglevel { + ERROR_LEVEL, + WARNING_LEVEL, + INFORMATION_LEVEL +}; + enum cache_type { READ_CACHE,WRITE_CACHE, diff --git a/include/mysql.h b/include/mysql.h index e2ed3ab59af..cf5af6ce189 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -99,7 +99,7 @@ typedef struct st_mysql_field { unsigned int flags; /* Div flags */ unsigned int decimals; /* Number of decimals in field */ unsigned int charsetnr; /* Character set */ - enum enum_field_types type; /* Type of field. Se mysql_com.h for types */ + enum enum_field_types type; /* Type of field. See mysql_com.h for types */ } MYSQL_FIELD; typedef char **MYSQL_ROW; /* return data as array of strings */ @@ -175,7 +175,7 @@ struct st_mysql_options { */ my_bool rpl_parse; /* - If set, never read from a master,only from slave, when doing + If set, never read from a master, only from slave, when doing a read that is replication-aware */ my_bool no_master_reads; @@ -538,7 +538,7 @@ enum enum_mysql_stmt_state typedef struct st_mysql_bind { unsigned long *length; /* output length pointer */ - my_bool *is_null; /* Pointer to null indicators */ + my_bool *is_null; /* Pointer to null indicator */ void *buffer; /* buffer to get/put data */ enum enum_field_types buffer_type; /* buffer type */ unsigned long buffer_length; /* buffer length, must be set for str/binary */ @@ -581,7 +581,7 @@ typedef struct st_mysql_stmt unsigned char **row); unsigned long stmt_id; /* Id for prepared statement */ unsigned int last_errno; /* error code */ - unsigned int param_count; /* inpute parameters count */ + unsigned int param_count; /* input parameter count */ unsigned int field_count; /* number of columns in result set */ enum enum_mysql_stmt_state state; /* statement state */ char last_error[MYSQL_ERRMSG_SIZE]; /* error message */ diff --git a/include/mysqld_error.h b/include/mysqld_error.h index 4d65515d6ce..776869ff045 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -318,4 +318,5 @@ #define ER_WARN_INVALID_TIMESTAMP 1299 #define ER_INVALID_CHARACTER_STRING 1300 #define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301 -#define ER_ERROR_MESSAGES 302 +#define ER_CONFLICTING_DECLARATIONS 1302 +#define ER_ERROR_MESSAGES 303 diff --git a/innobase/buf/buf0rea.c b/innobase/buf/buf0rea.c index 71e885ff439..11107d777c8 100644 --- a/innobase/buf/buf0rea.c +++ b/innobase/buf/buf0rea.c @@ -629,6 +629,8 @@ buf_read_ibuf_merge_pages( } } + os_aio_simulated_wake_handler_threads(); + /* Flush pages from the end of the LRU list if necessary */ buf_flush_free_margin(); diff --git a/isam/isamchk.c b/isam/isamchk.c index 5dd20c14063..c0ba810ef64 100644 --- a/isam/isamchk.c +++ b/isam/isamchk.c @@ -671,7 +671,7 @@ static void get_options(register int *argc, register char ***argv) if (isatty(fileno(stdout))) testflag|=T_WRITE_LOOP; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) exit(ho_error); if (*argc == 0) diff --git a/isam/pack_isam.c b/isam/pack_isam.c index aa83b2b2a96..6e03df100a2 100644 --- a/isam/pack_isam.c +++ b/isam/pack_isam.c @@ -337,7 +337,7 @@ static void get_options(int *argc, char ***argv) { int ho_error; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) exit(ho_error); my_progname= argv[0][0]; diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index cea8ce3a499..380e53d7d47 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -3339,6 +3339,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, } case MYSQL_TYPE_DATE: case MYSQL_TYPE_DATETIME: + case MYSQL_TYPE_TIMESTAMP: { MYSQL_TIME *tm= (MYSQL_TIME *)buffer; str_to_datetime(value, length, tm, 0, &err); @@ -3393,7 +3394,7 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, longlong value) { char *buffer= (char *)param->buffer; - uint field_is_unsigned= (field->flags & UNSIGNED_FLAG); + uint field_is_unsigned= field->flags & UNSIGNED_FLAG; switch (param->buffer_type) { case MYSQL_TYPE_NULL: /* do nothing */ @@ -3429,7 +3430,7 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, char buff[22]; /* Enough for longlong */ char *end= longlong10_to_str(value, buff, field_is_unsigned ? 10: -10); /* Resort to string conversion which supports all typecodes */ - fetch_string_with_conversion(param, buff, end - buff); + fetch_string_with_conversion(param, buff, (uint) (end - buff)); break; } } @@ -3505,7 +3506,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, sprintf(buff, "%.*f", (int) field->decimals, value); end= strend(buff); } - fetch_string_with_conversion(param, buff, end - buff); + fetch_string_with_conversion(param, buff, (uint) (end - buff)); break; } } @@ -3590,14 +3591,14 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, { ulong length; enum enum_field_types field_type= field->type; + uint field_is_unsigned= field->flags & UNSIGNED_FLAG; switch (field_type) { case MYSQL_TYPE_TINY: { char value= (char) **row; - uint field_is_unsigned= (field->flags & UNSIGNED_FLAG); - longlong data= (field_is_unsigned) ? (longlong) (unsigned char) value: - (longlong) value; + longlong data= field_is_unsigned ? (longlong) (unsigned char) value : + (longlong) value; fetch_long_with_conversion(param, field, data); length= 1; break; @@ -3606,19 +3607,18 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, case MYSQL_TYPE_YEAR: { short value= sint2korr(*row); - uint field_is_unsigned= (field->flags & UNSIGNED_FLAG); - longlong data= ((field_is_unsigned) ? (longlong) (unsigned short) value: - (longlong) value); + longlong data= field_is_unsigned ? (longlong) (unsigned short) value : + (longlong) value; fetch_long_with_conversion(param, field, data); length= 2; break; } + case MYSQL_TYPE_INT24: /* mediumint is sent as 4 bytes int */ case MYSQL_TYPE_LONG: { long value= sint4korr(*row); - uint field_is_unsigned= (field->flags & UNSIGNED_FLAG); - longlong data= ((field_is_unsigned) ? (longlong) (unsigned long) value: - (longlong) value); + longlong data= field_is_unsigned ? (longlong) (unsigned long) value : + (longlong) value; fetch_long_with_conversion(param, field, data); length= 4; break; diff --git a/libmysqld/libmysqld.rc b/libmysqld/libmysqld.rc new file mode 100755 index 00000000000..5b6142faddf --- /dev/null +++ b/libmysqld/libmysqld.rc @@ -0,0 +1,125 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 4,0,20,0 + PRODUCTVERSION 4,0,20,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x9L +#else + FILEFLAGS 0x8L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN +#ifdef _DEBUG + VALUE "Comments", "Embedded Server\0" + VALUE "CompanyName", "MySQL AB\0" + VALUE "FileDescription", "Embedded Server\0" + VALUE "FileVersion", "4.0.20\0" + VALUE "InternalName", "Embedded Server\0" + VALUE "LegalCopyright", "Copyright © 2004\0" + VALUE "LegalTrademarks", "MySQL and MySQL AB\0" + VALUE "OriginalFilename", "libmysqld.dll debug\0" + VALUE "PrivateBuild", "libmysqld.dll debug \0" + VALUE "ProductName", "libmysqld.dll debug\0" + VALUE "ProductVersion", "4.0.20\0" + VALUE "SpecialBuild", "\0" +#else + VALUE "Comments", "Embedded Server\0" + VALUE "CompanyName", "MySQL AB\0" + VALUE "FileDescription", "Embedded Server\0" + VALUE "FileVersion", "4.0.20\0" + VALUE "InternalName", "Embedded Server\0" + VALUE "LegalCopyright", "Copyright © 2004\0" + VALUE "LegalTrademarks", "MySQL and MySQL AB\0" + VALUE "OriginalFilename", "libmysqld.dll release\0" + VALUE "PrivateBuild", "libmysqld.dll release \0" + VALUE "ProductName", "libmysqld.dll release\0" + VALUE "ProductVersion", "4.0.20\0" + VALUE "SpecialBuild", "\0" +#endif + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/libmysqld/resource.h b/libmysqld/resource.h new file mode 100755 index 00000000000..f770fe490a6 --- /dev/null +++ b/libmysqld/resource.h @@ -0,0 +1,15 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by libmysqld.rc +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/myisam/mi_key.c b/myisam/mi_key.c index 043dd7c6884..3545756779f 100644 --- a/myisam/mi_key.c +++ b/myisam/mi_key.c @@ -23,9 +23,9 @@ #include #endif -#define CHECK_KEYS +#define CHECK_KEYS /* Enable safety checks */ -#define FIX_LENGTH \ +#define FIX_LENGTH(cs, pos, length, char_length) \ do { \ if (length > char_length) \ char_length= my_charpos(cs, pos, pos+length, char_length); \ @@ -48,7 +48,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, my_bool is_ft= info->s->keyinfo[keynr].flag & HA_FULLTEXT; DBUG_ENTER("_mi_make_key"); - if(info->s->keyinfo[keynr].flag & HA_SPATIAL) + if (info->s->keyinfo[keynr].flag & HA_SPATIAL) { /* TODO: nulls processing @@ -78,7 +78,8 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, *key++=1; /* Not NULL */ } - char_length= (!is_ft && cs && cs->mbmaxlen > 1) ? length/cs->mbmaxlen : length; + char_length= ((!is_ft && cs && cs->mbmaxlen > 1) ? length/cs->mbmaxlen : + length); pos= (byte*) record+keyseg->start; if (keyseg->flag & HA_SPACE_PACK) @@ -95,7 +96,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, pos++; } length=(uint) (end-pos); - FIX_LENGTH; + FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); memcpy((byte*) key,(byte*) pos,(size_t) char_length); key+=char_length; @@ -106,7 +107,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, uint tmp_length=uint2korr(pos); pos+=2; /* Skip VARCHAR length */ set_if_smaller(length,tmp_length); - FIX_LENGTH; + FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); memcpy((byte*) key,(byte*) pos,(size_t) char_length); key+= char_length; @@ -117,7 +118,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos); memcpy_fixed((byte*) &pos,pos+keyseg->bit_start,sizeof(char*)); set_if_smaller(length,tmp_length); - FIX_LENGTH; + FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); memcpy((byte*) key,(byte*) pos,(size_t) char_length); key+= char_length; @@ -157,7 +158,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key, } continue; } - FIX_LENGTH; + FIX_LENGTH(cs, pos, length, char_length); memcpy((byte*) key, pos, char_length); if (length > char_length) cs->cset->fill(cs, key+char_length, length-char_length, ' '); @@ -237,7 +238,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, } k_length-=length; length=(uint) (end-pos); - FIX_LENGTH; + FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); memcpy((byte*) key,pos,(size_t) char_length); key+= char_length; @@ -250,7 +251,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, k_length-= 2+length; pos+=2; set_if_smaller(length,tmp_length); /* Safety */ - FIX_LENGTH; + FIX_LENGTH(cs, pos, length, char_length); store_key_length_inc(key,char_length); old+=2; /* Skip length */ memcpy((byte*) key, pos,(size_t) char_length); @@ -267,7 +268,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, } continue; } - FIX_LENGTH; + FIX_LENGTH(cs, pos, length, char_length); memcpy((byte*) key, pos, char_length); if (length > char_length) cs->cset->fill(cs,key+char_length, length-char_length, ' '); diff --git a/myisam/mi_test1.c b/myisam/mi_test1.c index 77c4d3dfbad..5574eaba101 100644 --- a/myisam/mi_test1.c +++ b/myisam/mi_test1.c @@ -644,7 +644,7 @@ static void get_options(int argc, char *argv[]) { int ho_error; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL))) exit(ho_error); return; diff --git a/myisam/myisam_ftdump.c b/myisam/myisam_ftdump.c index eeee96d0ff2..cbc8437da79 100644 --- a/myisam/myisam_ftdump.c +++ b/myisam/myisam_ftdump.c @@ -68,7 +68,7 @@ int main(int argc,char *argv[]) struct { MI_INFO *info; } aio0, *aio=&aio0; /* for GWS_IN_USE */ MY_INIT(argv[0]); - if ((error=handle_options(&argc, &argv, my_long_options, get_one_option))) + if ((error=handle_options(&argc, &argv, my_long_options, get_one_option, 0))) exit(error); if (count || dump) verbose=0; diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index 2c44953ccc9..5a6717833c5 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -696,7 +696,7 @@ static void get_options(register int *argc,register char ***argv) if (isatty(fileno(stdout))) check_param.testflag|=T_WRITE_LOOP; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) exit(ho_error); /* If using repair, then update checksum if one uses --update-state */ diff --git a/myisam/myisampack.c b/myisam/myisampack.c index de4bd80805a..d3241467d23 100644 --- a/myisam/myisampack.c +++ b/myisam/myisampack.c @@ -350,7 +350,7 @@ static void get_options(int *argc,char ***argv) if (isatty(fileno(stdout))) write_loop=1; - if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option, NULL))) exit(ho_error); if (!*argc) diff --git a/mysql-test/ndb/ndb_config_2_node.ini b/mysql-test/ndb/ndb_config_2_node.ini index a395b300df4..cc0f940efe3 100644 --- a/mysql-test/ndb/ndb_config_2_node.ini +++ b/mysql-test/ndb/ndb_config_2_node.ini @@ -5,15 +5,16 @@ DataMemory= CHOOSE_DataMemory IndexMemory= CHOOSE_IndexMemory Diskless= CHOOSE_Diskless TimeBetweenWatchDogCheck= 30000 -FileSystemPath= CHOOSE_FILESYSTEM +DataDir= CHOOSE_FILESYSTEM [ndbd] -HostName: CHOOSE_HOSTNAME_1 +HostName= CHOOSE_HOSTNAME_1 [ndbd] -HostName: CHOOSE_HOSTNAME_2 +HostName= CHOOSE_HOSTNAME_2 [ndb_mgmd] +DataDir= CHOOSE_FILESYSTEM PortNumber= CHOOSE_PORT_MGM [mysqld] diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh index bbd3fa3257a..e04e22f1434 100644 --- a/mysql-test/ndb/ndbcluster.sh +++ b/mysql-test/ndb/ndbcluster.sh @@ -193,8 +193,7 @@ stop_default_ndbcluster() { exec_mgmtclient="$exec_mgmtclient --try-reconnect=1" -echo "all stop" | $exec_mgmtclient 2>&1 | cat > /dev/null -echo "3 stop" | $exec_mgmtclient 2>&1 | cat > /dev/null +echo "shutdown" | $exec_mgmtclient 2>&1 | cat > /dev/null if [ -f "$fs_ndb/$pidfile" ] ; then kill -9 `cat "$fs_ndb/$pidfile"` 2> /dev/null diff --git a/mysql-test/r/binary.result b/mysql-test/r/binary.result index 68b507d1089..405de1158d6 100644 --- a/mysql-test/r/binary.result +++ b/mysql-test/r/binary.result @@ -111,10 +111,10 @@ a b aaa bbb select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1; charset(a) charset(b) charset(binary 'ccc') -latin1 binary latin1 +latin1 binary binary select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1; collation(a) collation(b) collation(binary 'ccc') -latin1_bin binary latin1_bin +latin1_bin binary binary drop table t1; create table t1( firstname char(20), lastname char(20)); insert into t1 values ("john","doe"),("John","Doe"); diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result index ae0def02399..edf30e7f6e4 100644 --- a/mysql-test/r/connect.result +++ b/mysql-test/r/connect.result @@ -40,6 +40,7 @@ show tables; Tables_in_test update mysql.user set password=old_password("gambling2") where user=_binary"test"; flush privileges; +set password=""; set password='gambling3'; ERROR HY000: Password hash should be a 41-digit hexadecimal number set password=old_password('gambling3'); diff --git a/mysql-test/r/create_select_tmp.result b/mysql-test/r/create_select_tmp.result index 09ffc9013c7..b99bf3e3591 100644 --- a/mysql-test/r/create_select_tmp.result +++ b/mysql-test/r/create_select_tmp.result @@ -1,19 +1,19 @@ drop table if exists t1, t2; CREATE TABLE t1 ( a int ); INSERT INTO t1 VALUES (1),(2),(1); -CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1; +CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; ERROR 23000: Duplicate entry '1' for key 1 select * from t2; ERROR 42S02: Table 'test.t2' doesn't exist -CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1; +CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; ERROR 23000: Duplicate entry '1' for key 1 select * from t2; ERROR 42S02: Table 'test.t2' doesn't exist -CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1; +CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; ERROR 23000: Duplicate entry '1' for key 1 select * from t2; ERROR 42S02: Table 'test.t2' doesn't exist -CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1; +CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; ERROR 23000: Duplicate entry '1' for key 1 select * from t2; ERROR 42S02: Table 'test.t2' doesn't exist diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result index 2a59f976156..3793e962d40 100644 --- a/mysql-test/r/ctype_cp1251.result +++ b/mysql-test/r/ctype_cp1251.result @@ -49,8 +49,8 @@ a b aaa bbb select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1; charset(a) charset(b) charset(binary 'ccc') -cp1251 binary cp1251 +cp1251 binary binary select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1; collation(a) collation(b) collation(binary 'ccc') -cp1251_bin binary cp1251_bin +cp1251_bin binary binary drop table t1; diff --git a/mysql-test/r/ctype_create.result b/mysql-test/r/ctype_create.result index 0da76c556e2..b35131f62a4 100644 --- a/mysql-test/r/ctype_create.result +++ b/mysql-test/r/ctype_create.result @@ -54,4 +54,12 @@ t1 CREATE TABLE `t1` ( `a` char(10) collate latin1_german1_ci default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci DROP TABLE t1; +create table t1 (a char) character set latin1 character set latin2; +ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET latin2' +create table t1 (a char) character set latin1 collate latin2_bin; +ERROR 42000: COLLATION 'latin2_bin' is not valid for CHARACTER SET 'latin1' +create database d1 default character set latin1 character set latin2; +ERROR HY000: Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET latin2' +create database d1 default character set latin1 collate latin2_bin; +ERROR 42000: COLLATION 'latin2_bin' is not valid for CHARACTER SET 'latin1' DROP DATABASE mysqltest1; diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 38fc8e17d14..f3be539251a 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -1,5 +1,4 @@ -drop table if exists t1; -drop table if exists t2; +drop table if exists t1,t2; set names utf8; select left(_utf8 0xD0B0D0B1D0B2,1); left(_utf8 0xD0B0D0B1D0B2,1) diff --git a/mysql-test/r/endspace.result b/mysql-test/r/endspace.result index 167adea6674..96210a0e16d 100644 --- a/mysql-test/r/endspace.result +++ b/mysql-test/r/endspace.result @@ -19,7 +19,7 @@ select 'a a' > 'a', 'a \0' < 'a'; 1 1 select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a'; binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a' -1 0 0 +1 1 1 create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)); insert into t1 values ('teststring'), ('nothing'), ('teststring\t'); check table t1; @@ -52,13 +52,13 @@ select * from t1 ignore key (key1) where text1='teststring' or text1 like 'tests text1 teststring teststring -select * from t1 where text1='teststring' or text1 like 'teststring_%'; -text1 -teststring -teststring -select * from t1 where text1='teststring' or text1 > 'teststring\t'; -text1 -teststring +select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%'; +concat('|', text1, '|') +|teststring | +|teststring| +select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t'; +concat('|', text1, '|') +|teststring| select text1, length(text1) from t1 order by text1; text1 length(text1) nothing 7 @@ -77,7 +77,28 @@ concat('|', text1, '|') |teststring| |teststring | |teststring | +select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t'; +concat('|', text1, '|') +|teststring| +|teststring | +select concat('|', text1, '|') from t1 where text1='teststring'; +concat('|', text1, '|') +|teststring| +select concat('|', text1, '|') from t1 where text1='teststring '; +concat('|', text1, '|') +|teststring | alter table t1 modify text1 text not null, pack_keys=1; +select concat('|', text1, '|') from t1 where text1='teststring'; +concat('|', text1, '|') +|teststring| +|teststring | +select concat('|', text1, '|') from t1 where text1='teststring '; +concat('|', text1, '|') +|teststring| +|teststring | +explain select concat('|', text1, '|') from t1 where text1='teststring '; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range key1 key1 22 NULL 2 Using where select * from t1 where text1 like 'teststring_%'; text1 teststring @@ -87,10 +108,10 @@ text1 teststring teststring teststring -select * from t1 where text1='teststring' or text1 > 'teststring\t'; -text1 -teststring -teststring +select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t'; +concat('|', text1, '|') +|teststring| +|teststring | select concat('|', text1, '|') from t1 order by text1; concat('|', text1, '|') |nothing| diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result index 4c8a0561b0a..dd916d06372 100644 --- a/mysql-test/r/func_if.result +++ b/mysql-test/r/func_if.result @@ -43,7 +43,7 @@ explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using filesort Warnings: -Note 1003 select if((test.t1.u = 1),test.t1.st,(test.t1.st collate _latin1'BINARY')) AS `s` from test.t1 where (test.t1.st like _latin1'%a%') order by if((test.t1.u = 1),test.t1.st,(test.t1.st collate _latin1'BINARY')) +Note 1003 select if((test.t1.u = 1),test.t1.st,cast(test.t1.st as char charset binary)) AS `s` from test.t1 where (test.t1.st like _latin1'%a%') order by if((test.t1.u = 1),test.t1.st,cast(test.t1.st as char charset binary)) select nullif(u=0, 'test') from t1; nullif(u=0, 'test') NULL diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 345832387bd..7b2fc4b21a5 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -638,7 +638,7 @@ explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'moo id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,(_latin1'HE' collate _latin1'BINARY') AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")` +Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,cast(_latin1'HE' as char charset binary) AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")` SELECT lpad(12345, 5, "#"); lpad(12345, 5, "#") 12345 diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index c2fd7855c85..9f5dd286cf9 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -466,3 +466,22 @@ insert IGNORE into t1 values ('Garbage'); ERROR HY000: Unknown error alter table t1 add spatial index(a); drop table t1; +create table t1(a geometry not null, spatial index(a)); +insert into t1 values +(GeomFromText('POINT(1 1)')), (GeomFromText('POINT(3 3)')), +(GeomFromText('POINT(4 4)')), (GeomFromText('POINT(6 6)')); +select AsText(a) from t1 where +MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a) +or +MBRContains(GeomFromText('Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'), a); +AsText(a) +POINT(1 1) +POINT(3 3) +POINT(4 4) +select AsText(a) from t1 where +MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a) +and +MBRContains(GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a); +AsText(a) +POINT(1 1) +drop table t1; diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result index f7e0bbf3e2c..218276406b1 100644 --- a/mysql-test/r/having.result +++ b/mysql-test/r/having.result @@ -127,3 +127,4 @@ having (a.description is not null) and (c=0); id description c 1 test 0 2 test2 0 +drop table t1,t2,t3; diff --git a/mysql-test/r/lowercase_table.result b/mysql-test/r/lowercase_table.result index 8bf3db8cad0..2f71e4c2f57 100644 --- a/mysql-test/r/lowercase_table.result +++ b/mysql-test/r/lowercase_table.result @@ -58,3 +58,10 @@ ERROR 42000: Not unique table/alias: 'C' drop table t1, t2; show tables; Tables_in_test +create table t1 (a int); +select TEST.t1.* from TEST.t1; +a +alter table t1 rename to T1; +select TEST.t1.* from TEST.t1; +a +drop table t1; diff --git a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result index 0109097d3a1..354675cd4d4 100644 --- a/mysql-test/r/myisam.result +++ b/mysql-test/r/myisam.result @@ -412,7 +412,6 @@ aaa. aaa . select concat(a,'.') from t1 where binary a='aaa'; concat(a,'.') -aaa . aaa. update t1 set a='bbb' where a='aaa'; select concat(a,'.') from t1; diff --git a/mysql-test/r/ndb_autodiscover.result b/mysql-test/r/ndb_autodiscover.result index b0e2aa04f3e..f5b908c39e2 100644 --- a/mysql-test/r/ndb_autodiscover.result +++ b/mysql-test/r/ndb_autodiscover.result @@ -35,10 +35,10 @@ update t1 set name="Autodiscover" where id = 2; show status like 'handler_discover%'; Variable_name Value Handler_discover 4 -select * from t1 order by name; +select * from t1 order by id; id name -2 Autodiscover 1 Autodiscover +2 Autodiscover 3 Discover 3 show status like 'handler_discover%'; Variable_name Value diff --git a/mysql-test/r/ndb_index_ordered.result b/mysql-test/r/ndb_index_ordered.result index 75de1ac4a7f..1441e53e935 100644 --- a/mysql-test/r/ndb_index_ordered.result +++ b/mysql-test/r/ndb_index_ordered.result @@ -205,4 +205,10 @@ a b c select * from t1 where b<=5 and c=0 or b<=5 and c=2; a b c 19 4 0 +select count(*) from t1 where b = 0; +count(*) +0 +select count(*) from t1 where b = 1; +count(*) +1 drop table t1; diff --git a/mysql-test/r/type_blob.result b/mysql-test/r/type_blob.result index 580fc9a8d0b..95bba1d4ec7 100644 --- a/mysql-test/r/type_blob.result +++ b/mysql-test/r/type_blob.result @@ -593,9 +593,12 @@ create table t1 (id integer primary key auto_increment, txt text, unique index t insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL); select * from t1 where txt='Chevy' or txt is NULL; id txt +3 NULL 1 Chevy 2 Chevy -3 NULL +explain select * from t1 where txt='Chevy' or txt is NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range txt_index txt_index 23 NULL 2 Using where select * from t1 where txt='Chevy '; id txt 1 Chevy @@ -663,6 +666,21 @@ id txt 1 Chevy 2 Chevy 4 Ford +alter table t1 modify column txt blob; +explain select * from t1 where txt='Chevy' or txt is NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 2 Using where +select * from t1 where txt='Chevy' or txt is NULL; +id txt +1 Chevy +3 NULL +explain select * from t1 where txt='Chevy' or txt is NULL order by txt; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ref_or_null txt_index txt_index 23 const 2 Using where; Using filesort +select * from t1 where txt='Chevy' or txt is NULL order by txt; +id txt +3 NULL +1 Chevy drop table t1; CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1))); INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,''); diff --git a/mysql-test/r/type_ranges.result b/mysql-test/r/type_ranges.result index e803fde14a6..5a65c90c5c7 100644 --- a/mysql-test/r/type_ranges.result +++ b/mysql-test/r/type_ranges.result @@ -272,7 +272,7 @@ auto bigint(17) unsigned NULL PRI 0 select,insert,update,references t1 bigint(1) NULL 0 select,insert,update,references t2 char(1) latin1_swedish_ci select,insert,update,references t3 longtext latin1_swedish_ci select,insert,update,references -t4 longtext latin1_bin select,insert,update,references +t4 longblob NULL select,insert,update,references select * from t2; auto t1 t2 t3 t4 11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index aa8c0903558..425e4a05586 100644 --- a/mysql-test/r/type_timestamp.result +++ b/mysql-test/r/type_timestamp.result @@ -365,3 +365,15 @@ select * from t1; t1 i 2004-04-01 00:00:00 10 drop table t1; +create table t1 (ts timestamp(19)); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ts` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +set TIMESTAMP=1000000000; +insert into t1 values (); +select * from t1; +ts +2001-09-09 04:46:40 +drop table t1; diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test index c1ecf176470..4598ca5ea15 100644 --- a/mysql-test/t/connect.test +++ b/mysql-test/t/connect.test @@ -48,6 +48,7 @@ flush privileges; #connect (con1,localhost,test,gambling2,""); #show tables; connect (con1,localhost,test,gambling2,mysql); +set password=""; --error 1105 set password='gambling3'; set password=old_password('gambling3'); diff --git a/mysql-test/t/create_select_tmp.test b/mysql-test/t/create_select_tmp.test index 166d32fb17c..d81a3799d98 100644 --- a/mysql-test/t/create_select_tmp.test +++ b/mysql-test/t/create_select_tmp.test @@ -12,18 +12,18 @@ drop table if exists t1, t2; CREATE TABLE t1 ( a int ); INSERT INTO t1 VALUES (1),(2),(1); --error 1062; -CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1; +CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; --error 1146; select * from t2; --error 1062; -CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=INNODB SELECT a FROM t1; +CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1; --error 1146; select * from t2; --error 1062; -CREATE TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1; +CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; --error 1146; select * from t2; --error 1062; -CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) TYPE=MYISAM SELECT a FROM t1; +CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1; --error 1146; select * from t2; diff --git a/mysql-test/t/ctype_create.test b/mysql-test/t/ctype_create.test index 6d7ed6fc205..9a5cb025474 100644 --- a/mysql-test/t/ctype_create.test +++ b/mysql-test/t/ctype_create.test @@ -71,6 +71,18 @@ SHOW CREATE TABLE t1; DROP TABLE t1; # +# Bug# +# CREATE TABLE and CREATE DATABASE didn't fail in some cases +# +--error 1302 +create table t1 (a char) character set latin1 character set latin2; +--error 1253 +create table t1 (a char) character set latin1 collate latin2_bin; +--error 1302 +create database d1 default character set latin1 character set latin2; +--error 1253 +create database d1 default character set latin1 collate latin2_bin; + # # DROP DATABASE mysqltest1; diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 4624f2ec78c..2c531d4e5d2 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -3,8 +3,7 @@ # --disable_warnings -drop table if exists t1; -drop table if exists t2; +drop table if exists t1,t2; --enable_warnings set names utf8; diff --git a/mysql-test/t/endspace.test b/mysql-test/t/endspace.test index a9933ff93b5..9ee5e32967a 100644 --- a/mysql-test/t/endspace.test +++ b/mysql-test/t/endspace.test @@ -31,19 +31,25 @@ explain select * from t1 order by text1; alter table t1 modify text1 char(32) binary not null; check table t1; select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%'; -select * from t1 where text1='teststring' or text1 like 'teststring_%'; -select * from t1 where text1='teststring' or text1 > 'teststring\t'; +select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%'; +select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t'; select text1, length(text1) from t1 order by text1; select text1, length(text1) from t1 order by binary text1; alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20)); insert into t1 values ('teststring '); select concat('|', text1, '|') from t1 order by text1; +select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t'; +select concat('|', text1, '|') from t1 where text1='teststring'; +select concat('|', text1, '|') from t1 where text1='teststring '; alter table t1 modify text1 text not null, pack_keys=1; +select concat('|', text1, '|') from t1 where text1='teststring'; +select concat('|', text1, '|') from t1 where text1='teststring '; +explain select concat('|', text1, '|') from t1 where text1='teststring '; select * from t1 where text1 like 'teststring_%'; select * from t1 where text1='teststring' or text1 like 'teststring_%'; -select * from t1 where text1='teststring' or text1 > 'teststring\t'; +select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t'; select concat('|', text1, '|') from t1 order by text1; drop table t1; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 590007caba1..e35b9996a44 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -172,3 +172,21 @@ insert IGNORE into t1 values ('Garbage'); alter table t1 add spatial index(a); drop table t1; + +# +# Bug #5219: problem with range optimizer +# + +create table t1(a geometry not null, spatial index(a)); +insert into t1 values +(GeomFromText('POINT(1 1)')), (GeomFromText('POINT(3 3)')), +(GeomFromText('POINT(4 4)')), (GeomFromText('POINT(6 6)')); +select AsText(a) from t1 where + MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a) + or + MBRContains(GeomFromText('Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'), a); +select AsText(a) from t1 where + MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a) + and + MBRContains(GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a); +drop table t1; diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test index 870f57a4483..12a44fd75dc 100644 --- a/mysql-test/t/having.test +++ b/mysql-test/t/having.test @@ -121,3 +121,4 @@ select from t1 a left join t3 b on a.id=b.order_id group by a.id, a.description having (a.description is not null) and (c=0); +drop table t1,t2,t3; diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test index db46f3d432d..bdfa8dfc132 100644 --- a/mysql-test/t/lowercase_table.test +++ b/mysql-test/t/lowercase_table.test @@ -54,3 +54,13 @@ select C.a, c.a from t1 c, t2 C; drop table t1, t2; show tables; + +# +# Test all caps database name +# +create table t1 (a int); +select TEST.t1.* from TEST.t1; +alter table t1 rename to T1; +select TEST.t1.* from TEST.t1; +drop table t1; + diff --git a/mysql-test/t/ndb_autodiscover.test b/mysql-test/t/ndb_autodiscover.test index d04599f223e..371a130291b 100644 --- a/mysql-test/t/ndb_autodiscover.test +++ b/mysql-test/t/ndb_autodiscover.test @@ -50,7 +50,7 @@ flush tables; system rm var/master-data/test/t1.frm ; update t1 set name="Autodiscover" where id = 2; show status like 'handler_discover%'; -select * from t1 order by name; +select * from t1 order by id; show status like 'handler_discover%'; # diff --git a/mysql-test/t/ndb_index_ordered.test b/mysql-test/t/ndb_index_ordered.test index 3def52e865c..cffe9236fb5 100644 --- a/mysql-test/t/ndb_index_ordered.test +++ b/mysql-test/t/ndb_index_ordered.test @@ -113,6 +113,9 @@ select * from t1 where b<=5 and c=0; select * from t1 where b=4 and c<=5 order by a; select * from t1 where b<=4 and c<=5 order by a; select * from t1 where b<=5 and c=0 or b<=5 and c=2; + +select count(*) from t1 where b = 0; +select count(*) from t1 where b = 1; drop table t1; # diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test index 8c6cabd997b..bd571deff49 100644 --- a/mysql-test/t/type_blob.test +++ b/mysql-test/t/type_blob.test @@ -340,6 +340,7 @@ drop table t1; create table t1 (id integer primary key auto_increment, txt text, unique index txt_index (txt (20))); insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL); select * from t1 where txt='Chevy' or txt is NULL; +explain select * from t1 where txt='Chevy' or txt is NULL; select * from t1 where txt='Chevy '; select * from t1 where txt='Chevy ' or txt='Chevy'; select * from t1 where txt='Chevy' or txt='Chevy '; @@ -358,7 +359,13 @@ select * from t1 where txt < 'Chevy ' or txt is NULL; select * from t1 where txt <= 'Chevy'; select * from t1 where txt > 'Chevy'; select * from t1 where txt >= 'Chevy'; +alter table t1 modify column txt blob; +explain select * from t1 where txt='Chevy' or txt is NULL; +select * from t1 where txt='Chevy' or txt is NULL; +explain select * from t1 where txt='Chevy' or txt is NULL order by txt; +select * from t1 where txt='Chevy' or txt is NULL order by txt; drop table t1; + CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1))); INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,''); select max(i) from t1 where c = ''; diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test index 9b3abc9f155..a644197f757 100644 --- a/mysql-test/t/type_timestamp.test +++ b/mysql-test/t/type_timestamp.test @@ -234,3 +234,13 @@ alter table t1 add i int default 10; select * from t1; drop table t1; + +# Test for bug #4491, TIMESTAMP(19) should be possible to create and not +# only read in 4.0 +# +create table t1 (ts timestamp(19)); +show create table t1; +set TIMESTAMP=1000000000; +insert into t1 values (); +select * from t1; +drop table t1; diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index d7a9babe5e7..07a8f199b3b 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -17,9 +17,9 @@ #include #include #include -#include #include #include +#include static int findopt(char *optpat, uint length, const struct my_option **opt_res, @@ -56,6 +56,13 @@ char *disabled_my_option= (char*) "0"; my_bool my_getopt_print_errors= 1; +void default_reporter(enum loglevel level, const char *format, ...) +{ + va_list args; + va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); +} /* function: handle_options @@ -76,10 +83,8 @@ void my_getopt_register_get_addr(gptr* (*func_addr)(const char *, uint, } int handle_options(int *argc, char ***argv, - const struct my_option *longopts, - my_bool (*get_one_option)(int, - const struct my_option *, - char *)) + const struct my_option *longopts, my_get_one_option get_one_option, + my_error_reporter reporter) { uint opt_found, argvpos= 0, length, i; my_bool end_of_options= 0, must_be_var, set_maximum_value, @@ -95,6 +100,8 @@ int handle_options(int *argc, char ***argv, (*argv)++; /* --- || ---- */ init_variables(longopts); + if (! reporter) reporter = &default_reporter; + for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++) { char *cur_arg= *pos; @@ -118,8 +125,8 @@ int handle_options(int *argc, char ***argv, if (!*++pos) { if (my_getopt_print_errors) - fprintf(stderr, "%s: Option '-O' requires an argument\n", - my_progname); + reporter(ERROR_LEVEL, "%s: Option '-O' requires an argument\n", + my_progname); return EXIT_ARGUMENT_REQUIRED; } cur_arg= *pos; @@ -135,9 +142,8 @@ int handle_options(int *argc, char ***argv, if (!*cur_arg) { if (my_getopt_print_errors) - fprintf(stderr, - "%s: Option '--set-variable' requires an argument\n", - my_progname); + reporter(ERROR_LEVEL, "%s: Option '--set-variable' requires an argument\n", + my_progname); return EXIT_ARGUMENT_REQUIRED; } } @@ -149,9 +155,8 @@ int handle_options(int *argc, char ***argv, if (!*++pos) { if (my_getopt_print_errors) - fprintf(stderr, - "%s: Option '--set-variable' requires an argument\n", - my_progname); + reporter(ERROR_LEVEL, "%s: Option '--set-variable' requires an argument\n", + my_progname); return EXIT_ARGUMENT_REQUIRED; } cur_arg= *pos; @@ -210,7 +215,7 @@ int handle_options(int *argc, char ***argv, if (opt_found > 1) { if (my_getopt_print_errors) - fprintf(stderr, + reporter(ERROR_LEVEL, "%s: ambiguous option '--%s-%s' (--%s-%s)\n", my_progname, special_opt_prefix[i], opt_str, special_opt_prefix[i], prev_found); @@ -245,18 +250,16 @@ int handle_options(int *argc, char ***argv, if (must_be_var) { if (my_getopt_print_errors) - fprintf(stderr, - "%s: %s: unknown variable '%s'\n", my_progname, - option_is_loose ? "WARNING" : "ERROR", opt_str); + reporter(option_is_loose ? WARNING_LEVEL : ERROR_LEVEL, + "%s: unknown variable '%s'\n", my_progname, cur_arg); if (!option_is_loose) return EXIT_UNKNOWN_VARIABLE; } else { if (my_getopt_print_errors) - fprintf(stderr, - "%s: %s: unknown option '--%s'\n", my_progname, - option_is_loose ? "WARNING" : "ERROR", opt_str); + reporter(option_is_loose ? WARNING_LEVEL : ERROR_LEVEL, + "%s: unknown option '--%s'\n", my_progname, cur_arg); if (!option_is_loose) return EXIT_UNKNOWN_OPTION; } @@ -272,14 +275,14 @@ int handle_options(int *argc, char ***argv, if (must_be_var) { if (my_getopt_print_errors) - fprintf(stderr, "%s: variable prefix '%s' is not unique\n", + reporter(ERROR_LEVEL, "%s: variable prefix '%s' is not unique\n", my_progname, opt_str); return EXIT_VAR_PREFIX_NOT_UNIQUE; } else { if (my_getopt_print_errors) - fprintf(stderr, "%s: ambiguous option '--%s' (%s, %s)\n", + reporter(ERROR_LEVEL, "%s: ambiguous option '--%s' (%s, %s)\n", my_progname, opt_str, prev_found, optp->name); return EXIT_AMBIGUOUS_OPTION; } @@ -300,7 +303,7 @@ int handle_options(int *argc, char ***argv, if (must_be_var && (optp->var_type & GET_TYPE_MASK) == GET_NO_ARG) { if (my_getopt_print_errors) - fprintf(stderr, "%s: option '%s' cannot take an argument\n", + reporter(ERROR_LEVEL, "%s: option '%s' cannot take an argument\n", my_progname, optp->name); return EXIT_NO_ARGUMENT_ALLOWED; } @@ -312,7 +315,7 @@ int handle_options(int *argc, char ***argv, if (optend && (optp->var_type & GET_TYPE_MASK) != GET_BOOL) { if (my_getopt_print_errors) - fprintf(stderr, "%s: option '--%s' cannot take an argument\n", + reporter(ERROR_LEVEL, "%s: option '--%s' cannot take an argument\n", my_progname, optp->name); return EXIT_NO_ARGUMENT_ALLOWED; } @@ -351,7 +354,7 @@ int handle_options(int *argc, char ***argv, if (!*++pos) { if (my_getopt_print_errors) - fprintf(stderr, "%s: option '--%s' requires an argument\n", + reporter(ERROR_LEVEL, "%s: option '--%s' requires an argument\n", my_progname, optp->name); return EXIT_ARGUMENT_REQUIRED; } @@ -410,7 +413,7 @@ int handle_options(int *argc, char ***argv, if (!pos[1]) { if (my_getopt_print_errors) - fprintf(stderr, + reporter(ERROR_LEVEL, "%s: option '-%c' requires an argument\n", my_progname, optp->id); return EXIT_ARGUMENT_REQUIRED; @@ -423,7 +426,7 @@ int handle_options(int *argc, char ***argv, if ((error= setval(optp, optp->value, argument, set_maximum_value))) { - fprintf(stderr, + reporter(ERROR_LEVEL, "%s: Error while setting value '%s' to '%s'\n", my_progname, argument, optp->name); return error; @@ -435,7 +438,7 @@ int handle_options(int *argc, char ***argv, if (!opt_found) { if (my_getopt_print_errors) - fprintf(stderr, + reporter(ERROR_LEVEL, "%s: unknown option '-%c'\n", my_progname, *optend); return EXIT_UNKNOWN_OPTION; } @@ -445,7 +448,7 @@ int handle_options(int *argc, char ***argv, } if ((error= setval(optp, value, argument, set_maximum_value))) { - fprintf(stderr, + reporter(ERROR_LEVEL, "%s: Error while setting value '%s' to '%s'\n", my_progname, argument, optp->name); return error; diff --git a/ndb/include/mgmapi/mgmapi_config_parameters.h b/ndb/include/mgmapi/mgmapi_config_parameters.h index 64b14a95f7d..4a4863298dd 100644 --- a/ndb/include/mgmapi/mgmapi_config_parameters.h +++ b/ndb/include/mgmapi/mgmapi_config_parameters.h @@ -12,6 +12,7 @@ #define CFG_NODE_BYTE_ORDER 4 #define CFG_NODE_HOST 5 #define CFG_NODE_SYSTEM 6 +#define CFG_NODE_DATADIR 7 /** * DB config parameters @@ -89,6 +90,8 @@ #define CFG_DB_LONG_SIGNAL_BUFFER 157 +#define CFG_DB_BACKUP_DATADIR 158 + #define CFG_NODE_ARBIT_RANK 200 #define CFG_NODE_ARBIT_DELAY 201 diff --git a/ndb/include/mgmcommon/ConfigRetriever.hpp b/ndb/include/mgmcommon/ConfigRetriever.hpp index 396ce24308c..dd34eb0cfbb 100644 --- a/ndb/include/mgmcommon/ConfigRetriever.hpp +++ b/ndb/include/mgmcommon/ConfigRetriever.hpp @@ -78,6 +78,11 @@ public: * Get config from file */ struct ndb_mgm_configuration * getConfig(const char * file); + + /** + * Verify config + */ + bool verifyConfig(const struct ndb_mgm_configuration *, Uint32 nodeid); private: BaseString errorString; enum ErrorType { @@ -97,11 +102,6 @@ private: Uint32 m_version; Uint32 m_node_type; NdbMgmHandle m_handle; - - /** - * Verify config - */ - bool verifyConfig(const struct ndb_mgm_configuration *); }; #endif diff --git a/ndb/include/mgmcommon/NdbConfig.h b/ndb/include/mgmcommon/NdbConfig.h index 5c83a348df2..eb90f5e7c78 100644 --- a/ndb/include/mgmcommon/NdbConfig.h +++ b/ndb/include/mgmcommon/NdbConfig.h @@ -21,6 +21,7 @@ extern "C" { #endif +void NdbConfig_SetPath(const char *path); char* NdbConfig_NdbCfgName(int with_ndb_home); char* NdbConfig_ErrorFileName(int node_id); char* NdbConfig_ClusterLogFileName(int node_id); diff --git a/ndb/include/ndb_global.h b/ndb/include/ndb_global.h index 68ea0943935..0ae781ba5c2 100644 --- a/ndb/include/ndb_global.h +++ b/ndb/include/ndb_global.h @@ -93,6 +93,14 @@ extern int strcasecmp(const char *s1, const char *s2); extern int strncasecmp(const char *s1, const char *s2, size_t n); #endif +#ifdef SCO + +#ifndef PATH_MAX +#define PATH_MAX 1024 +#endif + +#endif /* SCO */ + #ifdef __cplusplus } #endif diff --git a/ndb/src/common/logger/FileLogHandler.cpp b/ndb/src/common/logger/FileLogHandler.cpp index d13dd7b2a78..632db71db15 100644 --- a/ndb/src/common/logger/FileLogHandler.cpp +++ b/ndb/src/common/logger/FileLogHandler.cpp @@ -14,8 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include - #include // @@ -146,7 +146,7 @@ FileLogHandler::createNewFile() { bool rc = true; int fileNo = 1; - char newName[MAXPATHLEN]; + char newName[PATH_MAX]; do { diff --git a/ndb/src/common/mgmcommon/ConfigRetriever.cpp b/ndb/src/common/mgmcommon/ConfigRetriever.cpp index 2e809907058..afee135d793 100644 --- a/ndb/src/common/mgmcommon/ConfigRetriever.cpp +++ b/ndb/src/common/mgmcommon/ConfigRetriever.cpp @@ -154,7 +154,7 @@ ConfigRetriever::getConfig() { if(p == 0) return 0; - if(!verifyConfig(p)){ + if(!verifyConfig(p, _ownNodeId)){ free(p); p= 0; } @@ -239,7 +239,7 @@ ConfigRetriever::setConnectString(const char * connectString) { } bool -ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){ +ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32 nodeid){ char buf[255]; ndb_mgm_configuration_iterator * it; @@ -253,8 +253,8 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){ } NdbAutoPtr ptr(it); - if(ndb_mgm_find(it, CFG_NODE_ID, _ownNodeId) != 0){ - snprintf(buf, 255, "Unable to find node with id: %d", _ownNodeId); + if(ndb_mgm_find(it, CFG_NODE_ID, nodeid) != 0){ + snprintf(buf, 255, "Unable to find node with id: %d", nodeid); setError(CR_ERROR, buf); return false; } @@ -266,6 +266,11 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){ return false; } + const char * datadir; + if(!ndb_mgm_get_string_parameter(it, CFG_NODE_DATADIR, &datadir)){ + NdbConfig_SetPath(datadir); + } + char localhost[MAXHOSTNAMELEN]; if(NdbHost_GetHostName(localhost) != 0){ snprintf(buf, 255, "Unable to get own hostname"); @@ -332,8 +337,8 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){ if(iter.get(CFG_CONNECTION_NODE_1, &nodeId1)) continue; if(iter.get(CFG_CONNECTION_NODE_2, &nodeId2)) continue; - if(nodeId1 != _ownNodeId && nodeId2 != _ownNodeId) continue; - remoteNodeId = (_ownNodeId == nodeId1 ? nodeId2 : nodeId1); + if(nodeId1 != nodeid && nodeId2 != nodeid) continue; + remoteNodeId = (nodeid == nodeId1 ? nodeId2 : nodeId1); const char * name; struct in_addr addr; @@ -342,7 +347,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){ if(Ndb_getInAddr(&addr, name) != 0){ tmp.assfmt("Unable to lookup/illegal hostname %s, " "connection from node %d to node %d", - name, _ownNodeId, remoteNodeId); + name, nodeid, remoteNodeId); setError(CR_ERROR, tmp.c_str()); return false; } @@ -352,7 +357,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){ if(Ndb_getInAddr(&addr, name) != 0){ tmp.assfmt("Unable to lookup/illegal hostname %s, " "connection from node %d to node %d", - name, _ownNodeId, remoteNodeId); + name, nodeid, remoteNodeId); setError(CR_ERROR, tmp.c_str()); return false; } diff --git a/ndb/src/common/mgmcommon/Makefile.am b/ndb/src/common/mgmcommon/Makefile.am index 174999579d4..ed6a526eb47 100644 --- a/ndb/src/common/mgmcommon/Makefile.am +++ b/ndb/src/common/mgmcommon/Makefile.am @@ -1,23 +1,13 @@ -MYSQLDATAdir = $(localstatedir) -MYSQLSHAREdir = $(pkgdatadir) -MYSQLBASEdir= $(prefix) - noinst_LTLIBRARIES = libmgmsrvcommon.la libmgmsrvcommon_la_SOURCES = \ LocalConfig.cpp \ - Config.cpp \ - ConfigInfo.cpp \ ConfigRetriever.cpp \ - InitConfigFileParser.cpp \ IPCConfig.cpp NdbConfig.c -INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmapi +INCLUDES_LOC = -I$(top_srcdir)/ndb/src/mgmapi -I$(top_srcdir)/ndb/src/mgmsrv -DEFS_LOC = -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \ - -DDATADIR="\"$(MYSQLDATAdir)\"" \ - -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ - -DNDB_BASE_PORT="\"@ndb_port_base@\"" +DEFS_LOC = -DNDB_BASE_PORT="\"@ndb_port_base@\"" include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/type_ndbapi.mk.am diff --git a/ndb/src/common/mgmcommon/NdbConfig.c b/ndb/src/common/mgmcommon/NdbConfig.c index baf25033b6f..c3f4abf61a7 100644 --- a/ndb/src/common/mgmcommon/NdbConfig.c +++ b/ndb/src/common/mgmcommon/NdbConfig.c @@ -19,6 +19,8 @@ #include #include +static char *datadir_path= 0; + static char* NdbConfig_AllocHomePath(int _len) { @@ -27,19 +29,27 @@ NdbConfig_AllocHomePath(int _len) int path_len= 0; char *buf; + if (path == 0) + path= datadir_path; + if (path) path_len= strlen(path); len+= path_len; buf= NdbMem_Allocate(len); if (path_len > 0) - snprintf(buf, len, "%s%c", path, DIR_SEPARATOR); + snprintf(buf, len, "%s%s", path, DIR_SEPARATOR); else buf[0]= 0; return buf; } +void +NdbConfig_SetPath(const char* path){ + datadir_path= path; +} + char* NdbConfig_NdbCfgName(int with_ndb_home){ char *buf; diff --git a/ndb/src/kernel/Makefile.am b/ndb/src/kernel/Makefile.am index 60284f6a369..a6be3244b41 100644 --- a/ndb/src/kernel/Makefile.am +++ b/ndb/src/kernel/Makefile.am @@ -52,7 +52,10 @@ LDADD += \ $(top_builddir)/ndb/src/common/mgmcommon/libmgmsrvcommon.la \ $(top_builddir)/ndb/src/mgmapi/libmgmapi.la \ $(top_builddir)/ndb/src/common/portlib/libportlib.la \ - $(top_builddir)/ndb/src/common/util/libgeneral.la + $(top_builddir)/ndb/src/common/util/libgeneral.la \ + $(top_builddir)/dbug/libdbug.a \ + $(top_builddir)/mysys/libmysys.a \ + $(top_builddir)/strings/libmystrings.a # Don't update the files from bitkeeper %::SCCS/s.% diff --git a/ndb/src/kernel/blocks/ERROR_codes.txt b/ndb/src/kernel/blocks/ERROR_codes.txt index af575de4f62..43532a973f9 100644 --- a/ndb/src/kernel/blocks/ERROR_codes.txt +++ b/ndb/src/kernel/blocks/ERROR_codes.txt @@ -5,7 +5,7 @@ Next DBACC 3001 Next DBTUP 4007 Next DBLQH 5040 Next DBDICT 6006 -Next DBDIH 7173 +Next DBDIH 7174 Next DBTC 8035 Next CMVMI 9000 Next BACKUP 10022 @@ -387,6 +387,11 @@ Backup Stuff: 5028: Crash when receiving LQHKEYREQ (in non-master) +Failed Create Table: +-------------------- +7173: Create table failed due to not sufficient number of fragment or + replica records. + Drop Table/Index: ----------------- 4001: Crash on REL_TABMEMREQ in TUP diff --git a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp index e1f199ac411..e2085eb612c 100644 --- a/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp +++ b/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp @@ -46,6 +46,7 @@ // Used here only to print event reports on stdout/console. EventLogger g_eventLogger; +extern int simulate_error_during_shutdown; Cmvmi::Cmvmi(const Configuration & conf) : SimulatedBlock(CMVMI, conf) @@ -148,6 +149,16 @@ void Cmvmi::execNDB_TAMPER(Signal* signal) if(ERROR_INSERTED(9997)){ ndbrequire(false); } + + if(ERROR_INSERTED(9996)){ + simulate_error_during_shutdown= SIGSEGV; + ndbrequire(false); + } + + if(ERROR_INSERTED(9995)){ + simulate_error_during_shutdown= SIGSEGV; + kill(getpid(), SIGABRT); + } }//execNDB_TAMPER() void Cmvmi::execSET_LOGLEVELORD(Signal* signal) diff --git a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp index 178e840cd4a..572e9f39ba5 100644 --- a/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp +++ b/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp @@ -6174,7 +6174,7 @@ void Dbdih::execCREATE_FRAGMENTATION_REQ(Signal * signal){ break; case DictTabInfo::AllNodesLargeTable: jam(); - noOfFragments = csystemnodes; + noOfFragments = 4 * csystemnodes; break; case DictTabInfo::SingleFragment: jam(); @@ -6425,6 +6425,10 @@ void Dbdih::execDIADDTABREQ(Signal* signal) tabPtr.p->totalfragments = noFragments; ndbrequire(noReplicas == cnoReplicas); // Only allowed + if (ERROR_INSERTED(7173)) { + addtabrefuseLab(signal, connectPtr, ZREPLERROR1); + return; + } if ((noReplicas * noFragments) > cnoFreeReplicaRec) { jam(); addtabrefuseLab(signal, connectPtr, ZREPLERROR1); @@ -6736,13 +6740,15 @@ void Dbdih::tableDeleteLab(Signal* signal, FileRecordPtr filePtr) void Dbdih::releaseTable(TabRecordPtr tabPtr) { FragmentstorePtr fragPtr; - for (Uint32 fragId = 0; fragId < tabPtr.p->totalfragments; fragId++) { - jam(); - getFragstore(tabPtr.p, fragId, fragPtr); - releaseReplicas(fragPtr.p->storedReplicas); - releaseReplicas(fragPtr.p->oldStoredReplicas); - }//for - releaseFragments(tabPtr); + if (tabPtr.p->noOfFragChunks > 0) { + for (Uint32 fragId = 0; fragId < tabPtr.p->totalfragments; fragId++) { + jam(); + getFragstore(tabPtr.p, fragId, fragPtr); + releaseReplicas(fragPtr.p->storedReplicas); + releaseReplicas(fragPtr.p->oldStoredReplicas); + }//for + releaseFragments(tabPtr); + } if (tabPtr.p->tabFile[0] != RNIL) { jam(); releaseFile(tabPtr.p->tabFile[0]); @@ -6875,9 +6881,6 @@ Uint32 Dbdih::extractNodeInfo(const Fragmentstore * fragPtr, Uint32 nodes[]) return nodeCount; }//Dbdih::extractNodeInfo() -#define NO_OF_FRAGS_PER_CHUNK 16 -#define LOG_NO_OF_FRAGS_PER_CHUNK 4 - void Dbdih::getFragstore(TabRecord * tab, //In parameter Uint32 fragNo, //In parameter @@ -11051,6 +11054,7 @@ void Dbdih::initRestorableGciFiles() void Dbdih::initTable(TabRecordPtr tabPtr) { + tabPtr.p->noOfFragChunks = 0; tabPtr.p->method = TabRecord::NOTDEFINED; tabPtr.p->tabStatus = TabRecord::TS_IDLE; tabPtr.p->noOfWords = 0; diff --git a/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp b/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp index 9495c487847..803314ae52d 100644 --- a/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp +++ b/ndb/src/kernel/blocks/dbtux/DbtuxMeta.cpp @@ -287,6 +287,22 @@ Dbtux::execDROP_TAB_REQ(Signal* signal) const DropTabReq reqCopy = *(const DropTabReq*)signal->getDataPtr(); const DropTabReq* const req = &reqCopy; IndexPtr indexPtr; + + Uint32 tableId = req->tableId; + Uint32 senderRef = req->senderRef; + Uint32 senderData = req->senderData; + if (tableId >= c_indexPool.getSize()) { + jam(); + // reply to sender + DropTabConf* const conf = (DropTabConf*)signal->getDataPtrSend(); + conf->senderRef = reference(); + conf->senderData = senderData; + conf->tableId = tableId; + sendSignal(senderRef, GSN_DROP_TAB_CONF, + signal, DropTabConf::SignalLength, JBB); + return; + } + c_indexPool.getPtr(indexPtr, req->tableId); // drop works regardless of index state #ifdef VM_TRACE diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp index c2b8cc80a44..c61fccad22a 100644 --- a/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +++ b/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp @@ -108,8 +108,10 @@ AsyncFile::AsyncFile() : } void -AsyncFile::doStart(Uint32 nodeId, const char * filesystemPath) { - theFileName.init(nodeId, filesystemPath); +AsyncFile::doStart(Uint32 nodeId, + const char * filesystemPath, + const char * backup_path) { + theFileName.init(nodeId, filesystemPath, backup_path); // Stacksize for filesystem threads // An 8k stack should be enough diff --git a/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp b/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp index 9a405bc1580..2176c93c5d5 100644 --- a/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp +++ b/ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp @@ -181,7 +181,7 @@ public: void execute( Request* request ); - void doStart(Uint32 nodeId, const char * fspath); + void doStart(Uint32 nodeId, const char * fspath, const char * backup_path); // its a thread so its always running void run(); diff --git a/ndb/src/kernel/blocks/ndbfs/Filename.cpp b/ndb/src/kernel/blocks/ndbfs/Filename.cpp index 660fe6eee94..28aa1d23df4 100644 --- a/ndb/src/kernel/blocks/ndbfs/Filename.cpp +++ b/ndb/src/kernel/blocks/ndbfs/Filename.cpp @@ -46,43 +46,31 @@ Filename::Filename() : } void -Filename::init(Uint32 nodeid, const char * pFileSystemPath){ +Filename::init(Uint32 nodeid, + const char * pFileSystemPath, + const char * pBackupDirPath){ + DBUG_ENTER("Filename::init"); + if (pFileSystemPath == NULL) { ERROR_SET(fatal, AFS_ERROR_NOPATH, ""," Filename::init()"); return; } - strncpy(theBaseDirectory, pFileSystemPath, PATH_MAX); - - // the environment variable is set, - // check that it is pointing on a valid directory - // - char buf2[PATH_MAX]; memset(buf2, 0,sizeof(buf2)); -#ifdef NDB_WIN32 - char* szFilePart; - if(!GetFullPathName(theBaseDirectory, sizeof(buf2), buf2, &szFilePart) - || (::GetFileAttributes(theBaseDirectory)&FILE_ATTRIBUTE_READONLY)) -#else - if((::realpath(theBaseDirectory, buf2) == NULL)|| - (::access(theBaseDirectory, W_OK) != 0)) -#endif - { - ERROR_SET(fatal, AFS_ERROR_INVALIDPATH, pFileSystemPath, " Filename::init()"); - } - strncpy(theBaseDirectory, buf2, sizeof(theBaseDirectory)); - // path seems ok, add delimiter if missing - if (strcmp(&theBaseDirectory[strlen(theBaseDirectory) - 1], - DIR_SEPARATOR) != 0) - strcat(theBaseDirectory, DIR_SEPARATOR); - - snprintf(buf2, sizeof(buf2), "ndb_%u_fs%s", nodeid, DIR_SEPARATOR); - strcat(theBaseDirectory, buf2); + snprintf(theFileSystemDirectory, sizeof(theFileSystemDirectory), + "%sndb_%u_fs%s", pFileSystemPath, nodeid, DIR_SEPARATOR); + strncpy(theBackupDirectory, pBackupDirPath, sizeof(theBackupDirectory)); + + DBUG_PRINT("info", ("theFileSystemDirectory=%s", theFileSystemDirectory)); + DBUG_PRINT("info", ("theBackupDirectory=%s", theBackupDirectory)); #ifdef NDB_WIN32 - CreateDirectory(theBaseDirectory, 0); + CreateDirectory(theFileSystemDirectory, 0); #else - mkdir(theBaseDirectory, S_IRUSR | S_IWUSR | S_IXUSR | S_IXGRP | S_IRGRP); + mkdir(theFileSystemDirectory, S_IRUSR | S_IWUSR | S_IXUSR | S_IXGRP | S_IRGRP); #endif + theBaseDirectory= 0; + + DBUG_VOID_RETURN; } Filename::~Filename(){ @@ -94,10 +82,16 @@ Filename::set(BlockReference blockReference, { char buf[PATH_MAX]; theLevelDepth = 0; - strncpy(theName, theBaseDirectory, PATH_MAX); - + const Uint32 type = FsOpenReq::getSuffix(filenumber); const Uint32 version = FsOpenReq::getVersion(filenumber); + + if (version == 2) + theBaseDirectory= theBackupDirectory; + else + theBaseDirectory= theFileSystemDirectory; + strncpy(theName, theBaseDirectory, PATH_MAX); + switch(version){ case 1 :{ const Uint32 diskNo = FsOpenReq::v1_getDisk(filenumber); diff --git a/ndb/src/kernel/blocks/ndbfs/Filename.hpp b/ndb/src/kernel/blocks/ndbfs/Filename.hpp index 25c06092436..249c1b1ca10 100644 --- a/ndb/src/kernel/blocks/ndbfs/Filename.hpp +++ b/ndb/src/kernel/blocks/ndbfs/Filename.hpp @@ -67,13 +67,16 @@ public: const char* directory(int level); int levels() const; const char* c_str() const; - - void init(Uint32 nodeid, const char * fileSystemPath); + + void init(Uint32 nodeid, const char * fileSystemPath, + const char * backupDirPath); private: int theLevelDepth; char theName[PATH_MAX]; - char theBaseDirectory[PATH_MAX]; + char theFileSystemDirectory[PATH_MAX]; + char theBackupDirectory[PATH_MAX]; + char *theBaseDirectory; char theDirectory[PATH_MAX]; }; diff --git a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp index c7ef1a91099..56e3d3abbed 100644 --- a/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp +++ b/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp @@ -58,6 +58,8 @@ Ndbfs::Ndbfs(const Configuration & conf) : m_maxOpenedFiles(0) { theFileSystemPath = conf.fileSystemPath(); + theBackupFilePath = conf.backupFilePath(); + theRequestPool = new Pool; const ndb_mgm_configuration_iterator * p = conf.getOwnConfigIterator(); @@ -559,7 +561,7 @@ Ndbfs::createAsyncFile(){ } AsyncFile* file = new AsyncFile; - file->doStart(getOwnNodeId(), theFileSystemPath); + file->doStart(getOwnNodeId(), theFileSystemPath, theBackupFilePath); // Put the file in list of all files theFiles.push_back(file); diff --git a/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp b/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp index 080196a9ea5..c5aaa4e5c49 100644 --- a/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp +++ b/ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp @@ -80,6 +80,7 @@ private: Vector theIdleFiles; // List of idle AsyncFiles OpenFiles theOpenFiles; // List of open AsyncFiles const char * theFileSystemPath; + const char * theBackupFilePath; // Statistics variables Uint32 m_maxOpenedFiles; diff --git a/ndb/src/kernel/error/ErrorHandlingMacros.hpp b/ndb/src/kernel/error/ErrorHandlingMacros.hpp index 416507fee23..d8bb7ff759b 100644 --- a/ndb/src/kernel/error/ErrorHandlingMacros.hpp +++ b/ndb/src/kernel/error/ErrorHandlingMacros.hpp @@ -22,6 +22,8 @@ extern const char programName[]; +#define ERROR_SET_SIGNAL(messageCategory, messageID, problemData, objectRef) \ + ErrorReporter::handleError(messageCategory, messageID, problemData, objectRef, NST_ErrorHandlerSignal) #define ERROR_SET(messageCategory, messageID, problemData, objectRef) \ ErrorReporter::handleError(messageCategory, messageID, problemData, objectRef) // Description: diff --git a/ndb/src/kernel/main.cpp b/ndb/src/kernel/main.cpp index 4d3a0afe6ed..1f080b003bc 100644 --- a/ndb/src/kernel/main.cpp +++ b/ndb/src/kernel/main.cpp @@ -15,6 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include +#include #include #include "Configuration.hpp" @@ -26,6 +27,7 @@ #include #include #include +#include #include #include @@ -39,6 +41,7 @@ #endif extern EventLogger g_eventLogger; +extern NdbMutex * theShutdownMutex; void catchsigs(bool ignore); // for process signal handling @@ -328,16 +331,24 @@ handler_shutdown(int signum){ extern "C" void handler_error(int signum){ + // only let one thread run shutdown + static long thread_id= 0; + + if (thread_id != 0 && thread_id == my_thread_id()) + { + // Shutdown thread received signal + signal(signum, SIG_DFL); + kill(getpid(), signum); + while(true) + NdbSleep_MilliSleep(10); + } + if(theShutdownMutex && NdbMutex_Trylock(theShutdownMutex) != 0) + while(true) + NdbSleep_MilliSleep(10); + thread_id= my_thread_id(); g_eventLogger.info("Received signal %d. Running error handler.", signum); // restart the system char errorData[40]; snprintf(errorData, 40, "Signal %d received", signum); - ERROR_SET(fatal, 0, errorData, __FILE__); + ERROR_SET_SIGNAL(fatal, 0, errorData, __FILE__); } - - - - - - - diff --git a/ndb/src/kernel/vm/Configuration.cpp b/ndb/src/kernel/vm/Configuration.cpp index 9469a39a6f5..288a1509c9b 100644 --- a/ndb/src/kernel/vm/Configuration.cpp +++ b/ndb/src/kernel/vm/Configuration.cpp @@ -14,6 +14,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include +#include + #include "Configuration.hpp" #include #include "GlobalData.hpp" @@ -56,6 +59,9 @@ Configuration::init(int argc, const char** argv){ int _deamon = 0; int _help = 0; int _print_version = 0; +#ifndef DBUG_OFF + const char *debug_option= 0; +#endif /** * Arguments to NDB process @@ -66,6 +72,10 @@ Configuration::init(int argc, const char** argv){ { "nostart", 'n', arg_flag, &_no_start, "Don't start ndbd immediately. Ndbd will await command from ndb_mgmd", "" }, { "daemon", 'd', arg_flag, &_deamon, "Start ndbd as daemon", "" }, +#ifndef DBUG_OFF + { "debug", 0, arg_string, &debug_option, + "Specify debug options e.g. d:t:i:o,out.trace", "options" }, +#endif { "initial", 'i', arg_flag, &_initial, "Perform initial start of ndbd, including cleaning the file system. Consult documentation before using this", "" }, @@ -84,15 +94,17 @@ Configuration::init(int argc, const char** argv){ return false; } -#if 0 - ndbout << "no_start=" <<_no_start<< endl; - ndbout << "initial=" <<_initial<< endl; - ndbout << "deamon=" <<_deamon<< endl; - ndbout << "connect_str="<<_connect_str<> + LOG_NO_OF_FRAGS_PER_CHUNK) << + LOG_NO_OF_FRAGS_PER_CHUNK; + cfg.put(CFG_DIH_FRAG_CONNECT, - NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfDBNodes); + noFragPerTable * noOfMetaTables); int temp; temp = noOfReplicas - 2; @@ -611,7 +659,7 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){ cfg.put(CFG_DIH_MORE_NODES, temp * NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfDBNodes); - + cfg.put(CFG_DIH_REPLICAS, NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfDBNodes * noOfReplicas); diff --git a/ndb/src/kernel/vm/Configuration.hpp b/ndb/src/kernel/vm/Configuration.hpp index bd91f3fa74b..e84ff8d9193 100644 --- a/ndb/src/kernel/vm/Configuration.hpp +++ b/ndb/src/kernel/vm/Configuration.hpp @@ -53,6 +53,7 @@ public: // Cluster configuration const char * programName() const; const char * fileSystemPath() const; + const char * backupFilePath() const; char * getConnectStringCopy() const; /** @@ -89,6 +90,7 @@ private: */ char * _programName; char * _fsPath; + char * _backupPath; bool _initialStart; char * _connectString; bool _daemonMode; @@ -108,6 +110,12 @@ Configuration::fileSystemPath() const { return _fsPath; } +inline +const char * +Configuration::backupFilePath() const { + return _backupPath; +} + inline bool Configuration::getInitialStart() const { diff --git a/ndb/src/kernel/vm/Emulator.cpp b/ndb/src/kernel/vm/Emulator.cpp index 75aea2bda7f..202c6547a81 100644 --- a/ndb/src/kernel/vm/Emulator.cpp +++ b/ndb/src/kernel/vm/Emulator.cpp @@ -61,6 +61,7 @@ Uint32 theEmulatedJamBlockNumber = 0; EmulatorData globalEmulatorData; NdbMutex * theShutdownMutex = 0; +int simulate_error_during_shutdown= 0; EmulatorData::EmulatorData(){ theConfiguration = 0; @@ -117,7 +118,8 @@ NdbShutdown(NdbShutdownType type, } } - if(NdbMutex_Trylock(theShutdownMutex) == 0){ + if((type == NST_ErrorHandlerSignal) || // Signal handler has already locked mutex + (NdbMutex_Trylock(theShutdownMutex) == 0)){ globalData.theRestartFlag = perform_stop; bool restart = false; @@ -145,6 +147,9 @@ NdbShutdown(NdbShutdownType type, case NST_ErrorHandler: ndbout << "Error handler " << shutting << " system" << endl; break; + case NST_ErrorHandlerSignal: + ndbout << "Error handler signal " << shutting << " system" << endl; + break; case NST_Restart: ndbout << "Restarting system" << endl; break; @@ -175,6 +180,12 @@ NdbShutdown(NdbShutdownType type, #endif } + if (simulate_error_during_shutdown) { + kill(getpid(), simulate_error_during_shutdown); + while(true) + NdbSleep_MilliSleep(10); + } + globalEmulatorData.theWatchDog->doStop(); #ifdef VM_TRACE diff --git a/ndb/src/kernel/vm/Emulator.hpp b/ndb/src/kernel/vm/Emulator.hpp index 8c4504b9ba7..bd240f8679b 100644 --- a/ndb/src/kernel/vm/Emulator.hpp +++ b/ndb/src/kernel/vm/Emulator.hpp @@ -79,6 +79,7 @@ enum NdbShutdownType { NST_Normal, NST_Watchdog, NST_ErrorHandler, + NST_ErrorHandlerSignal, NST_Restart, NST_ErrorInsert }; diff --git a/ndb/src/kernel/vm/pc.hpp b/ndb/src/kernel/vm/pc.hpp index 5ac95d661a4..2d745d26b1c 100644 --- a/ndb/src/kernel/vm/pc.hpp +++ b/ndb/src/kernel/vm/pc.hpp @@ -150,6 +150,13 @@ #define NO_OF_FRAG_PER_NODE 1 #define MAX_FRAG_PER_NODE 8 +/** +* DIH allocates fragments in chunk for fast find of fragment record. +* These parameters define chunk size and log of chunk size. +*/ +#define NO_OF_FRAGS_PER_CHUNK 4 +#define LOG_NO_OF_FRAGS_PER_CHUNK 2 + /* ---------------------------------------------------------------- */ // To avoid synching too big chunks at a time we synch after writing // a certain number of data/UNDO pages. (e.g. 2 MBytes). diff --git a/ndb/src/mgmclient/CommandInterpreter.cpp b/ndb/src/mgmclient/CommandInterpreter.cpp index c90ed1822f1..631531ca696 100644 --- a/ndb/src/mgmclient/CommandInterpreter.cpp +++ b/ndb/src/mgmclient/CommandInterpreter.cpp @@ -47,10 +47,13 @@ static const char* helpText = "HELP DEBUG Help for debug compiled version\n" #endif "SHOW Print information about cluster\n" +#if 0 "SHOW CONFIG Print configuration\n" "SHOW PARAMETERS Print configuration parameters\n" +#endif "START BACKUP Start backup\n" "ABORT BACKUP Abort backup\n" +"SHUTDOWN Shutdown all processed in cluster and quit\n" "CLUSTERLOG ON Enable Cluster logging\n" "CLUSTERLOG OFF Disable Cluster logging\n" "CLUSTERLOG FILTER Toggle severity filter on/off\n" @@ -62,7 +65,9 @@ static const char* helpText = "EXIT SINGLE USER MODE Exit single user mode\n" " STATUS Print status\n" " CLUSTERLOG {=}+ Set log level for cluster log\n" +#ifdef HAVE_GLOBAL_REPLICATION "REP CONNECT Connect to REP server on host:port\n" +#endif "QUIT Quit management client\n" ; @@ -299,6 +304,10 @@ CommandInterpreter::readAndExecute(int _try_reconnect) executeShow(allAfterFirstToken); return true; } + else if (strcmp(firstToken, "SHUTDOWN") == 0) { + executeShutdown(allAfterFirstToken); + return true; + } else if (strcmp(firstToken, "CLUSTERLOG") == 0){ executeClusterLog(allAfterFirstToken); return true; @@ -628,6 +637,57 @@ CommandInterpreter::executeHelp(char* parameters) } +/***************************************************************************** + * SHUTDOWN + *****************************************************************************/ + +void +CommandInterpreter::executeShutdown(char* parameters) +{ + connect(); + + ndb_mgm_cluster_state *state = ndb_mgm_get_status(m_mgmsrv); + if(state == NULL) { + ndbout_c("Could not get status"); + printError(); + return; + } + + int result = 0; + result = ndb_mgm_stop(m_mgmsrv, 0, 0); + if (result <= 0) { + ndbout << "Shutdown failed." << endl; + printError(); + return; + } + + ndbout << "NDB Cluster storage node(s) have shutdown." << endl; + + int mgm_id= 0; + for(int i=0; i < state->no_of_nodes; i++) { + if(state->node_states[i].node_type == NDB_MGM_NODE_TYPE_MGM && + state->node_states[i].version != 0){ + if (mgm_id == 0) + mgm_id= state->node_states[i].node_id; + else { + ndbout << "Unable to locate management server, shutdown manually with #STOP" + << endl; + } + } + } + + result = 0; + result = ndb_mgm_stop(m_mgmsrv, 1, &mgm_id); + if (result <= 0) { + ndbout << "Shutdown failed." << endl; + printError(); + return; + } + + ndbout << "NDB Cluster management server shutdown." << endl; + exit(0); +} + /***************************************************************************** * SHOW *****************************************************************************/ diff --git a/ndb/src/mgmclient/CommandInterpreter.hpp b/ndb/src/mgmclient/CommandInterpreter.hpp index 478e03d129a..eecc48a739e 100644 --- a/ndb/src/mgmclient/CommandInterpreter.hpp +++ b/ndb/src/mgmclient/CommandInterpreter.hpp @@ -127,6 +127,7 @@ private: */ void executeHelp(char* parameters); void executeShow(char* parameters); + void executeShutdown(char* parameters); void executeRun(char* parameters); void executeInfo(char* parameters); void executeClusterLog(char* parameters); diff --git a/ndb/src/common/mgmcommon/Config.cpp b/ndb/src/mgmsrv/Config.cpp similarity index 99% rename from ndb/src/common/mgmcommon/Config.cpp rename to ndb/src/mgmsrv/Config.cpp index c0819b9f463..b8a494cb759 100644 --- a/ndb/src/common/mgmcommon/Config.cpp +++ b/ndb/src/mgmsrv/Config.cpp @@ -19,7 +19,6 @@ #include #include "MgmtErrorReporter.hpp" #include -#include "ConfigInfo.hpp" //***************************************************************************** // Ctor / Dtor diff --git a/ndb/src/common/mgmcommon/Config.hpp b/ndb/src/mgmsrv/Config.hpp similarity index 98% rename from ndb/src/common/mgmcommon/Config.hpp rename to ndb/src/mgmsrv/Config.hpp index 26fd53dbed2..b5e1e17b027 100644 --- a/ndb/src/common/mgmcommon/Config.hpp +++ b/ndb/src/mgmsrv/Config.hpp @@ -24,7 +24,7 @@ #include #include #include -#include "ConfigInfo.hpp" +#include class ConfigInfo; diff --git a/ndb/src/common/mgmcommon/ConfigInfo.cpp b/ndb/src/mgmsrv/ConfigInfo.cpp similarity index 92% rename from ndb/src/common/mgmcommon/ConfigInfo.cpp rename to ndb/src/mgmsrv/ConfigInfo.cpp index 1c8eb5137b9..948423f0109 100644 --- a/ndb/src/common/mgmcommon/ConfigInfo.cpp +++ b/ndb/src/mgmsrv/ConfigInfo.cpp @@ -33,11 +33,15 @@ * Section names ****************************************************************************/ +#define DB_TOKEN "DB" +#define MGM_TOKEN "MGM" +#define API_TOKEN "API" + const ConfigInfo::AliasPair ConfigInfo::m_sectionNameAliases[]={ - {"API", "MYSQLD"}, - {"DB", "NDBD"}, - {"MGM", "NDB_MGMD"}, + {API_TOKEN, "MYSQLD"}, + {DB_TOKEN, "NDBD"}, + {MGM_TOKEN, "NDB_MGMD"}, {0, 0} }; @@ -47,9 +51,9 @@ ConfigInfo::m_sectionNames[]={ "EXTERNAL SYSTEM", "COMPUTER", - "DB", - "MGM", - "API", + DB_TOKEN, + MGM_TOKEN, + API_TOKEN, "REP", "EXTERNAL REP", @@ -84,6 +88,8 @@ static bool fixNodeId(InitConfigFileParser::Context & ctx, const char * data); static bool fixExtConnection(InitConfigFileParser::Context & ctx, const char * data); static bool fixDepricated(InitConfigFileParser::Context & ctx, const char *); static bool saveInConfigValues(InitConfigFileParser::Context & ctx, const char *); +static bool fixFileSystemPath(InitConfigFileParser::Context & ctx, const char * data); +static bool fixBackupDataDir(InitConfigFileParser::Context & ctx, const char * data); const ConfigInfo::SectionRule ConfigInfo::m_SectionRules[] = { @@ -91,9 +97,9 @@ ConfigInfo::m_SectionRules[] = { { "EXTERNAL SYSTEM", transformExternalSystem, 0 }, { "COMPUTER", transformComputer, 0 }, - { "DB", transformNode, 0 }, - { "API", transformNode, 0 }, - { "MGM", transformNode, 0 }, + { DB_TOKEN, transformNode, 0 }, + { API_TOKEN, transformNode, 0 }, + { MGM_TOKEN, transformNode, 0 }, { "REP", transformNode, 0 }, { "EXTERNAL REP", transformExtNode, 0 }, @@ -102,9 +108,9 @@ ConfigInfo::m_SectionRules[] = { { "SCI", transformConnection, 0 }, { "OSE", transformConnection, 0 }, - { "DB", fixNodeHostname, 0 }, - { "API", fixNodeHostname, 0 }, - { "MGM", fixNodeHostname, 0 }, + { DB_TOKEN, fixNodeHostname, 0 }, + { API_TOKEN, fixNodeHostname, 0 }, + { MGM_TOKEN, fixNodeHostname, 0 }, { "REP", fixNodeHostname, 0 }, //{ "EXTERNAL REP", fixNodeHostname, 0 }, @@ -138,7 +144,10 @@ ConfigInfo::m_SectionRules[] = { { "*", fixDepricated, 0 }, { "*", applyDefaultValues, "system" }, - { "DB", checkDbConstraints, 0 }, + { DB_TOKEN, fixFileSystemPath, 0 }, + { DB_TOKEN, fixBackupDataDir, 0 }, + + { DB_TOKEN, checkDbConstraints, 0 }, /** * checkConnectionConstraints must be after fixExtConnection @@ -153,9 +162,9 @@ ConfigInfo::m_SectionRules[] = { { "*", checkMandatory, 0 }, - { "DB", saveInConfigValues, 0 }, - { "API", saveInConfigValues, 0 }, - { "MGM", saveInConfigValues, 0 }, + { DB_TOKEN, saveInConfigValues, 0 }, + { API_TOKEN, saveInConfigValues, 0 }, + { MGM_TOKEN, saveInConfigValues, 0 }, { "REP", saveInConfigValues, 0 }, { "TCP", saveInConfigValues, 0 }, @@ -196,7 +205,7 @@ struct DepricationTransform { static const DepricationTransform f_deprication[] = { - { "DB", "Discless", "Diskless", 0, 1 }, + { DB_TOKEN, "Discless", "Diskless", 0, 1 }, { 0, 0, 0, 0, 0} }; @@ -302,7 +311,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { CFG_SYS_PRIMARY_MGM_NODE, "PrimaryMGMNode", "SYSTEM", - "Node id of Primary MGM node", + "Node id of Primary "MGM_TOKEN" node", ConfigInfo::USED, false, ConfigInfo::INT, @@ -327,8 +336,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ***************************************************************************/ { CFG_SECTION_NODE, - "DB", - "DB", + DB_TOKEN, + DB_TOKEN, "Node section", ConfigInfo::USED, false, @@ -340,7 +349,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_NODE_HOST, "HostName", - "DB", + DB_TOKEN, "Name of computer for this node", ConfigInfo::INTERNAL, false, @@ -351,7 +360,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_NODE_SYSTEM, "System", - "DB", + DB_TOKEN, "Name of system for this node", ConfigInfo::INTERNAL, false, @@ -362,8 +371,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_NODE_ID, "Id", - "DB", - "Number identifying the database node (DB)", + DB_TOKEN, + "Number identifying the database node ("DB_TOKEN")", ConfigInfo::USED, false, ConfigInfo::INT, @@ -374,7 +383,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { KEY_INTERNAL, "ServerPort", - "DB", + DB_TOKEN, "Port used to setup transporter", ConfigInfo::USED, false, @@ -386,7 +395,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_REPLICAS, "NoOfReplicas", - "DB", + DB_TOKEN, "Number of copies of all data in the database (1-4)", ConfigInfo::USED, false, @@ -398,7 +407,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_ATTRIBUTES, "MaxNoOfAttributes", - "DB", + DB_TOKEN, "Total number of attributes stored in database. I.e. sum over all tables", ConfigInfo::USED, false, @@ -410,7 +419,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_TABLES, "MaxNoOfTables", - "DB", + DB_TOKEN, "Total number of tables stored in the database", ConfigInfo::USED, false, @@ -422,7 +431,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_ORDERED_INDEXES, "MaxNoOfOrderedIndexes", - "DB", + DB_TOKEN, "Total number of ordered indexes that can be defined in the system", ConfigInfo::USED, false, @@ -434,7 +443,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_UNIQUE_HASH_INDEXES, "MaxNoOfUniqueHashIndexes", - "DB", + DB_TOKEN, "Total number of unique hash indexes that can be defined in the system", ConfigInfo::USED, false, @@ -446,7 +455,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_INDEXES, "MaxNoOfIndexes", - "DB", + DB_TOKEN, "Total number of indexes that can be defined in the system", ConfigInfo::DEPRICATED, false, @@ -458,8 +467,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_INDEX_OPS, "MaxNoOfConcurrentIndexOperations", - "DB", - "Total number of index operations that can execute simultaneously on one DB node", + DB_TOKEN, + "Total number of index operations that can execute simultaneously on one "DB_TOKEN" node", ConfigInfo::USED, false, ConfigInfo::INT, @@ -471,7 +480,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_TRIGGERS, "MaxNoOfTriggers", - "DB", + DB_TOKEN, "Total number of triggers that can be defined in the system", ConfigInfo::USED, false, @@ -483,8 +492,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_TRIGGER_OPS, "MaxNoOfFiredTriggers", - "DB", - "Total number of triggers that can fire simultaneously in one DB node", + DB_TOKEN, + "Total number of triggers that can fire simultaneously in one "DB_TOKEN" node", ConfigInfo::USED, false, ConfigInfo::INT, @@ -495,7 +504,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { KEY_INTERNAL, "ExecuteOnComputer", - "DB", + DB_TOKEN, "String referencing an earlier defined COMPUTER", ConfigInfo::USED, false, @@ -506,7 +515,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_SAVE_MSGS, "MaxNoOfSavedMessages", - "DB", + DB_TOKEN, "Max number of error messages in error log and max number of trace files", ConfigInfo::USED, true, @@ -518,7 +527,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_MEMLOCK, "LockPagesInMainMemory", - "DB", + DB_TOKEN, "If set to yes, then NDB Cluster data will not be swapped out to disk", ConfigInfo::USED, true, @@ -530,7 +539,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_WATCHDOG_INTERVAL, "TimeBetweenWatchDogCheck", - "DB", + DB_TOKEN, "Time between execution checks inside a database node", ConfigInfo::USED, true, @@ -542,8 +551,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_STOP_ON_ERROR, "StopOnError", - "DB", - "If set to N, the DB automatically restarts/recovers in case of node failure", + DB_TOKEN, + "If set to N, "DB_TOKEN" automatically restarts/recovers in case of node failure", ConfigInfo::USED, true, ConfigInfo::BOOL, @@ -554,7 +563,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_STOP_ON_ERROR_INSERT, "RestartOnErrorInsert", - "DB", + DB_TOKEN, "See src/kernel/vm/Emulator.hpp NdbRestartType for details", ConfigInfo::INTERNAL, true, @@ -566,7 +575,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_OPS, "MaxNoOfConcurrentOperations", - "DB", + DB_TOKEN, "Max number of operation records in transaction coordinator", ConfigInfo::USED, false, @@ -578,7 +587,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_LOCAL_OPS, "MaxNoOfLocalOperations", - "DB", + DB_TOKEN, "Max number of operation records defined in the local storage node", ConfigInfo::USED, false, @@ -590,7 +599,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_LOCAL_SCANS, "MaxNoOfLocalScans", - "DB", + DB_TOKEN, "Max number of fragment scans in parallel in the local storage node", ConfigInfo::USED, false, @@ -602,7 +611,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_BATCH_SIZE, "BatchSizePerLocalScan", - "DB", + DB_TOKEN, "Used to calculate the number of lock records for scan with hold lock", ConfigInfo::USED, false, @@ -614,8 +623,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_TRANSACTIONS, "MaxNoOfConcurrentTransactions", - "DB", - "Max number of transaction executing concurrently on the DB node", + DB_TOKEN, + "Max number of transaction executing concurrently on the "DB_TOKEN" node", ConfigInfo::USED, false, ConfigInfo::INT, @@ -626,8 +635,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_SCANS, "MaxNoOfConcurrentScans", - "DB", - "Max number of scans executing concurrently on the DB node", + DB_TOKEN, + "Max number of scans executing concurrently on the "DB_TOKEN" node", ConfigInfo::USED, false, ConfigInfo::INT, @@ -638,8 +647,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_TRANS_BUFFER_MEM, "TransactionBufferMemory", - "DB", - "Dynamic buffer space (in bytes) for key and attribute data allocated for each DB node", + DB_TOKEN, + "Dynamic buffer space (in bytes) for key and attribute data allocated for each "DB_TOKEN" node", ConfigInfo::USED, false, ConfigInfo::INT, @@ -650,8 +659,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_INDEX_MEM, "IndexMemory", - "DB", - "Number bytes on each DB node allocated for storing indexes", + DB_TOKEN, + "Number bytes on each "DB_TOKEN" node allocated for storing indexes", ConfigInfo::USED, false, ConfigInfo::INT64, @@ -662,8 +671,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_DATA_MEM, "DataMemory", - "DB", - "Number bytes on each DB node allocated for storing data", + DB_TOKEN, + "Number bytes on each "DB_TOKEN" node allocated for storing data", ConfigInfo::USED, false, ConfigInfo::INT64, @@ -674,8 +683,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_UNDO_INDEX_BUFFER, "UndoIndexBuffer", - "DB", - "Number bytes on each DB node allocated for writing UNDO logs for index part", + DB_TOKEN, + "Number bytes on each "DB_TOKEN" node allocated for writing UNDO logs for index part", ConfigInfo::USED, false, ConfigInfo::INT, @@ -686,8 +695,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_UNDO_DATA_BUFFER, "UndoDataBuffer", - "DB", - "Number bytes on each DB node allocated for writing UNDO logs for data part", + DB_TOKEN, + "Number bytes on each "DB_TOKEN" node allocated for writing UNDO logs for data part", ConfigInfo::USED, false, ConfigInfo::INT, @@ -698,8 +707,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_REDO_BUFFER, "RedoBuffer", - "DB", - "Number bytes on each DB node allocated for writing REDO logs", + DB_TOKEN, + "Number bytes on each "DB_TOKEN" node allocated for writing REDO logs", ConfigInfo::USED, false, ConfigInfo::INT, @@ -710,8 +719,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_LONG_SIGNAL_BUFFER, "LongMessageBuffer", - "DB", - "Number bytes on each DB node allocated for internal long messages", + DB_TOKEN, + "Number bytes on each "DB_TOKEN" node allocated for internal long messages", ConfigInfo::USED, false, ConfigInfo::INT, @@ -722,7 +731,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_START_PARTIAL_TIMEOUT, "StartPartialTimeout", - "DB", + DB_TOKEN, "Time to wait before trying to start wo/ all nodes. 0=Wait forever", ConfigInfo::USED, true, @@ -734,7 +743,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_START_PARTITION_TIMEOUT, "StartPartitionedTimeout", - "DB", + DB_TOKEN, "Time to wait before trying to start partitioned. 0=Wait forever", ConfigInfo::USED, true, @@ -746,7 +755,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_START_FAILURE_TIMEOUT, "StartFailureTimeout", - "DB", + DB_TOKEN, "Time to wait before terminating. 0=Wait forever", ConfigInfo::USED, true, @@ -758,8 +767,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_HEARTBEAT_INTERVAL, "HeartbeatIntervalDbDb", - "DB", - "Time between DB-DB heartbeats. DB considered dead after 3 missed HBs", + DB_TOKEN, + "Time between "DB_TOKEN"-"DB_TOKEN" heartbeats. "DB_TOKEN" considered dead after 3 missed HBs", ConfigInfo::USED, true, ConfigInfo::INT, @@ -770,8 +779,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_API_HEARTBEAT_INTERVAL, "HeartbeatIntervalDbApi", - "DB", - "Time between API-DB heartbeats. API connection closed after 3 missed HBs", + DB_TOKEN, + "Time between "API_TOKEN"-"DB_TOKEN" heartbeats. "API_TOKEN" connection closed after 3 missed HBs", ConfigInfo::USED, true, ConfigInfo::INT, @@ -782,7 +791,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_LCP_INTERVAL, "TimeBetweenLocalCheckpoints", - "DB", + DB_TOKEN, "Time between taking snapshots of the database (expressed in 2log of bytes)", ConfigInfo::USED, true, @@ -794,7 +803,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_GCP_INTERVAL, "TimeBetweenGlobalCheckpoints", - "DB", + DB_TOKEN, "Time between doing group commit of transactions to disk", ConfigInfo::USED, true, @@ -806,8 +815,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_NO_REDOLOG_FILES, "NoOfFragmentLogFiles", - "DB", - "No of 16 Mbyte Redo log files in each of 4 file sets belonging to DB node", + DB_TOKEN, + "No of 16 Mbyte Redo log files in each of 4 file sets belonging to "DB_TOKEN" node", ConfigInfo::USED, false, ConfigInfo::INT, @@ -818,8 +827,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { KEY_INTERNAL, "MaxNoOfOpenFiles", - "DB", - "Max number of files open per DB node.(One thread is created per file)", + DB_TOKEN, + "Max number of files open per "DB_TOKEN" node.(One thread is created per file)", ConfigInfo::USED, false, ConfigInfo::INT, @@ -831,7 +840,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_TRANSACTION_CHECK_INTERVAL, "TimeBetweenInactiveTransactionAbortCheck", - "DB", + DB_TOKEN, "Time between inactive transaction checks", ConfigInfo::USED, true, @@ -843,7 +852,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_TRANSACTION_INACTIVE_TIMEOUT, "TransactionInactiveTimeout", - "DB", + DB_TOKEN, "Time application can wait before executing another transaction part (ms).\n" "This is the time the transaction coordinator waits for the application\n" "to execute or send another part (query, statement) of the transaction.\n" @@ -859,7 +868,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT, "TransactionDeadlockDetectionTimeout", - "DB", + DB_TOKEN, "Time transaction can be executing in a DB node (ms).\n" "This is the time the transaction coordinator waits for each database node\n" "of the transaction to execute a request. If the database node takes too\n" @@ -874,7 +883,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { KEY_INTERNAL, "NoOfDiskPagesToDiskDuringRestartTUP", - "DB", + DB_TOKEN, "?", ConfigInfo::USED, true, @@ -886,7 +895,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { KEY_INTERNAL, "NoOfDiskPagesToDiskAfterRestartTUP", - "DB", + DB_TOKEN, "?", ConfigInfo::USED, true, @@ -898,7 +907,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { KEY_INTERNAL, "NoOfDiskPagesToDiskDuringRestartACC", - "DB", + DB_TOKEN, "?", ConfigInfo::USED, true, @@ -910,7 +919,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { KEY_INTERNAL, "NoOfDiskPagesToDiskAfterRestartACC", - "DB", + DB_TOKEN, "?", ConfigInfo::USED, true, @@ -923,7 +932,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_DISCLESS, "Diskless", - "DB", + DB_TOKEN, "Run wo/ disk", ConfigInfo::USED, true, @@ -935,7 +944,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { KEY_INTERNAL, "Discless", - "DB", + DB_TOKEN, "Diskless", ConfigInfo::DEPRICATED, true, @@ -949,7 +958,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_ARBIT_TIMEOUT, "ArbitrationTimeout", - "DB", + DB_TOKEN, "Max time (milliseconds) database partion waits for arbitration signal", ConfigInfo::USED, false, @@ -959,20 +968,31 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { STR_VALUE(MAX_INT_RNIL) }, { - CFG_DB_FILESYSTEM_PATH, - "FileSystemPath", - "DB", - "Path to directory where the DB node stores its data (directory must exist)", + CFG_NODE_DATADIR, + "DataDir", + DB_TOKEN, + "Data directory for this node", ConfigInfo::USED, false, ConfigInfo::STRING, - DATADIR, + MYSQLCLUSTERDIR, + 0, 0 }, + + { + CFG_DB_FILESYSTEM_PATH, + "FileSystemPath", + DB_TOKEN, + "Path to directory where the "DB_TOKEN" node stores its data (directory must exist)", + ConfigInfo::USED, + false, + ConfigInfo::STRING, + UNDEFINED, 0, 0 }, { CFG_LOGLEVEL_STARTUP, "LogLevelStartup", - "DB", + DB_TOKEN, "Node startup info printed on stdout", ConfigInfo::USED, false, @@ -984,7 +1004,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_LOGLEVEL_SHUTDOWN, "LogLevelShutdown", - "DB", + DB_TOKEN, "Node shutdown info printed on stdout", ConfigInfo::USED, false, @@ -996,7 +1016,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_LOGLEVEL_STATISTICS, "LogLevelStatistic", - "DB", + DB_TOKEN, "Transaction, operation, transporter info printed on stdout", ConfigInfo::USED, false, @@ -1008,7 +1028,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_LOGLEVEL_CHECKPOINT, "LogLevelCheckpoint", - "DB", + DB_TOKEN, "Local and Global checkpoint info printed on stdout", ConfigInfo::USED, false, @@ -1020,7 +1040,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_LOGLEVEL_NODERESTART, "LogLevelNodeRestart", - "DB", + DB_TOKEN, "Node restart, node failure info printed on stdout", ConfigInfo::USED, false, @@ -1032,7 +1052,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_LOGLEVEL_CONNECTION, "LogLevelConnection", - "DB", + DB_TOKEN, "Node connect/disconnect info printed on stdout", ConfigInfo::USED, false, @@ -1044,7 +1064,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_LOGLEVEL_ERROR, "LogLevelError", - "DB", + DB_TOKEN, "Transporter, heartbeat errors printed on stdout", ConfigInfo::USED, false, @@ -1056,7 +1076,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_LOGLEVEL_INFO, "LogLevelInfo", - "DB", + DB_TOKEN, "Heartbeat and log info printed on stdout", ConfigInfo::USED, false, @@ -1071,7 +1091,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_PARALLEL_BACKUPS, "ParallelBackups", - "DB", + DB_TOKEN, "Maximum number of parallel backups", ConfigInfo::NOTIMPLEMENTED, false, @@ -1080,10 +1100,21 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { "1", "1" }, + { + CFG_DB_BACKUP_DATADIR, + "BackupDataDir", + DB_TOKEN, + "Path to where to store backups", + ConfigInfo::USED, + false, + ConfigInfo::STRING, + UNDEFINED, + 0, 0 }, + { CFG_DB_BACKUP_MEM, "BackupMemory", - "DB", + DB_TOKEN, "Total memory allocated for backups per node (in bytes)", ConfigInfo::USED, false, @@ -1095,7 +1126,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_BACKUP_DATA_BUFFER_MEM, "BackupDataBufferSize", - "DB", + DB_TOKEN, "Default size of databuffer for a backup (in bytes)", ConfigInfo::USED, false, @@ -1107,7 +1138,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_BACKUP_LOG_BUFFER_MEM, "BackupLogBufferSize", - "DB", + DB_TOKEN, "Default size of logbuffer for a backup (in bytes)", ConfigInfo::USED, false, @@ -1119,7 +1150,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_DB_BACKUP_WRITE_SIZE, "BackupWriteSize", - "DB", + DB_TOKEN, "Default size of filesystem writes made by backup (in bytes)", ConfigInfo::USED, false, @@ -1205,8 +1236,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ***************************************************************************/ { CFG_SECTION_NODE, - "API", - "API", + API_TOKEN, + API_TOKEN, "Node section", ConfigInfo::USED, false, @@ -1218,7 +1249,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_NODE_HOST, "HostName", - "API", + API_TOKEN, "Name of computer for this node", ConfigInfo::INTERNAL, false, @@ -1229,7 +1260,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_NODE_SYSTEM, "System", - "API", + API_TOKEN, "Name of system for this node", ConfigInfo::INTERNAL, false, @@ -1240,8 +1271,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_NODE_ID, "Id", - "API", - "Number identifying application node (API)", + API_TOKEN, + "Number identifying application node ("API_TOKEN")", ConfigInfo::USED, false, ConfigInfo::INT, @@ -1252,7 +1283,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { KEY_INTERNAL, "ExecuteOnComputer", - "API", + API_TOKEN, "String referencing an earlier defined COMPUTER", ConfigInfo::USED, false, @@ -1263,8 +1294,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_NODE_ARBIT_RANK, "ArbitrationRank", - "API", - "If 0, then API is not arbitrator. Kernel selects arbitrators in order 1, 2", + API_TOKEN, + "If 0, then "API_TOKEN" is not arbitrator. Kernel selects arbitrators in order 1, 2", ConfigInfo::USED, false, ConfigInfo::INT, @@ -1275,7 +1306,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_NODE_ARBIT_DELAY, "ArbitrationDelay", - "API", + API_TOKEN, "When asked to arbitrate, arbitrator waits this long before voting (msec)", ConfigInfo::USED, false, @@ -1325,8 +1356,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ***************************************************************************/ { CFG_SECTION_NODE, - "MGM", - "MGM", + MGM_TOKEN, + MGM_TOKEN, "Node section", ConfigInfo::USED, false, @@ -1338,7 +1369,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_NODE_HOST, "HostName", - "MGM", + MGM_TOKEN, "Name of computer for this node", ConfigInfo::INTERNAL, false, @@ -1346,10 +1377,21 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { UNDEFINED, 0, 0 }, + { + CFG_NODE_DATADIR, + "DataDir", + MGM_TOKEN, + "Data directory for this node", + ConfigInfo::USED, + false, + ConfigInfo::STRING, + MYSQLCLUSTERDIR, + 0, 0 }, + { CFG_NODE_SYSTEM, "System", - "MGM", + MGM_TOKEN, "Name of system for this node", ConfigInfo::INTERNAL, false, @@ -1360,8 +1402,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_NODE_ID, "Id", - "MGM", - "Number identifying the management server node (MGM)", + MGM_TOKEN, + "Number identifying the management server node ("MGM_TOKEN")", ConfigInfo::USED, false, ConfigInfo::INT, @@ -1372,7 +1414,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_LOG_DESTINATION, "LogDestination", - "MGM", + MGM_TOKEN, "String describing where logmessages are sent", ConfigInfo::USED, false, @@ -1383,7 +1425,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { KEY_INTERNAL, "ExecuteOnComputer", - "MGM", + MGM_TOKEN, "String referencing an earlier defined COMPUTER", ConfigInfo::USED, false, @@ -1394,7 +1436,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { KEY_INTERNAL, "MaxNoOfSavedEvents", - "MGM", + MGM_TOKEN, "", ConfigInfo::USED, false, @@ -1406,7 +1448,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_MGM_PORT, "PortNumber", - "MGM", + MGM_TOKEN, "Port number to give commands to/fetch configurations from management server", ConfigInfo::USED, false, @@ -1418,7 +1460,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { KEY_INTERNAL, "PortNumberStats", - "MGM", + MGM_TOKEN, "Port number used to get statistical information from a management server", ConfigInfo::USED, false, @@ -1430,8 +1472,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_NODE_ARBIT_RANK, "ArbitrationRank", - "MGM", - "If 0, then MGM is not arbitrator. Kernel selects arbitrators in order 1, 2", + MGM_TOKEN, + "If 0, then "MGM_TOKEN" is not arbitrator. Kernel selects arbitrators in order 1, 2", ConfigInfo::USED, false, ConfigInfo::INT, @@ -1442,7 +1484,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { { CFG_NODE_ARBIT_DELAY, "ArbitrationDelay", - "MGM", + MGM_TOKEN, "", ConfigInfo::USED, false, @@ -1492,7 +1534,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { CFG_CONNECTION_NODE_1, "NodeId1", "TCP", - "Id of node (DB, API or MGM) on one side of the connection", + "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", ConfigInfo::USED, false, ConfigInfo::STRING, @@ -1503,7 +1545,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { CFG_CONNECTION_NODE_2, "NodeId2", "TCP", - "Id of node (DB, API or MGM) on one side of the connection", + "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", ConfigInfo::USED, false, ConfigInfo::STRING, @@ -1623,7 +1665,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { CFG_CONNECTION_NODE_1, "NodeId1", "SHM", - "Id of node (DB, API or MGM) on one side of the connection", + "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", ConfigInfo::USED, false, ConfigInfo::STRING, @@ -1646,7 +1688,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { CFG_CONNECTION_NODE_2, "NodeId2", "SHM", - "Id of node (DB, API or MGM) on one side of the connection", + "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", ConfigInfo::USED, false, ConfigInfo::STRING, @@ -1743,7 +1785,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { CFG_CONNECTION_NODE_1, "NodeId1", "SCI", - "Id of node (DB, API or MGM) on one side of the connection", + "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", ConfigInfo::USED, false, ConfigInfo::INT, @@ -1755,7 +1797,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { CFG_CONNECTION_NODE_2, "NodeId2", "SCI", - "Id of node (DB, API or MGM) on one side of the connection", + "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", ConfigInfo::USED, false, ConfigInfo::INT, @@ -1898,7 +1940,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { CFG_CONNECTION_NODE_1, "NodeId1", "OSE", - "Id of node (DB, API or MGM) on one side of the connection", + "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", ConfigInfo::USED, false, ConfigInfo::INT, @@ -1910,7 +1952,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { CFG_CONNECTION_NODE_2, "NodeId2", "OSE", - "Id of node (DB, API or MGM) on one side of the connection", + "Id of node ("DB_TOKEN", "API_TOKEN" or "MGM_TOKEN") on one side of the connection", ConfigInfo::USED, false, ConfigInfo::INT, @@ -2232,7 +2274,7 @@ ConfigInfo::getDescription(const Properties * section, bool ConfigInfo::isSection(const char * section) const { for (int i = 0; iget("ExecuteOnComputer", &compId)){ const char * type; - if(ctx.m_currentSection->get("Type", &type) && strcmp(type,"DB") == 0) + if(ctx.m_currentSection->get("Type", &type) && strcmp(type,DB_TOKEN) == 0) require(ctx.m_currentSection->put("HostName", "localhost")); else require(ctx.m_currentSection->put("HostName", "")); @@ -2463,6 +2505,39 @@ fixNodeHostname(InitConfigFileParser::Context & ctx, const char * data){ return checkLocalhostHostnameMix(ctx); } +bool +fixFileSystemPath(InitConfigFileParser::Context & ctx, const char * data){ + DBUG_ENTER("fixFileSystemPath"); + + const char * path; + if (ctx.m_currentSection->get("FileSystemPath", &path)) + DBUG_RETURN(true); + + if (ctx.m_currentSection->get("DataDir", &path)) { + require(ctx.m_currentSection->put("FileSystemPath", path)); + DBUG_RETURN(true); + } + + require(false); + DBUG_RETURN(false); +} + +bool +fixBackupDataDir(InitConfigFileParser::Context & ctx, const char * data){ + + const char * path; + if (ctx.m_currentSection->get("BackupDataDir", &path)) + return true; + + if (ctx.m_currentSection->get("FileSystemPath", &path)) { + require(ctx.m_currentSection->put("BackupDataDir", path)); + return true; + } + + require(false); + return false; +} + bool transformExtNode(InitConfigFileParser::Context & ctx, const char * data){ @@ -2804,10 +2879,16 @@ fixHostname(InitConfigFileParser::Context & ctx, const char * data){ static bool fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){ + DBUG_ENTER("fixPortNumber"); + Uint32 id1= 0, id2= 0; require(ctx.m_currentSection->get("NodeId1", &id1)); require(ctx.m_currentSection->get("NodeId2", &id2)); - id1 = id1 < id2 ? id1 : id2; + if (id1 > id2) { + Uint32 tmp= id1; + id1= id2; + id2= tmp; + } const Properties * node; require(ctx.m_config->get("Node", id1, &node)); @@ -2816,7 +2897,7 @@ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){ if (hostname.c_str()[0] == 0) { ctx.reportError("Hostname required on nodeid %d since it will act as server.", id1); - return false; + DBUG_RETURN(false); } Uint32 port= 0; @@ -2849,7 +2930,9 @@ fixPortNumber(InitConfigFileParser::Context & ctx, const char * data){ } else ctx.m_currentSection->put("PortNumber", port); - return true; + DBUG_PRINT("info", ("connection %d-%d port %d host %s", id1, id2, port, hostname.c_str())); + + DBUG_RETURN(true); } /** @@ -2934,8 +3017,8 @@ checkConnectionConstraints(InitConfigFileParser::Context & ctx, const char *){ * -# Not both of them are MGMs * -# None of them contain a "SystemX" name */ - if((strcmp(type1, "DB") != 0 && strcmp(type2, "DB") != 0) && - !(strcmp(type1, "MGM") == 0 && strcmp(type2, "MGM") == 0) && + if((strcmp(type1, DB_TOKEN) != 0 && strcmp(type2, DB_TOKEN) != 0) && + !(strcmp(type1, MGM_TOKEN) == 0 && strcmp(type2, MGM_TOKEN) == 0) && !ctx.m_currentSection->contains("System1") && !ctx.m_currentSection->contains("System2")){ ctx.reportError("Invalid connection between node %d (%s) and node %d (%s)" @@ -3183,10 +3266,10 @@ add_node_connections(Vector§ions, const char * type; if(!tmp->get("Type", &type)) continue; - if (strcmp(type,"DB") == 0) + if (strcmp(type,DB_TOKEN) == 0) p_db_nodes.put("", i_db++, i); - else if (strcmp(type,"API") == 0 || - strcmp(type,"MGM") == 0) + else if (strcmp(type,API_TOKEN) == 0 || + strcmp(type,MGM_TOKEN) == 0) p_api_mgm_nodes.put("", i_api_mgm++, i); } @@ -3259,7 +3342,7 @@ static bool add_server_ports(Vector§ions, Uint32 adder= 0; computers.get("",computer, &adder); - if (strcmp(type,"DB") == 0) { + if (strcmp(type,DB_TOKEN) == 0) { adder++; tmp->put("ServerPort", port_base+adder); computers.put("",computer, adder); @@ -3276,7 +3359,7 @@ check_node_vs_replicas(Vector§ions, { Uint32 db_nodes = 0; Uint32 replicas = 0; - ctx.m_userProperties.get("DB", &db_nodes); + ctx.m_userProperties.get(DB_TOKEN, &db_nodes); ctx.m_userProperties.get("NoOfReplicas", &replicas); if((db_nodes % replicas) != 0){ ctx.reportError("Invalid no of db nodes wrt no of replicas.\n" diff --git a/ndb/src/common/mgmcommon/ConfigInfo.hpp b/ndb/src/mgmsrv/ConfigInfo.hpp similarity index 100% rename from ndb/src/common/mgmcommon/ConfigInfo.hpp rename to ndb/src/mgmsrv/ConfigInfo.hpp diff --git a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp b/ndb/src/mgmsrv/InitConfigFileParser.cpp similarity index 99% rename from ndb/src/common/mgmcommon/InitConfigFileParser.cpp rename to ndb/src/mgmsrv/InitConfigFileParser.cpp index 833a2efab9d..652e0f96190 100644 --- a/ndb/src/common/mgmcommon/InitConfigFileParser.cpp +++ b/ndb/src/mgmsrv/InitConfigFileParser.cpp @@ -480,10 +480,6 @@ InitConfigFileParser::parseSectionHeader(const char* line) const { tmp[0] = ' '; trim(tmp); - // Convert section header to upper - for(int i= strlen(tmp)-1; i >= 0; i--) - tmp[i]= toupper(tmp[i]); - // Get the correct header name if an alias { const char *tmp_alias= m_info->getAlias(tmp); diff --git a/ndb/src/common/mgmcommon/InitConfigFileParser.hpp b/ndb/src/mgmsrv/InitConfigFileParser.hpp similarity index 100% rename from ndb/src/common/mgmcommon/InitConfigFileParser.hpp rename to ndb/src/mgmsrv/InitConfigFileParser.hpp diff --git a/ndb/src/mgmsrv/Makefile.am b/ndb/src/mgmsrv/Makefile.am index 630a19e0356..60b579d18e1 100644 --- a/ndb/src/mgmsrv/Makefile.am +++ b/ndb/src/mgmsrv/Makefile.am @@ -1,3 +1,7 @@ +MYSQLDATAdir = $(localstatedir) +MYSQLSHAREdir = $(pkgdatadir) +MYSQLBASEdir= $(prefix) +MYSQLCLUSTERdir= $(prefix)/mysql-cluster ndbbin_PROGRAMS = ndb_mgmd @@ -11,6 +15,9 @@ ndb_mgmd_SOURCES = \ NodeLogLevelList.cpp \ SignalQueue.cpp \ MgmtSrvrConfig.cpp \ + ConfigInfo.cpp \ + InitConfigFileParser.cpp \ + Config.cpp \ CommandInterpreter.cpp INCLUDES_LOC = -I$(top_srcdir)/ndb/src/ndbapi \ @@ -24,6 +31,12 @@ LDADD_LOC = $(top_builddir)/ndb/src/libndbclient.la \ $(top_builddir)/strings/libmystrings.a @TERMCAP_LIB@ +DEFS_LOC = -DDEFAULT_MYSQL_HOME="\"$(MYSQLBASEdir)\"" \ + -DDATADIR="\"$(MYSQLDATAdir)\"" \ + -DSHAREDIR="\"$(MYSQLSHAREdir)\"" \ + -DMYSQLCLUSTERDIR="\"$(MYSQLCLUSTERdir)\"" \ + -DNDB_BASE_PORT="\"@ndb_port_base@\"" + include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/type_ndbapi.mk.am diff --git a/ndb/src/mgmsrv/MgmtSrvr.cpp b/ndb/src/mgmsrv/MgmtSrvr.cpp index 0936ec234cf..e54323ea156 100644 --- a/ndb/src/mgmsrv/MgmtSrvr.cpp +++ b/ndb/src/mgmsrv/MgmtSrvr.cpp @@ -19,6 +19,7 @@ #include "MgmtSrvr.hpp" #include "MgmtErrorReporter.hpp" +#include #include #include @@ -512,6 +513,8 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId, theConfCount(0), m_allocated_resources(*this) { + DBUG_ENTER("MgmtSrvr::MgmtSrvr"); + _config = NULL; _isStatPortActive = false; _isClusterLogStatActive = false; @@ -543,37 +546,39 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId, for(Uint32 i = 0; im_configValues, CFG_SECTION_NODE); - for(ndb_mgm_first(iter); ndb_mgm_valid(iter); ndb_mgm_next(iter)){ - unsigned type, id; - if(ndb_mgm_get_int_parameter(iter, CFG_TYPE_OF_SECTION, &type) != 0) - continue; - - if(ndb_mgm_get_int_parameter(iter, CFG_NODE_ID, &id) != 0) - continue; - - MGM_REQUIRE(id < MAX_NODES); + { + ndb_mgm_configuration_iterator * iter = ndb_mgm_create_configuration_iterator + (config->m_configValues, CFG_SECTION_NODE); + for(ndb_mgm_first(iter); ndb_mgm_valid(iter); ndb_mgm_next(iter)){ + unsigned type, id; + if(ndb_mgm_get_int_parameter(iter, CFG_TYPE_OF_SECTION, &type) != 0) + continue; - switch(type){ - case NODE_TYPE_DB: - nodeTypes[id] = NDB_MGM_NODE_TYPE_NDB; - break; - case NODE_TYPE_API: - nodeTypes[id] = NDB_MGM_NODE_TYPE_API; - break; - case NODE_TYPE_MGM: - nodeTypes[id] = NDB_MGM_NODE_TYPE_MGM; - break; - case NODE_TYPE_REP: - nodeTypes[id] = NDB_MGM_NODE_TYPE_REP; - break; - case NODE_TYPE_EXT_REP: - default: - break; + if(ndb_mgm_get_int_parameter(iter, CFG_NODE_ID, &id) != 0) + continue; + + MGM_REQUIRE(id < MAX_NODES); + + switch(type){ + case NODE_TYPE_DB: + nodeTypes[id] = NDB_MGM_NODE_TYPE_NDB; + break; + case NODE_TYPE_API: + nodeTypes[id] = NDB_MGM_NODE_TYPE_API; + break; + case NODE_TYPE_MGM: + nodeTypes[id] = NDB_MGM_NODE_TYPE_MGM; + break; + case NODE_TYPE_REP: + nodeTypes[id] = NDB_MGM_NODE_TYPE_REP; + break; + case NODE_TYPE_EXT_REP: + default: + break; + } } + ndb_mgm_destroy_iterator(iter); } - ndb_mgm_destroy_iterator(iter); m_statisticsListner = NULL; @@ -589,6 +594,18 @@ MgmtSrvr::MgmtSrvr(NodeId nodeId, exit(-1); } _ownNodeId = tmp; + + + { + DBUG_PRINT("info", ("verifyConfig")); + ConfigRetriever cr(NDB_VERSION, NDB_MGM_NODE_TYPE_MGM); + if (!cr.verifyConfig(config->m_configValues, _ownNodeId)) { + ndbout << cr.getErrorString() << endl; + exit(-1); + } + } + + DBUG_VOID_RETURN; } diff --git a/ndb/src/mgmsrv/main.cpp b/ndb/src/mgmsrv/main.cpp index 511043e62c9..8e031e42ada 100644 --- a/ndb/src/mgmsrv/main.cpp +++ b/ndb/src/mgmsrv/main.cpp @@ -109,7 +109,7 @@ struct getargs args[] = { "Specify cluster configuration file", "filename" }, #ifndef DBUG_OFF { "debug", 0, arg_string, &debug_option, - "Specify debug option e.d. d:t:i:o,out.trace", "options" }, + "Specify debug options e.g. d:t:i:o,out.trace", "options" }, #endif { "daemon", 'd', arg_flag, &glob.daemon, "Run ndb_mgmd in daemon mode" }, @@ -143,8 +143,8 @@ NDB_MAIN(mgmsrv){ exit(1); } - my_init(); #ifndef DBUG_OFF + my_init(); if (debug_option) DBUG_PUSH(debug_option); #endif diff --git a/ndb/src/ndbapi/NdbBlob.cpp b/ndb/src/ndbapi/NdbBlob.cpp index 65e1aeedda7..7939f54d846 100644 --- a/ndb/src/ndbapi/NdbBlob.cpp +++ b/ndb/src/ndbapi/NdbBlob.cpp @@ -145,6 +145,7 @@ NdbBlob::init() theNdbOp = NULL; theTable = NULL; theAccessTable = NULL; + theBlobTable = NULL; theColumn = NULL; theFillChar = 0; theInlineSize = 0; @@ -1028,9 +1029,9 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* // sanity check assert((NDB_BLOB_HEAD_SIZE << 2) == sizeof(Head)); assert(theColumn->m_attrSize * theColumn->m_arraySize == sizeof(Head) + theInlineSize); - const NdbDictionary::Table* bt; - const NdbDictionary::Column* bc; if (thePartSize > 0) { + const NdbDictionary::Table* bt = NULL; + const NdbDictionary::Column* bc = NULL; if (theStripeSize == 0 || (bt = theColumn->getBlobTable()) == NULL || (bc = bt->getColumn("DATA")) == NULL || @@ -1039,8 +1040,8 @@ NdbBlob::atPrepare(NdbConnection* aCon, NdbOperation* anOp, const NdbColumnImpl* setErrorCode(ErrTable); return -1; } + theBlobTable = &NdbTableImpl::getImpl(*bt); } - theBlobTable = & NdbTableImpl::getImpl(*bt); // buffers theKeyBuf.alloc(theTable->m_sizeOfKeysInWords << 2); theAccessKeyBuf.alloc(theAccessTable->m_sizeOfKeysInWords << 2); diff --git a/ndb/src/ndbapi/NdbDictionaryImpl.cpp b/ndb/src/ndbapi/NdbDictionaryImpl.cpp index e7a3a1f8e86..6a776dfc6d2 100644 --- a/ndb/src/ndbapi/NdbDictionaryImpl.cpp +++ b/ndb/src/ndbapi/NdbDictionaryImpl.cpp @@ -699,7 +699,7 @@ NdbDictInterface::~NdbDictInterface() { if (m_transporter != NULL){ if (m_blockNumber != -1) - m_transporter->close(m_blockNumber); + m_transporter->close(m_blockNumber, 0); } } diff --git a/ndb/src/ndbapi/NdbScanOperation.cpp b/ndb/src/ndbapi/NdbScanOperation.cpp index 85dec939efb..22f9eb16f1d 100644 --- a/ndb/src/ndbapi/NdbScanOperation.cpp +++ b/ndb/src/ndbapi/NdbScanOperation.cpp @@ -1184,13 +1184,11 @@ NdbIndexScanOperation::fix_get_values(){ for(Uint32 i = 0; im_columns[i]; - NdbColumnImpl * col = tab->getColumn(key->m_keyInfoPos); - curr->setup(col, 0); - } - break; + case FAKE_PTR: + curr->setup(curr->m_column, 0); case API_PTR: + curr = curr->next(); + break; case SETBOUND_EQ: break; #ifdef VM_TRACE @@ -1198,7 +1196,6 @@ NdbIndexScanOperation::fix_get_values(){ abort(); #endif } - curr = curr->next(); } } diff --git a/ndb/src/ndbapi/Ndbif.cpp b/ndb/src/ndbapi/Ndbif.cpp index 7ad37401b9a..7ad51efdb62 100644 --- a/ndb/src/ndbapi/Ndbif.cpp +++ b/ndb/src/ndbapi/Ndbif.cpp @@ -97,7 +97,7 @@ Ndb::init(int aMaxNoOfTransactions) } theFirstTransId = ((Uint64)theNdbBlockNumber << 52)+((Uint64)theNode << 40); - theFirstTransId += theFacade->m_open_count; + theFirstTransId += theFacade->m_max_trans_id; theFacade->unlock_mutex(); @@ -175,7 +175,7 @@ error_handler: freeOperation(); delete theDictionary; - TransporterFacade::instance()->close(theNdbBlockNumber); + TransporterFacade::instance()->close(theNdbBlockNumber, 0); return -1; } diff --git a/ndb/src/ndbapi/Ndbinit.cpp b/ndb/src/ndbapi/Ndbinit.cpp index be168ddffbe..b09696d5262 100644 --- a/ndb/src/ndbapi/Ndbinit.cpp +++ b/ndb/src/ndbapi/Ndbinit.cpp @@ -195,9 +195,9 @@ Ndb::~Ndb() NdbGlobalEventBuffer_drop(theGlobalEventBufferHandle); if (TransporterFacade::instance() != NULL && theNdbBlockNumber > 0){ - TransporterFacade::instance()->close(theNdbBlockNumber); + TransporterFacade::instance()->close(theNdbBlockNumber, theFirstTransId); } - + NdbMutex_Lock(&createNdbMutex); theNoOfNdbObjects -= 1; diff --git a/ndb/src/ndbapi/TransporterFacade.cpp b/ndb/src/ndbapi/TransporterFacade.cpp index 65d7c1738d7..852996e92c0 100644 --- a/ndb/src/ndbapi/TransporterFacade.cpp +++ b/ndb/src/ndbapi/TransporterFacade.cpp @@ -548,10 +548,10 @@ TransporterFacade::TransporterFacade() : theClusterMgr = NULL; theArbitMgr = NULL; theStartNodeId = 1; - m_open_count = 0; m_scan_batch_size= MAX_SCAN_BATCH_SIZE; m_batch_byte_size= SCAN_BATCH_SIZE; m_batch_size= DEF_BATCH_SIZE; + m_max_trans_id = 0; } bool @@ -698,9 +698,11 @@ TransporterFacade::ReportNodeAlive(NodeId tNodeId) } int -TransporterFacade::close(BlockNumber blockNumber) +TransporterFacade::close(BlockNumber blockNumber, Uint64 trans_id) { NdbMutex_Lock(theMutexPtr); + Uint32 low_bits = (Uint32)trans_id; + m_max_trans_id = m_max_trans_id > low_bits ? m_max_trans_id : low_bits; close_local(blockNumber); NdbMutex_Unlock(theMutexPtr); return 0; @@ -717,7 +719,6 @@ TransporterFacade::open(void* objRef, ExecuteFunction fun, NodeStatusFunction statusFun) { - m_open_count++; return m_threads.open(objRef, fun, statusFun); } diff --git a/ndb/src/ndbapi/TransporterFacade.hpp b/ndb/src/ndbapi/TransporterFacade.hpp index 8489b8c9419..1ecdfab1e31 100644 --- a/ndb/src/ndbapi/TransporterFacade.hpp +++ b/ndb/src/ndbapi/TransporterFacade.hpp @@ -67,7 +67,7 @@ public: int open(void* objRef, ExecuteFunction, NodeStatusFunction); // Close this block number - int close(BlockNumber blockNumber); + int close(BlockNumber blockNumber, Uint64 trans_id); // Only sends to nodes which are alive int sendSignal(NdbApiSignal * signal, NodeId nodeId); @@ -220,9 +220,9 @@ private: return (m_statusNext[index] & (1 << 16)) != 0; } } m_threads; - - Uint32 m_open_count; - + + Uint32 m_max_trans_id; + /** * execute function */ diff --git a/ndb/test/include/NdbBackup.hpp b/ndb/test/include/NdbBackup.hpp index 0a372eca7df..e2e672b8a72 100644 --- a/ndb/test/include/NdbBackup.hpp +++ b/ndb/test/include/NdbBackup.hpp @@ -47,7 +47,7 @@ private: int _node_id, unsigned _backup_id); - const char * getFileSystemPathForNode(int _node_id); + const char * getBackupDataDirForNode(int _node_id); }; diff --git a/ndb/test/ndbapi/testDict.cpp b/ndb/test/ndbapi/testDict.cpp index e7597c26960..a0c7bb1414b 100644 --- a/ndb/test/ndbapi/testDict.cpp +++ b/ndb/test/ndbapi/testDict.cpp @@ -1002,11 +1002,13 @@ int runGetPrimaryKey(NDBT_Context* ctx, NDBT_Step* step){ return result; } -int +struct ErrorCodes { int error_id; bool crash;}; +ErrorCodes NF_codes[] = { - 6003 - ,6004 - //,6005 + {6003, true}, + {6004, true}, + //,6005, true, + {7173, false} }; int @@ -1042,7 +1044,9 @@ runNF1(NDBT_Context* ctx, NDBT_Step* step){ for(int i = 0; i 50){ - CHECK2(restarter.startNodes(&nodeId, 1) == 0, + if(myRandom48(100) > 50){ + CHECK2(restarter.startNodes(&nodeId, 1) == 0, "failed to start node"); - CHECK2(restarter.waitClusterStarted() == 0, + CHECK2(restarter.waitClusterStarted() == 0, "waitClusterStarted failed"); - CHECK2(dict->dropTable(pTab->getName()) == 0, + CHECK2(dict->dropTable(pTab->getName()) == 0, "drop table failed"); - } else { - CHECK2(dict->dropTable(pTab->getName()) == 0, + } else { + CHECK2(dict->dropTable(pTab->getName()) == 0, "drop table failed"); - CHECK2(restarter.startNodes(&nodeId, 1) == 0, + CHECK2(restarter.startNodes(&nodeId, 1) == 0, "failed to start node"); - CHECK2(restarter.waitClusterStarted() == 0, + CHECK2(restarter.waitClusterStarted() == 0, "waitClusterStarted failed"); - } + } - CHECK2(restarter.dumpStateOneNode(nodeId, &val, 1) == 0, + CHECK2(restarter.dumpStateOneNode(nodeId, &val, 1) == 0, "Failed to set LCP to min value"); + } } } end: @@ -1299,7 +1305,7 @@ runTableRenameNF(NDBT_Context* ctx, NDBT_Step* step){ const int numNodes = restarter.getNumDbNodes(); for(int i = 0; icset->scan(cs, from, from+len, MY_SEQ_SPACES); @@ -1781,7 +1781,7 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs) #if SIZEOF_LONG > 4 if (unsigned_flag) { - if (tmp > UINT_MAX32) + if ((ulong) tmp > UINT_MAX32) { tmp= UINT_MAX32; error= 1; @@ -4277,27 +4277,17 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs) int Field_str::store(double nr) { - bool use_scientific_notation=TRUE; char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE]; uint length; - if (field_length < 32 && nr > 1) // TODO: negative numbers - { - if (ceiling == 0) - { - static double e[]= {1e1, 1e2, 1e4, 1e8, 1e16 }; - double p= 1; - for (int i= sizeof(e)/sizeof(e[0]), j= 1<>= 1 ) - { - if (field_length & j) - p*= e[i]; - } - ceiling= p-1; - } - use_scientific_notation= (ceiling < nr); - } - length= (uint)sprintf(buff, "%-.*g", - use_scientific_notation ? max(0,(int)field_length-5) : field_length, - nr); + bool use_scientific_notation= TRUE; + use_scientific_notation= TRUE; +if (field_length < 32 && fabs(nr) < log_10[field_length]-1) + use_scientific_notation= FALSE; + length= (uint) my_sprintf(buff, (buff, "%-.*g", + (use_scientific_notation ? + max(0, (int)field_length-5) : + field_length), + nr)); /* +1 below is because "precision" in %g above means the max. number of significant digits, not the output width. @@ -4310,6 +4300,7 @@ int Field_str::store(double nr) return store((const char *)buff, min(length, field_length), charset()); } + int Field_string::store(longlong nr) { char buff[64]; @@ -4403,9 +4394,8 @@ char *Field_string::pack(char *to, const char *from, uint max_length) char *Field_string::pack_key(char *to, const char *from, uint max_length) { - int length=min(field_length,max_length); - uint char_length= (field_charset->mbmaxlen > 1) ? - max_length/field_charset->mbmaxlen : max_length; + uint length= min(field_length,max_length); + uint char_length= max_length/field_charset->mbmaxlen; if (length > char_length) char_length= my_charpos(field_charset, from, from+length, char_length); set_if_smaller(length, char_length); diff --git a/sql/field.h b/sql/field.h index eaf90ddc0ff..9cce7b9541b 100644 --- a/sql/field.h +++ b/sql/field.h @@ -336,14 +336,13 @@ public: class Field_str :public Field { protected: CHARSET_INFO *field_charset; - double ceiling; // for ::store(double nr) public: Field_str(char *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, struct st_table *table_arg,CHARSET_INFO *charset) :Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, table_arg), ceiling(0.0) + unireg_check_arg, field_name_arg, table_arg) { field_charset=charset; if (charset->state & MY_CS_BINSORT) diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc index 7a445ed8c4d..cb97febea32 100644 --- a/sql/gen_lex_hash.cc +++ b/sql/gen_lex_hash.cc @@ -362,7 +362,7 @@ static int get_options(int argc, char **argv) { int ho_error; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, 0))) exit(ho_error); if (argc >= 1) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 80b8c21fa0c..8146426fed0 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -2559,6 +2559,8 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) When using LOCK TABLE's external_lock is only called when the actual TABLE LOCK is done. Under LOCK TABLES, each used tables will force a call to start_stmt. + Ndb doesn't currently support table locks, and will do ordinary + startTransaction for each transaction/statement. */ int ha_ndbcluster::start_stmt(THD *thd) @@ -2574,7 +2576,9 @@ int ha_ndbcluster::start_stmt(THD *thd) NdbConnection *tablock_trans= (NdbConnection*)thd->transaction.all.ndb_tid; DBUG_PRINT("info", ("tablock_trans: %x", (uint)tablock_trans)); - DBUG_ASSERT(tablock_trans); trans= m_ndb->hupp(tablock_trans); + DBUG_ASSERT(tablock_trans); +// trans= m_ndb->hupp(tablock_trans); + trans= m_ndb->startTransaction(); if (trans == NULL) ERR_RETURN(m_ndb->getNdbError()); thd->transaction.stmt.ndb_tid= trans; diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 5ad4cf92959..bf7813eb9ba 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1732,8 +1732,8 @@ bool Item_func_in::nulls_in_row() static int srtcmp_in(CHARSET_INFO *cs, const String *x,const String *y) { return cs->coll->strnncollsp(cs, - (unsigned char *) x->ptr(),x->length(), - (unsigned char *) y->ptr(),y->length()); + (uchar *) x->ptr(),x->length(), + (uchar *) y->ptr(),y->length()); } diff --git a/sql/item_row.cc b/sql/item_row.cc index c7e4bc0acf4..f6623e80734 100644 --- a/sql/item_row.cc +++ b/sql/item_row.cc @@ -66,7 +66,8 @@ bool Item_row::fix_fields(THD *thd, TABLE_LIST *tabl, Item **ref) // we can't assign 'item' before, because fix_fields() can change arg Item *item= *arg; used_tables_cache |= item->used_tables(); - if (const_item_cache&= item->const_item() && !with_null) + const_item_cache&= item->const_item() && !with_null; + if (const_item_cache) { if (item->cols() > 1) with_null|= item->null_inside(); diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index ecfeff02cac..fac73a1a759 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -39,7 +39,8 @@ C_MODE_END String my_empty_string("",default_charset_info); -static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, const char *fname) +static void my_coll_agg_error(DTCollation &c1, DTCollation &c2, + const char *fname) { my_error(ER_CANT_AGGREGATE_2COLLATIONS,MYF(0), c1.collation->name,c1.derivation_name(), @@ -62,8 +63,9 @@ double Item_str_func::val() { DBUG_ASSERT(fixed == 1); int err; - String *res; - res=val_str(&str_value); + char buff[64]; + String *res, tmp(buff,sizeof(buff), &my_charset_bin); + res= val_str(&tmp); return res ? my_strntod(res->charset(), (char*) res->ptr(),res->length(), NULL, &err) : 0.0; } @@ -72,8 +74,9 @@ longlong Item_str_func::val_int() { DBUG_ASSERT(fixed == 1); int err; - String *res; - res=val_str(&str_value); + char buff[22]; + String *res, tmp(buff,sizeof(buff), &my_charset_bin); + res= val_str(&tmp); return (res ? my_strntoll(res->charset(), res->ptr(), res->length(), 10, NULL, &err) : @@ -986,10 +989,7 @@ String *Item_func_left::val_str(String *str) if (res->length() <= (uint) length || res->length() <= (char_pos= res->charpos(length))) return res; - if (&str_value == res) - str_value.length(char_pos); - else - str_value.set(*res, 0, char_pos); + str_value.set(*res, 0, char_pos); return &str_value; } @@ -2200,7 +2200,8 @@ String *Item_func_conv_charset::val_str(String *str) null_value=1; return 0; } - null_value= str_value.copy(arg->ptr(),arg->length(),arg->charset(),conv_charset); + null_value= str_value.copy(arg->ptr(),arg->length(),arg->charset(), + conv_charset); return null_value ? 0 : &str_value; } diff --git a/sql/item_sum.cc b/sql/item_sum.cc index cbb4cd41046..0ec8baf97bb 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -1945,13 +1945,12 @@ void Item_func_group_concat::reset_field() bool Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) { + uint i; /* for loop variable */ DBUG_ASSERT(fixed == 0); if (save_args_for_prepared_statement(thd)) return 1; - uint i; /* for loop variable */ - if (!thd->allow_sum_func) { my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0)); @@ -1971,7 +1970,7 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1)) return 1; if (i < arg_count_field) - maybe_null |= args[i]->maybe_null; + maybe_null|= args[i]->maybe_null; } result_field= 0; @@ -2048,7 +2047,8 @@ bool Item_func_group_concat::setup(THD *thd) of a record instead of a pointer of one. */ if (!(table=create_tmp_table(thd, tmp_table_param, all_fields, - (ORDER*) 0, 0, TRUE,select_lex->options | thd->options, + (ORDER*) 0, 0, TRUE, + select_lex->options | thd->options, HA_POS_ERROR,(char *) ""))) DBUG_RETURN(1); table->file->extra(HA_EXTRA_NO_ROWS); diff --git a/sql/log.cc b/sql/log.cc index 240965fdca3..f4ec5d9c731 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1,15 +1,15 @@ /* Copyright (C) 2000-2003 MySQL AB - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ @@ -31,12 +31,51 @@ #include #include // For test_if_number +#ifdef __NT__ +#include "message.h" +#endif + MYSQL_LOG mysql_log,mysql_update_log,mysql_slow_log,mysql_bin_log; ulong sync_binlog_counter= 0; static bool test_if_number(const char *str, long *res, bool allow_wildcards); +#ifdef __NT__ +static int eventSource = 0; +void setupWindowsEventSource() +{ + if (eventSource) return; + + eventSource = 1; + HKEY hRegKey = NULL; + DWORD dwError = 0; + TCHAR szPath[ MAX_PATH ]; + + // Create the event source registry key + dwError = RegCreateKey(HKEY_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\MySQL", + &hRegKey); + + // Name of the PE module that contains the message resource + GetModuleFileName(NULL, szPath, MAX_PATH); + + // Register EventMessageFile + dwError = RegSetValueEx(hRegKey, "EventMessageFile", 0, REG_EXPAND_SZ, + (PBYTE) szPath, strlen(szPath)+1); + + + // Register supported event types + DWORD dwTypes = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE; + dwError = RegSetValueEx(hRegKey, "TypesSupported", 0, REG_DWORD, + (LPBYTE) &dwTypes, sizeof dwTypes); + + RegCloseKey(hRegKey); +} + +#endif + + /**************************************************************************** ** Find a uniq filename for 'filename.#'. ** Set # to a number as low as possible @@ -230,7 +269,7 @@ bool MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg, "started with:\nTcp port: %d Unix socket: %s\n", my_progname,server_version,mysqld_port,mysqld_unix_port #endif - ); + ); end=strnmov(buff+len,"Time Id Command Argument\n", sizeof(buff)-len); if (my_b_write(&log_file, (byte*) buff,(uint) (end-buff)) || @@ -1940,41 +1979,33 @@ static bool test_if_number(register const char *str, } /* test_if_number */ -void sql_print_error(const char *format,...) +void print_buffer_to_file(enum loglevel level, const char *buffer) { - va_list args; time_t skr; struct tm tm_tmp; struct tm *start; - va_start(args,format); - DBUG_ENTER("sql_print_error"); + + DBUG_ENTER("print_buffer_to_log"); VOID(pthread_mutex_lock(&LOCK_error_log)); -#ifndef DBUG_OFF - { - char buff[1024]; - my_vsnprintf(buff,sizeof(buff)-1,format,args); - DBUG_PRINT("error",("%s",buff)); - va_end(args); - va_start(args,format); - } -#endif + skr=time(NULL); - localtime_r(&skr,&tm_tmp); + localtime_r(&skr, &tm_tmp); start=&tm_tmp; - fprintf(stderr,"%02d%02d%02d %2d:%02d:%02d ", - start->tm_year % 100, - start->tm_mon+1, + fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %s\n", + start->tm_year % 100, + start->tm_mon+1, start->tm_mday, start->tm_hour, start->tm_min, - start->tm_sec); - (void) vfprintf(stderr,format,args); - (void) fputc('\n',stderr); + start->tm_sec, + level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ? "WARNING" : "INFORMATION", + buffer); + fflush(stderr); - va_end(args); VOID(pthread_mutex_unlock(&LOCK_error_log)); + DBUG_VOID_RETURN; } @@ -2171,3 +2202,122 @@ void MYSQL_LOG::report_pos_in_innodb() #endif DBUG_VOID_RETURN; } + +#ifdef __NT__ +void print_buffer_to_nt_eventlog(enum loglevel level, char *buff, int buffLen) +{ + HANDLE event; + char *buffptr; + LPCSTR *buffmsgptr; + + DBUG_ENTER("print_buffer_to_nt_eventlog"); + + buffptr = buff; + if (strlen(buff) > (uint)(buffLen-4)) + { + char *newBuff = new char[ strlen(buff) + 4 ]; + strcpy(newBuff, buff); + buffptr = newBuff; + } + strcat(buffptr, "\r\n\r\n"); + buffmsgptr = (LPCSTR*)&buffptr; + + setupWindowsEventSource(); + if (event = RegisterEventSource(NULL,"MySQL")) + { + switch (level){ + case ERROR_LEVEL: + ReportEvent(event, EVENTLOG_ERROR_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, buffmsgptr, NULL); + break; + case WARNING_LEVEL: + ReportEvent(event, EVENTLOG_WARNING_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, buffmsgptr, NULL); + break; + case INFORMATION_LEVEL: + ReportEvent(event, EVENTLOG_INFORMATION_TYPE, 0, MSG_DEFAULT, NULL, 1, 0, buffmsgptr, NULL); + break; + } + DeregisterEventSource(event); + } + + // if we created a string buffer, then delete it + if (buffptr != buff) + delete[] buffptr; + + DBUG_VOID_RETURN; +} +#endif + +/* + Prints a printf style message to the error log and, under NT, to the Windows event log. + + SYNOPSIS + vprint_msg_to_log() + event_type Type of event to write (Error, Warning, or Info) + format Printf style format of message + args va_list list of arguments for the message + + NOTE + + IMPLEMENTATION + This function prints the message into a buffer and then sends that buffer to other + functions to write that message to other logging sources. + + RETURN VALUES + void +*/ +void vprint_msg_to_log(enum loglevel level, const char *format, va_list args) +{ + char buff[1024]; + DBUG_ENTER("vprint_msg_to_log"); + + my_vsnprintf(buff, sizeof(buff)-5, format, args); + + print_buffer_to_file(level, buff); + +#ifndef DBUG_OFF + DBUG_PRINT("error",("%s",buff)); +#endif + +#ifdef __NT__ + print_buffer_to_nt_eventlog(level, buff, sizeof(buff)); +#endif + + DBUG_VOID_RETURN; +} + + +void sql_print_error(const char *format, ...) +{ + DBUG_ENTER("sql_print_error"); + + va_list args; + va_start(args, format); + vprint_msg_to_log(ERROR_LEVEL, format, args); + va_end(args); + + DBUG_VOID_RETURN; +} + +void sql_print_warning(const char *format, ...) +{ + DBUG_ENTER("sql_print_warning"); + + va_list args; + va_start(args, format); + vprint_msg_to_log(WARNING_LEVEL, format, args); + va_end(args); + + DBUG_VOID_RETURN; +} + +void sql_print_information(const char *format, ...) +{ + DBUG_ENTER("sql_print_information"); + + va_list args; + va_start(args, format); + vprint_msg_to_log(INFORMATION_LEVEL, format, args); + va_end(args); + + DBUG_VOID_RETURN; +} diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 2037cf48616..1949ecf26dc 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -576,7 +576,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table,List &fields, int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds); int mysql_delete(THD *thd, TABLE_LIST *table, COND *conds, SQL_LIST *order, ha_rows rows, ulong options); -int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok=0); +int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok); TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update); TABLE *open_table(THD *thd,const char *db,const char *table,const char *alias, bool *refresh); @@ -782,8 +782,14 @@ int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length); bool init_errmessage(void); void sql_perror(const char *message); -void sql_print_error(const char *format,...) - __attribute__ ((format (printf, 1, 2))); + +void vprint_msg_to_log( enum loglevel level, const char *format, va_list args ); +void sql_print_error( const char *format, ... ); +void sql_print_warning( const char *format, ...); +void sql_print_information( const char *format, ...); + + + bool fn_format_relative_to_data_home(my_string to, const char *name, const char *dir, const char *extension); bool open_log(MYSQL_LOG *log, const char *hostname, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 4ef41e62f32..11397736555 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2687,7 +2687,7 @@ static void handle_connections_methods() (!have_tcpip || opt_disable_networking) && !opt_enable_shared_memory) { - sql_print_error("TCP/IP,--shared-memory or --named-pipe should be configured on NT OS"); + sql_print_error("TCP/IP, --shared-memory, or --named-pipe should be configured on NT OS"); unireg_abort(1); // Will not return } #endif @@ -6078,7 +6078,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), } return 0; } - + /* Initiates DEBUG - but no debugging here ! */ extern "C" gptr * mysql_getopt_value(const char *keyname, uint key_length, @@ -6108,6 +6108,13 @@ mysql_getopt_value(const char *keyname, uint key_length, return option->value; } +void option_error_reporter( enum loglevel level, const char *format, ... ) +{ + va_list args; + va_start( args, format ); + vprint_msg_to_log( level, format, args ); + va_end( args ); +} static void get_options(int argc,char **argv) { @@ -6116,7 +6123,7 @@ static void get_options(int argc,char **argv) my_getopt_register_get_addr(mysql_getopt_value); strmake(def_ft_boolean_syntax, ft_boolean_syntax, sizeof(ft_boolean_syntax)-1); - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option)) != 0) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, option_error_reporter))) exit(ho_error); if (argc > 0) { diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 40e3ffebe56..f11ed31950a 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -1302,14 +1302,14 @@ tree_and(PARAM *param,SEL_TREE *tree1,SEL_TREE *tree2) if (*key2 && !(*key2)->simple_key()) flag|=CLONE_KEY2_MAYBE; *key1=key_and(*key1,*key2,flag); - if ((*key1)->type == SEL_ARG::IMPOSSIBLE) + if (*key1 && (*key1)->type == SEL_ARG::IMPOSSIBLE) { tree1->type= SEL_TREE::IMPOSSIBLE; +#ifdef EXTRA_DEBUG + (*key1)->test_use_count(*key1); +#endif break; } -#ifdef EXTRA_DEBUG - (*key1)->test_use_count(*key1); -#endif } } DBUG_RETURN(tree1); @@ -1456,6 +1456,13 @@ key_and(SEL_ARG *key1,SEL_ARG *key2,uint clone_flag) return key1; } + if ((key1->min_flag | key2->min_flag) & GEOM_FLAG) + { + key1->free_tree(); + key2->free_tree(); + return 0; // Can't optimize this + } + key1->use_count--; key2->use_count--; SEL_ARG *e1=key1->first(), *e2=key2->first(), *new_tree=0; @@ -1538,7 +1545,8 @@ key_or(SEL_ARG *key1,SEL_ARG *key2) key1->use_count--; key2->use_count--; - if (key1->part != key2->part) + if (key1->part != key2->part || + (key1->min_flag | key2->min_flag) & GEOM_FLAG) { key1->free_tree(); key2->free_tree(); diff --git a/sql/protocol.cc b/sql/protocol.cc index 7c4b09ac3e3..da2a285fffc 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -200,7 +200,7 @@ net_printf(THD *thd, uint errcode, ...) 2+SQLSTATE_LENGTH+1 : 2) : 0); #ifndef EMBEDDED_LIBRARY text_pos=(char*) net->buff + head_length + offset + 1; - length=(char*)net->buff_end-text_pos; + length= (uint) ((char*)net->buff_end - text_pos); #else length=sizeof(text_pos)-1; #endif diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index ee75210d4fe..9769ec1a55d 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -314,3 +314,4 @@ character-set=latin2 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 408f86b0445..31715354101 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -308,3 +308,4 @@ character-set=latin1 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 95af6aaa01f..06e47e006f5 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -316,3 +316,4 @@ character-set=latin1 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 5ad23b92a5a..a2e74460380 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -305,3 +305,4 @@ character-set=latin1 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 36e0b8409e9..df29f08e752 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -310,3 +310,4 @@ character-set=latin7 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index 3bd6835908e..f0435278440 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -305,3 +305,4 @@ character-set=latin1 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index bf5a36a887a..af11e09f2f6 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -317,3 +317,4 @@ character-set=latin1 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index 9703bad11a1..7c921beba75 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -305,3 +305,4 @@ character-set=greek "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 1f71086ff69..e961b72a38e 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -307,3 +307,4 @@ character-set=latin2 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 21158fcb567..02c719fd7c0 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -305,3 +305,4 @@ character-set=latin1 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 3a6dd644d8b..9674f690183 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -307,3 +307,4 @@ character-set=ujis "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 356f0a63540..417d9976b7c 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -305,3 +305,4 @@ character-set=euckr "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index b5564cb264e..ae0b307439d 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -307,3 +307,4 @@ character-set=latin1 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index fcea45b06ac..246333af497 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -307,3 +307,4 @@ character-set=latin1 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 2a18e4de020..417757b2aea 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -309,3 +309,4 @@ character-set=latin2 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 6ba0fbca014..344860280cb 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -306,3 +306,4 @@ character-set=latin1 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 50b2b36c959..6b64d103e61 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -309,3 +309,4 @@ character-set=latin2 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index d8641d1dd14..642b792a24f 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -307,3 +307,4 @@ character-set=koi8r "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index a8cde5a56b1..8c8bc6e9729 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -311,3 +311,4 @@ character-set=cp1250 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 42ef7f62076..23814b2cbc2 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -313,3 +313,4 @@ character-set=latin2 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index b82712be350..113157858ad 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -307,3 +307,4 @@ character-set=latin1 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index 78620b28a2f..8b43ea8ed0e 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -305,3 +305,4 @@ character-set=latin1 "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 6d07eb1a656..4c762bf5313 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -310,3 +310,4 @@ character-set=koi8u "Invalid TIMESTAMP value in column '%s' at row %ld", "Invalid %s character string: '%.64s'", "Result of %s() was larger than max_allowed_packet (%ld) - truncated" +"Conflicting declarations: '%s' and '%s'" diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index f60897bf62b..fd3d27099ed 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -551,21 +551,19 @@ static ulong get_sort(uint count,...) uint chars= 0; uint wild_pos= 0; /* first wildcard position */ - if (start= str) + if ((start= str)) { for (; *str ; str++) { if (*str == wild_many || *str == wild_one || *str == wild_prefix) { - wild_pos= str - start + 1; + wild_pos= (uint) (str - start) + 1; break; } - else - chars++; + chars= 128; // Marker that chars existed } } - sort= (sort << 8) + (wild_pos ? (wild_pos > 127 ? 127 : wild_pos) : - (chars ? 128 : 0)); + sort= (sort << 8) + (wild_pos ? min(wild_pos, 127) : chars); } va_end(args); return sort; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index dede280325d..ea7b4521247 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2441,9 +2441,20 @@ bool insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name, const char *table_name, List_iterator *it) { + char name_buff[NAME_LEN+1]; uint found; DBUG_ENTER("insert_fields"); + + if (db_name && lower_case_table_names) + { + /* convert database to lower case for comparison */ + strmake(name_buff, db_name, sizeof(name_buff)-1); + my_casedn_str(system_charset_info,name_buff); + db_name = name_buff; + } + + found=0; for (; tables ; tables=tables->next) { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index f9e979d1fdf..3cb356d42c8 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2740,7 +2740,7 @@ unsent_create_error: send_error(thd,ER_LOCK_OR_ACTIVE_TRANSACTION,NullS); goto error; } - res=mysql_truncate(thd,tables); + res=mysql_truncate(thd, tables, 0); break; case SQLCOM_DELETE: { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6fdc1c2bfc3..4ca8008c518 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -833,7 +833,8 @@ JOIN::optimize() ((group_list && const_tables != tables && (!simple_group || !test_if_skip_sort_order(&join_tab[const_tables], group_list, - unit->select_limit_cnt, 0))) || select_distinct) && + unit->select_limit_cnt, 0))) || + select_distinct) && tmp_table_param.quick_group && !procedure) { need_tmp=1; simple_order=simple_group=0; // Force tmp table without sort @@ -2163,22 +2164,32 @@ add_key_field(KEY_FIELD **key_fields,uint and_level, COND *cond, number. cmp_type() is checked to allow compare of dates to numbers. eq_func is NEVER true when num_values > 1 */ - if (!eq_func || - field->result_type() == STRING_RESULT && - (*value)->result_type() != STRING_RESULT && - field->cmp_type() != (*value)->result_type()) - return; - - /* - We can't use indexes if the effective collation - of the operation differ from the field collation. - */ - if (field->result_type() == STRING_RESULT && - (*value)->result_type() == STRING_RESULT && - field->cmp_type() == STRING_RESULT && - ((Field_str*)field)->charset() != cond->compare_collation()) - return; + if (!eq_func) + return; + if (field->result_type() == STRING_RESULT) + { + if ((*value)->result_type() != STRING_RESULT) + { + if (field->cmp_type() != (*value)->result_type()) + return; + } + else + { + /* + We can't use indexes if the effective collation + of the operation differ from the field collation. + We can also not used index on a text column, as the column may + contain 'x' 'x\t' 'x ' and 'read_next_same' will stop after + 'x' when searching for WHERE col='x ' + */ + if (field->cmp_type() == STRING_RESULT && + (((Field_str*)field)->charset() != cond->compare_collation() || + ((*value)->type() != Item::NULL_ITEM && + (field->flags & BLOB_FLAG) && !field->binary()))) + return; + } + } } } DBUG_ASSERT(num_values == 1); @@ -5564,9 +5575,7 @@ bool create_myisam_from_heap(THD *thd, TABLE *table, TMP_TABLE_PARAM *param, table->file->info(HA_STATUS_VARIABLE); /* update table->file->records */ new_table.file->start_bulk_insert(table->file->records); #else - /* - HA_EXTRA_WRITE_CACHE can stay until close, no need to disable it explicitly. - */ + /* HA_EXTRA_WRITE_CACHE can stay until close, no need to disable it */ new_table.file->extra(HA_EXTRA_WRITE_CACHE); #endif @@ -7234,9 +7243,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit, keys.merge(table->used_keys); /* - We are adding here also the index speified in FORCE INDEX clause, + We are adding here also the index specified in FORCE INDEX clause, if any. - This is to allow users to use index in ORDER BY. + This is to allow users to use index in ORDER BY. */ if (table->force_index) keys.merge(table->keys_in_use_for_query); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 9cc39fe5104..1c057e03a11 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1049,7 +1049,10 @@ create: lex->col_list.empty(); } | CREATE DATABASE opt_if_not_exists ident - { Lex->create_info.default_table_charset=NULL; } + { + Lex->create_info.default_table_charset= NULL; + Lex->create_info.used_fields= 0; + } opt_create_database_options { LEX *lex=Lex; @@ -1136,11 +1139,8 @@ create_database_options: | create_database_options create_database_option {}; create_database_option: - opt_default COLLATE_SYM collation_name_or_default - { Lex->create_info.default_table_charset=$3; } - | opt_default charset charset_name_or_default - { Lex->create_info.default_table_charset=$3; } - ; + default_collation {} + | default_charset {}; opt_table_options: /* empty */ { $$= 0; } @@ -1200,21 +1200,49 @@ create_table_option: table_list->next=0; lex->create_info.used_fields|= HA_CREATE_USED_UNION; } - | opt_default charset opt_equal charset_name_or_default - { - Lex->create_info.default_table_charset= $4; - Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET; - } - | opt_default COLLATE_SYM opt_equal collation_name_or_default - { - Lex->create_info.default_table_charset= $4; - Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET; - } + | default_charset + | default_collation | INSERT_METHOD opt_equal merge_insert_types { Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD;} | DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys { Lex->create_info.data_file_name= $4.str; } | INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys { Lex->create_info.index_file_name= $4.str; }; +default_charset: + opt_default charset opt_equal charset_name_or_default + { + HA_CREATE_INFO *cinfo= &Lex->create_info; + if ((cinfo->used_fields & HA_CREATE_USED_DEFAULT_CHARSET) && + cinfo->default_table_charset && $4 && + !my_charset_same(cinfo->default_table_charset,$4)) + { + char cs1[32]; + char cs2[32]; + my_snprintf(cs1, sizeof(cs1), "CHARACTER SET %s", + cinfo->default_table_charset->csname); + my_snprintf(cs2, sizeof(cs2), "CHARACTER SET %s", $4->csname); + net_printf(YYTHD, ER_CONFLICTING_DECLARATIONS, cs1, cs2); + YYABORT; + } + Lex->create_info.default_table_charset= $4; + Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET; + }; + +default_collation: + opt_default COLLATE_SYM opt_equal collation_name_or_default + { + HA_CREATE_INFO *cinfo= &Lex->create_info; + if ((cinfo->used_fields & HA_CREATE_USED_DEFAULT_CHARSET) && + cinfo->default_table_charset && $4 && + !my_charset_same(cinfo->default_table_charset,$4)) + { + net_printf(YYTHD,ER_COLLATION_CHARSET_MISMATCH, + $4->name, cinfo->default_table_charset->csname); + YYABORT; + } + Lex->create_info.default_table_charset= $4; + Lex->create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET; + }; + storage_engines: ident_or_text { @@ -1824,7 +1852,12 @@ alter: } alter_list {} - | ALTER DATABASE ident opt_create_database_options + | ALTER DATABASE ident + { + Lex->create_info.default_table_charset= NULL; + Lex->create_info.used_fields= 0; + } + opt_create_database_options { LEX *lex=Lex; lex->sql_command=SQLCOM_ALTER_DB; @@ -2745,8 +2778,7 @@ simple_expr: | ASCII_SYM '(' expr ')' { $$= new Item_func_ascii($3); } | BINARY expr %prec NEG { - $$= new Item_func_set_collation($2,new Item_string(binary_keyword, - 6, &my_charset_latin1)); + $$= create_func_cast($2, ITEM_CAST_CHAR, -1, &my_charset_bin); } | CAST_SYM '(' expr AS cast_type ')' { diff --git a/sql/tztime.cc b/sql/tztime.cc index 757272d332f..610f75f1643 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -2158,20 +2158,21 @@ my_tz_find(const String * name, TABLE_LIST *tz_tables) if (!(result_tz= new (&tz_storage) Time_zone_offset(offset)) || my_hash_insert(&offset_tzs, (const byte *) result_tz)) { + result_tz= 0; sql_print_error("Fatal error: Out of memory " "while setting new time zone"); - result_tz= 0; } } - } else { + } + else + { + result_tz= 0; if ((tmp_tzname= (TZ_NAMES_ENTRY *)hash_search(&tz_names, (const byte *)name->ptr(), name->length()))) result_tz= tmp_tzname->tz; - else if(time_zone_tables_exist) + else if (time_zone_tables_exist) result_tz= tz_load_from_open_tables(name, tz_tables); - else - result_tz= 0; } VOID(pthread_mutex_unlock(&tz_LOCK)); diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 9e59c22c31e..42dc0ab086d 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -93,7 +93,7 @@ static int my_strnncoll_binary(CHARSET_INFO * cs __attribute__((unused)), NOTE This function is used for real binary strings, i.e. for BLOB, BINARY(N) and VARBINARY(N). - It does not ignore trailing spaces. + It compares trailing spaces as spaces. RETURN < 0 s < t @@ -133,7 +133,8 @@ static int my_strnncoll_8bit_bin(CHARSET_INFO * cs __attribute__((unused)), NOTE This function is used for character strings with binary collations. - It ignores trailing spaces. + The shorter string is extended with end space to be as long as the longer + one. RETURN < 0 s < t diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index 614717998fb..aea517811ab 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -701,7 +701,7 @@ CHARSET_INFO my_charset_latin1_german2_ci= ctype_latin1, to_lower_latin1, to_upper_latin1, - NULL, + sort_order_latin1_de, NULL, /* contractions */ NULL, /* sort_order_big*/ cs_to_uni, /* tab_to_uni */ diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 7af76126fc4..2548a68ab19 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -237,7 +237,8 @@ int my_wildcmp_mb(CHARSET_INFO *cs, if (str++ == str_end) return (-1); } { - int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one,w_many); + int tmp=my_wildcmp_mb(cs,str,str_end,wildstr,wildend,escape,w_one, + w_many); if (tmp <= 0) return (tmp); } @@ -248,41 +249,46 @@ int my_wildcmp_mb(CHARSET_INFO *cs, return (str != str_end ? 1 : 0); } + uint my_numchars_mb(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e) + const char *pos, const char *end) { - register uint32 n=0,mblen; - while (b < e) + register uint32 count=0; + while (pos < end) { - b+= (mblen= my_ismbchar(cs,b,e)) ? mblen : 1; - ++n; + uint mblen; + pos+= (mblen= my_ismbchar(cs,pos,end)) ? mblen : 1; + count++; } - return n; + return count; } + uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)), - const char *b, const char *e, uint pos) + const char *pos, const char *end, uint length) { - uint mblen; - const char *b0=b; + const char *start= pos; - while (pos && bcset->mb_wc(cs, &wc, (uchar*) b, (uchar*) e)) <0) break; b+= mblen; @@ -374,7 +380,8 @@ static int my_strnncoll_mb_bin(CHARSET_INFO * cs __attribute__((unused)), NOTE This function is used for character strings with binary collations. - It ignores trailing spaces. + The shorter string is extended with end space to be as long as the longer + one. RETURN A negative number if s < t diff --git a/strings/strto.c b/strings/strto.c index 52efec6e087..9e10b935834 100644 --- a/strings/strto.c +++ b/strings/strto.c @@ -35,8 +35,12 @@ it can be compiled with the UNSIGNED and/or LONGLONG flag set */ -#include -#include "m_string.h" + +#if !defined(_global_h) || !defined(_m_string_h) +# error Calling file must include 'my_global.h' and 'm_string.h' + /* see 'strtoll.c' and 'strtoull.c' for the reasons */ +#endif + #include "m_ctype.h" #include "my_sys.h" /* defines errno */ #include diff --git a/strings/strtol.c b/strings/strtol.c index 10d7f8f9da6..ed4ca86c846 100644 --- a/strings/strtol.c +++ b/strings/strtol.c @@ -14,9 +14,16 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* This defines strtol() if neaded */ +/* This implements strtol() if needed */ +/* + These includes are mandatory because they check for type sizes and + functions, especially they handle tricks for Tru64 where 'long' is + 64 bit already and our 'longlong' is just a 'long'. + */ #include +#include + #if !defined(MSDOS) && !defined(HAVE_STRTOL) && !defined(__WIN__) #include "strto.c" #endif diff --git a/strings/strtoll.c b/strings/strtoll.c index b0b4ef328fc..45352ffd360 100644 --- a/strings/strtoll.c +++ b/strings/strtoll.c @@ -14,11 +14,20 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* This is defines strtoll() if neaded */ +/* This implements strtoll() if needed */ -#define strtoll glob_strtoll /* Fix for True64 */ +/* + These includes are mandatory because they check for type sizes and + functions, especially they handle tricks for Tru64 where 'long' is + 64 bit already and our 'longlong' is just a 'long'. + This solves a problem on Tru64 where the C99 compiler has a prototype + for 'strtoll()' but no implementation, see "6.1 New C99 library functions" + in file '/usr/share/doclib/cc.dtk/release_notes.txt'. + */ #include +#include + #if !defined(HAVE_STRTOLL) && defined(HAVE_LONG_LONG) #define USE_LONGLONG #include "strto.c" diff --git a/strings/strtoul.c b/strings/strtoul.c index 00e1f820942..32a7bc62298 100644 --- a/strings/strtoul.c +++ b/strings/strtoul.c @@ -14,9 +14,16 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* This is defines strtoul() if neaded */ +/* This implements strtol() if needed */ +/* + These includes are mandatory because they check for type sizes and + functions, especially they handle tricks for Tru64 where 'long' is + 64 bit already and our 'longlong' is just a 'long'. + */ #include +#include + #if !defined(MSDOS) && !defined(HAVE_STRTOUL) #define USE_UNSIGNED #include "strto.c" diff --git a/strings/strtoull.c b/strings/strtoull.c index f4f3ce19bf7..0c2788bc188 100644 --- a/strings/strtoull.c +++ b/strings/strtoull.c @@ -14,9 +14,20 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* This is defines strtoull() */ +/* This implements strtoull() if needed */ + +/* + These includes are mandatory because they check for type sizes and + functions, especially they handle tricks for Tru64 where 'long' is + 64 bit already and our 'longlong' is just a 'long'. + This solves a problem on Tru64 where the C99 compiler has a prototype + for 'strtoull()' but no implementation, see "6.1 New C99 library functions" + in file '/usr/share/doclib/cc.dtk/release_notes.txt'. + */ #include +#include + #if !defined(HAVE_STRTOULL) && defined(HAVE_LONG_LONG) #define USE_UNSIGNED #define USE_LONGLONG diff --git a/support-files/Makefile.am b/support-files/Makefile.am index 3b43f7b7911..7ae1071f9ec 100644 --- a/support-files/Makefile.am +++ b/support-files/Makefile.am @@ -22,7 +22,7 @@ EXTRA_DIST = mysql.spec.sh \ my-medium.cnf.sh \ my-large.cnf.sh \ my-huge.cnf.sh \ - my-innodb-heavy-4G \ + my-innodb-heavy-4G.cnf.sh \ mysql-log-rotate.sh \ mysql.server.sh \ binary-configure.sh \ diff --git a/support-files/mysql.spec.sh b/support-files/mysql.spec.sh index 6ec05433bef..e7f8a035a15 100644 --- a/support-files/mysql.spec.sh +++ b/support-files/mysql.spec.sh @@ -156,7 +156,7 @@ Summary: MySQL - server with Berkeley DB, RAID and UDF support Group: Applications/Databases Provides: mysql-Max Obsoletes: mysql-Max -Requires: MySQL >= 4.0 +Requires: MySQL-server >= 4.0 %description Max Optional MySQL server binary that supports additional features like @@ -594,8 +594,13 @@ fi %attr(644, root, root) %{_libdir}/mysql/libmysqld.a # The spec file changelog only includes changes made to the spec file -# itself +# itself - note that they must be ordered by date (important when +# merging BK trees) %changelog +* Thu Aug 26 2004 Lenz Grimmer + +- MySQL-Max now requires MySQL-server instead of MySQL (BUG 3860) + * Fri Aug 20 2004 Lenz Grimmer - do not link statically on IA64/AMD64 as these systems do not have diff --git a/tests/client_test.c b/tests/client_test.c index de77d4517dd..ed186837d28 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -10044,6 +10044,53 @@ static void test_bug4030() } +static void test_bug5126() +{ + MYSQL_STMT *stmt; + MYSQL_BIND bind[2]; + long c1, c2; + const char *stmt_text; + int rc; + + myheader("test_bug5126"); + + stmt_text= "DROP TABLE IF EXISTS t1"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + + stmt_text= "CREATE TABLE t1 (a mediumint, b int)"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + + stmt_text= "INSERT INTO t1 VALUES (8386608, 1)"; + rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text)); + myquery(rc); + + stmt= mysql_stmt_init(mysql); + stmt_text= "SELECT a, b FROM t1"; + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + check_execute(stmt, rc); + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + /* Bind output buffers */ + bzero(bind, sizeof(bind)); + + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= &c1; + bind[1].buffer_type= MYSQL_TYPE_LONG; + bind[1].buffer= &c2; + + mysql_stmt_bind_result(stmt, bind); + + rc= mysql_stmt_fetch(stmt); + assert(rc == 0); + assert(c1 == 8386608 && c2 == 1); + printf("%ld, %ld\n", c1, c2); + mysql_stmt_close(stmt); +} + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -10142,7 +10189,7 @@ static void get_options(int argc, char **argv) int ho_error; if ((ho_error= handle_options(&argc, &argv, client_test_long_options, - get_one_option))) + get_one_option, 0))) exit(ho_error); if (tty_password) @@ -10341,6 +10388,7 @@ int main(int argc, char **argv) test_bug4236(); /* init -> execute */ test_bug4030(); /* test conversion string -> time types in libmysql */ + test_bug5126(); /* support for mediumint type in libmysql */ /* XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH. diff --git a/tools/mysqlmanager.c b/tools/mysqlmanager.c index bb0a76d6c49..36a8b2f394c 100644 --- a/tools/mysqlmanager.c +++ b/tools/mysqlmanager.c @@ -1335,7 +1335,7 @@ static int parse_args(int argc, char **argv) { int ho_error; - if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option, NULL))) exit(ho_error); return 0;