1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00
BitKeeper/etc/logging_ok:
  auto-union
ndb/include/mgmapi/mgmapi_config_parameters.h:
  Auto merged
ndb/src/kernel/vm/Configuration.cpp:
  Auto merged
ndb/src/mgmsrv/ConfigInfo.cpp:
  Auto merged
ndb/src/ndbapi/NdbDictionaryImpl.cpp:
  Auto merged
ndb/src/ndbapi/NdbScanOperation.cpp:
  Auto merged
ndb/src/ndbapi/TransporterFacade.hpp:
  Auto merged
This commit is contained in:
unknown
2004-08-30 12:13:11 +02:00
174 changed files with 1788 additions and 697 deletions

View File

@@ -80,6 +80,7 @@ jcole@mugatu.jcole.us
jcole@mugatu.spaceapes.com jcole@mugatu.spaceapes.com
jcole@sarvik.tfr.cafe.ee jcole@sarvik.tfr.cafe.ee
jcole@tetra.spaceapes.com jcole@tetra.spaceapes.com
joerg@mysql.com
joreland@mysql.com joreland@mysql.com
jorge@linux.jorge.mysql.com jorge@linux.jorge.mysql.com
jplindst@t41.(none) jplindst@t41.(none)

View File

@@ -376,7 +376,7 @@ if ($opt_stage <= 5 && !$opt_no_test && !$opt_no_mysqltest)
log_timestamp(); log_timestamp();
system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir); system("mkdir $bench_tmpdir") if (! -d $bench_tmpdir);
safe_cd("${test_dir}/mysql-test"); 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");
} }
# #

8
VC++Files/sql/message.mc Normal file
View File

@@ -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.

View File

@@ -920,6 +920,89 @@ SOURCE=.\log_event.cpp
# End Source File # End Source File
# Begin 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 SOURCE=.\mf_iocache.cpp
!IF "$(CFG)" == "mysqld - Win32 Release" !IF "$(CFG)" == "mysqld - Win32 Release"

View File

@@ -44,7 +44,7 @@
#include <locale.h> #include <locale.h>
#endif #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 */ /* Don't try to make a nice table if the data is too big */
#define MAX_COLUMN_LENGTH 1024 #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 while (*argument) *argument++= 'x'; // Destroy argument
if (*start) if (*start)
start[1]=0 ; start[1]=0 ;
tty_password= 0;
} }
else else
tty_password= 1; 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_max_allowed_packet= *mysql_params->p_max_allowed_packet;
opt_net_buffer_length= *mysql_params->p_net_buffer_length; 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); exit(ho_error);
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet; *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) if (num_fields == 2)
{ {
put_info("Many help items for your request exist", INFO_INFO); put_info("Many help items for your request exist", INFO_INFO);
put_info("For more specific request please type 'help <item>' where item is one of next", INFO_INFO); put_info("To make a more specific request, please type 'help <item>',\nwhere item is one of next", INFO_INFO);
num_name= 0; num_name= 0;
num_cat= 1; num_cat= 1;
last_char= '_'; last_char= '_';
} }
else if ((cur= mysql_fetch_row(result))) else if ((cur= mysql_fetch_row(result)))
{ {
tee_fprintf(PAGER, "You asked help about help category: \"%s\"\n", cur[0]); tee_fprintf(PAGER, "You asked for help about help category: \"%s\"\n", cur[0]);
put_info("For a more information type 'help <item>' where item is one of the following", INFO_INFO); put_info("For more information, type 'help <item>', where item is one of the following", INFO_INFO);
num_name= 1; num_name= 1;
num_cat= 2; num_cat= 2;
print_help_item(&cur,1,2,&last_char); print_help_item(&cur,1,2,&last_char);
@@ -1691,7 +1692,7 @@ static int com_server_help(String *buffer __attribute__((unused)),
else else
{ {
put_info("\nNothing found", INFO_INFO); 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) if (help_arg)
return com_server_help(buffer,line,help_arg+1); 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("\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 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("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); put_info("List of all MySQL commands:", INFO_INFO);
if (!named_cmds) if (!named_cmds)
put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO); put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);

View File

@@ -276,7 +276,7 @@ int main(int argc,char *argv[])
mysql_init(&mysql); mysql_init(&mysql);
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
save_argv = argv; /* Save for free_defaults */ 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); free_defaults(save_argv);
exit(ho_error); exit(ho_error);

View File

@@ -666,7 +666,7 @@ static int parse_args(int *argc, char*** argv)
result_file = stdout; result_file = stdout;
load_defaults("my",load_default_groups,argc,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, NULL)))
exit(ho_error); exit(ho_error);
return 0; return 0;

View File

@@ -295,7 +295,7 @@ static int get_options(int *argc, char ***argv)
load_defaults("my", load_default_groups, argc, 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); exit(ho_error);
if (!what_to_do) if (!what_to_do)

View File

@@ -604,7 +604,7 @@ static int get_options(int *argc, char ***argv)
md_result_file= stdout; md_result_file= stdout;
load_defaults("my",load_default_groups,argc,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); exit(ho_error);
*mysql_params->p_max_allowed_packet= opt_max_allowed_packet; *mysql_params->p_max_allowed_packet= opt_max_allowed_packet;

View File

@@ -228,7 +228,7 @@ static int get_options(int *argc, char ***argv)
{ {
int ho_error; 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); exit(ho_error);
if (enclosed && opt_enclosed) if (enclosed && opt_enclosed)

View File

@@ -95,7 +95,7 @@ int parse_args(int argc, char** argv)
{ {
int ho_error; 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); exit(ho_error);
return 0; return 0;

View File

@@ -133,7 +133,7 @@ int parse_args(int argc, char **argv)
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
default_argv= 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); exit(ho_error);
return 0; return 0;

View File

@@ -297,7 +297,7 @@ get_options(int *argc,char ***argv)
{ {
int ho_error; 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); exit(ho_error);
if (tty_password) if (tty_password)

View File

@@ -2100,7 +2100,7 @@ int parse_args(int argc, char **argv)
load_defaults("my",load_default_groups,&argc,&argv); load_defaults("my",load_default_groups,&argc,&argv);
default_argv= 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); exit(1);
if (argc > 1) if (argc > 1)

View File

@@ -23,10 +23,10 @@ libedit_a_DEPENDENCIES = @LIBEDIT_LOBJECTS@
pkginclude_HEADERS = readline/readline.h pkginclude_HEADERS = readline/readline.h
noinst_HEADERS = chared.h el.h histedit.h key.h parse.h refresh.h sig.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 \ sys.h tokenizer.h config.h hist.h map.h prompt.h read.h \
search.h tty.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 CLEANFILES = makelist common.h emacs.h vi.h fcns.h help.h fcns.c help.c

View File

@@ -661,12 +661,6 @@ history_load(History *h, const char *fname)
if ((fp = fopen(fname, "r")) == NULL) if ((fp = fopen(fname, "r")) == NULL)
return (i); 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); ptr = h_malloc(max_size = 1024);
if (ptr == NULL) if (ptr == NULL)
goto done; goto done;
@@ -720,8 +714,6 @@ history_save(History *h, const char *fname)
if (fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1) if (fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1)
goto done; goto done;
if (fputs(hist_cookie, fp) == EOF)
goto done;
ptr = h_malloc(max_size = 1024); ptr = h_malloc(max_size = 1024);
if (ptr == NULL) if (ptr == NULL)
goto done; goto done;
@@ -740,7 +732,7 @@ history_save(History *h, const char *fname)
ptr = nptr; ptr = nptr;
} }
(void) strvis(ptr, ev.str, VIS_WHITE); (void) strvis(ptr, ev.str, VIS_WHITE);
(void) fprintf(fp, "%s\n", ptr); (void) fprintf(fp, "%s\n", ev.str);
} }
oomem: oomem:
h_free((ptr_t)ptr); h_free((ptr_t)ptr);

View File

@@ -99,7 +99,7 @@ static int get_options(int *argc,char ***argv)
{ {
int ho_error; 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); exit(ho_error);
if (*argc < 1) if (*argc < 1)

View File

@@ -20,6 +20,7 @@
#include <my_global.h> #include <my_global.h>
#include <m_string.h> #include <m_string.h>
#include <my_sys.h>
#include <my_getopt.h> #include <my_getopt.h>
#include <signal.h> #include <signal.h>
#include <errno.h> #include <errno.h>
@@ -66,7 +67,7 @@ int main(int argc, char *argv[])
progname= argv[0]; 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); exit(-1);
if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 || if (!argv[0] || !argv[1] || (pid= atoi(argv[0])) <= 0 ||
(t= atoi(argv[1])) <= 0) (t= atoi(argv[1])) <= 0)

View File

@@ -157,7 +157,7 @@ static int get_options(int *argc,char ***argv)
{ {
int ho_error; 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); exit(ho_error);
if (!*argc && !print_all_codes) if (!*argc && !print_all_codes)

View File

@@ -121,7 +121,7 @@ static int parse_args(int argc, char **argv)
{ {
int ho_error; 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); exit(ho_error);
/* /*

View File

@@ -90,7 +90,7 @@ static int get_options(int *argc,char ***argv)
{ {
int ho_error; 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); exit(ho_error);
if (*argc == 0) if (*argc == 0)

View File

@@ -246,12 +246,12 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
if (seg->type == HA_KEYTYPE_TEXT) if (seg->type == HA_KEYTYPE_TEXT)
{ {
CHARSET_INFO *cs= seg->charset; CHARSET_INFO *cs= seg->charset;
uint length= ((uchar*)key) - pos; uint char_length= (uint) ((uchar*) key - pos);
uint char_length= length / cs->mbmaxlen; if (cs->mbmaxlen > 1)
if (length > char_length)
{ {
char_length= my_charpos(cs, pos, pos + length, char_length); uint length= char_length;
set_if_smaller(char_length, 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); 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) if (seg->type == HA_KEYTYPE_TEXT)
{ {
CHARSET_INFO *cs= seg->charset; CHARSET_INFO *cs= seg->charset;
uint char_length= seg->length / cs->mbmaxlen; uint char_length= seg->length;
if (seg->length > char_length) if (cs->mbmaxlen > 1)
{ {
char_length= my_charpos(cs, pos, pos + seg->length, char_length); char_length= my_charpos(cs, pos, pos + char_length,
set_if_smaller(char_length, seg->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); 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) if (seg->type == HA_KEYTYPE_TEXT)
{ {
CHARSET_INFO *cs= seg->charset; CHARSET_INFO *cs= seg->charset;
uint char_length= seg->length / cs->mbmaxlen;
uint char_length1; uint char_length1;
uint char_length2; uint char_length2;
uchar *pos1= (uchar*)rec1 + seg->start; uchar *pos1= (uchar*)rec1 + seg->start;
uchar *pos2= (uchar*)rec2 + 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); 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); 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 else
{ {
@@ -468,12 +469,12 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
if (seg->type == HA_KEYTYPE_TEXT) if (seg->type == HA_KEYTYPE_TEXT)
{ {
CHARSET_INFO *cs= seg->charset; CHARSET_INFO *cs= seg->charset;
uint char_length= seg->length / cs->mbmaxlen;
uint char_length_key; uint char_length_key;
uint char_length_rec; uint char_length_rec;
uchar *pos= (uchar*) rec + seg->start; 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); char_length_key= my_charpos(cs, key, key + seg->length, char_length);
set_if_smaller(char_length_key, seg->length); set_if_smaller(char_length_key, seg->length);
char_length_rec= my_charpos(cs, pos, pos + seg->length, char_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++) for (seg=keydef->seg,endseg=seg+keydef->keysegs ; seg < endseg ; seg++)
{ {
CHARSET_INFO *cs= seg->charset; CHARSET_INFO *cs= seg->charset;
uint char_length= (cs && cs->mbmaxlen > 1) ? seg->length / cs->mbmaxlen : uint char_length= seg->length;
seg->length;
uchar *pos= (uchar*) rec + seg->start; uchar *pos= (uchar*) rec + seg->start;
if (seg->null_bit) if (seg->null_bit)
*key++= test(rec[seg->null_pos] & 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); char_length= my_charpos(cs, pos, pos + seg->length,
set_if_smaller(char_length, 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); memcpy(key,rec+seg->start,(size_t) char_length);
key+= char_length; key+= char_length;
} }
} }
uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key, uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
const byte *rec, byte *recpos) const byte *rec, byte *recpos)
{ {
@@ -575,13 +577,13 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
} }
continue; continue;
} }
char_length= seg->length / (seg->charset ? seg->charset->mbmaxlen : 1); char_length= seg->length;
if (seg->length > char_length) if (seg->charset->mbmaxlen > 1)
{ {
char_length= my_charpos(seg->charset, char_length= my_charpos(seg->charset,
rec + seg->start, rec + seg->start + seg->length, rec + seg->start, rec + seg->start + char_length,
char_length); char_length / seg->charset->mbmaxlen);
set_if_smaller(char_length, seg->length); set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
if (char_length < seg->length) if (char_length < seg->length)
seg->charset->cset->fill(seg->charset, key + char_length, seg->charset->cset->fill(seg->charset, key + char_length,
seg->length - char_length, ' '); seg->length - char_length, ' ');
@@ -593,7 +595,9 @@ uint hp_rb_make_key(HP_KEYDEF *keydef, byte *key,
return key - start_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; HA_KEYSEG *seg, *endseg;
uchar *start_key= key; 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; continue;
} }
char_length= seg->length / (seg->charset ? seg->charset->mbmaxlen : 1); char_length= seg->length;
if (seg->length > char_length) if (seg->charset->mbmaxlen > 1)
{ {
char_length= my_charpos(seg->charset, old, old+seg->length, char_length); char_length= my_charpos(seg->charset, old, old+char_length,
set_if_smaller(char_length, seg->length); char_length / seg->charset->mbmaxlen);
set_if_smaller(char_length, seg->length); /* QQ: ok to remove? */
if (char_length < seg->length) if (char_length < seg->length)
seg->charset->cset->fill(seg->charset, key + char_length, seg->charset->cset->fill(seg->charset, key + char_length,
seg->length - 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; return key - start_key;
} }
uint hp_rb_key_length(HP_KEYDEF *keydef, uint hp_rb_key_length(HP_KEYDEF *keydef,
const byte *key __attribute__((unused))) const byte *key __attribute__((unused)))
{ {
return keydef->length; return keydef->length;
} }
uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key) uint hp_rb_null_key_length(HP_KEYDEF *keydef, const byte *key)
{ {
const byte *start_key= key; const byte *start_key= key;

View File

@@ -238,6 +238,9 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error);
#ifndef HAVE_STRTOULL #ifndef HAVE_STRTOULL
#define HAVE_STRTOULL #define HAVE_STRTOULL
#endif #endif
#ifndef HAVE_STRTOLL
#define HAVE_STRTOLL
#endif
#else #else
#ifdef HAVE_LONG_LONG #ifdef HAVE_LONG_LONG
extern char *longlong2str(longlong val,char *dst,int radix); extern char *longlong2str(longlong val,char *dst,int radix);

View File

@@ -14,6 +14,9 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef _my_getopt_h
#define _my_getopt_h
C_MODE_START C_MODE_START
#define GET_NO_ARG 1 #define GET_NO_ARG 1
@@ -54,11 +57,12 @@ struct my_option
extern char *disabled_my_option; extern char *disabled_my_option;
extern my_bool my_getopt_print_errors; 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, extern int handle_options (int *argc, char ***argv,
const struct my_option *longopts, const struct my_option *longopts, my_get_one_option,
my_bool (*get_one_option)(int, my_error_reporter );
const struct my_option *,
char *));
extern void my_print_help(const struct my_option *options); extern void my_print_help(const struct my_option *options);
extern void my_print_variables(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, 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); 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); my_bool getopt_compare_strings(const char *s, const char *t, uint length);
C_MODE_END C_MODE_END
#endif /* _my_getopt_h */

View File

@@ -244,6 +244,12 @@ typedef struct wild_file_pack /* Struct to hold info when selecting files */
my_string *wild; /* Pointer to wildcards */ my_string *wild; /* Pointer to wildcards */
} WF_PACK; } WF_PACK;
enum loglevel {
ERROR_LEVEL,
WARNING_LEVEL,
INFORMATION_LEVEL
};
enum cache_type enum cache_type
{ {
READ_CACHE,WRITE_CACHE, READ_CACHE,WRITE_CACHE,

View File

@@ -99,7 +99,7 @@ typedef struct st_mysql_field {
unsigned int flags; /* Div flags */ unsigned int flags; /* Div flags */
unsigned int decimals; /* Number of decimals in field */ unsigned int decimals; /* Number of decimals in field */
unsigned int charsetnr; /* Character set */ 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; } MYSQL_FIELD;
typedef char **MYSQL_ROW; /* return data as array of strings */ typedef char **MYSQL_ROW; /* return data as array of strings */
@@ -538,7 +538,7 @@ enum enum_mysql_stmt_state
typedef struct st_mysql_bind typedef struct st_mysql_bind
{ {
unsigned long *length; /* output length pointer */ 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 */ void *buffer; /* buffer to get/put data */
enum enum_field_types buffer_type; /* buffer type */ enum enum_field_types buffer_type; /* buffer type */
unsigned long buffer_length; /* buffer length, must be set for str/binary */ 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 char **row);
unsigned long stmt_id; /* Id for prepared statement */ unsigned long stmt_id; /* Id for prepared statement */
unsigned int last_errno; /* error code */ 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 */ unsigned int field_count; /* number of columns in result set */
enum enum_mysql_stmt_state state; /* statement state */ enum enum_mysql_stmt_state state; /* statement state */
char last_error[MYSQL_ERRMSG_SIZE]; /* error message */ char last_error[MYSQL_ERRMSG_SIZE]; /* error message */

View File

@@ -318,4 +318,5 @@
#define ER_WARN_INVALID_TIMESTAMP 1299 #define ER_WARN_INVALID_TIMESTAMP 1299
#define ER_INVALID_CHARACTER_STRING 1300 #define ER_INVALID_CHARACTER_STRING 1300
#define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301 #define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301
#define ER_ERROR_MESSAGES 302 #define ER_CONFLICTING_DECLARATIONS 1302
#define ER_ERROR_MESSAGES 303

View File

@@ -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 */ /* Flush pages from the end of the LRU list if necessary */
buf_flush_free_margin(); buf_flush_free_margin();

View File

@@ -671,7 +671,7 @@ static void get_options(register int *argc, register char ***argv)
if (isatty(fileno(stdout))) if (isatty(fileno(stdout)))
testflag|=T_WRITE_LOOP; 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); exit(ho_error);
if (*argc == 0) if (*argc == 0)

View File

@@ -337,7 +337,7 @@ static void get_options(int *argc, char ***argv)
{ {
int ho_error; 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); exit(ho_error);
my_progname= argv[0][0]; my_progname= argv[0][0];

View File

@@ -3339,6 +3339,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
} }
case MYSQL_TYPE_DATE: case MYSQL_TYPE_DATE:
case MYSQL_TYPE_DATETIME: case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
{ {
MYSQL_TIME *tm= (MYSQL_TIME *)buffer; MYSQL_TIME *tm= (MYSQL_TIME *)buffer;
str_to_datetime(value, length, tm, 0, &err); 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) longlong value)
{ {
char *buffer= (char *)param->buffer; 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) { switch (param->buffer_type) {
case MYSQL_TYPE_NULL: /* do nothing */ 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 buff[22]; /* Enough for longlong */
char *end= longlong10_to_str(value, buff, field_is_unsigned ? 10: -10); char *end= longlong10_to_str(value, buff, field_is_unsigned ? 10: -10);
/* Resort to string conversion which supports all typecodes */ /* 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; break;
} }
} }
@@ -3505,7 +3506,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
sprintf(buff, "%.*f", (int) field->decimals, value); sprintf(buff, "%.*f", (int) field->decimals, value);
end= strend(buff); end= strend(buff);
} }
fetch_string_with_conversion(param, buff, end - buff); fetch_string_with_conversion(param, buff, (uint) (end - buff));
break; break;
} }
} }
@@ -3590,13 +3591,13 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
{ {
ulong length; ulong length;
enum enum_field_types field_type= field->type; enum enum_field_types field_type= field->type;
uint field_is_unsigned= field->flags & UNSIGNED_FLAG;
switch (field_type) { switch (field_type) {
case MYSQL_TYPE_TINY: case MYSQL_TYPE_TINY:
{ {
char value= (char) **row; char value= (char) **row;
uint field_is_unsigned= (field->flags & UNSIGNED_FLAG); longlong data= field_is_unsigned ? (longlong) (unsigned char) value :
longlong data= (field_is_unsigned) ? (longlong) (unsigned char) value:
(longlong) value; (longlong) value;
fetch_long_with_conversion(param, field, data); fetch_long_with_conversion(param, field, data);
length= 1; length= 1;
@@ -3606,19 +3607,18 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
case MYSQL_TYPE_YEAR: case MYSQL_TYPE_YEAR:
{ {
short value= sint2korr(*row); short value= sint2korr(*row);
uint field_is_unsigned= (field->flags & UNSIGNED_FLAG); longlong data= field_is_unsigned ? (longlong) (unsigned short) value :
longlong data= ((field_is_unsigned) ? (longlong) (unsigned short) value: (longlong) value;
(longlong) value);
fetch_long_with_conversion(param, field, data); fetch_long_with_conversion(param, field, data);
length= 2; length= 2;
break; break;
} }
case MYSQL_TYPE_INT24: /* mediumint is sent as 4 bytes int */
case MYSQL_TYPE_LONG: case MYSQL_TYPE_LONG:
{ {
long value= sint4korr(*row); long value= sint4korr(*row);
uint field_is_unsigned= (field->flags & UNSIGNED_FLAG); longlong data= field_is_unsigned ? (longlong) (unsigned long) value :
longlong data= ((field_is_unsigned) ? (longlong) (unsigned long) value: (longlong) value;
(longlong) value);
fetch_long_with_conversion(param, field, data); fetch_long_with_conversion(param, field, data);
length= 4; length= 4;
break; break;

125
libmysqld/libmysqld.rc Executable file
View File

@@ -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 <20> 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 <20> 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

15
libmysqld/resource.h Executable file
View File

@@ -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

View File

@@ -23,9 +23,9 @@
#include <ieeefp.h> #include <ieeefp.h>
#endif #endif
#define CHECK_KEYS #define CHECK_KEYS /* Enable safety checks */
#define FIX_LENGTH \ #define FIX_LENGTH(cs, pos, length, char_length) \
do { \ do { \
if (length > char_length) \ if (length > char_length) \
char_length= my_charpos(cs, pos, pos+length, char_length); \ char_length= my_charpos(cs, pos, pos+length, char_length); \
@@ -78,7 +78,8 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
*key++=1; /* Not NULL */ *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; pos= (byte*) record+keyseg->start;
if (keyseg->flag & HA_SPACE_PACK) if (keyseg->flag & HA_SPACE_PACK)
@@ -95,7 +96,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
pos++; pos++;
} }
length=(uint) (end-pos); length=(uint) (end-pos);
FIX_LENGTH; FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length); store_key_length_inc(key,char_length);
memcpy((byte*) key,(byte*) pos,(size_t) char_length); memcpy((byte*) key,(byte*) pos,(size_t) char_length);
key+=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); uint tmp_length=uint2korr(pos);
pos+=2; /* Skip VARCHAR length */ pos+=2; /* Skip VARCHAR length */
set_if_smaller(length,tmp_length); set_if_smaller(length,tmp_length);
FIX_LENGTH; FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length); store_key_length_inc(key,char_length);
memcpy((byte*) key,(byte*) pos,(size_t) char_length); memcpy((byte*) key,(byte*) pos,(size_t) char_length);
key+= 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); uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos);
memcpy_fixed((byte*) &pos,pos+keyseg->bit_start,sizeof(char*)); memcpy_fixed((byte*) &pos,pos+keyseg->bit_start,sizeof(char*));
set_if_smaller(length,tmp_length); set_if_smaller(length,tmp_length);
FIX_LENGTH; FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length); store_key_length_inc(key,char_length);
memcpy((byte*) key,(byte*) pos,(size_t) char_length); memcpy((byte*) key,(byte*) pos,(size_t) char_length);
key+= char_length; key+= char_length;
@@ -157,7 +158,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
} }
continue; continue;
} }
FIX_LENGTH; FIX_LENGTH(cs, pos, length, char_length);
memcpy((byte*) key, pos, char_length); memcpy((byte*) key, pos, char_length);
if (length > char_length) if (length > char_length)
cs->cset->fill(cs, key+char_length, 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; k_length-=length;
length=(uint) (end-pos); length=(uint) (end-pos);
FIX_LENGTH; FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length); store_key_length_inc(key,char_length);
memcpy((byte*) key,pos,(size_t) char_length); memcpy((byte*) key,pos,(size_t) char_length);
key+= 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; k_length-= 2+length;
pos+=2; pos+=2;
set_if_smaller(length,tmp_length); /* Safety */ set_if_smaller(length,tmp_length); /* Safety */
FIX_LENGTH; FIX_LENGTH(cs, pos, length, char_length);
store_key_length_inc(key,char_length); store_key_length_inc(key,char_length);
old+=2; /* Skip length */ old+=2; /* Skip length */
memcpy((byte*) key, pos,(size_t) char_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; continue;
} }
FIX_LENGTH; FIX_LENGTH(cs, pos, length, char_length);
memcpy((byte*) key, pos, char_length); memcpy((byte*) key, pos, char_length);
if (length > char_length) if (length > char_length)
cs->cset->fill(cs,key+char_length, length-char_length, ' '); cs->cset->fill(cs,key+char_length, length-char_length, ' ');

View File

@@ -644,7 +644,7 @@ static void get_options(int argc, char *argv[])
{ {
int ho_error; 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); exit(ho_error);
return; return;

View File

@@ -68,7 +68,7 @@ int main(int argc,char *argv[])
struct { MI_INFO *info; } aio0, *aio=&aio0; /* for GWS_IN_USE */ struct { MI_INFO *info; } aio0, *aio=&aio0; /* for GWS_IN_USE */
MY_INIT(argv[0]); 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); exit(error);
if (count || dump) if (count || dump)
verbose=0; verbose=0;

View File

@@ -696,7 +696,7 @@ static void get_options(register int *argc,register char ***argv)
if (isatty(fileno(stdout))) if (isatty(fileno(stdout)))
check_param.testflag|=T_WRITE_LOOP; 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); exit(ho_error);
/* If using repair, then update checksum if one uses --update-state */ /* If using repair, then update checksum if one uses --update-state */

View File

@@ -350,7 +350,7 @@ static void get_options(int *argc,char ***argv)
if (isatty(fileno(stdout))) if (isatty(fileno(stdout)))
write_loop=1; 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); exit(ho_error);
if (!*argc) if (!*argc)

View File

@@ -5,15 +5,16 @@ DataMemory= CHOOSE_DataMemory
IndexMemory= CHOOSE_IndexMemory IndexMemory= CHOOSE_IndexMemory
Diskless= CHOOSE_Diskless Diskless= CHOOSE_Diskless
TimeBetweenWatchDogCheck= 30000 TimeBetweenWatchDogCheck= 30000
FileSystemPath= CHOOSE_FILESYSTEM DataDir= CHOOSE_FILESYSTEM
[ndbd] [ndbd]
HostName: CHOOSE_HOSTNAME_1 HostName= CHOOSE_HOSTNAME_1
[ndbd] [ndbd]
HostName: CHOOSE_HOSTNAME_2 HostName= CHOOSE_HOSTNAME_2
[ndb_mgmd] [ndb_mgmd]
DataDir= CHOOSE_FILESYSTEM
PortNumber= CHOOSE_PORT_MGM PortNumber= CHOOSE_PORT_MGM
[mysqld] [mysqld]

View File

@@ -193,8 +193,7 @@ stop_default_ndbcluster() {
exec_mgmtclient="$exec_mgmtclient --try-reconnect=1" exec_mgmtclient="$exec_mgmtclient --try-reconnect=1"
echo "all stop" | $exec_mgmtclient 2>&1 | cat > /dev/null echo "shutdown" | $exec_mgmtclient 2>&1 | cat > /dev/null
echo "3 stop" | $exec_mgmtclient 2>&1 | cat > /dev/null
if [ -f "$fs_ndb/$pidfile" ] ; then if [ -f "$fs_ndb/$pidfile" ] ; then
kill -9 `cat "$fs_ndb/$pidfile"` 2> /dev/null kill -9 `cat "$fs_ndb/$pidfile"` 2> /dev/null

View File

@@ -111,10 +111,10 @@ a b
aaa bbb aaa bbb
select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1; select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
charset(a) charset(b) charset(binary 'ccc') 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; select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
collation(a) collation(b) collation(binary 'ccc') collation(a) collation(b) collation(binary 'ccc')
latin1_bin binary latin1_bin latin1_bin binary binary
drop table t1; drop table t1;
create table t1( firstname char(20), lastname char(20)); create table t1( firstname char(20), lastname char(20));
insert into t1 values ("john","doe"),("John","Doe"); insert into t1 values ("john","doe"),("John","Doe");

View File

@@ -40,6 +40,7 @@ show tables;
Tables_in_test Tables_in_test
update mysql.user set password=old_password("gambling2") where user=_binary"test"; update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges; flush privileges;
set password="";
set password='gambling3'; set password='gambling3';
ERROR HY000: Password hash should be a 41-digit hexadecimal number ERROR HY000: Password hash should be a 41-digit hexadecimal number
set password=old_password('gambling3'); set password=old_password('gambling3');

View File

@@ -1,19 +1,19 @@
drop table if exists t1, t2; drop table if exists t1, t2;
CREATE TABLE t1 ( a int ); CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1); 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 ERROR 23000: Duplicate entry '1' for key 1
select * from t2; select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist 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 ERROR 23000: Duplicate entry '1' for key 1
select * from t2; select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist 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 ERROR 23000: Duplicate entry '1' for key 1
select * from t2; select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist 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 ERROR 23000: Duplicate entry '1' for key 1
select * from t2; select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist ERROR 42S02: Table 'test.t2' doesn't exist

View File

@@ -49,8 +49,8 @@ a b
aaa bbb aaa bbb
select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1; select charset(a), charset(b), charset(binary 'ccc') from t1 limit 1;
charset(a) charset(b) charset(binary 'ccc') 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; select collation(a), collation(b), collation(binary 'ccc') from t1 limit 1;
collation(a) collation(b) collation(binary 'ccc') collation(a) collation(b) collation(binary 'ccc')
cp1251_bin binary cp1251_bin cp1251_bin binary binary
drop table t1; drop table t1;

View File

@@ -54,4 +54,12 @@ t1 CREATE TABLE `t1` (
`a` char(10) collate latin1_german1_ci default NULL `a` char(10) collate latin1_german1_ci default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
DROP TABLE t1; 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; DROP DATABASE mysqltest1;

View File

@@ -1,5 +1,4 @@
drop table if exists t1; drop table if exists t1,t2;
drop table if exists t2;
set names utf8; set names utf8;
select left(_utf8 0xD0B0D0B1D0B2,1); select left(_utf8 0xD0B0D0B1D0B2,1);
left(_utf8 0xD0B0D0B1D0B2,1) left(_utf8 0xD0B0D0B1D0B2,1)

View File

@@ -19,7 +19,7 @@ select 'a a' > 'a', 'a \0' < 'a';
1 1 1 1
select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a'; 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' 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)); create table t1 (text1 varchar(32) not NULL, KEY key1 (text1));
insert into t1 values ('teststring'), ('nothing'), ('teststring\t'); insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
check table t1; check table t1;
@@ -52,13 +52,13 @@ select * from t1 ignore key (key1) where text1='teststring' or text1 like 'tests
text1 text1
teststring teststring
teststring teststring
select * from t1 where text1='teststring' or text1 like 'teststring_%'; select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
text1 concat('|', text1, '|')
teststring |teststring |
teststring |teststring|
select * from t1 where text1='teststring' or text1 > 'teststring\t'; select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
text1 concat('|', text1, '|')
teststring |teststring|
select text1, length(text1) from t1 order by text1; select text1, length(text1) from t1 order by text1;
text1 length(text1) text1 length(text1)
nothing 7 nothing 7
@@ -77,7 +77,28 @@ concat('|', text1, '|')
|teststring| |teststring|
|teststring | |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; 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_%'; select * from t1 where text1 like 'teststring_%';
text1 text1
teststring teststring
@@ -87,10 +108,10 @@ text1
teststring teststring
teststring teststring
teststring teststring
select * from t1 where text1='teststring' or text1 > 'teststring\t'; select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
text1 concat('|', text1, '|')
teststring |teststring|
teststring |teststring |
select concat('|', text1, '|') from t1 order by text1; select concat('|', text1, '|') from t1 order by text1;
concat('|', text1, '|') concat('|', text1, '|')
|nothing| |nothing|

View File

@@ -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 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 1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using filesort
Warnings: 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; select nullif(u=0, 'test') from t1;
nullif(u=0, 'test') nullif(u=0, 'test')
NULL NULL

View File

@@ -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 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 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings: 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, "#"); SELECT lpad(12345, 5, "#");
lpad(12345, 5, "#") lpad(12345, 5, "#")
12345 12345

View File

@@ -466,3 +466,22 @@ insert IGNORE into t1 values ('Garbage');
ERROR HY000: Unknown error ERROR HY000: Unknown error
alter table t1 add spatial index(a); alter table t1 add spatial index(a);
drop table t1; 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;

View File

@@ -127,3 +127,4 @@ having (a.description is not null) and (c=0);
id description c id description c
1 test 0 1 test 0
2 test2 0 2 test2 0
drop table t1,t2,t3;

View File

@@ -58,3 +58,10 @@ ERROR 42000: Not unique table/alias: 'C'
drop table t1, t2; drop table t1, t2;
show tables; show tables;
Tables_in_test 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;

View File

@@ -413,7 +413,6 @@ aaa .
select concat(a,'.') from t1 where binary a='aaa'; select concat(a,'.') from t1 where binary a='aaa';
concat(a,'.') concat(a,'.')
aaa. aaa.
aaa.
update t1 set a='bbb' where a='aaa'; update t1 set a='bbb' where a='aaa';
select concat(a,'.') from t1; select concat(a,'.') from t1;
concat(a,'.') concat(a,'.')

View File

@@ -35,10 +35,10 @@ update t1 set name="Autodiscover" where id = 2;
show status like 'handler_discover%'; show status like 'handler_discover%';
Variable_name Value Variable_name Value
Handler_discover 4 Handler_discover 4
select * from t1 order by name; select * from t1 order by id;
id name id name
2 Autodiscover
1 Autodiscover 1 Autodiscover
2 Autodiscover
3 Discover 3 3 Discover 3
show status like 'handler_discover%'; show status like 'handler_discover%';
Variable_name Value Variable_name Value

View File

@@ -205,4 +205,10 @@ a b c
select * from t1 where b<=5 and c=0 or b<=5 and c=2; select * from t1 where b<=5 and c=0 or b<=5 and c=2;
a b c a b c
19 4 0 19 4 0
select count(*) from t1 where b = 0;
count(*)
0
select count(*) from t1 where b = 1;
count(*)
1
drop table t1; drop table t1;

View File

@@ -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); insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
select * from t1 where txt='Chevy' or txt is NULL; select * from t1 where txt='Chevy' or txt is NULL;
id txt id txt
3 NULL
1 Chevy 1 Chevy
2 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 '; select * from t1 where txt='Chevy ';
id txt id txt
1 Chevy 1 Chevy
@@ -663,6 +666,21 @@ id txt
1 Chevy 1 Chevy
2 Chevy 2 Chevy
4 Ford 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; 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))); 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,''); INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,'');

View File

@@ -272,7 +272,7 @@ auto bigint(17) unsigned NULL PRI 0 select,insert,update,references
t1 bigint(1) NULL 0 select,insert,update,references t1 bigint(1) NULL 0 select,insert,update,references
t2 char(1) latin1_swedish_ci select,insert,update,references t2 char(1) latin1_swedish_ci select,insert,update,references
t3 longtext 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; select * from t2;
auto t1 t2 t3 t4 auto t1 t2 t3 t4
11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 11 1 a aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

View File

@@ -365,3 +365,15 @@ select * from t1;
t1 i t1 i
2004-04-01 00:00:00 10 2004-04-01 00:00:00 10
drop table t1; 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;

View File

@@ -48,6 +48,7 @@ flush privileges;
#connect (con1,localhost,test,gambling2,""); #connect (con1,localhost,test,gambling2,"");
#show tables; #show tables;
connect (con1,localhost,test,gambling2,mysql); connect (con1,localhost,test,gambling2,mysql);
set password="";
--error 1105 --error 1105
set password='gambling3'; set password='gambling3';
set password=old_password('gambling3'); set password=old_password('gambling3');

View File

@@ -12,18 +12,18 @@ drop table if exists t1, t2;
CREATE TABLE t1 ( a int ); CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1); INSERT INTO t1 VALUES (1),(2),(1);
--error 1062; --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; --error 1146;
select * from t2; select * from t2;
--error 1062; --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; --error 1146;
select * from t2; select * from t2;
--error 1062; --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; --error 1146;
select * from t2; select * from t2;
--error 1062; --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; --error 1146;
select * from t2; select * from t2;

View File

@@ -71,6 +71,18 @@ SHOW CREATE TABLE t1;
DROP 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; DROP DATABASE mysqltest1;

View File

@@ -3,8 +3,7 @@
# #
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1,t2;
drop table if exists t2;
--enable_warnings --enable_warnings
set names utf8; set names utf8;

View File

@@ -31,19 +31,25 @@ explain select * from t1 order by text1;
alter table t1 modify text1 char(32) binary not null; alter table t1 modify text1 char(32) binary not null;
check table t1; check table t1;
select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%'; select * from t1 ignore key (key1) where text1='teststring' or text1 like 'teststring_%';
select * from t1 where text1='teststring' or text1 like 'teststring_%'; select concat('|', text1, '|') 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 text1, length(text1) from t1 order by text1; select text1, length(text1) from t1 order by text1;
select text1, length(text1) from t1 order by binary 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)); alter table t1 modify text1 blob not null, drop key key1, add key key1 (text1(20));
insert into t1 values ('teststring '); insert into t1 values ('teststring ');
select concat('|', text1, '|') from t1 order by text1; 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; 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 like 'teststring_%';
select * from t1 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 > 'teststring\t';
select concat('|', text1, '|') from t1 order by text1; select concat('|', text1, '|') from t1 order by text1;
drop table t1; drop table t1;

View File

@@ -172,3 +172,21 @@ insert IGNORE into t1 values ('Garbage');
alter table t1 add spatial index(a); alter table t1 add spatial index(a);
drop table t1; 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;

View File

@@ -121,3 +121,4 @@ select
from t1 a left join t3 b on a.id=b.order_id from t1 a left join t3 b on a.id=b.order_id
group by a.id, a.description group by a.id, a.description
having (a.description is not null) and (c=0); having (a.description is not null) and (c=0);
drop table t1,t2,t3;

View File

@@ -54,3 +54,13 @@ select C.a, c.a from t1 c, t2 C;
drop table t1, t2; drop table t1, t2;
show tables; 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;

View File

@@ -50,7 +50,7 @@ flush tables;
system rm var/master-data/test/t1.frm ; system rm var/master-data/test/t1.frm ;
update t1 set name="Autodiscover" where id = 2; update t1 set name="Autodiscover" where id = 2;
show status like 'handler_discover%'; show status like 'handler_discover%';
select * from t1 order by name; select * from t1 order by id;
show status like 'handler_discover%'; show status like 'handler_discover%';
# #

View File

@@ -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<=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 * 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; drop table t1;
# #

View File

@@ -340,6 +340,7 @@ drop table t1;
create table t1 (id integer primary key auto_increment, txt text, unique index txt_index (txt (20))); 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); insert into t1 (txt) values ('Chevy'), ('Chevy '), (NULL);
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;
select * from t1 where txt='Chevy '; select * from t1 where txt='Chevy ';
select * from t1 where txt='Chevy ' or txt='Chevy'; select * from t1 where txt='Chevy ' or 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'; 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; 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))); 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,''); INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
select max(i) from t1 where c = ''; select max(i) from t1 where c = '';

View File

@@ -234,3 +234,13 @@ alter table t1 add i int default 10;
select * from t1; select * from t1;
drop table 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;

View File

@@ -17,9 +17,9 @@
#include <my_global.h> #include <my_global.h>
#include <m_string.h> #include <m_string.h>
#include <stdlib.h> #include <stdlib.h>
#include <my_getopt.h>
#include <my_sys.h> #include <my_sys.h>
#include <mysys_err.h> #include <mysys_err.h>
#include <my_getopt.h>
static int findopt(char *optpat, uint length, static int findopt(char *optpat, uint length,
const struct my_option **opt_res, const struct my_option **opt_res,
@@ -56,6 +56,13 @@ char *disabled_my_option= (char*) "0";
my_bool my_getopt_print_errors= 1; 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 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, int handle_options(int *argc, char ***argv,
const struct my_option *longopts, const struct my_option *longopts, my_get_one_option get_one_option,
my_bool (*get_one_option)(int, my_error_reporter reporter)
const struct my_option *,
char *))
{ {
uint opt_found, argvpos= 0, length, i; uint opt_found, argvpos= 0, length, i;
my_bool end_of_options= 0, must_be_var, set_maximum_value, my_bool end_of_options= 0, must_be_var, set_maximum_value,
@@ -95,6 +100,8 @@ int handle_options(int *argc, char ***argv,
(*argv)++; /* --- || ---- */ (*argv)++; /* --- || ---- */
init_variables(longopts); init_variables(longopts);
if (! reporter) reporter = &default_reporter;
for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++) for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++)
{ {
char *cur_arg= *pos; char *cur_arg= *pos;
@@ -118,7 +125,7 @@ int handle_options(int *argc, char ***argv,
if (!*++pos) if (!*++pos)
{ {
if (my_getopt_print_errors) if (my_getopt_print_errors)
fprintf(stderr, "%s: Option '-O' requires an argument\n", reporter(ERROR_LEVEL, "%s: Option '-O' requires an argument\n",
my_progname); my_progname);
return EXIT_ARGUMENT_REQUIRED; return EXIT_ARGUMENT_REQUIRED;
} }
@@ -135,8 +142,7 @@ int handle_options(int *argc, char ***argv,
if (!*cur_arg) if (!*cur_arg)
{ {
if (my_getopt_print_errors) if (my_getopt_print_errors)
fprintf(stderr, reporter(ERROR_LEVEL, "%s: Option '--set-variable' requires an argument\n",
"%s: Option '--set-variable' requires an argument\n",
my_progname); my_progname);
return EXIT_ARGUMENT_REQUIRED; return EXIT_ARGUMENT_REQUIRED;
} }
@@ -149,8 +155,7 @@ int handle_options(int *argc, char ***argv,
if (!*++pos) if (!*++pos)
{ {
if (my_getopt_print_errors) if (my_getopt_print_errors)
fprintf(stderr, reporter(ERROR_LEVEL, "%s: Option '--set-variable' requires an argument\n",
"%s: Option '--set-variable' requires an argument\n",
my_progname); my_progname);
return EXIT_ARGUMENT_REQUIRED; return EXIT_ARGUMENT_REQUIRED;
} }
@@ -210,7 +215,7 @@ int handle_options(int *argc, char ***argv,
if (opt_found > 1) if (opt_found > 1)
{ {
if (my_getopt_print_errors) if (my_getopt_print_errors)
fprintf(stderr, reporter(ERROR_LEVEL,
"%s: ambiguous option '--%s-%s' (--%s-%s)\n", "%s: ambiguous option '--%s-%s' (--%s-%s)\n",
my_progname, special_opt_prefix[i], opt_str, my_progname, special_opt_prefix[i], opt_str,
special_opt_prefix[i], prev_found); special_opt_prefix[i], prev_found);
@@ -245,18 +250,16 @@ int handle_options(int *argc, char ***argv,
if (must_be_var) if (must_be_var)
{ {
if (my_getopt_print_errors) if (my_getopt_print_errors)
fprintf(stderr, reporter(option_is_loose ? WARNING_LEVEL : ERROR_LEVEL,
"%s: %s: unknown variable '%s'\n", my_progname, "%s: unknown variable '%s'\n", my_progname, cur_arg);
option_is_loose ? "WARNING" : "ERROR", opt_str);
if (!option_is_loose) if (!option_is_loose)
return EXIT_UNKNOWN_VARIABLE; return EXIT_UNKNOWN_VARIABLE;
} }
else else
{ {
if (my_getopt_print_errors) if (my_getopt_print_errors)
fprintf(stderr, reporter(option_is_loose ? WARNING_LEVEL : ERROR_LEVEL,
"%s: %s: unknown option '--%s'\n", my_progname, "%s: unknown option '--%s'\n", my_progname, cur_arg);
option_is_loose ? "WARNING" : "ERROR", opt_str);
if (!option_is_loose) if (!option_is_loose)
return EXIT_UNKNOWN_OPTION; return EXIT_UNKNOWN_OPTION;
} }
@@ -272,14 +275,14 @@ int handle_options(int *argc, char ***argv,
if (must_be_var) if (must_be_var)
{ {
if (my_getopt_print_errors) 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); my_progname, opt_str);
return EXIT_VAR_PREFIX_NOT_UNIQUE; return EXIT_VAR_PREFIX_NOT_UNIQUE;
} }
else else
{ {
if (my_getopt_print_errors) 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); my_progname, opt_str, prev_found, optp->name);
return EXIT_AMBIGUOUS_OPTION; 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 (must_be_var && (optp->var_type & GET_TYPE_MASK) == GET_NO_ARG)
{ {
if (my_getopt_print_errors) 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); my_progname, optp->name);
return EXIT_NO_ARGUMENT_ALLOWED; 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 (optend && (optp->var_type & GET_TYPE_MASK) != GET_BOOL)
{ {
if (my_getopt_print_errors) 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); my_progname, optp->name);
return EXIT_NO_ARGUMENT_ALLOWED; return EXIT_NO_ARGUMENT_ALLOWED;
} }
@@ -351,7 +354,7 @@ int handle_options(int *argc, char ***argv,
if (!*++pos) if (!*++pos)
{ {
if (my_getopt_print_errors) 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); my_progname, optp->name);
return EXIT_ARGUMENT_REQUIRED; return EXIT_ARGUMENT_REQUIRED;
} }
@@ -410,7 +413,7 @@ int handle_options(int *argc, char ***argv,
if (!pos[1]) if (!pos[1])
{ {
if (my_getopt_print_errors) if (my_getopt_print_errors)
fprintf(stderr, reporter(ERROR_LEVEL,
"%s: option '-%c' requires an argument\n", "%s: option '-%c' requires an argument\n",
my_progname, optp->id); my_progname, optp->id);
return EXIT_ARGUMENT_REQUIRED; return EXIT_ARGUMENT_REQUIRED;
@@ -423,7 +426,7 @@ int handle_options(int *argc, char ***argv,
if ((error= setval(optp, optp->value, argument, if ((error= setval(optp, optp->value, argument,
set_maximum_value))) set_maximum_value)))
{ {
fprintf(stderr, reporter(ERROR_LEVEL,
"%s: Error while setting value '%s' to '%s'\n", "%s: Error while setting value '%s' to '%s'\n",
my_progname, argument, optp->name); my_progname, argument, optp->name);
return error; return error;
@@ -435,7 +438,7 @@ int handle_options(int *argc, char ***argv,
if (!opt_found) if (!opt_found)
{ {
if (my_getopt_print_errors) if (my_getopt_print_errors)
fprintf(stderr, reporter(ERROR_LEVEL,
"%s: unknown option '-%c'\n", my_progname, *optend); "%s: unknown option '-%c'\n", my_progname, *optend);
return EXIT_UNKNOWN_OPTION; return EXIT_UNKNOWN_OPTION;
} }
@@ -445,7 +448,7 @@ int handle_options(int *argc, char ***argv,
} }
if ((error= setval(optp, value, argument, set_maximum_value))) if ((error= setval(optp, value, argument, set_maximum_value)))
{ {
fprintf(stderr, reporter(ERROR_LEVEL,
"%s: Error while setting value '%s' to '%s'\n", "%s: Error while setting value '%s' to '%s'\n",
my_progname, argument, optp->name); my_progname, argument, optp->name);
return error; return error;

View File

@@ -12,6 +12,7 @@
#define CFG_NODE_BYTE_ORDER 4 #define CFG_NODE_BYTE_ORDER 4
#define CFG_NODE_HOST 5 #define CFG_NODE_HOST 5
#define CFG_NODE_SYSTEM 6 #define CFG_NODE_SYSTEM 6
#define CFG_NODE_DATADIR 7
/** /**
* DB config parameters * DB config parameters
@@ -89,6 +90,8 @@
#define CFG_DB_LONG_SIGNAL_BUFFER 157 #define CFG_DB_LONG_SIGNAL_BUFFER 157
#define CFG_DB_BACKUP_DATADIR 158
#define CFG_NODE_ARBIT_RANK 200 #define CFG_NODE_ARBIT_RANK 200
#define CFG_NODE_ARBIT_DELAY 201 #define CFG_NODE_ARBIT_DELAY 201

View File

@@ -78,6 +78,11 @@ public:
* Get config from file * Get config from file
*/ */
struct ndb_mgm_configuration * getConfig(const char * file); struct ndb_mgm_configuration * getConfig(const char * file);
/**
* Verify config
*/
bool verifyConfig(const struct ndb_mgm_configuration *, Uint32 nodeid);
private: private:
BaseString errorString; BaseString errorString;
enum ErrorType { enum ErrorType {
@@ -97,11 +102,6 @@ private:
Uint32 m_version; Uint32 m_version;
Uint32 m_node_type; Uint32 m_node_type;
NdbMgmHandle m_handle; NdbMgmHandle m_handle;
/**
* Verify config
*/
bool verifyConfig(const struct ndb_mgm_configuration *);
}; };
#endif #endif

View File

@@ -21,6 +21,7 @@
extern "C" { extern "C" {
#endif #endif
void NdbConfig_SetPath(const char *path);
char* NdbConfig_NdbCfgName(int with_ndb_home); char* NdbConfig_NdbCfgName(int with_ndb_home);
char* NdbConfig_ErrorFileName(int node_id); char* NdbConfig_ErrorFileName(int node_id);
char* NdbConfig_ClusterLogFileName(int node_id); char* NdbConfig_ClusterLogFileName(int node_id);

View File

@@ -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); extern int strncasecmp(const char *s1, const char *s2, size_t n);
#endif #endif
#ifdef SCO
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
#endif /* SCO */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -14,8 +14,8 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#include <FileLogHandler.hpp> #include <FileLogHandler.hpp>
#include <File.hpp> #include <File.hpp>
// //
@@ -146,7 +146,7 @@ FileLogHandler::createNewFile()
{ {
bool rc = true; bool rc = true;
int fileNo = 1; int fileNo = 1;
char newName[MAXPATHLEN]; char newName[PATH_MAX];
do do
{ {

View File

@@ -154,7 +154,7 @@ ConfigRetriever::getConfig() {
if(p == 0) if(p == 0)
return 0; return 0;
if(!verifyConfig(p)){ if(!verifyConfig(p, _ownNodeId)){
free(p); free(p);
p= 0; p= 0;
} }
@@ -239,7 +239,7 @@ ConfigRetriever::setConnectString(const char * connectString) {
} }
bool bool
ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32 nodeid){
char buf[255]; char buf[255];
ndb_mgm_configuration_iterator * it; ndb_mgm_configuration_iterator * it;
@@ -253,8 +253,8 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
} }
NdbAutoPtr<ndb_mgm_configuration_iterator> ptr(it); NdbAutoPtr<ndb_mgm_configuration_iterator> ptr(it);
if(ndb_mgm_find(it, CFG_NODE_ID, _ownNodeId) != 0){ if(ndb_mgm_find(it, CFG_NODE_ID, nodeid) != 0){
snprintf(buf, 255, "Unable to find node with id: %d", _ownNodeId); snprintf(buf, 255, "Unable to find node with id: %d", nodeid);
setError(CR_ERROR, buf); setError(CR_ERROR, buf);
return false; return false;
} }
@@ -266,6 +266,11 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
return false; return false;
} }
const char * datadir;
if(!ndb_mgm_get_string_parameter(it, CFG_NODE_DATADIR, &datadir)){
NdbConfig_SetPath(datadir);
}
char localhost[MAXHOSTNAMELEN]; char localhost[MAXHOSTNAMELEN];
if(NdbHost_GetHostName(localhost) != 0){ if(NdbHost_GetHostName(localhost) != 0){
snprintf(buf, 255, "Unable to get own hostname"); 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_1, &nodeId1)) continue;
if(iter.get(CFG_CONNECTION_NODE_2, &nodeId2)) continue; if(iter.get(CFG_CONNECTION_NODE_2, &nodeId2)) continue;
if(nodeId1 != _ownNodeId && nodeId2 != _ownNodeId) continue; if(nodeId1 != nodeid && nodeId2 != nodeid) continue;
remoteNodeId = (_ownNodeId == nodeId1 ? nodeId2 : nodeId1); remoteNodeId = (nodeid == nodeId1 ? nodeId2 : nodeId1);
const char * name; const char * name;
struct in_addr addr; struct in_addr addr;
@@ -342,7 +347,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
if(Ndb_getInAddr(&addr, name) != 0){ if(Ndb_getInAddr(&addr, name) != 0){
tmp.assfmt("Unable to lookup/illegal hostname %s, " tmp.assfmt("Unable to lookup/illegal hostname %s, "
"connection from node %d to node %d", "connection from node %d to node %d",
name, _ownNodeId, remoteNodeId); name, nodeid, remoteNodeId);
setError(CR_ERROR, tmp.c_str()); setError(CR_ERROR, tmp.c_str());
return false; return false;
} }
@@ -352,7 +357,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf){
if(Ndb_getInAddr(&addr, name) != 0){ if(Ndb_getInAddr(&addr, name) != 0){
tmp.assfmt("Unable to lookup/illegal hostname %s, " tmp.assfmt("Unable to lookup/illegal hostname %s, "
"connection from node %d to node %d", "connection from node %d to node %d",
name, _ownNodeId, remoteNodeId); name, nodeid, remoteNodeId);
setError(CR_ERROR, tmp.c_str()); setError(CR_ERROR, tmp.c_str());
return false; return false;
} }

View File

@@ -1,23 +1,13 @@
MYSQLDATAdir = $(localstatedir)
MYSQLSHAREdir = $(pkgdatadir)
MYSQLBASEdir= $(prefix)
noinst_LTLIBRARIES = libmgmsrvcommon.la noinst_LTLIBRARIES = libmgmsrvcommon.la
libmgmsrvcommon_la_SOURCES = \ libmgmsrvcommon_la_SOURCES = \
LocalConfig.cpp \ LocalConfig.cpp \
Config.cpp \
ConfigInfo.cpp \
ConfigRetriever.cpp \ ConfigRetriever.cpp \
InitConfigFileParser.cpp \
IPCConfig.cpp NdbConfig.c 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)\"" \ DEFS_LOC = -DNDB_BASE_PORT="\"@ndb_port_base@\""
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" \
-DNDB_BASE_PORT="\"@ndb_port_base@\""
include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_ndbapi.mk.am include $(top_srcdir)/ndb/config/type_ndbapi.mk.am

View File

@@ -19,6 +19,8 @@
#include <NdbEnv.h> #include <NdbEnv.h>
#include <NdbMem.h> #include <NdbMem.h>
static char *datadir_path= 0;
static char* static char*
NdbConfig_AllocHomePath(int _len) NdbConfig_AllocHomePath(int _len)
{ {
@@ -27,19 +29,27 @@ NdbConfig_AllocHomePath(int _len)
int path_len= 0; int path_len= 0;
char *buf; char *buf;
if (path == 0)
path= datadir_path;
if (path) if (path)
path_len= strlen(path); path_len= strlen(path);
len+= path_len; len+= path_len;
buf= NdbMem_Allocate(len); buf= NdbMem_Allocate(len);
if (path_len > 0) if (path_len > 0)
snprintf(buf, len, "%s%c", path, DIR_SEPARATOR); snprintf(buf, len, "%s%s", path, DIR_SEPARATOR);
else else
buf[0]= 0; buf[0]= 0;
return buf; return buf;
} }
void
NdbConfig_SetPath(const char* path){
datadir_path= path;
}
char* char*
NdbConfig_NdbCfgName(int with_ndb_home){ NdbConfig_NdbCfgName(int with_ndb_home){
char *buf; char *buf;

View File

@@ -52,7 +52,10 @@ LDADD += \
$(top_builddir)/ndb/src/common/mgmcommon/libmgmsrvcommon.la \ $(top_builddir)/ndb/src/common/mgmcommon/libmgmsrvcommon.la \
$(top_builddir)/ndb/src/mgmapi/libmgmapi.la \ $(top_builddir)/ndb/src/mgmapi/libmgmapi.la \
$(top_builddir)/ndb/src/common/portlib/libportlib.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 # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%

View File

@@ -5,7 +5,7 @@ Next DBACC 3001
Next DBTUP 4007 Next DBTUP 4007
Next DBLQH 5040 Next DBLQH 5040
Next DBDICT 6006 Next DBDICT 6006
Next DBDIH 7173 Next DBDIH 7174
Next DBTC 8035 Next DBTC 8035
Next CMVMI 9000 Next CMVMI 9000
Next BACKUP 10022 Next BACKUP 10022
@@ -387,6 +387,11 @@ Backup Stuff:
5028: Crash when receiving LQHKEYREQ (in non-master) 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: Drop Table/Index:
----------------- -----------------
4001: Crash on REL_TABMEMREQ in TUP 4001: Crash on REL_TABMEMREQ in TUP

View File

@@ -46,6 +46,7 @@
// Used here only to print event reports on stdout/console. // Used here only to print event reports on stdout/console.
EventLogger g_eventLogger; EventLogger g_eventLogger;
extern int simulate_error_during_shutdown;
Cmvmi::Cmvmi(const Configuration & conf) : Cmvmi::Cmvmi(const Configuration & conf) :
SimulatedBlock(CMVMI, conf) SimulatedBlock(CMVMI, conf)
@@ -148,6 +149,16 @@ void Cmvmi::execNDB_TAMPER(Signal* signal)
if(ERROR_INSERTED(9997)){ if(ERROR_INSERTED(9997)){
ndbrequire(false); 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() }//execNDB_TAMPER()
void Cmvmi::execSET_LOGLEVELORD(Signal* signal) void Cmvmi::execSET_LOGLEVELORD(Signal* signal)

View File

@@ -6174,7 +6174,7 @@ void Dbdih::execCREATE_FRAGMENTATION_REQ(Signal * signal){
break; break;
case DictTabInfo::AllNodesLargeTable: case DictTabInfo::AllNodesLargeTable:
jam(); jam();
noOfFragments = csystemnodes; noOfFragments = 4 * csystemnodes;
break; break;
case DictTabInfo::SingleFragment: case DictTabInfo::SingleFragment:
jam(); jam();
@@ -6425,6 +6425,10 @@ void Dbdih::execDIADDTABREQ(Signal* signal)
tabPtr.p->totalfragments = noFragments; tabPtr.p->totalfragments = noFragments;
ndbrequire(noReplicas == cnoReplicas); // Only allowed ndbrequire(noReplicas == cnoReplicas); // Only allowed
if (ERROR_INSERTED(7173)) {
addtabrefuseLab(signal, connectPtr, ZREPLERROR1);
return;
}
if ((noReplicas * noFragments) > cnoFreeReplicaRec) { if ((noReplicas * noFragments) > cnoFreeReplicaRec) {
jam(); jam();
addtabrefuseLab(signal, connectPtr, ZREPLERROR1); addtabrefuseLab(signal, connectPtr, ZREPLERROR1);
@@ -6736,6 +6740,7 @@ void Dbdih::tableDeleteLab(Signal* signal, FileRecordPtr filePtr)
void Dbdih::releaseTable(TabRecordPtr tabPtr) void Dbdih::releaseTable(TabRecordPtr tabPtr)
{ {
FragmentstorePtr fragPtr; FragmentstorePtr fragPtr;
if (tabPtr.p->noOfFragChunks > 0) {
for (Uint32 fragId = 0; fragId < tabPtr.p->totalfragments; fragId++) { for (Uint32 fragId = 0; fragId < tabPtr.p->totalfragments; fragId++) {
jam(); jam();
getFragstore(tabPtr.p, fragId, fragPtr); getFragstore(tabPtr.p, fragId, fragPtr);
@@ -6743,6 +6748,7 @@ void Dbdih::releaseTable(TabRecordPtr tabPtr)
releaseReplicas(fragPtr.p->oldStoredReplicas); releaseReplicas(fragPtr.p->oldStoredReplicas);
}//for }//for
releaseFragments(tabPtr); releaseFragments(tabPtr);
}
if (tabPtr.p->tabFile[0] != RNIL) { if (tabPtr.p->tabFile[0] != RNIL) {
jam(); jam();
releaseFile(tabPtr.p->tabFile[0]); releaseFile(tabPtr.p->tabFile[0]);
@@ -6875,9 +6881,6 @@ Uint32 Dbdih::extractNodeInfo(const Fragmentstore * fragPtr, Uint32 nodes[])
return nodeCount; return nodeCount;
}//Dbdih::extractNodeInfo() }//Dbdih::extractNodeInfo()
#define NO_OF_FRAGS_PER_CHUNK 16
#define LOG_NO_OF_FRAGS_PER_CHUNK 4
void void
Dbdih::getFragstore(TabRecord * tab, //In parameter Dbdih::getFragstore(TabRecord * tab, //In parameter
Uint32 fragNo, //In parameter Uint32 fragNo, //In parameter
@@ -11051,6 +11054,7 @@ void Dbdih::initRestorableGciFiles()
void Dbdih::initTable(TabRecordPtr tabPtr) void Dbdih::initTable(TabRecordPtr tabPtr)
{ {
tabPtr.p->noOfFragChunks = 0;
tabPtr.p->method = TabRecord::NOTDEFINED; tabPtr.p->method = TabRecord::NOTDEFINED;
tabPtr.p->tabStatus = TabRecord::TS_IDLE; tabPtr.p->tabStatus = TabRecord::TS_IDLE;
tabPtr.p->noOfWords = 0; tabPtr.p->noOfWords = 0;

View File

@@ -287,6 +287,22 @@ Dbtux::execDROP_TAB_REQ(Signal* signal)
const DropTabReq reqCopy = *(const DropTabReq*)signal->getDataPtr(); const DropTabReq reqCopy = *(const DropTabReq*)signal->getDataPtr();
const DropTabReq* const req = &reqCopy; const DropTabReq* const req = &reqCopy;
IndexPtr indexPtr; 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); c_indexPool.getPtr(indexPtr, req->tableId);
// drop works regardless of index state // drop works regardless of index state
#ifdef VM_TRACE #ifdef VM_TRACE

View File

@@ -108,8 +108,10 @@ AsyncFile::AsyncFile() :
} }
void void
AsyncFile::doStart(Uint32 nodeId, const char * filesystemPath) { AsyncFile::doStart(Uint32 nodeId,
theFileName.init(nodeId, filesystemPath); const char * filesystemPath,
const char * backup_path) {
theFileName.init(nodeId, filesystemPath, backup_path);
// Stacksize for filesystem threads // Stacksize for filesystem threads
// An 8k stack should be enough // An 8k stack should be enough

View File

@@ -181,7 +181,7 @@ public:
void execute( Request* request ); 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 // its a thread so its always running
void run(); void run();

View File

@@ -46,43 +46,31 @@ Filename::Filename() :
} }
void 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) { if (pFileSystemPath == NULL) {
ERROR_SET(fatal, AFS_ERROR_NOPATH, ""," Filename::init()"); ERROR_SET(fatal, AFS_ERROR_NOPATH, ""," Filename::init()");
return; return;
} }
strncpy(theBaseDirectory, pFileSystemPath, PATH_MAX); snprintf(theFileSystemDirectory, sizeof(theFileSystemDirectory),
"%sndb_%u_fs%s", pFileSystemPath, nodeid, DIR_SEPARATOR);
strncpy(theBackupDirectory, pBackupDirPath, sizeof(theBackupDirectory));
// the environment variable is set, DBUG_PRINT("info", ("theFileSystemDirectory=%s", theFileSystemDirectory));
// check that it is pointing on a valid directory DBUG_PRINT("info", ("theBackupDirectory=%s", theBackupDirectory));
//
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);
#ifdef NDB_WIN32 #ifdef NDB_WIN32
CreateDirectory(theBaseDirectory, 0); CreateDirectory(theFileSystemDirectory, 0);
#else #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 #endif
theBaseDirectory= 0;
DBUG_VOID_RETURN;
} }
Filename::~Filename(){ Filename::~Filename(){
@@ -94,10 +82,16 @@ Filename::set(BlockReference blockReference,
{ {
char buf[PATH_MAX]; char buf[PATH_MAX];
theLevelDepth = 0; theLevelDepth = 0;
strncpy(theName, theBaseDirectory, PATH_MAX);
const Uint32 type = FsOpenReq::getSuffix(filenumber); const Uint32 type = FsOpenReq::getSuffix(filenumber);
const Uint32 version = FsOpenReq::getVersion(filenumber); const Uint32 version = FsOpenReq::getVersion(filenumber);
if (version == 2)
theBaseDirectory= theBackupDirectory;
else
theBaseDirectory= theFileSystemDirectory;
strncpy(theName, theBaseDirectory, PATH_MAX);
switch(version){ switch(version){
case 1 :{ case 1 :{
const Uint32 diskNo = FsOpenReq::v1_getDisk(filenumber); const Uint32 diskNo = FsOpenReq::v1_getDisk(filenumber);

View File

@@ -68,12 +68,15 @@ public:
int levels() const; int levels() const;
const char* c_str() const; const char* c_str() const;
void init(Uint32 nodeid, const char * fileSystemPath); void init(Uint32 nodeid, const char * fileSystemPath,
const char * backupDirPath);
private: private:
int theLevelDepth; int theLevelDepth;
char theName[PATH_MAX]; char theName[PATH_MAX];
char theBaseDirectory[PATH_MAX]; char theFileSystemDirectory[PATH_MAX];
char theBackupDirectory[PATH_MAX];
char *theBaseDirectory;
char theDirectory[PATH_MAX]; char theDirectory[PATH_MAX];
}; };

View File

@@ -58,6 +58,8 @@ Ndbfs::Ndbfs(const Configuration & conf) :
m_maxOpenedFiles(0) m_maxOpenedFiles(0)
{ {
theFileSystemPath = conf.fileSystemPath(); theFileSystemPath = conf.fileSystemPath();
theBackupFilePath = conf.backupFilePath();
theRequestPool = new Pool<Request>; theRequestPool = new Pool<Request>;
const ndb_mgm_configuration_iterator * p = conf.getOwnConfigIterator(); const ndb_mgm_configuration_iterator * p = conf.getOwnConfigIterator();
@@ -559,7 +561,7 @@ Ndbfs::createAsyncFile(){
} }
AsyncFile* file = new AsyncFile; AsyncFile* file = new AsyncFile;
file->doStart(getOwnNodeId(), theFileSystemPath); file->doStart(getOwnNodeId(), theFileSystemPath, theBackupFilePath);
// Put the file in list of all files // Put the file in list of all files
theFiles.push_back(file); theFiles.push_back(file);

View File

@@ -80,6 +80,7 @@ private:
Vector<AsyncFile*> theIdleFiles; // List of idle AsyncFiles Vector<AsyncFile*> theIdleFiles; // List of idle AsyncFiles
OpenFiles theOpenFiles; // List of open AsyncFiles OpenFiles theOpenFiles; // List of open AsyncFiles
const char * theFileSystemPath; const char * theFileSystemPath;
const char * theBackupFilePath;
// Statistics variables // Statistics variables
Uint32 m_maxOpenedFiles; Uint32 m_maxOpenedFiles;

View File

@@ -22,6 +22,8 @@
extern const char programName[]; 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) \ #define ERROR_SET(messageCategory, messageID, problemData, objectRef) \
ErrorReporter::handleError(messageCategory, messageID, problemData, objectRef) ErrorReporter::handleError(messageCategory, messageID, problemData, objectRef)
// Description: // Description:

View File

@@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h> #include <ndb_global.h>
#include <my_pthread.h>
#include <ndb_version.h> #include <ndb_version.h>
#include "Configuration.hpp" #include "Configuration.hpp"
@@ -26,6 +27,7 @@
#include <NdbOut.hpp> #include <NdbOut.hpp>
#include <NdbMain.h> #include <NdbMain.h>
#include <NdbDaemon.h> #include <NdbDaemon.h>
#include <NdbSleep.h>
#include <NdbConfig.h> #include <NdbConfig.h>
#include <WatchDog.hpp> #include <WatchDog.hpp>
@@ -39,6 +41,7 @@
#endif #endif
extern EventLogger g_eventLogger; extern EventLogger g_eventLogger;
extern NdbMutex * theShutdownMutex;
void catchsigs(bool ignore); // for process signal handling void catchsigs(bool ignore); // for process signal handling
@@ -328,16 +331,24 @@ handler_shutdown(int signum){
extern "C" extern "C"
void void
handler_error(int signum){ 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); g_eventLogger.info("Received signal %d. Running error handler.", signum);
// restart the system // restart the system
char errorData[40]; char errorData[40];
snprintf(errorData, 40, "Signal %d received", signum); snprintf(errorData, 40, "Signal %d received", signum);
ERROR_SET(fatal, 0, errorData, __FILE__); ERROR_SET_SIGNAL(fatal, 0, errorData, __FILE__);
} }

View File

@@ -14,6 +14,9 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#include <my_sys.h>
#include "Configuration.hpp" #include "Configuration.hpp"
#include <ErrorHandlingMacros.hpp> #include <ErrorHandlingMacros.hpp>
#include "GlobalData.hpp" #include "GlobalData.hpp"
@@ -56,6 +59,9 @@ Configuration::init(int argc, const char** argv){
int _deamon = 0; int _deamon = 0;
int _help = 0; int _help = 0;
int _print_version = 0; int _print_version = 0;
#ifndef DBUG_OFF
const char *debug_option= 0;
#endif
/** /**
* Arguments to NDB process * Arguments to NDB process
@@ -66,6 +72,10 @@ Configuration::init(int argc, const char** argv){
{ "nostart", 'n', arg_flag, &_no_start, { "nostart", 'n', arg_flag, &_no_start,
"Don't start ndbd immediately. Ndbd will await command from ndb_mgmd", "" }, "Don't start ndbd immediately. Ndbd will await command from ndb_mgmd", "" },
{ "daemon", 'd', arg_flag, &_deamon, "Start ndbd as daemon", "" }, { "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, { "initial", 'i', arg_flag, &_initial,
"Perform initial start of ndbd, including cleaning the file system. Consult documentation before using this", "" }, "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; return false;
} }
#if 0 #ifndef DBUG_OFF
ndbout << "no_start=" <<_no_start<< endl; my_init();
ndbout << "initial=" <<_initial<< endl; if (debug_option)
ndbout << "deamon=" <<_deamon<< endl; DBUG_PUSH(debug_option);
ndbout << "connect_str="<<_connect_str<<endl;
arg_printusage(args, num_args, argv[0], desc);
return false;
#endif #endif
DBUG_PRINT("info", ("no_start=%d", _no_start));
DBUG_PRINT("info", ("initial=%d", _initial));
DBUG_PRINT("info", ("deamon=%d", _deamon));
DBUG_PRINT("info", ("connect_str=%s", _connect_str));
ndbSetOwnVersion(); ndbSetOwnVersion();
if (_print_version) { if (_print_version) {
@@ -132,6 +144,7 @@ Configuration::Configuration()
_programName = 0; _programName = 0;
_connectString = 0; _connectString = 0;
_fsPath = 0; _fsPath = 0;
_backupPath = 0;
_initialStart = false; _initialStart = false;
_daemonMode = false; _daemonMode = false;
m_config_retriever= 0; m_config_retriever= 0;
@@ -144,6 +157,9 @@ Configuration::~Configuration(){
if(_fsPath != NULL) if(_fsPath != NULL)
free(_fsPath); free(_fsPath);
if(_backupPath != NULL)
free(_backupPath);
if (m_config_retriever) { if (m_config_retriever) {
delete m_config_retriever; delete m_config_retriever;
} }
@@ -225,8 +241,48 @@ Configuration::fetch_configuration(){
} }
} }
static char * get_and_validate_path(ndb_mgm_configuration_iterator &iter,
Uint32 param, const char *param_string)
{
const char* path = NULL;
if(iter.get(param, &path)){
ERROR_SET(fatal, ERR_INVALID_CONFIG, "Invalid configuration fetched missing ",
param_string);
}
if(path == 0 || strlen(path) == 0){
ERROR_SET(fatal, ERR_INVALID_CONFIG,
"Invalid configuration fetched. Configuration does not contain valid ",
param_string);
}
// 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(path, sizeof(buf2), buf2, &szFilePart)
|| (::GetFileAttributes(alloc_path)&FILE_ATTRIBUTE_READONLY))
#else
if((::realpath(path, buf2) == NULL)||
(::access(buf2, W_OK) != 0))
#endif
{
ERROR_SET(fatal, AFS_ERROR_INVALIDPATH, path, " Filename::init()");
}
if (strcmp(&buf2[strlen(buf2) - 1], DIR_SEPARATOR))
strcat(buf2, DIR_SEPARATOR);
return strdup(buf2);
}
void void
Configuration::setupConfiguration(){ Configuration::setupConfiguration(){
DBUG_ENTER("Configuration::setupConfiguration");
ndb_mgm_configuration * p = m_clusterConfig; ndb_mgm_configuration * p = m_clusterConfig;
/** /**
@@ -272,28 +328,14 @@ Configuration::setupConfiguration(){
} }
/** /**
* Get filesystem path * Get paths
*/ */
{ if (_fsPath)
const char* pFileSystemPath = NULL; free(_fsPath);
if(iter.get(CFG_DB_FILESYSTEM_PATH, &pFileSystemPath)){ _fsPath= get_and_validate_path(iter, CFG_DB_FILESYSTEM_PATH, "FileSystemPath");
ERROR_SET(fatal, ERR_INVALID_CONFIG, "Invalid configuration fetched", if (_backupPath)
"FileSystemPath missing"); free(_backupPath);
} _backupPath= get_and_validate_path(iter, CFG_DB_BACKUP_DATADIR, "BackupDataDir");
if(pFileSystemPath == 0 || strlen(pFileSystemPath) == 0){
ERROR_SET(fatal, ERR_INVALID_CONFIG, "Invalid configuration fetched",
"Configuration does not contain valid filesystem path");
}
if(pFileSystemPath[strlen(pFileSystemPath) - 1] == '/')
_fsPath = strdup(pFileSystemPath);
else {
_fsPath = (char *)NdbMem_Allocate(strlen(pFileSystemPath) + 2);
strcpy(_fsPath, pFileSystemPath);
strcat(_fsPath, "/");
}
}
if(iter.get(CFG_DB_STOP_ON_ERROR_INSERT, &m_restartOnErrorInsert)){ if(iter.get(CFG_DB_STOP_ON_ERROR_INSERT, &m_restartOnErrorInsert)){
ERROR_SET(fatal, ERR_INVALID_CONFIG, "Invalid configuration fetched", ERROR_SET(fatal, ERR_INVALID_CONFIG, "Invalid configuration fetched",
@@ -315,6 +357,8 @@ Configuration::setupConfiguration(){
(p, CFG_SECTION_NODE); (p, CFG_SECTION_NODE);
calcSizeAlt(cf); calcSizeAlt(cf);
DBUG_VOID_RETURN;
} }
bool bool
@@ -599,8 +643,12 @@ Configuration::calcSizeAlt(ConfigValues * ownConfig){
cfg.put(CFG_DIH_CONNECT, cfg.put(CFG_DIH_CONNECT,
noOfOperations + noOfTransactions + 46); noOfOperations + noOfTransactions + 46);
Uint32 noFragPerTable= ((noOfDBNodes + NO_OF_FRAGS_PER_CHUNK - 1) >>
LOG_NO_OF_FRAGS_PER_CHUNK) <<
LOG_NO_OF_FRAGS_PER_CHUNK;
cfg.put(CFG_DIH_FRAG_CONNECT, cfg.put(CFG_DIH_FRAG_CONNECT,
NO_OF_FRAG_PER_NODE * noOfMetaTables * noOfDBNodes); noFragPerTable * noOfMetaTables);
int temp; int temp;
temp = noOfReplicas - 2; temp = noOfReplicas - 2;

View File

@@ -53,6 +53,7 @@ public:
// Cluster configuration // Cluster configuration
const char * programName() const; const char * programName() const;
const char * fileSystemPath() const; const char * fileSystemPath() const;
const char * backupFilePath() const;
char * getConnectStringCopy() const; char * getConnectStringCopy() const;
/** /**
@@ -89,6 +90,7 @@ private:
*/ */
char * _programName; char * _programName;
char * _fsPath; char * _fsPath;
char * _backupPath;
bool _initialStart; bool _initialStart;
char * _connectString; char * _connectString;
bool _daemonMode; bool _daemonMode;
@@ -108,6 +110,12 @@ Configuration::fileSystemPath() const {
return _fsPath; return _fsPath;
} }
inline
const char *
Configuration::backupFilePath() const {
return _backupPath;
}
inline inline
bool bool
Configuration::getInitialStart() const { Configuration::getInitialStart() const {

View File

@@ -61,6 +61,7 @@ Uint32 theEmulatedJamBlockNumber = 0;
EmulatorData globalEmulatorData; EmulatorData globalEmulatorData;
NdbMutex * theShutdownMutex = 0; NdbMutex * theShutdownMutex = 0;
int simulate_error_during_shutdown= 0;
EmulatorData::EmulatorData(){ EmulatorData::EmulatorData(){
theConfiguration = 0; 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; globalData.theRestartFlag = perform_stop;
bool restart = false; bool restart = false;
@@ -145,6 +147,9 @@ NdbShutdown(NdbShutdownType type,
case NST_ErrorHandler: case NST_ErrorHandler:
ndbout << "Error handler " << shutting << " system" << endl; ndbout << "Error handler " << shutting << " system" << endl;
break; break;
case NST_ErrorHandlerSignal:
ndbout << "Error handler signal " << shutting << " system" << endl;
break;
case NST_Restart: case NST_Restart:
ndbout << "Restarting system" << endl; ndbout << "Restarting system" << endl;
break; break;
@@ -175,6 +180,12 @@ NdbShutdown(NdbShutdownType type,
#endif #endif
} }
if (simulate_error_during_shutdown) {
kill(getpid(), simulate_error_during_shutdown);
while(true)
NdbSleep_MilliSleep(10);
}
globalEmulatorData.theWatchDog->doStop(); globalEmulatorData.theWatchDog->doStop();
#ifdef VM_TRACE #ifdef VM_TRACE

View File

@@ -79,6 +79,7 @@ enum NdbShutdownType {
NST_Normal, NST_Normal,
NST_Watchdog, NST_Watchdog,
NST_ErrorHandler, NST_ErrorHandler,
NST_ErrorHandlerSignal,
NST_Restart, NST_Restart,
NST_ErrorInsert NST_ErrorInsert
}; };

View File

@@ -150,6 +150,13 @@
#define NO_OF_FRAG_PER_NODE 1 #define NO_OF_FRAG_PER_NODE 1
#define MAX_FRAG_PER_NODE 8 #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 // To avoid synching too big chunks at a time we synch after writing
// a certain number of data/UNDO pages. (e.g. 2 MBytes). // a certain number of data/UNDO pages. (e.g. 2 MBytes).

View File

@@ -47,10 +47,13 @@ static const char* helpText =
"HELP DEBUG Help for debug compiled version\n" "HELP DEBUG Help for debug compiled version\n"
#endif #endif
"SHOW Print information about cluster\n" "SHOW Print information about cluster\n"
#if 0
"SHOW CONFIG Print configuration\n" "SHOW CONFIG Print configuration\n"
"SHOW PARAMETERS Print configuration parameters\n" "SHOW PARAMETERS Print configuration parameters\n"
#endif
"START BACKUP Start backup\n" "START BACKUP Start backup\n"
"ABORT BACKUP <backup id> Abort backup\n" "ABORT BACKUP <backup id> Abort backup\n"
"SHUTDOWN Shutdown all processed in cluster and quit\n"
"CLUSTERLOG ON Enable Cluster logging\n" "CLUSTERLOG ON Enable Cluster logging\n"
"CLUSTERLOG OFF Disable Cluster logging\n" "CLUSTERLOG OFF Disable Cluster logging\n"
"CLUSTERLOG FILTER <severity> Toggle severity filter on/off\n" "CLUSTERLOG FILTER <severity> Toggle severity filter on/off\n"
@@ -62,7 +65,9 @@ static const char* helpText =
"EXIT SINGLE USER MODE Exit single user mode\n" "EXIT SINGLE USER MODE Exit single user mode\n"
"<id> STATUS Print status\n" "<id> STATUS Print status\n"
"<id> CLUSTERLOG {<category>=<level>}+ Set log level for cluster log\n" "<id> CLUSTERLOG {<category>=<level>}+ Set log level for cluster log\n"
#ifdef HAVE_GLOBAL_REPLICATION
"REP CONNECT <host:port> Connect to REP server on host:port\n" "REP CONNECT <host:port> Connect to REP server on host:port\n"
#endif
"QUIT Quit management client\n" "QUIT Quit management client\n"
; ;
@@ -299,6 +304,10 @@ CommandInterpreter::readAndExecute(int _try_reconnect)
executeShow(allAfterFirstToken); executeShow(allAfterFirstToken);
return true; return true;
} }
else if (strcmp(firstToken, "SHUTDOWN") == 0) {
executeShutdown(allAfterFirstToken);
return true;
}
else if (strcmp(firstToken, "CLUSTERLOG") == 0){ else if (strcmp(firstToken, "CLUSTERLOG") == 0){
executeClusterLog(allAfterFirstToken); executeClusterLog(allAfterFirstToken);
return true; 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 * SHOW
*****************************************************************************/ *****************************************************************************/

View File

@@ -127,6 +127,7 @@ private:
*/ */
void executeHelp(char* parameters); void executeHelp(char* parameters);
void executeShow(char* parameters); void executeShow(char* parameters);
void executeShutdown(char* parameters);
void executeRun(char* parameters); void executeRun(char* parameters);
void executeInfo(char* parameters); void executeInfo(char* parameters);
void executeClusterLog(char* parameters); void executeClusterLog(char* parameters);

View File

@@ -19,7 +19,6 @@
#include <string.h> #include <string.h>
#include "MgmtErrorReporter.hpp" #include "MgmtErrorReporter.hpp"
#include <Properties.hpp> #include <Properties.hpp>
#include "ConfigInfo.hpp"
//***************************************************************************** //*****************************************************************************
// Ctor / Dtor // Ctor / Dtor

Some files were not shown because too many files have changed in this diff Show More