merge with 4.0
This commit is contained in:
commit
350b433569
@ -8,6 +8,6 @@ c_warnings="$c_warnings $debug_extra_warnings"
|
|||||||
cxx_warnings="$cxx_warnings $debug_extra_warnings"
|
cxx_warnings="$cxx_warnings $debug_extra_warnings"
|
||||||
extra_configs="$pentium_configs $debug_configs"
|
extra_configs="$pentium_configs $debug_configs"
|
||||||
|
|
||||||
extra_configs="$extra_configs --with-berkeley-db --with-innodb --without-isam --with-embedded-server --with-openssl --with-raid"
|
extra_configs="$extra_configs --with-berkeley-db --with-innodb --without-isam --with-embedded-server --with-openssl --with-raid --with-vio"
|
||||||
|
|
||||||
. "$path/FINISH.sh"
|
. "$path/FINISH.sh"
|
||||||
|
@ -11,6 +11,7 @@ administrador@light.hegel.local
|
|||||||
ahlentz@co3064164-a.rochd1.qld.optusnet.com.au
|
ahlentz@co3064164-a.rochd1.qld.optusnet.com.au
|
||||||
akishkin@work.mysql.com
|
akishkin@work.mysql.com
|
||||||
antony@ltantony.rdg.cyberkinetica.homeunix.net
|
antony@ltantony.rdg.cyberkinetica.homeunix.net
|
||||||
|
arjen@bitbike.com
|
||||||
arjen@co3064164-a.bitbike.com
|
arjen@co3064164-a.bitbike.com
|
||||||
arjen@fred.bitbike.com
|
arjen@fred.bitbike.com
|
||||||
arjen@george.bitbike.com
|
arjen@george.bitbike.com
|
||||||
@ -148,6 +149,7 @@ tonu@hundin.mysql.fi
|
|||||||
tonu@volk.internalnet
|
tonu@volk.internalnet
|
||||||
tonu@x153.internalnet
|
tonu@x153.internalnet
|
||||||
tonu@x3.internalnet
|
tonu@x3.internalnet
|
||||||
|
ulli@morbus.(none)
|
||||||
venu@hundin.mysql.fi
|
venu@hundin.mysql.fi
|
||||||
venu@myvenu.com
|
venu@myvenu.com
|
||||||
venu@work.mysql.com
|
venu@work.mysql.com
|
||||||
|
@ -280,10 +280,6 @@ SOURCE=.\mtr\mtr0mtr.c
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\odbc\odbc0odbc.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\os\os0file.c
|
SOURCE=.\os\os0file.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -499,6 +499,10 @@ SOURCE=..\strings\strxmov.c
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=..\strings\strxnmov.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=..\mysys\thr_mutex.c
|
SOURCE=..\mysys\thr_mutex.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -1275,7 +1275,6 @@ dnl circular references.
|
|||||||
\$(top_builddir)/innobase/page/libpage.a\
|
\$(top_builddir)/innobase/page/libpage.a\
|
||||||
\$(top_builddir)/innobase/rem/librem.a\
|
\$(top_builddir)/innobase/rem/librem.a\
|
||||||
\$(top_builddir)/innobase/thr/libthr.a\
|
\$(top_builddir)/innobase/thr/libthr.a\
|
||||||
\$(top_builddir)/innobase/com/libcom.a\
|
|
||||||
\$(top_builddir)/innobase/sync/libsync.a\
|
\$(top_builddir)/innobase/sync/libsync.a\
|
||||||
\$(top_builddir)/innobase/data/libdata.a\
|
\$(top_builddir)/innobase/data/libdata.a\
|
||||||
\$(top_builddir)/innobase/mach/libmach.a\
|
\$(top_builddir)/innobase/mach/libmach.a\
|
||||||
|
@ -3183,6 +3183,8 @@ static const char* construct_prompt()
|
|||||||
processed_prompt.append(' ');
|
processed_prompt.append(' ');
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
|
if (t->tm_hour < 10)
|
||||||
|
processed_prompt.append('0');
|
||||||
add_int_to_prompt(t->tm_hour);
|
add_int_to_prompt(t->tm_hour);
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
@ -3190,6 +3192,8 @@ static const char* construct_prompt()
|
|||||||
getHour = t->tm_hour % 12;
|
getHour = t->tm_hour % 12;
|
||||||
if (getHour == 0)
|
if (getHour == 0)
|
||||||
getHour=12;
|
getHour=12;
|
||||||
|
if (getHour < 10)
|
||||||
|
processed_prompt.append('0');
|
||||||
add_int_to_prompt(getHour);
|
add_int_to_prompt(getHour);
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
@ -3215,6 +3219,8 @@ static const char* construct_prompt()
|
|||||||
processed_prompt.append(strtok(dateTime,"\n"));
|
processed_prompt.append(strtok(dateTime,"\n"));
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
|
if (t->tm_sec < 10)
|
||||||
|
processed_prompt.append('0');
|
||||||
add_int_to_prompt(t->tm_sec);
|
add_int_to_prompt(t->tm_sec);
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2000 MySQL AB
|
/* Copyright (C) 2000-2004 MySQL AB
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -140,7 +140,7 @@ static struct my_option my_long_options[] =
|
|||||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
#endif
|
#endif
|
||||||
{"port", 'P', "Port number to use for connection.", (gptr*) &tcp_port,
|
{"port", 'P', "Port number to use for connection.", (gptr*) &tcp_port,
|
||||||
(gptr*) &tcp_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &tcp_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0},
|
||||||
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
|
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol of connection (tcp,socket,pipe,memory).",
|
||||||
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"relative", 'r',
|
{"relative", 'r',
|
||||||
@ -440,6 +440,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Execute a command.
|
Execute a command.
|
||||||
Return 0 on ok
|
Return 0 on ok
|
||||||
@ -450,6 +451,14 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
|
|||||||
static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
static int execute_commands(MYSQL *mysql,int argc, char **argv)
|
||||||
{
|
{
|
||||||
const char *status;
|
const char *status;
|
||||||
|
/*
|
||||||
|
MySQL documentation relies on the fact that mysqladmin will
|
||||||
|
execute commands in the order specified, e.g.
|
||||||
|
mysqladmin -u root flush-privileges password "newpassword"
|
||||||
|
to reset a lost root password.
|
||||||
|
If this behaviour is ever changed, Docs should be notified.
|
||||||
|
*/
|
||||||
|
|
||||||
struct rand_struct rand_st;
|
struct rand_struct rand_st;
|
||||||
|
|
||||||
for (; argc > 0 ; argv++,argc--)
|
for (; argc > 0 ; argv++,argc--)
|
||||||
|
@ -443,9 +443,9 @@ static struct my_option my_long_options[] =
|
|||||||
{"user", 'u', "Connect to the remote server as username.",
|
{"user", 'u', "Connect to the remote server as username.",
|
||||||
(gptr*) &user, (gptr*) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0,
|
(gptr*) &user, (gptr*) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0,
|
||||||
0, 0},
|
0, 0},
|
||||||
{"local-load", 'l', "Prepare files for local load in directory.",
|
{"local-load", 'l', "Prepare local temporary files for LOAD DATA INFILE in the specified directory.",
|
||||||
(gptr*) &dirname_for_local_load, (gptr*) &dirname_for_local_load, 0,
|
(gptr*) &dirname_for_local_load, (gptr*) &dirname_for_local_load, 0,
|
||||||
GET_STR_ALLOC, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
|
{"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
|
||||||
0, 0, 0, 0, 0},
|
0, 0, 0, 0, 0},
|
||||||
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
|
||||||
@ -579,6 +579,7 @@ static int parse_args(int *argc, char*** argv)
|
|||||||
static MYSQL* safe_connect()
|
static MYSQL* safe_connect()
|
||||||
{
|
{
|
||||||
MYSQL *local_mysql = mysql_init(NULL);
|
MYSQL *local_mysql = mysql_init(NULL);
|
||||||
|
|
||||||
if (!local_mysql)
|
if (!local_mysql)
|
||||||
die("Failed on mysql_init");
|
die("Failed on mysql_init");
|
||||||
|
|
||||||
@ -893,7 +894,7 @@ int main(int argc, char** argv)
|
|||||||
{
|
{
|
||||||
if (init_tmpdir(&tmpdir, 0))
|
if (init_tmpdir(&tmpdir, 0))
|
||||||
exit(1);
|
exit(1);
|
||||||
dirname_for_local_load= my_tmpdir(&tmpdir);
|
dirname_for_local_load= my_strdup(my_tmpdir(&tmpdir), MY_WME);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (load_processor.init())
|
if (load_processor.init())
|
||||||
@ -904,6 +905,8 @@ int main(int argc, char** argv)
|
|||||||
load_processor.init_by_cur_dir();
|
load_processor.init_by_cur_dir();
|
||||||
|
|
||||||
exit_value= 0;
|
exit_value= 0;
|
||||||
|
fprintf(result_file,
|
||||||
|
"/*!40019 SET @@session.max_insert_delayed_threads=0*/;\n");
|
||||||
while (--argc >= 0)
|
while (--argc >= 0)
|
||||||
{
|
{
|
||||||
if (dump_log_entries(*(argv++)))
|
if (dump_log_entries(*(argv++)))
|
||||||
|
@ -80,8 +80,6 @@ static my_bool verbose=0,tFlag=0,cFlag=0,dFlag=0,quick= 1, extended_insert= 1,
|
|||||||
opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0,
|
opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0,
|
||||||
opt_alldbs=0,opt_create_db=0,opt_first_slave=0,opt_set_names=0,
|
opt_alldbs=0,opt_create_db=0,opt_first_slave=0,opt_set_names=0,
|
||||||
opt_autocommit=0,opt_master_data,opt_disable_keys=1,opt_xml=0,
|
opt_autocommit=0,opt_master_data,opt_disable_keys=1,opt_xml=0,
|
||||||
opt_delete_master_logs=0, tty_password=0,
|
|
||||||
opt_single_transaction=0, opt_comments= 0, opt_compact= 0;
|
|
||||||
static MYSQL mysql_connection,*sock=0;
|
static MYSQL mysql_connection,*sock=0;
|
||||||
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
|
static char insert_pat[12 * 1024],*opt_password=0,*current_user=0,
|
||||||
*current_host=0,*path=0,*fields_terminated=0,
|
*current_host=0,*path=0,*fields_terminated=0,
|
||||||
|
@ -876,6 +876,15 @@ int do_exec(struct st_query* q)
|
|||||||
if (!*cmd)
|
if (!*cmd)
|
||||||
die("Missing argument in exec\n");
|
die("Missing argument in exec\n");
|
||||||
|
|
||||||
|
if (disable_result_log)
|
||||||
|
{
|
||||||
|
if (!(res_file= popen(cmd, "r")) && q->abort_on_error)
|
||||||
|
die("popen() failed\n");
|
||||||
|
while (fgets(buf, sizeof(buf), res_file));
|
||||||
|
pclose(res_file);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (q->record_file[0])
|
if (q->record_file[0])
|
||||||
{
|
{
|
||||||
init_dynamic_string(&ds_tmp, "", 16384, 65536);
|
init_dynamic_string(&ds_tmp, "", 16384, 65536);
|
||||||
@ -906,6 +915,7 @@ int do_exec(struct st_query* q)
|
|||||||
}
|
}
|
||||||
if (ds == &ds_tmp)
|
if (ds == &ds_tmp)
|
||||||
dynstr_free(&ds_tmp);
|
dynstr_free(&ds_tmp);
|
||||||
|
}
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
@ -1902,7 +1912,7 @@ static struct my_option my_long_options[] =
|
|||||||
{"password", 'p', "Password to use when connecting to server.",
|
{"password", 'p', "Password to use when connecting to server.",
|
||||||
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"port", 'P', "Port number to use for connection.", (gptr*) &port,
|
{"port", 'P', "Port number to use for connection.", (gptr*) &port,
|
||||||
(gptr*) &port, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &port, 0, GET_INT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0},
|
||||||
{"quiet", 's', "Suppress all normal output.", (gptr*) &silent,
|
{"quiet", 's', "Suppress all normal output.", (gptr*) &silent,
|
||||||
(gptr*) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
(gptr*) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"record", 'r', "Record output of test_file into result file.",
|
{"record", 'r', "Record output of test_file into result file.",
|
||||||
@ -2305,7 +2315,8 @@ int run_query(MYSQL* mysql, struct st_query* q, int flags)
|
|||||||
{
|
{
|
||||||
if (i)
|
if (i)
|
||||||
dynstr_append_mem(ds, "\t", 1);
|
dynstr_append_mem(ds, "\t", 1);
|
||||||
dynstr_append(ds, fields[i].name);
|
replace_dynstr_append_mem(ds, fields[i].name,
|
||||||
|
strlen(fields[i].name));
|
||||||
}
|
}
|
||||||
dynstr_append_mem(ds, "\n", 1);
|
dynstr_append_mem(ds, "\n", 1);
|
||||||
}
|
}
|
||||||
|
@ -1013,7 +1013,7 @@ case $SYSTEM_TYPE in
|
|||||||
*darwin5*)
|
*darwin5*)
|
||||||
if test "$ac_cv_prog_gcc" = "yes"
|
if test "$ac_cv_prog_gcc" = "yes"
|
||||||
then
|
then
|
||||||
FLAGS="-traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DFN_NO_CASE_SENCE"
|
FLAGS="-traditional-cpp -DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
|
||||||
CFLAGS="$CFLAGS $FLAGS"
|
CFLAGS="$CFLAGS $FLAGS"
|
||||||
CXXFLAGS="$CXXFLAGS $FLAGS"
|
CXXFLAGS="$CXXFLAGS $FLAGS"
|
||||||
MAX_C_OPTIMIZE="-O"
|
MAX_C_OPTIMIZE="-O"
|
||||||
@ -1023,7 +1023,7 @@ case $SYSTEM_TYPE in
|
|||||||
*darwin6*)
|
*darwin6*)
|
||||||
if test "$ac_cv_prog_gcc" = "yes"
|
if test "$ac_cv_prog_gcc" = "yes"
|
||||||
then
|
then
|
||||||
FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH -DFN_NO_CASE_SENCE"
|
FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DHAVE_BROKEN_REALPATH"
|
||||||
CFLAGS="$CFLAGS $FLAGS"
|
CFLAGS="$CFLAGS $FLAGS"
|
||||||
CXXFLAGS="$CXXFLAGS $FLAGS"
|
CXXFLAGS="$CXXFLAGS $FLAGS"
|
||||||
MAX_C_OPTIMIZE="-O"
|
MAX_C_OPTIMIZE="-O"
|
||||||
@ -1032,7 +1032,7 @@ case $SYSTEM_TYPE in
|
|||||||
*darwin7*)
|
*darwin7*)
|
||||||
if test "$ac_cv_prog_gcc" = "yes"
|
if test "$ac_cv_prog_gcc" = "yes"
|
||||||
then
|
then
|
||||||
FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DFN_NO_CASE_SENCE"
|
FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ"
|
||||||
CFLAGS="$CFLAGS $FLAGS"
|
CFLAGS="$CFLAGS $FLAGS"
|
||||||
CXXFLAGS="$CXXFLAGS $FLAGS"
|
CXXFLAGS="$CXXFLAGS $FLAGS"
|
||||||
MAX_C_OPTIMIZE="-O"
|
MAX_C_OPTIMIZE="-O"
|
||||||
|
@ -14,12 +14,16 @@
|
|||||||
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 */
|
||||||
|
|
||||||
/* Replace strings in textfile
|
/*
|
||||||
This program replace strings in a file or on stdin/stdout.
|
Replace strings in textfile
|
||||||
It accepts a list of from-strings and to-strings and replaces all
|
|
||||||
occurents of from-strings to to-strings.
|
This program replaces strings in files or from stdin to stdout.
|
||||||
The first occurents of a found string is matched. If there are more than
|
It accepts a list of from-string/to-string pairs and replaces
|
||||||
one possibly replace the longer from-string is replaced.
|
each occurrence of a from-string with the corresponding to-string.
|
||||||
|
The first occurrence of a found string is matched. If there is more
|
||||||
|
than one possibility for the string to replace, longer matches
|
||||||
|
are preferred before shorter matches.
|
||||||
|
|
||||||
Special characters in from string:
|
Special characters in from string:
|
||||||
\^ Match start of line.
|
\^ Match start of line.
|
||||||
\$ Match end of line.
|
\$ Match end of line.
|
||||||
@ -167,7 +171,7 @@ register char **argv[];
|
|||||||
break;
|
break;
|
||||||
case '#':
|
case '#':
|
||||||
DBUG_PUSH (++pos);
|
DBUG_PUSH (++pos);
|
||||||
pos= (char*) " "; /* Skipp rest of arguments */
|
pos= (char*) " "; /* Skip rest of arguments */
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
version=1;
|
version=1;
|
||||||
@ -179,12 +183,13 @@ register char **argv[];
|
|||||||
if (version)
|
if (version)
|
||||||
break;
|
break;
|
||||||
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
|
puts("This software comes with ABSOLUTELY NO WARRANTY. This is free software,\nand you are welcome to modify and redistribute it under the GPL license\n");
|
||||||
puts("This program replace strings in a file or on stdin/stdout.\n"
|
puts("This program replaces strings in files or from stdin to stdout.\n"
|
||||||
"It accepts a list of from-strings and to-strings and replaces\n"
|
"It accepts a list of from-string/to-string pairs and replaces\n"
|
||||||
"all occurents of from-strings to to-strings.\n"
|
"each occurrence of a from-string with the corresponding to-string.\n"
|
||||||
"The first occurents of a found string is matched. Longer matches\n"
|
"The first occurrence of a found string is matched. If there is\n"
|
||||||
"are prefered before shorter matches.\n\n"
|
"more than one possibility for the string to replace, longer\n"
|
||||||
"Special characters in from string:\n"
|
"matches are preferred before shorter matches.\n\n"
|
||||||
|
"A from-string can contain these special characters:\n"
|
||||||
" \\^ Match start of line.\n"
|
" \\^ Match start of line.\n"
|
||||||
" \\$ Match end of line.\n"
|
" \\$ Match end of line.\n"
|
||||||
" \\b Match space-character, start of line or end of line.\n"
|
" \\b Match space-character, start of line or end of line.\n"
|
||||||
@ -237,7 +242,7 @@ POINTER_ARRAY *from_array,*to_array;
|
|||||||
(*argv)++;
|
(*argv)++;
|
||||||
}
|
}
|
||||||
if (*argc)
|
if (*argc)
|
||||||
{ /* Skipp "--" argument */
|
{ /* Skip "--" argument */
|
||||||
(*argc)--;
|
(*argc)--;
|
||||||
(*argv)++;
|
(*argv)++;
|
||||||
}
|
}
|
||||||
@ -949,9 +954,11 @@ static void free_buffer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Fill the buffer retaining the last n bytes at the beginning of the
|
/*
|
||||||
|
Fill the buffer retaining the last n bytes at the beginning of the
|
||||||
newly filled buffer (for backward context). Returns the number of new
|
newly filled buffer (for backward context). Returns the number of new
|
||||||
bytes read from disk. */
|
bytes read from disk.
|
||||||
|
*/
|
||||||
|
|
||||||
static int fill_buffer_retaining(fd,n)
|
static int fill_buffer_retaining(fd,n)
|
||||||
File fd;
|
File fd;
|
||||||
|
@ -606,7 +606,7 @@ extern void pack_dirname(my_string to,const char *from);
|
|||||||
extern uint unpack_dirname(my_string to,const char *from);
|
extern uint unpack_dirname(my_string to,const char *from);
|
||||||
extern uint cleanup_dirname(my_string to,const char *from);
|
extern uint cleanup_dirname(my_string to,const char *from);
|
||||||
extern uint system_filename(my_string to,const char *from);
|
extern uint system_filename(my_string to,const char *from);
|
||||||
extern my_string unpack_filename(my_string to,const char *from);
|
extern uint unpack_filename(my_string to,const char *from);
|
||||||
extern my_string intern_filename(my_string to,const char *from);
|
extern my_string intern_filename(my_string to,const char *from);
|
||||||
extern my_string directory_file_name(my_string dst, const char *src);
|
extern my_string directory_file_name(my_string dst, const char *src);
|
||||||
extern int pack_filename(my_string to, const char *name, size_s max_length);
|
extern int pack_filename(my_string to, const char *name, size_s max_length);
|
||||||
@ -663,9 +663,9 @@ extern int my_b_safe_write(IO_CACHE *info,const byte *Buffer,uint Count);
|
|||||||
|
|
||||||
extern int my_block_write(IO_CACHE *info, const byte *Buffer,
|
extern int my_block_write(IO_CACHE *info, const byte *Buffer,
|
||||||
uint Count, my_off_t pos);
|
uint Count, my_off_t pos);
|
||||||
extern int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock);
|
extern int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock);
|
||||||
|
|
||||||
#define flush_io_cache(info) _flush_io_cache((info),1)
|
#define flush_io_cache(info) my_b_flush_io_cache((info),1)
|
||||||
|
|
||||||
extern int end_io_cache(IO_CACHE *info);
|
extern int end_io_cache(IO_CACHE *info);
|
||||||
extern uint my_b_fill(IO_CACHE *info);
|
extern uint my_b_fill(IO_CACHE *info);
|
||||||
|
@ -22,7 +22,7 @@ TAR = gtar
|
|||||||
|
|
||||||
noinst_HEADERS = ib_config.h
|
noinst_HEADERS = ib_config.h
|
||||||
|
|
||||||
SUBDIRS = os ut btr buf com data dict dyn eval fil fsp fut \
|
SUBDIRS = os ut btr buf data dict dyn eval fil fsp fut \
|
||||||
ha ibuf include lock log mach mem mtr page \
|
ha ibuf include lock log mach mem mtr page \
|
||||||
pars que read rem row srv sync thr trx usr
|
pars que read rem row srv sync thr trx usr
|
||||||
|
|
||||||
|
@ -299,7 +299,9 @@ btr_page_alloc_for_ibuf(
|
|||||||
|
|
||||||
new_page = buf_page_get(dict_tree_get_space(tree), node_addr.page,
|
new_page = buf_page_get(dict_tree_get_space(tree), node_addr.page,
|
||||||
RW_X_LATCH, mtr);
|
RW_X_LATCH, mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(new_page, SYNC_TREE_NODE_NEW);
|
buf_page_dbg_add_level(new_page, SYNC_TREE_NODE_NEW);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
flst_remove(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
|
flst_remove(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
|
||||||
new_page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE,
|
new_page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE,
|
||||||
@ -357,7 +359,9 @@ btr_page_alloc(
|
|||||||
|
|
||||||
new_page = buf_page_get(dict_tree_get_space(tree), new_page_no,
|
new_page = buf_page_get(dict_tree_get_space(tree), new_page_no,
|
||||||
RW_X_LATCH, mtr);
|
RW_X_LATCH, mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(new_page, SYNC_TREE_NODE_NEW);
|
buf_page_dbg_add_level(new_page, SYNC_TREE_NODE_NEW);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(new_page);
|
return(new_page);
|
||||||
}
|
}
|
||||||
@ -398,7 +402,7 @@ btr_get_size(
|
|||||||
|
|
||||||
n += fseg_n_reserved_pages(seg_header, &dummy, &mtr);
|
n += fseg_n_reserved_pages(seg_header, &dummy, &mtr);
|
||||||
} else {
|
} else {
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
mtr_commit(&mtr);
|
mtr_commit(&mtr);
|
||||||
@ -664,8 +668,9 @@ btr_create(
|
|||||||
ibuf_hdr_frame = fseg_create(space, 0,
|
ibuf_hdr_frame = fseg_create(space, 0,
|
||||||
IBUF_HEADER + IBUF_TREE_SEG_HEADER, mtr);
|
IBUF_HEADER + IBUF_TREE_SEG_HEADER, mtr);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(ibuf_hdr_frame, SYNC_TREE_NODE_NEW);
|
buf_page_dbg_add_level(ibuf_hdr_frame, SYNC_TREE_NODE_NEW);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(buf_frame_get_page_no(ibuf_hdr_frame)
|
ut_ad(buf_frame_get_page_no(ibuf_hdr_frame)
|
||||||
== IBUF_HEADER_PAGE_NO);
|
== IBUF_HEADER_PAGE_NO);
|
||||||
/* Allocate then the next page to the segment: it will be the
|
/* Allocate then the next page to the segment: it will be the
|
||||||
@ -690,7 +695,9 @@ btr_create(
|
|||||||
|
|
||||||
page_no = buf_frame_get_page_no(frame);
|
page_no = buf_frame_get_page_no(frame);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(frame, SYNC_TREE_NODE_NEW);
|
buf_page_dbg_add_level(frame, SYNC_TREE_NODE_NEW);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (type & DICT_IBUF) {
|
if (type & DICT_IBUF) {
|
||||||
/* It is an insert buffer tree: initialize the free list */
|
/* It is an insert buffer tree: initialize the free list */
|
||||||
@ -705,7 +712,9 @@ btr_create(
|
|||||||
mtr);
|
mtr);
|
||||||
/* The fseg create acquires a second latch on the page,
|
/* The fseg create acquires a second latch on the page,
|
||||||
therefore we must declare it: */
|
therefore we must declare it: */
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(frame, SYNC_TREE_NODE_NEW);
|
buf_page_dbg_add_level(frame, SYNC_TREE_NODE_NEW);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a new index page on the the allocated segment page */
|
/* Create a new index page on the the allocated segment page */
|
||||||
@ -1520,7 +1529,9 @@ func_start:
|
|||||||
|
|
||||||
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
|
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
|
||||||
MTR_MEMO_X_LOCK));
|
MTR_MEMO_X_LOCK));
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(rw_lock_own(dict_tree_get_lock(tree), RW_LOCK_EX));
|
ut_ad(rw_lock_own(dict_tree_get_lock(tree), RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
page = btr_cur_get_page(cursor);
|
page = btr_cur_get_page(cursor);
|
||||||
|
|
||||||
|
@ -3157,8 +3157,10 @@ btr_store_big_rec_extern_fields(
|
|||||||
prev_page_no,
|
prev_page_no,
|
||||||
RW_X_LATCH, &mtr);
|
RW_X_LATCH, &mtr);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(prev_page,
|
buf_page_dbg_add_level(prev_page,
|
||||||
SYNC_EXTERN_STORAGE);
|
SYNC_EXTERN_STORAGE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
mlog_write_ulint(prev_page + FIL_PAGE_DATA
|
mlog_write_ulint(prev_page + FIL_PAGE_DATA
|
||||||
+ BTR_BLOB_HDR_NEXT_PAGE_NO,
|
+ BTR_BLOB_HDR_NEXT_PAGE_NO,
|
||||||
@ -3193,9 +3195,9 @@ btr_store_big_rec_extern_fields(
|
|||||||
rec_page = buf_page_get(space_id,
|
rec_page = buf_page_get(space_id,
|
||||||
buf_frame_get_page_no(data),
|
buf_frame_get_page_no(data),
|
||||||
RW_X_LATCH, &mtr);
|
RW_X_LATCH, &mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(rec_page, SYNC_NO_ORDER_CHECK);
|
buf_page_dbg_add_level(rec_page, SYNC_NO_ORDER_CHECK);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
mlog_write_ulint(data + local_len + BTR_EXTERN_LEN, 0,
|
mlog_write_ulint(data + local_len + BTR_EXTERN_LEN, 0,
|
||||||
MLOG_4BYTES, &mtr);
|
MLOG_4BYTES, &mtr);
|
||||||
mlog_write_ulint(data + local_len + BTR_EXTERN_LEN + 4,
|
mlog_write_ulint(data + local_len + BTR_EXTERN_LEN + 4,
|
||||||
@ -3287,9 +3289,9 @@ btr_free_externally_stored_field(
|
|||||||
|
|
||||||
rec_page = buf_page_get(buf_frame_get_space_id(data),
|
rec_page = buf_page_get(buf_frame_get_space_id(data),
|
||||||
buf_frame_get_page_no(data), RW_X_LATCH, &mtr);
|
buf_frame_get_page_no(data), RW_X_LATCH, &mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(rec_page, SYNC_NO_ORDER_CHECK);
|
buf_page_dbg_add_level(rec_page, SYNC_NO_ORDER_CHECK);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
space_id = mach_read_from_4(data + local_len
|
space_id = mach_read_from_4(data + local_len
|
||||||
+ BTR_EXTERN_SPACE_ID);
|
+ BTR_EXTERN_SPACE_ID);
|
||||||
|
|
||||||
@ -3332,9 +3334,9 @@ btr_free_externally_stored_field(
|
|||||||
}
|
}
|
||||||
|
|
||||||
page = buf_page_get(space_id, page_no, RW_X_LATCH, &mtr);
|
page = buf_page_get(space_id, page_no, RW_X_LATCH, &mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_EXTERN_STORAGE);
|
buf_page_dbg_add_level(page, SYNC_EXTERN_STORAGE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
next_page_no = mach_read_from_4(page + FIL_PAGE_DATA
|
next_page_no = mach_read_from_4(page + FIL_PAGE_DATA
|
||||||
+ BTR_BLOB_HDR_NEXT_PAGE_NO);
|
+ BTR_BLOB_HDR_NEXT_PAGE_NO);
|
||||||
|
|
||||||
@ -3512,9 +3514,9 @@ btr_copy_externally_stored_field(
|
|||||||
mtr_start(&mtr);
|
mtr_start(&mtr);
|
||||||
|
|
||||||
page = buf_page_get(space_id, page_no, RW_S_LATCH, &mtr);
|
page = buf_page_get(space_id, page_no, RW_S_LATCH, &mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_EXTERN_STORAGE);
|
buf_page_dbg_add_level(page, SYNC_EXTERN_STORAGE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
blob_header = page + offset;
|
blob_header = page + offset;
|
||||||
|
|
||||||
part_len = btr_blob_get_part_len(blob_header);
|
part_len = btr_blob_get_part_len(blob_header);
|
||||||
|
@ -238,9 +238,9 @@ btr_pcur_restore_position(
|
|||||||
cursor->block_when_stored, page,
|
cursor->block_when_stored, page,
|
||||||
cursor->modify_clock, mtr)) {
|
cursor->modify_clock, mtr)) {
|
||||||
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
|
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
if (cursor->rel_pos == BTR_PCUR_ON) {
|
if (cursor->rel_pos == BTR_PCUR_ON) {
|
||||||
|
|
||||||
cursor->latch_mode = latch_mode;
|
cursor->latch_mode = latch_mode;
|
||||||
|
@ -93,8 +93,10 @@ btr_search_check_free_space_in_heap(void)
|
|||||||
hash_table_t* table;
|
hash_table_t* table;
|
||||||
mem_heap_t* heap;
|
mem_heap_t* heap;
|
||||||
|
|
||||||
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
&& !rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
|
||||||
|
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
table = btr_search_sys->hash_index;
|
table = btr_search_sys->hash_index;
|
||||||
|
|
||||||
@ -194,8 +196,10 @@ btr_search_info_update_hash(
|
|||||||
ulint n_unique;
|
ulint n_unique;
|
||||||
int cmp;
|
int cmp;
|
||||||
|
|
||||||
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
&& !rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
|
||||||
|
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
index = cursor->index;
|
index = cursor->index;
|
||||||
|
|
||||||
@ -317,10 +321,12 @@ btr_search_update_block_hash_info(
|
|||||||
buf_block_t* block, /* in: buffer block */
|
buf_block_t* block, /* in: buffer block */
|
||||||
btr_cur_t* cursor) /* in: cursor */
|
btr_cur_t* cursor) /* in: cursor */
|
||||||
{
|
{
|
||||||
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
&& !rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
|
||||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
||||||
|| rw_lock_own(&(block->lock), RW_LOCK_EX));
|
ut_ad(rw_lock_own(&((buf_block_t*) block)->lock, RW_LOCK_SHARED)
|
||||||
|
|| rw_lock_own(&((buf_block_t*) block)->lock, RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(cursor);
|
ut_ad(cursor);
|
||||||
|
|
||||||
info->last_hash_succ = FALSE;
|
info->last_hash_succ = FALSE;
|
||||||
@ -398,9 +404,11 @@ btr_search_update_hash_ref(
|
|||||||
dulint tree_id;
|
dulint tree_id;
|
||||||
|
|
||||||
ut_ad(cursor->flag == BTR_CUR_HASH_FAIL);
|
ut_ad(cursor->flag == BTR_CUR_HASH_FAIL);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
||||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|
||||||
|| rw_lock_own(&(block->lock), RW_LOCK_EX));
|
|| rw_lock_own(&(block->lock), RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
if (block->is_hashed
|
if (block->is_hashed
|
||||||
&& (info->n_hash_potential > 0)
|
&& (info->n_hash_potential > 0)
|
||||||
&& (block->curr_n_fields == info->n_fields)
|
&& (block->curr_n_fields == info->n_fields)
|
||||||
@ -419,7 +427,9 @@ btr_search_update_hash_ref(
|
|||||||
fold = rec_fold(rec, block->curr_n_fields,
|
fold = rec_fold(rec, block->curr_n_fields,
|
||||||
block->curr_n_bytes, tree_id);
|
block->curr_n_bytes, tree_id);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
ha_insert_for_fold(btr_search_sys->hash_index, fold, rec);
|
ha_insert_for_fold(btr_search_sys->hash_index, fold, rec);
|
||||||
}
|
}
|
||||||
@ -439,8 +449,10 @@ btr_search_info_update_slow(
|
|||||||
ulint* params;
|
ulint* params;
|
||||||
ulint* params2;
|
ulint* params2;
|
||||||
|
|
||||||
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
&& !rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
|
||||||
|
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
block = buf_block_align(btr_cur_get_rec(cursor));
|
block = buf_block_align(btr_cur_get_rec(cursor));
|
||||||
|
|
||||||
@ -762,7 +774,9 @@ btr_search_guess_on_hash(
|
|||||||
|
|
||||||
can_only_compare_to_cursor_rec = FALSE;
|
can_only_compare_to_cursor_rec = FALSE;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE_FROM_HASH);
|
buf_page_dbg_add_level(page, SYNC_TREE_NODE_FROM_HASH);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
block = buf_block_align(page);
|
block = buf_block_align(page);
|
||||||
@ -911,8 +925,10 @@ btr_search_drop_page_hash_index(
|
|||||||
ulint* folds;
|
ulint* folds;
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
&& !rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
|
||||||
|
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
rw_lock_s_lock(&btr_search_latch);
|
rw_lock_s_lock(&btr_search_latch);
|
||||||
|
|
||||||
@ -927,9 +943,11 @@ btr_search_drop_page_hash_index(
|
|||||||
|
|
||||||
table = btr_search_sys->hash_index;
|
table = btr_search_sys->hash_index;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|
||||||
|| rw_lock_own(&(block->lock), RW_LOCK_EX)
|
|| rw_lock_own(&(block->lock), RW_LOCK_EX)
|
||||||
|| (block->buf_fix_count == 0));
|
|| (block->buf_fix_count == 0));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
n_fields = block->curr_n_fields;
|
n_fields = block->curr_n_fields;
|
||||||
n_bytes = block->curr_n_bytes;
|
n_bytes = block->curr_n_bytes;
|
||||||
@ -1031,7 +1049,9 @@ btr_search_drop_page_hash_when_freed(
|
|||||||
BUF_GET_IF_IN_POOL, IB__FILE__, __LINE__,
|
BUF_GET_IF_IN_POOL, IB__FILE__, __LINE__,
|
||||||
&mtr);
|
&mtr);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE_FROM_HASH);
|
buf_page_dbg_add_level(page, SYNC_TREE_NODE_FROM_HASH);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
btr_search_drop_page_hash_index(page);
|
btr_search_drop_page_hash_index(page);
|
||||||
|
|
||||||
@ -1072,9 +1092,11 @@ btr_search_build_page_hash_index(
|
|||||||
block = buf_block_align(page);
|
block = buf_block_align(page);
|
||||||
table = btr_search_sys->hash_index;
|
table = btr_search_sys->hash_index;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
||||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|
||||||
|| rw_lock_own(&(block->lock), RW_LOCK_EX));
|
|| rw_lock_own(&(block->lock), RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
rw_lock_s_lock(&btr_search_latch);
|
rw_lock_s_lock(&btr_search_latch);
|
||||||
|
|
||||||
@ -1237,8 +1259,10 @@ btr_search_move_or_delete_hash_entries(
|
|||||||
block = buf_block_align(page);
|
block = buf_block_align(page);
|
||||||
new_block = buf_block_align(new_page);
|
new_block = buf_block_align(new_page);
|
||||||
|
|
||||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX)
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
&& rw_lock_own(&(new_block->lock), RW_LOCK_EX));
|
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
|
||||||
|
ut_ad(rw_lock_own(&(new_block->lock), RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
rw_lock_s_lock(&btr_search_latch);
|
rw_lock_s_lock(&btr_search_latch);
|
||||||
|
|
||||||
@ -1298,7 +1322,9 @@ btr_search_update_hash_on_delete(
|
|||||||
|
|
||||||
block = buf_block_align(rec);
|
block = buf_block_align(rec);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
|
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (!block->is_hashed) {
|
if (!block->is_hashed) {
|
||||||
|
|
||||||
@ -1339,7 +1365,9 @@ btr_search_update_hash_node_on_insert(
|
|||||||
|
|
||||||
block = buf_block_align(rec);
|
block = buf_block_align(rec);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
|
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (!block->is_hashed) {
|
if (!block->is_hashed) {
|
||||||
|
|
||||||
@ -1400,7 +1428,9 @@ btr_search_update_hash_on_insert(
|
|||||||
|
|
||||||
block = buf_block_align(rec);
|
block = buf_block_align(rec);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
|
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (!block->is_hashed) {
|
if (!block->is_hashed) {
|
||||||
|
|
||||||
|
@ -480,7 +480,7 @@ buf_block_init(
|
|||||||
#ifdef UNIV_SYNC_DEBUG
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
rw_lock_create(&(block->debug_latch));
|
rw_lock_create(&(block->debug_latch));
|
||||||
rw_lock_set_level(&(block->debug_latch), SYNC_NO_ORDER_CHECK);
|
rw_lock_set_level(&(block->debug_latch), SYNC_NO_ORDER_CHECK);
|
||||||
#endif
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
@ -1325,9 +1325,9 @@ buf_page_optimistic_get_func(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!UT_DULINT_EQ(modify_clock, block->modify_clock)) {
|
if (!UT_DULINT_EQ(modify_clock, block->modify_clock)) {
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(block->frame, SYNC_NO_ORDER_CHECK);
|
buf_page_dbg_add_level(block->frame, SYNC_NO_ORDER_CHECK);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
if (rw_latch == RW_S_LATCH) {
|
if (rw_latch == RW_S_LATCH) {
|
||||||
rw_lock_s_unlock(&(block->lock));
|
rw_lock_s_unlock(&(block->lock));
|
||||||
} else {
|
} else {
|
||||||
@ -1527,7 +1527,9 @@ buf_page_init(
|
|||||||
in units of a page */
|
in units of a page */
|
||||||
buf_block_t* block) /* in: block to init */
|
buf_block_t* block) /* in: block to init */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_a(block->state != BUF_BLOCK_FILE_PAGE);
|
ut_a(block->state != BUF_BLOCK_FILE_PAGE);
|
||||||
|
|
||||||
/* Set the state of the block */
|
/* Set the state of the block */
|
||||||
|
@ -48,7 +48,9 @@ buf_flush_insert_into_flush_list(
|
|||||||
/*=============================*/
|
/*=============================*/
|
||||||
buf_block_t* block) /* in: block which is modified */
|
buf_block_t* block) /* in: block which is modified */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||||
|
|
||||||
@ -76,7 +78,9 @@ buf_flush_insert_sorted_into_flush_list(
|
|||||||
buf_block_t* prev_b;
|
buf_block_t* prev_b;
|
||||||
buf_block_t* b;
|
buf_block_t* b;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
prev_b = NULL;
|
prev_b = NULL;
|
||||||
b = UT_LIST_GET_FIRST(buf_pool->flush_list);
|
b = UT_LIST_GET_FIRST(buf_pool->flush_list);
|
||||||
@ -108,7 +112,9 @@ buf_flush_ready_for_replace(
|
|||||||
buf_block_t* block) /* in: buffer control block, must be in state
|
buf_block_t* block) /* in: buffer control block, must be in state
|
||||||
BUF_BLOCK_FILE_PAGE and in the LRU list */
|
BUF_BLOCK_FILE_PAGE and in the LRU list */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||||
|
|
||||||
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0)
|
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0)
|
||||||
@ -132,7 +138,9 @@ buf_flush_ready_for_flush(
|
|||||||
BUF_BLOCK_FILE_PAGE */
|
BUF_BLOCK_FILE_PAGE */
|
||||||
ulint flush_type)/* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
|
ulint flush_type)/* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||||
|
|
||||||
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0)
|
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0)
|
||||||
@ -163,8 +171,9 @@ buf_flush_write_complete(
|
|||||||
buf_block_t* block) /* in: pointer to the block in question */
|
buf_block_t* block) /* in: pointer to the block in question */
|
||||||
{
|
{
|
||||||
ut_ad(block);
|
ut_ad(block);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||||
|
|
||||||
block->oldest_modification = ut_dulint_zero;
|
block->oldest_modification = ut_dulint_zero;
|
||||||
@ -248,7 +257,7 @@ buf_flush_buffered_writes(void)
|
|||||||
"InnoDB: files.\n",
|
"InnoDB: files.\n",
|
||||||
(ulong) block->offset, (ulong) block->space);
|
(ulong) block->offset, (ulong) block->space);
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,11 +310,15 @@ loop:
|
|||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
" InnoDB: ERROR: over 9 / 10 of the buffer pool is occupied by\n"
|
" InnoDB: ERROR: over 9 / 10 of the buffer pool is occupied by\n"
|
||||||
"InnoDB: lock heaps or the adaptive hash index!\n"
|
"InnoDB: lock heaps or the adaptive hash index! Check that your\n"
|
||||||
|
"InnoDB: transactions do not set too many row locks.\n"
|
||||||
|
"InnoDB: Your buffer pool size is %lu MB. Maybe you should make\n"
|
||||||
|
"InnoDB: the buffer pool bigger?\n"
|
||||||
"InnoDB: We intentionally generate a seg fault to print a stack trace\n"
|
"InnoDB: We intentionally generate a seg fault to print a stack trace\n"
|
||||||
"InnoDB: on Linux!\n");
|
"InnoDB: on Linux!\n",
|
||||||
|
(ulong)(buf_pool->curr_size / (1024 * 1024 / UNIV_PAGE_SIZE)));
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
|
|
||||||
} else if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
|
} else if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
|
||||||
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 5) {
|
+ UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 5) {
|
||||||
@ -471,7 +475,9 @@ buf_LRU_old_adjust_len(void)
|
|||||||
ulint new_len;
|
ulint new_len;
|
||||||
|
|
||||||
ut_a(buf_pool->LRU_old);
|
ut_a(buf_pool->LRU_old);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(3 * (BUF_LRU_OLD_MIN_LEN / 8) > BUF_LRU_OLD_TOLERANCE + 5);
|
ut_ad(3 * (BUF_LRU_OLD_MIN_LEN / 8) > BUF_LRU_OLD_TOLERANCE + 5);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -544,7 +550,9 @@ buf_LRU_remove_block(
|
|||||||
{
|
{
|
||||||
ut_ad(buf_pool);
|
ut_ad(buf_pool);
|
||||||
ut_ad(block);
|
ut_ad(block);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||||
ut_a(block->in_LRU_list);
|
ut_a(block->in_LRU_list);
|
||||||
@ -608,7 +616,9 @@ buf_LRU_add_block_to_end_low(
|
|||||||
|
|
||||||
ut_ad(buf_pool);
|
ut_ad(buf_pool);
|
||||||
ut_ad(block);
|
ut_ad(block);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||||
|
|
||||||
@ -671,7 +681,9 @@ buf_LRU_add_block_low(
|
|||||||
|
|
||||||
ut_ad(buf_pool);
|
ut_ad(buf_pool);
|
||||||
ut_ad(block);
|
ut_ad(block);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||||
ut_a(!block->in_LRU_list);
|
ut_a(!block->in_LRU_list);
|
||||||
@ -772,7 +784,9 @@ buf_LRU_block_free_non_file_page(
|
|||||||
/*=============================*/
|
/*=============================*/
|
||||||
buf_block_t* block) /* in: block, must not contain a file page */
|
buf_block_t* block) /* in: block, must not contain a file page */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(block);
|
ut_ad(block);
|
||||||
|
|
||||||
ut_a((block->state == BUF_BLOCK_MEMORY)
|
ut_a((block->state == BUF_BLOCK_MEMORY)
|
||||||
@ -809,7 +823,9 @@ buf_LRU_block_remove_hashed_page(
|
|||||||
be in a state where it can be freed; there
|
be in a state where it can be freed; there
|
||||||
may or may not be a hash index to the page */
|
may or may not be a hash index to the page */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(block);
|
ut_ad(block);
|
||||||
|
|
||||||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||||
@ -863,7 +879,9 @@ buf_LRU_block_free_hashed_page(
|
|||||||
buf_block_t* block) /* in: block, must contain a file page and
|
buf_block_t* block) /* in: block, must contain a file page and
|
||||||
be in a state where it can be freed */
|
be in a state where it can be freed */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_a(block->state == BUF_BLOCK_REMOVE_HASH);
|
ut_a(block->state == BUF_BLOCK_REMOVE_HASH);
|
||||||
|
|
||||||
block->state = BUF_BLOCK_MEMORY;
|
block->state = BUF_BLOCK_MEMORY;
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
|
||||||
# & Innobase Oy
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
include ../include/Makefile.i
|
|
||||||
|
|
||||||
noinst_LIBRARIES = libcom.a
|
|
||||||
|
|
||||||
libcom_a_SOURCES = com0com.c com0shm.c
|
|
||||||
|
|
||||||
EXTRA_PROGRAMS =
|
|
@ -1,345 +0,0 @@
|
|||||||
/******************************************************
|
|
||||||
The communication primitives
|
|
||||||
|
|
||||||
(c) 1995 Innobase Oy
|
|
||||||
|
|
||||||
Created 9/23/1995 Heikki Tuuri
|
|
||||||
*******************************************************/
|
|
||||||
|
|
||||||
#include "com0com.h"
|
|
||||||
#ifdef UNIV_NONINL
|
|
||||||
#include "com0com.ic"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "mem0mem.h"
|
|
||||||
#include "com0shm.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
IMPLEMENTATION OF COMMUNICATION PRIMITIVES
|
|
||||||
==========================================
|
|
||||||
|
|
||||||
The primitives provide a uniform function interface for
|
|
||||||
use in communication. The primitives have been modeled
|
|
||||||
after the Windows Sockets interface. Below this uniform
|
|
||||||
API, the precise methods of communication, for example,
|
|
||||||
shared memory or Berkeley sockets, can be implemented
|
|
||||||
as subroutines.
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct com_endpoint_struct{
|
|
||||||
ulint type; /* endpoint type */
|
|
||||||
void* par; /* type-specific data structures */
|
|
||||||
ibool bound; /* TRUE if the endpoint has been
|
|
||||||
bound to an address */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
Accessor functions for an endpoint */
|
|
||||||
UNIV_INLINE
|
|
||||||
ulint
|
|
||||||
com_endpoint_get_type(
|
|
||||||
/*==================*/
|
|
||||||
com_endpoint_t* ep)
|
|
||||||
{
|
|
||||||
ut_ad(ep);
|
|
||||||
return(ep->type);
|
|
||||||
}
|
|
||||||
|
|
||||||
UNIV_INLINE
|
|
||||||
void
|
|
||||||
com_endpoint_set_type(
|
|
||||||
/*==================*/
|
|
||||||
com_endpoint_t* ep,
|
|
||||||
ulint type)
|
|
||||||
{
|
|
||||||
ut_ad(ep);
|
|
||||||
ut_ad(type == COM_SHM);
|
|
||||||
|
|
||||||
ep->type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
UNIV_INLINE
|
|
||||||
void*
|
|
||||||
com_endpoint_get_par(
|
|
||||||
/*=================*/
|
|
||||||
com_endpoint_t* ep)
|
|
||||||
{
|
|
||||||
ut_ad(ep);
|
|
||||||
return(ep->par);
|
|
||||||
}
|
|
||||||
|
|
||||||
UNIV_INLINE
|
|
||||||
void
|
|
||||||
com_endpoint_set_par(
|
|
||||||
/*=================*/
|
|
||||||
com_endpoint_t* ep,
|
|
||||||
void* par)
|
|
||||||
{
|
|
||||||
ut_ad(ep);
|
|
||||||
ut_ad(par);
|
|
||||||
|
|
||||||
ep->par = par;
|
|
||||||
}
|
|
||||||
|
|
||||||
UNIV_INLINE
|
|
||||||
ibool
|
|
||||||
com_endpoint_get_bound(
|
|
||||||
/*===================*/
|
|
||||||
com_endpoint_t* ep)
|
|
||||||
{
|
|
||||||
ut_ad(ep);
|
|
||||||
return(ep->bound);
|
|
||||||
}
|
|
||||||
|
|
||||||
UNIV_INLINE
|
|
||||||
void
|
|
||||||
com_endpoint_set_bound(
|
|
||||||
/*===================*/
|
|
||||||
com_endpoint_t* ep,
|
|
||||||
ibool bound)
|
|
||||||
{
|
|
||||||
ut_ad(ep);
|
|
||||||
|
|
||||||
ep->bound = bound;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
Creates a communications endpoint. */
|
|
||||||
|
|
||||||
com_endpoint_t*
|
|
||||||
com_endpoint_create(
|
|
||||||
/*================*/
|
|
||||||
/* out, own: communications endpoint, NULL if
|
|
||||||
did not succeed */
|
|
||||||
ulint type) /* in: communication type of endpoint:
|
|
||||||
only COM_SHM supported */
|
|
||||||
{
|
|
||||||
com_endpoint_t* ep;
|
|
||||||
void* par;
|
|
||||||
|
|
||||||
ep = mem_alloc(sizeof(com_endpoint_t));
|
|
||||||
|
|
||||||
com_endpoint_set_type(ep, type);
|
|
||||||
com_endpoint_set_bound(ep, FALSE);
|
|
||||||
|
|
||||||
if (type == COM_SHM) {
|
|
||||||
par = com_shm_endpoint_create();
|
|
||||||
com_endpoint_set_par(ep, par);
|
|
||||||
} else {
|
|
||||||
par = NULL;
|
|
||||||
ut_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (par != NULL) {
|
|
||||||
return(ep);
|
|
||||||
} else {
|
|
||||||
mem_free(ep);
|
|
||||||
return(NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
Frees a communications endpoint. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_endpoint_free(
|
|
||||||
/*==============*/
|
|
||||||
/* out: O if succeed, else error number */
|
|
||||||
com_endpoint_t* ep) /* in, own: communications endpoint */
|
|
||||||
{
|
|
||||||
ulint type;
|
|
||||||
ulint ret;
|
|
||||||
void* par;
|
|
||||||
|
|
||||||
type = com_endpoint_get_type(ep);
|
|
||||||
par = com_endpoint_get_par(ep);
|
|
||||||
|
|
||||||
if (type == COM_SHM) {
|
|
||||||
ret = com_shm_endpoint_free((com_shm_endpoint_t*)par);
|
|
||||||
} else {
|
|
||||||
ret = 0;
|
|
||||||
ut_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret) {
|
|
||||||
return(ret);
|
|
||||||
} else {
|
|
||||||
mem_free(ep);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
Sets an option, like the maximum datagram size for an endpoint.
|
|
||||||
The options may vary depending on the endpoint type. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_endpoint_set_option(
|
|
||||||
/*====================*/
|
|
||||||
/* out: 0 if succeed, else error number */
|
|
||||||
com_endpoint_t* ep, /* in: endpoint */
|
|
||||||
ulint optno, /* in: option number, only
|
|
||||||
COM_OPT_MAX_DGRAM_SIZE currently supported */
|
|
||||||
byte* optval, /* in: pointer to a buffer containing the
|
|
||||||
option value to set */
|
|
||||||
ulint optlen) /* in: option value buffer length */
|
|
||||||
{
|
|
||||||
ulint type;
|
|
||||||
ulint ret;
|
|
||||||
void* par;
|
|
||||||
|
|
||||||
type = com_endpoint_get_type(ep);
|
|
||||||
par = com_endpoint_get_par(ep);
|
|
||||||
|
|
||||||
if (type == COM_SHM) {
|
|
||||||
ret = com_shm_endpoint_set_option((com_shm_endpoint_t*)par,
|
|
||||||
optno, optval, optlen);
|
|
||||||
} else {
|
|
||||||
ret = 0;
|
|
||||||
ut_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
Binds a communications endpoint to the specified address. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_bind(
|
|
||||||
/*=====*/
|
|
||||||
/* out: 0 if succeed, else error number */
|
|
||||||
com_endpoint_t* ep, /* in: communications endpoint */
|
|
||||||
char* name, /* in: address name */
|
|
||||||
ulint len) /* in: name length */
|
|
||||||
{
|
|
||||||
ulint type;
|
|
||||||
ulint ret;
|
|
||||||
void* par;
|
|
||||||
|
|
||||||
ut_ad(len <= COM_MAX_ADDR_LEN);
|
|
||||||
|
|
||||||
if (com_endpoint_get_bound(ep)) {
|
|
||||||
return(COM_ERR_ALREADY_BOUND);
|
|
||||||
}
|
|
||||||
|
|
||||||
type = com_endpoint_get_type(ep);
|
|
||||||
par = com_endpoint_get_par(ep);
|
|
||||||
|
|
||||||
if (type == COM_SHM) {
|
|
||||||
ret = com_shm_bind((com_shm_endpoint_t*)par, name, len);
|
|
||||||
} else {
|
|
||||||
ret = 0;
|
|
||||||
ut_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret == 0) {
|
|
||||||
com_endpoint_set_bound(ep, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
Waits for a datagram to arrive at an endpoint. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_recvfrom(
|
|
||||||
/*=========*/
|
|
||||||
/* out: 0 if succeed, else error number */
|
|
||||||
com_endpoint_t* ep, /* in: communications endpoint */
|
|
||||||
byte* buf, /* out: datagram buffer; the buffer is
|
|
||||||
supplied by the caller */
|
|
||||||
ulint buf_len,/* in: datagram buffer length */
|
|
||||||
ulint* len, /* out: datagram length */
|
|
||||||
char* from, /* out: address name buffer; the buffer is
|
|
||||||
supplied by the caller */
|
|
||||||
ulint from_len,/* in: address name buffer length */
|
|
||||||
ulint* addr_len)/* out: address name length */
|
|
||||||
{
|
|
||||||
ulint type;
|
|
||||||
ulint ret;
|
|
||||||
void* par;
|
|
||||||
|
|
||||||
if (!com_endpoint_get_bound(ep)) {
|
|
||||||
|
|
||||||
return(COM_ERR_NOT_BOUND);
|
|
||||||
}
|
|
||||||
|
|
||||||
type = com_endpoint_get_type(ep);
|
|
||||||
par = com_endpoint_get_par(ep);
|
|
||||||
|
|
||||||
if (type == COM_SHM) {
|
|
||||||
ret = com_shm_recvfrom((com_shm_endpoint_t*)par,
|
|
||||||
buf, buf_len, len, from, from_len,
|
|
||||||
addr_len);
|
|
||||||
} else {
|
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
ut_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
Sends a datagram to the specified destination. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_sendto(
|
|
||||||
/*=======*/
|
|
||||||
/* out: 0 if succeed, else error number */
|
|
||||||
com_endpoint_t* ep, /* in: communications endpoint */
|
|
||||||
byte* buf, /* in: datagram buffer */
|
|
||||||
ulint len, /* in: datagram length */
|
|
||||||
char* to, /* in: address name buffer */
|
|
||||||
ulint tolen) /* in: address name length */
|
|
||||||
{
|
|
||||||
ulint type;
|
|
||||||
ulint ret;
|
|
||||||
void* par;
|
|
||||||
|
|
||||||
if (!com_endpoint_get_bound(ep)) {
|
|
||||||
return(COM_ERR_NOT_BOUND);
|
|
||||||
}
|
|
||||||
|
|
||||||
type = com_endpoint_get_type(ep);
|
|
||||||
par = com_endpoint_get_par(ep);
|
|
||||||
|
|
||||||
if (type == COM_SHM) {
|
|
||||||
ret = com_shm_sendto((com_shm_endpoint_t*)par, buf, len,
|
|
||||||
to, tolen);
|
|
||||||
} else {
|
|
||||||
ret = 0;
|
|
||||||
ut_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
Gets the maximum datagram size for an endpoint. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_endpoint_get_max_size(
|
|
||||||
/*======================*/
|
|
||||||
/* out: maximum size */
|
|
||||||
com_endpoint_t* ep) /* in: endpoint */
|
|
||||||
{
|
|
||||||
ulint type;
|
|
||||||
ulint ret;
|
|
||||||
void* par;
|
|
||||||
|
|
||||||
type = com_endpoint_get_type(ep);
|
|
||||||
par = com_endpoint_get_par(ep);
|
|
||||||
|
|
||||||
if (type == COM_SHM) {
|
|
||||||
ret = com_shm_endpoint_get_size((com_shm_endpoint_t*)par);
|
|
||||||
} else {
|
|
||||||
ret = 0;
|
|
||||||
ut_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(ret);
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
@ -1,12 +0,0 @@
|
|||||||
include ..\include\makefile.i
|
|
||||||
|
|
||||||
com.lib: com0com.obj com0shm.obj
|
|
||||||
lib -out:..\libs\com.lib com0com.obj com0shm.obj
|
|
||||||
|
|
||||||
com0com.obj: com0com.c
|
|
||||||
$(CCOM) $(CFL) -c com0com.c
|
|
||||||
|
|
||||||
com0shm.obj: com0shm.c
|
|
||||||
$(CCOM) $(CFL) -c com0shm.c
|
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ case "$target" in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile dnl
|
AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile dnl
|
||||||
buf/Makefile com/Makefile data/Makefile dnl
|
buf/Makefile data/Makefile dnl
|
||||||
dict/Makefile dyn/Makefile dnl
|
dict/Makefile dyn/Makefile dnl
|
||||||
eval/Makefile fil/Makefile fsp/Makefile fut/Makefile dnl
|
eval/Makefile fil/Makefile fsp/Makefile fut/Makefile dnl
|
||||||
ha/Makefile ibuf/Makefile include/Makefile dnl
|
ha/Makefile ibuf/Makefile include/Makefile dnl
|
||||||
|
@ -114,8 +114,8 @@ dtuple_datas_are_ordering_equal(
|
|||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
ut_ad(tuple1 && tuple2);
|
ut_ad(tuple1 && tuple2);
|
||||||
ut_ad(tuple1->magic_n = DATA_TUPLE_MAGIC_N);
|
ut_ad(tuple1->magic_n == DATA_TUPLE_MAGIC_N);
|
||||||
ut_ad(tuple2->magic_n = DATA_TUPLE_MAGIC_N);
|
ut_ad(tuple2->magic_n == DATA_TUPLE_MAGIC_N);
|
||||||
ut_ad(dtuple_check_typed(tuple1));
|
ut_ad(dtuple_check_typed(tuple1));
|
||||||
ut_ad(dtuple_check_typed(tuple2));
|
ut_ad(dtuple_check_typed(tuple2));
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ dfield_check_typed(
|
|||||||
(ulong) dfield_get_type(field)->mtype,
|
(ulong) dfield_get_type(field)->mtype,
|
||||||
(ulong) dfield_get_len(field));
|
(ulong) dfield_get_len(field));
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
@ -308,7 +308,7 @@ dtuple_validate(
|
|||||||
ulint i;
|
ulint i;
|
||||||
ulint j;
|
ulint j;
|
||||||
|
|
||||||
ut_a(tuple->magic_n = DATA_TUPLE_MAGIC_N);
|
ut_ad(tuple->magic_n == DATA_TUPLE_MAGIC_N);
|
||||||
|
|
||||||
n_fields = dtuple_get_n_fields(tuple);
|
n_fields = dtuple_get_n_fields(tuple);
|
||||||
|
|
||||||
|
@ -39,8 +39,9 @@ dict_hdr_get(
|
|||||||
|
|
||||||
header = DICT_HDR + buf_page_get(DICT_HDR_SPACE, DICT_HDR_PAGE_NO,
|
header = DICT_HDR + buf_page_get(DICT_HDR_SPACE, DICT_HDR_PAGE_NO,
|
||||||
RW_X_LATCH, mtr);
|
RW_X_LATCH, mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(header, SYNC_DICT_HEADER);
|
buf_page_dbg_add_level(header, SYNC_DICT_HEADER);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
return(header);
|
return(header);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ dict_hdr_get_new_id(
|
|||||||
|
|
||||||
dict_hdr = dict_hdr_get(&mtr);
|
dict_hdr = dict_hdr_get(&mtr);
|
||||||
|
|
||||||
id = mtr_read_dulint(dict_hdr + type, MLOG_8BYTES, &mtr);
|
id = mtr_read_dulint(dict_hdr + type, &mtr);
|
||||||
|
|
||||||
/* Add some dummy code here because otherwise pgcc seems to
|
/* Add some dummy code here because otherwise pgcc seems to
|
||||||
compile wrong */
|
compile wrong */
|
||||||
@ -75,7 +76,7 @@ dict_hdr_get_new_id(
|
|||||||
|
|
||||||
id = ut_dulint_add(id, 1);
|
id = ut_dulint_add(id, 1);
|
||||||
|
|
||||||
mlog_write_dulint(dict_hdr + type, id, MLOG_8BYTES, &mtr);
|
mlog_write_dulint(dict_hdr + type, id, &mtr);
|
||||||
|
|
||||||
mtr_commit(&mtr);
|
mtr_commit(&mtr);
|
||||||
|
|
||||||
@ -94,7 +95,9 @@ dict_hdr_flush_row_id(void)
|
|||||||
dulint id;
|
dulint id;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
id = dict_sys->row_id;
|
id = dict_sys->row_id;
|
||||||
|
|
||||||
@ -102,7 +105,7 @@ dict_hdr_flush_row_id(void)
|
|||||||
|
|
||||||
dict_hdr = dict_hdr_get(&mtr);
|
dict_hdr = dict_hdr_get(&mtr);
|
||||||
|
|
||||||
mlog_write_dulint(dict_hdr + DICT_HDR_ROW_ID, id, MLOG_8BYTES, &mtr);
|
mlog_write_dulint(dict_hdr + DICT_HDR_ROW_ID, id, &mtr);
|
||||||
|
|
||||||
mtr_commit(&mtr);
|
mtr_commit(&mtr);
|
||||||
}
|
}
|
||||||
@ -138,20 +141,16 @@ dict_hdr_create(
|
|||||||
/* Start counting row, table, index, and tree ids from
|
/* Start counting row, table, index, and tree ids from
|
||||||
DICT_HDR_FIRST_ID */
|
DICT_HDR_FIRST_ID */
|
||||||
mlog_write_dulint(dict_header + DICT_HDR_ROW_ID,
|
mlog_write_dulint(dict_header + DICT_HDR_ROW_ID,
|
||||||
ut_dulint_create(0, DICT_HDR_FIRST_ID),
|
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
|
||||||
MLOG_8BYTES, mtr);
|
|
||||||
|
|
||||||
mlog_write_dulint(dict_header + DICT_HDR_TABLE_ID,
|
mlog_write_dulint(dict_header + DICT_HDR_TABLE_ID,
|
||||||
ut_dulint_create(0, DICT_HDR_FIRST_ID),
|
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
|
||||||
MLOG_8BYTES, mtr);
|
|
||||||
|
|
||||||
mlog_write_dulint(dict_header + DICT_HDR_INDEX_ID,
|
mlog_write_dulint(dict_header + DICT_HDR_INDEX_ID,
|
||||||
ut_dulint_create(0, DICT_HDR_FIRST_ID),
|
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
|
||||||
MLOG_8BYTES, mtr);
|
|
||||||
|
|
||||||
mlog_write_dulint(dict_header + DICT_HDR_MIX_ID,
|
mlog_write_dulint(dict_header + DICT_HDR_MIX_ID,
|
||||||
ut_dulint_create(0, DICT_HDR_FIRST_ID),
|
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
|
||||||
MLOG_8BYTES, mtr);
|
|
||||||
|
|
||||||
/* Create the B-tree roots for the clustered indexes of the basic
|
/* Create the B-tree roots for the clustered indexes of the basic
|
||||||
system tables */
|
system tables */
|
||||||
@ -247,7 +246,7 @@ dict_boot(void)
|
|||||||
dict_sys->row_id = ut_dulint_add(
|
dict_sys->row_id = ut_dulint_add(
|
||||||
ut_dulint_align_up(
|
ut_dulint_align_up(
|
||||||
mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID,
|
mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID,
|
||||||
MLOG_8BYTES, &mtr),
|
&mtr),
|
||||||
DICT_HDR_ROW_ID_WRITE_MARGIN),
|
DICT_HDR_ROW_ID_WRITE_MARGIN),
|
||||||
DICT_HDR_ROW_ID_WRITE_MARGIN);
|
DICT_HDR_ROW_ID_WRITE_MARGIN);
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ dict_create_sys_tables_tuple(
|
|||||||
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
|
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
|
||||||
dfield_set_data(dfield, table->cluster_name,
|
dfield_set_data(dfield, table->cluster_name,
|
||||||
ut_strlen(table->cluster_name));
|
ut_strlen(table->cluster_name));
|
||||||
ut_a(0); /* Oracle-style clusters are not supported yet */
|
ut_error; /* Oracle-style clusters are not supported yet */
|
||||||
} else {
|
} else {
|
||||||
dfield_set_data(dfield, NULL, UNIV_SQL_NULL);
|
dfield_set_data(dfield, NULL, UNIV_SQL_NULL);
|
||||||
}
|
}
|
||||||
@ -272,8 +272,9 @@ dict_build_table_def_step(
|
|||||||
ulint error;
|
ulint error;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
UT_NOT_USED(thr);
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
table = node->table;
|
table = node->table;
|
||||||
|
|
||||||
@ -369,7 +370,9 @@ dict_create_sys_indexes_tuple(
|
|||||||
byte* ptr;
|
byte* ptr;
|
||||||
|
|
||||||
UT_NOT_USED(trx);
|
UT_NOT_USED(trx);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(index && heap);
|
ut_ad(index && heap);
|
||||||
|
|
||||||
sys_indexes = dict_sys->sys_indexes;
|
sys_indexes = dict_sys->sys_indexes;
|
||||||
@ -562,8 +565,9 @@ dict_build_index_def_step(
|
|||||||
dict_index_t* index;
|
dict_index_t* index;
|
||||||
dtuple_t* row;
|
dtuple_t* row;
|
||||||
|
|
||||||
UT_NOT_USED(thr);
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
index = node->index;
|
index = node->index;
|
||||||
|
|
||||||
@ -636,7 +640,9 @@ dict_create_index_tree_step(
|
|||||||
btr_pcur_t pcur;
|
btr_pcur_t pcur;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
UT_NOT_USED(thr);
|
UT_NOT_USED(thr);
|
||||||
|
|
||||||
index = node->index;
|
index = node->index;
|
||||||
@ -701,7 +707,9 @@ dict_drop_index_tree(
|
|||||||
byte* ptr;
|
byte* ptr;
|
||||||
ulint len;
|
ulint len;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
ptr = rec_get_nth_field(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, &len);
|
ptr = rec_get_nth_field(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, &len);
|
||||||
|
|
||||||
@ -831,7 +839,9 @@ dict_create_table_step(
|
|||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
|
|
||||||
ut_ad(thr);
|
ut_ad(thr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
trx = thr_get_trx(thr);
|
trx = thr_get_trx(thr);
|
||||||
|
|
||||||
@ -939,7 +949,9 @@ dict_create_index_step(
|
|||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
|
|
||||||
ut_ad(thr);
|
ut_ad(thr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
trx = thr_get_trx(thr);
|
trx = thr_get_trx(thr);
|
||||||
|
|
||||||
@ -1128,7 +1140,7 @@ dict_create_or_check_foreign_constraint_tables(void)
|
|||||||
|
|
||||||
graph->fork_type = QUE_FORK_MYSQL_INTERFACE;
|
graph->fork_type = QUE_FORK_MYSQL_INTERFACE;
|
||||||
|
|
||||||
ut_a(thr = que_fork_start_command(graph, SESS_COMM_EXECUTE, 0));
|
ut_a(thr = que_fork_start_command(graph));
|
||||||
|
|
||||||
que_run_threads(thr);
|
que_run_threads(thr);
|
||||||
|
|
||||||
@ -1201,7 +1213,9 @@ dict_create_add_foreigns_to_dictionary(
|
|||||||
ulint i;
|
ulint i;
|
||||||
char buf[10000];
|
char buf[10000];
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (NULL == dict_table_get_low((char *) "SYS_FOREIGN")) {
|
if (NULL == dict_table_get_low((char *) "SYS_FOREIGN")) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@ -1262,7 +1276,7 @@ loop:
|
|||||||
foreign->referenced_col_names[i]);
|
foreign->referenced_col_names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_a(len < (sizeof buf) - 19)
|
ut_a(len < (sizeof buf) - 19);
|
||||||
len += sprintf(buf + len,"COMMIT WORK;\nEND;\n");
|
len += sprintf(buf + len,"COMMIT WORK;\nEND;\n");
|
||||||
|
|
||||||
graph = pars_sql(buf);
|
graph = pars_sql(buf);
|
||||||
@ -1274,7 +1288,7 @@ loop:
|
|||||||
|
|
||||||
graph->fork_type = QUE_FORK_MYSQL_INTERFACE;
|
graph->fork_type = QUE_FORK_MYSQL_INTERFACE;
|
||||||
|
|
||||||
ut_a(thr = que_fork_start_command(graph, SESS_COMM_EXECUTE, 0));
|
ut_a(thr = que_fork_start_command(graph));
|
||||||
|
|
||||||
que_run_threads(thr);
|
que_run_threads(thr);
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ dict_tables_have_same_db(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
@ -232,7 +232,7 @@ dict_remove_db_name(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
|
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ dict_get_db_name_len(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@ -616,7 +616,9 @@ dict_table_get_on_id(
|
|||||||
if we are doing a rollback to handle an error in TABLE
|
if we are doing a rollback to handle an error in TABLE
|
||||||
CREATE, for example, we already have the mutex! */
|
CREATE, for example, we already have the mutex! */
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(dict_table_get_on_id_low(table_id, trx));
|
return(dict_table_get_on_id_low(table_id, trx));
|
||||||
}
|
}
|
||||||
@ -762,7 +764,9 @@ dict_table_add_to_cache(
|
|||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
ut_ad(table);
|
ut_ad(table);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(table->n_def == table->n_cols - DATA_N_SYS_COLS);
|
ut_ad(table->n_def == table->n_cols - DATA_N_SYS_COLS);
|
||||||
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
||||||
ut_ad(table->cached == FALSE);
|
ut_ad(table->cached == FALSE);
|
||||||
@ -898,7 +902,9 @@ dict_table_rename_in_cache(
|
|||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
ut_ad(table);
|
ut_ad(table);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
old_size = mem_heap_get_size(table->heap);
|
old_size = mem_heap_get_size(table->heap);
|
||||||
|
|
||||||
@ -1136,7 +1142,9 @@ dict_table_remove_from_cache(
|
|||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
ut_ad(table);
|
ut_ad(table);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
||||||
|
|
||||||
/* printf("Removing table %s from dictionary cache\n", table->name); */
|
/* printf("Removing table %s from dictionary cache\n", table->name); */
|
||||||
@ -1205,9 +1213,11 @@ dict_table_LRU_trim(void)
|
|||||||
dict_table_t* table;
|
dict_table_t* table;
|
||||||
dict_table_t* prev_table;
|
dict_table_t* prev_table;
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
table = UT_LIST_GET_LAST(dict_sys->table_LRU);
|
table = UT_LIST_GET_LAST(dict_sys->table_LRU);
|
||||||
|
|
||||||
@ -1236,7 +1246,9 @@ dict_col_add_to_cache(
|
|||||||
ulint fold;
|
ulint fold;
|
||||||
|
|
||||||
ut_ad(table && col);
|
ut_ad(table && col);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
||||||
|
|
||||||
fold = ut_fold_ulint_pair(ut_fold_string(table->name),
|
fold = ut_fold_ulint_pair(ut_fold_string(table->name),
|
||||||
@ -1267,7 +1279,9 @@ dict_col_remove_from_cache(
|
|||||||
ulint fold;
|
ulint fold;
|
||||||
|
|
||||||
ut_ad(table && col);
|
ut_ad(table && col);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
||||||
|
|
||||||
fold = ut_fold_ulint_pair(ut_fold_string(table->name),
|
fold = ut_fold_ulint_pair(ut_fold_string(table->name),
|
||||||
@ -1290,7 +1304,9 @@ dict_col_reposition_in_cache(
|
|||||||
ulint fold;
|
ulint fold;
|
||||||
|
|
||||||
ut_ad(table && col);
|
ut_ad(table && col);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
||||||
|
|
||||||
fold = ut_fold_ulint_pair(ut_fold_string(table->name),
|
fold = ut_fold_ulint_pair(ut_fold_string(table->name),
|
||||||
@ -1324,7 +1340,9 @@ dict_index_add_to_cache(
|
|||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
ut_ad(index);
|
ut_ad(index);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(index->n_def == index->n_fields);
|
ut_ad(index->n_def == index->n_fields);
|
||||||
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
|
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
|
||||||
|
|
||||||
@ -1450,7 +1468,9 @@ dict_index_remove_from_cache(
|
|||||||
ut_ad(table && index);
|
ut_ad(table && index);
|
||||||
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
||||||
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
|
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
ut_ad(UT_LIST_GET_LEN((index->tree)->tree_indexes) == 1);
|
ut_ad(UT_LIST_GET_LEN((index->tree)->tree_indexes) == 1);
|
||||||
dict_tree_free(index->tree);
|
dict_tree_free(index->tree);
|
||||||
@ -1494,7 +1514,9 @@ dict_index_find_cols(
|
|||||||
|
|
||||||
ut_ad(table && index);
|
ut_ad(table && index);
|
||||||
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
for (i = 0; i < index->n_fields; i++) {
|
for (i = 0; i < index->n_fields; i++) {
|
||||||
field = dict_index_get_nth_field(index, i);
|
field = dict_index_get_nth_field(index, i);
|
||||||
@ -1635,7 +1657,9 @@ dict_index_build_internal_clust(
|
|||||||
|
|
||||||
ut_ad(table && index);
|
ut_ad(table && index);
|
||||||
ut_ad(index->type & DICT_CLUSTERED);
|
ut_ad(index->type & DICT_CLUSTERED);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
||||||
|
|
||||||
/* Create a new index object with certainly enough fields */
|
/* Create a new index object with certainly enough fields */
|
||||||
@ -1804,7 +1828,9 @@ dict_index_build_internal_non_clust(
|
|||||||
|
|
||||||
ut_ad(table && index);
|
ut_ad(table && index);
|
||||||
ut_ad(0 == (index->type & DICT_CLUSTERED));
|
ut_ad(0 == (index->type & DICT_CLUSTERED));
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
|
||||||
|
|
||||||
/* The clustered index should be the first in the list of indexes */
|
/* The clustered index should be the first in the list of indexes */
|
||||||
@ -1923,7 +1949,9 @@ dict_foreign_remove_from_cache(
|
|||||||
/*===========================*/
|
/*===========================*/
|
||||||
dict_foreign_t* foreign) /* in, own: foreign constraint */
|
dict_foreign_t* foreign) /* in, own: foreign constraint */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_a(foreign);
|
ut_a(foreign);
|
||||||
|
|
||||||
if (foreign->referenced_table) {
|
if (foreign->referenced_table) {
|
||||||
@ -1952,7 +1980,9 @@ dict_foreign_find(
|
|||||||
{
|
{
|
||||||
dict_foreign_t* foreign;
|
dict_foreign_t* foreign;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
foreign = UT_LIST_GET_FIRST(table->foreign_list);
|
foreign = UT_LIST_GET_FIRST(table->foreign_list);
|
||||||
|
|
||||||
@ -2061,7 +2091,9 @@ dict_foreign_add_to_cache(
|
|||||||
ibool added_to_referenced_list = FALSE;
|
ibool added_to_referenced_list = FALSE;
|
||||||
char* buf = dict_foreign_err_buf;
|
char* buf = dict_foreign_err_buf;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
for_table = dict_table_check_if_in_cache_low(
|
for_table = dict_table_check_if_in_cache_low(
|
||||||
foreign->foreign_table_name);
|
foreign->foreign_table_name);
|
||||||
@ -2732,7 +2764,9 @@ dict_create_foreign_constraints_low(
|
|||||||
ulint column_name_lens[500];
|
ulint column_name_lens[500];
|
||||||
char referenced_table_name[2500];
|
char referenced_table_name[2500];
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
table = dict_table_get_low(name);
|
table = dict_table_get_low(name);
|
||||||
|
|
||||||
@ -3312,7 +3346,9 @@ dict_foreign_parse_drop_constraints(
|
|||||||
str = dict_strip_comments(*(trx->mysql_query_str));
|
str = dict_strip_comments(*(trx->mysql_query_str));
|
||||||
ptr = str;
|
ptr = str;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
loop:
|
loop:
|
||||||
ptr = dict_scan_to(ptr, (char *) "DROP");
|
ptr = dict_scan_to(ptr, (char *) "DROP");
|
||||||
|
|
||||||
@ -3452,7 +3488,9 @@ dict_procedure_reserve_parsed_copy(
|
|||||||
que_t* graph;
|
que_t* graph;
|
||||||
proc_node_t* proc_node;
|
proc_node_t* proc_node;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!mutex_own(&kernel_mutex));
|
ut_ad(!mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
mutex_enter(&(dict_sys->mutex));
|
mutex_enter(&(dict_sys->mutex));
|
||||||
|
|
||||||
@ -3500,7 +3538,9 @@ dict_procedure_release_parsed_copy(
|
|||||||
{
|
{
|
||||||
proc_node_t* proc_node;
|
proc_node_t* proc_node;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!mutex_own(&kernel_mutex));
|
ut_ad(!mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
mutex_enter(&(dict_sys->mutex));
|
mutex_enter(&(dict_sys->mutex));
|
||||||
|
|
||||||
@ -3577,9 +3617,9 @@ dict_tree_create(
|
|||||||
tree->id = index->id;
|
tree->id = index->id;
|
||||||
|
|
||||||
UT_LIST_INIT(tree->tree_indexes);
|
UT_LIST_INIT(tree->tree_indexes);
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
tree->magic_n = DICT_TREE_MAGIC_N;
|
tree->magic_n = DICT_TREE_MAGIC_N;
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
rw_lock_create(&(tree->lock));
|
rw_lock_create(&(tree->lock));
|
||||||
|
|
||||||
rw_lock_set_level(&(tree->lock), SYNC_INDEX_TREE);
|
rw_lock_set_level(&(tree->lock), SYNC_INDEX_TREE);
|
||||||
@ -3990,7 +4030,9 @@ dict_foreign_print_low(
|
|||||||
{
|
{
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
printf(" FOREIGN KEY CONSTRAINT %s: %s (", foreign->id,
|
printf(" FOREIGN KEY CONSTRAINT %s: %s (", foreign->id,
|
||||||
foreign->foreign_table_name);
|
foreign->foreign_table_name);
|
||||||
@ -4055,7 +4097,9 @@ dict_table_print_low(
|
|||||||
dict_foreign_t* foreign;
|
dict_foreign_t* foreign;
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
dict_update_statistics_low(table, TRUE);
|
dict_update_statistics_low(table, TRUE);
|
||||||
|
|
||||||
@ -4109,7 +4153,9 @@ dict_col_print_low(
|
|||||||
{
|
{
|
||||||
dtype_t* type;
|
dtype_t* type;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
type = dict_col_get_type(col);
|
type = dict_col_get_type(col);
|
||||||
printf("%s: ", col->name);
|
printf("%s: ", col->name);
|
||||||
@ -4129,7 +4175,9 @@ dict_index_print_low(
|
|||||||
ib_longlong n_vals;
|
ib_longlong n_vals;
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
tree = index->tree;
|
tree = index->tree;
|
||||||
|
|
||||||
@ -4175,7 +4223,9 @@ dict_field_print_low(
|
|||||||
/*=================*/
|
/*=================*/
|
||||||
dict_field_t* field) /* in: field */
|
dict_field_t* field) /* in: field */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
printf(" %s", field->name);
|
printf(" %s", field->name);
|
||||||
|
|
||||||
|
@ -43,7 +43,9 @@ dict_get_first_table_name_in_db(
|
|||||||
char* table_name;
|
char* table_name;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
heap = mem_heap_create(1000);
|
heap = mem_heap_create(1000);
|
||||||
|
|
||||||
@ -307,7 +309,9 @@ dict_load_columns(
|
|||||||
ulint i;
|
ulint i;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
mtr_start(&mtr);
|
mtr_start(&mtr);
|
||||||
|
|
||||||
@ -414,7 +418,9 @@ dict_load_fields(
|
|||||||
ulint i;
|
ulint i;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
UT_NOT_USED(table);
|
UT_NOT_USED(table);
|
||||||
|
|
||||||
@ -526,7 +532,9 @@ dict_load_indexes(
|
|||||||
dulint id;
|
dulint id;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if ((ut_dulint_get_high(table->id) == 0)
|
if ((ut_dulint_get_high(table->id) == 0)
|
||||||
&& (ut_dulint_get_low(table->id) < DICT_HDR_FIRST_ID)) {
|
&& (ut_dulint_get_low(table->id) < DICT_HDR_FIRST_ID)) {
|
||||||
@ -700,7 +708,9 @@ dict_load_table(
|
|||||||
ulint err;
|
ulint err;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
heap = mem_heap_create(1000);
|
heap = mem_heap_create(1000);
|
||||||
|
|
||||||
@ -791,7 +801,7 @@ dict_load_table(
|
|||||||
table->type = mach_read_from_4(field);
|
table->type = mach_read_from_4(field);
|
||||||
|
|
||||||
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
|
if (table->type == DICT_TABLE_CLUSTER_MEMBER) {
|
||||||
ut_a(0);
|
ut_error;
|
||||||
|
|
||||||
field = rec_get_nth_field(rec, 6, &len);
|
field = rec_get_nth_field(rec, 6, &len);
|
||||||
table->mix_id = mach_read_from_8(field);
|
table->mix_id = mach_read_from_8(field);
|
||||||
@ -872,7 +882,9 @@ dict_load_table_on_id(
|
|||||||
char* name;
|
char* name;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* NOTE that the operation of this function is protected by
|
/* NOTE that the operation of this function is protected by
|
||||||
the dictionary mutex, and therefore no deadlocks can occur
|
the dictionary mutex, and therefore no deadlocks can occur
|
||||||
@ -957,7 +969,9 @@ dict_load_sys_table(
|
|||||||
{
|
{
|
||||||
mem_heap_t* heap;
|
mem_heap_t* heap;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
heap = mem_heap_create(1000);
|
heap = mem_heap_create(1000);
|
||||||
|
|
||||||
@ -988,7 +1002,9 @@ dict_load_foreign_cols(
|
|||||||
ulint i;
|
ulint i;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
foreign->foreign_col_names = mem_heap_alloc(foreign->heap,
|
foreign->foreign_col_names = mem_heap_alloc(foreign->heap,
|
||||||
foreign->n_fields * sizeof(void*));
|
foreign->n_fields * sizeof(void*));
|
||||||
@ -1069,7 +1085,9 @@ dict_load_foreign(
|
|||||||
ulint err;
|
ulint err;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
heap2 = mem_heap_create(1000);
|
heap2 = mem_heap_create(1000);
|
||||||
|
|
||||||
@ -1201,7 +1219,9 @@ dict_load_foreigns(
|
|||||||
ulint err;
|
ulint err;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
sys_foreign = dict_table_get_low((char *) "SYS_FOREIGN");
|
sys_foreign = dict_table_get_low((char *) "SYS_FOREIGN");
|
||||||
|
|
||||||
|
@ -92,9 +92,9 @@ dict_mem_table_create(
|
|||||||
mutex_set_level(&(table->autoinc_mutex), SYNC_DICT_AUTOINC_MUTEX);
|
mutex_set_level(&(table->autoinc_mutex), SYNC_DICT_AUTOINC_MUTEX);
|
||||||
|
|
||||||
table->autoinc_inited = FALSE;
|
table->autoinc_inited = FALSE;
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
table->magic_n = DICT_TABLE_MAGIC_N;
|
table->magic_n = DICT_TABLE_MAGIC_N;
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
return(table);
|
return(table);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,7 +219,9 @@ dict_mem_index_create(
|
|||||||
index->stat_n_diff_key_vals = NULL;
|
index->stat_n_diff_key_vals = NULL;
|
||||||
|
|
||||||
index->cached = FALSE;
|
index->cached = FALSE;
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
index->magic_n = DICT_INDEX_MAGIC_N;
|
index->magic_n = DICT_INDEX_MAGIC_N;
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
|
|
||||||
return(index);
|
return(index);
|
||||||
}
|
}
|
||||||
|
@ -534,7 +534,9 @@ fil_node_close_file(
|
|||||||
ibool ret;
|
ibool ret;
|
||||||
|
|
||||||
ut_ad(node && system);
|
ut_ad(node && system);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(system->mutex)));
|
ut_ad(mutex_own(&(system->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_a(node->open);
|
ut_a(node->open);
|
||||||
ut_a(node->n_pending == 0);
|
ut_a(node->n_pending == 0);
|
||||||
ut_a(node->n_pending_flushes == 0);
|
ut_a(node->n_pending_flushes == 0);
|
||||||
@ -742,7 +744,9 @@ fil_node_free(
|
|||||||
fil_space_t* space) /* in: space where the file node is chained */
|
fil_space_t* space) /* in: space where the file node is chained */
|
||||||
{
|
{
|
||||||
ut_ad(node && system && space);
|
ut_ad(node && system && space);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(system->mutex)));
|
ut_ad(mutex_own(&(system->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_a(node->magic_n == FIL_NODE_MAGIC_N);
|
ut_a(node->magic_n == FIL_NODE_MAGIC_N);
|
||||||
ut_a(node->n_pending == 0);
|
ut_a(node->n_pending == 0);
|
||||||
|
|
||||||
@ -3383,7 +3387,9 @@ fil_node_prepare_for_io(
|
|||||||
fil_space_t* space) /* in: space */
|
fil_space_t* space) /* in: space */
|
||||||
{
|
{
|
||||||
ut_ad(node && system && space);
|
ut_ad(node && system && space);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(system->mutex)));
|
ut_ad(mutex_own(&(system->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (system->n_open > system->max_n_open + 5) {
|
if (system->n_open > system->max_n_open + 5) {
|
||||||
ut_print_timestamp(stderr);
|
ut_print_timestamp(stderr);
|
||||||
@ -3427,7 +3433,9 @@ fil_node_complete_io(
|
|||||||
{
|
{
|
||||||
ut_ad(node);
|
ut_ad(node);
|
||||||
ut_ad(system);
|
ut_ad(system);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(system->mutex)));
|
ut_ad(mutex_own(&(system->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
ut_a(node->n_pending > 0);
|
ut_a(node->n_pending > 0);
|
||||||
|
|
||||||
@ -3561,7 +3569,7 @@ fil_io(
|
|||||||
space->name, (ulong) byte_offset, (ulong) len,
|
space->name, (ulong) byte_offset, (ulong) len,
|
||||||
(ulong) type);
|
(ulong) type);
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->size > block_offset) {
|
if (node->size > block_offset) {
|
||||||
@ -3726,7 +3734,7 @@ fil_aio_wait(
|
|||||||
ret = os_aio_posix_handle(segment, &fil_node, &message);
|
ret = os_aio_posix_handle(segment, &fil_node, &message);
|
||||||
#else
|
#else
|
||||||
ret = 0; /* Eliminate compiler warning */
|
ret = 0; /* Eliminate compiler warning */
|
||||||
ut_a(0);
|
ut_error;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
srv_io_thread_op_info[segment] =(char *)"handle simulated aio";
|
srv_io_thread_op_info[segment] =(char *)"handle simulated aio";
|
||||||
|
@ -327,9 +327,9 @@ fsp_get_space_header(
|
|||||||
ut_ad(mtr);
|
ut_ad(mtr);
|
||||||
|
|
||||||
header = FSP_HEADER_OFFSET + buf_page_get(id, 0, RW_X_LATCH, mtr);
|
header = FSP_HEADER_OFFSET + buf_page_get(id, 0, RW_X_LATCH, mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(header, SYNC_FSP_PAGE);
|
buf_page_dbg_add_level(header, SYNC_FSP_PAGE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
return(header);
|
return(header);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,7 +684,9 @@ xdes_get_descriptor_with_space_hdr(
|
|||||||
} else {
|
} else {
|
||||||
descr_page = buf_page_get(space, descr_page_no, RW_X_LATCH,
|
descr_page = buf_page_get(space, descr_page_no, RW_X_LATCH,
|
||||||
mtr);
|
mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(descr_page, SYNC_FSP_PAGE);
|
buf_page_dbg_add_level(descr_page, SYNC_FSP_PAGE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
return(descr_page + XDES_ARR_OFFSET
|
return(descr_page + XDES_ARR_OFFSET
|
||||||
@ -714,8 +716,9 @@ xdes_get_descriptor(
|
|||||||
|
|
||||||
sp_header = FSP_HEADER_OFFSET
|
sp_header = FSP_HEADER_OFFSET
|
||||||
+ buf_page_get(space, 0, RW_X_LATCH, mtr);
|
+ buf_page_get(space, 0, RW_X_LATCH, mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(sp_header, SYNC_FSP_PAGE);
|
buf_page_dbg_add_level(sp_header, SYNC_FSP_PAGE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
return(xdes_get_descriptor_with_space_hdr(sp_header, space, offset,
|
return(xdes_get_descriptor_with_space_hdr(sp_header, space, offset,
|
||||||
mtr));
|
mtr));
|
||||||
}
|
}
|
||||||
@ -879,9 +882,10 @@ fsp_header_init(
|
|||||||
mtr_x_lock(fil_space_get_latch(space), mtr);
|
mtr_x_lock(fil_space_get_latch(space), mtr);
|
||||||
|
|
||||||
page = buf_page_create(space, 0, mtr);
|
page = buf_page_create(space, 0, mtr);
|
||||||
|
|
||||||
buf_page_get(space, 0, RW_X_LATCH, mtr);
|
buf_page_get(space, 0, RW_X_LATCH, mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
|
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* The prior contents of the file page should be ignored */
|
/* The prior contents of the file page should be ignored */
|
||||||
|
|
||||||
@ -902,8 +906,7 @@ fsp_header_init(
|
|||||||
flst_init(header + FSP_SEG_INODES_FULL, mtr);
|
flst_init(header + FSP_SEG_INODES_FULL, mtr);
|
||||||
flst_init(header + FSP_SEG_INODES_FREE, mtr);
|
flst_init(header + FSP_SEG_INODES_FREE, mtr);
|
||||||
|
|
||||||
mlog_write_dulint(header + FSP_SEG_ID, ut_dulint_create(0, 1),
|
mlog_write_dulint(header + FSP_SEG_ID, ut_dulint_create(0, 1), mtr);
|
||||||
MLOG_8BYTES, mtr);
|
|
||||||
if (space == 0) {
|
if (space == 0) {
|
||||||
fsp_fill_free_list(FALSE, space, header, mtr);
|
fsp_fill_free_list(FALSE, space, header, mtr);
|
||||||
btr_create(DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF, space,
|
btr_create(DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF, space,
|
||||||
@ -1244,8 +1247,10 @@ fsp_fill_free_list(
|
|||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
descr_page = buf_page_create(space, i, mtr);
|
descr_page = buf_page_create(space, i, mtr);
|
||||||
buf_page_get(space, i, RW_X_LATCH, mtr);
|
buf_page_get(space, i, RW_X_LATCH, mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(descr_page,
|
buf_page_dbg_add_level(descr_page,
|
||||||
SYNC_FSP_PAGE);
|
SYNC_FSP_PAGE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
fsp_init_file_page(descr_page, mtr);
|
fsp_init_file_page(descr_page, mtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1258,11 +1263,11 @@ fsp_fill_free_list(
|
|||||||
|
|
||||||
ibuf_page = buf_page_create(space,
|
ibuf_page = buf_page_create(space,
|
||||||
i + FSP_IBUF_BITMAP_OFFSET, &ibuf_mtr);
|
i + FSP_IBUF_BITMAP_OFFSET, &ibuf_mtr);
|
||||||
|
|
||||||
buf_page_get(space, i + FSP_IBUF_BITMAP_OFFSET,
|
buf_page_get(space, i + FSP_IBUF_BITMAP_OFFSET,
|
||||||
RW_X_LATCH, &ibuf_mtr);
|
RW_X_LATCH, &ibuf_mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(ibuf_page, SYNC_FSP_PAGE);
|
buf_page_dbg_add_level(ibuf_page, SYNC_FSP_PAGE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
fsp_init_file_page(ibuf_page, &ibuf_mtr);
|
fsp_init_file_page(ibuf_page, &ibuf_mtr);
|
||||||
|
|
||||||
ibuf_bitmap_page_init(ibuf_page, &ibuf_mtr);
|
ibuf_bitmap_page_init(ibuf_page, &ibuf_mtr);
|
||||||
@ -1423,7 +1428,7 @@ fsp_alloc_free_page(
|
|||||||
|
|
||||||
ut_print_buf(((byte*)descr) - 500, 1000);
|
ut_print_buf(((byte*)descr) - 500, 1000);
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
page_no = xdes_get_offset(descr) + free;
|
page_no = xdes_get_offset(descr) + free;
|
||||||
@ -1478,8 +1483,9 @@ fsp_alloc_free_page(
|
|||||||
buf_page_create(space, page_no, mtr);
|
buf_page_create(space, page_no, mtr);
|
||||||
|
|
||||||
page = buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
page = buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
|
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* Prior contents of the page should be ignored */
|
/* Prior contents of the page should be ignored */
|
||||||
fsp_init_file_page(page, mtr);
|
fsp_init_file_page(page, mtr);
|
||||||
@ -1529,7 +1535,7 @@ fsp_free_page(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)
|
if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)
|
||||||
@ -1599,7 +1605,7 @@ fsp_free_extent(
|
|||||||
|
|
||||||
ut_print_buf(((byte*)descr) - 500, 1000);
|
ut_print_buf(((byte*)descr) - 500, 1000);
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
xdes_init(descr, mtr);
|
xdes_init(descr, mtr);
|
||||||
@ -1714,15 +1720,15 @@ fsp_alloc_seg_inode_page(
|
|||||||
buf_block_align(page)->check_index_page_at_flush = FALSE;
|
buf_block_align(page)->check_index_page_at_flush = FALSE;
|
||||||
|
|
||||||
fil_page_set_type(page, FIL_PAGE_INODE);
|
fil_page_set_type(page, FIL_PAGE_INODE);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
|
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
for (i = 0; i < FSP_SEG_INODES_PER_PAGE; i++) {
|
for (i = 0; i < FSP_SEG_INODES_PER_PAGE; i++) {
|
||||||
|
|
||||||
inode = fsp_seg_inode_page_get_nth_inode(page, i, mtr);
|
inode = fsp_seg_inode_page_get_nth_inode(page, i, mtr);
|
||||||
|
|
||||||
mlog_write_dulint(inode + FSEG_ID, ut_dulint_zero,
|
mlog_write_dulint(inode + FSEG_ID, ut_dulint_zero, mtr);
|
||||||
MLOG_8BYTES, mtr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
flst_add_last(space_header + FSP_SEG_INODES_FREE,
|
flst_add_last(space_header + FSP_SEG_INODES_FREE,
|
||||||
@ -1762,7 +1768,9 @@ fsp_alloc_seg_inode(
|
|||||||
|
|
||||||
page = buf_page_get(buf_frame_get_space_id(space_header), page_no,
|
page = buf_page_get(buf_frame_get_space_id(space_header), page_no,
|
||||||
RW_X_LATCH, mtr);
|
RW_X_LATCH, mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
|
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
n = fsp_seg_inode_page_find_free(page, 0, mtr);
|
n = fsp_seg_inode_page_find_free(page, 0, mtr);
|
||||||
|
|
||||||
@ -1815,7 +1823,7 @@ fsp_free_seg_inode(
|
|||||||
page + FSEG_INODE_PAGE_NODE, mtr);
|
page + FSEG_INODE_PAGE_NODE, mtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
mlog_write_dulint(inode + FSEG_ID, ut_dulint_zero, MLOG_8BYTES, mtr);
|
mlog_write_dulint(inode + FSEG_ID, ut_dulint_zero, mtr);
|
||||||
mlog_write_ulint(inode + FSEG_MAGIC_N, 0, MLOG_4BYTES, mtr);
|
mlog_write_ulint(inode + FSEG_MAGIC_N, 0, MLOG_4BYTES, mtr);
|
||||||
|
|
||||||
if (ULINT_UNDEFINED == fsp_seg_inode_page_find_used(page, mtr)) {
|
if (ULINT_UNDEFINED == fsp_seg_inode_page_find_used(page, mtr)) {
|
||||||
@ -2014,9 +2022,11 @@ fseg_create_general(
|
|||||||
mtr);
|
mtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!mutex_own(&kernel_mutex)
|
ut_ad(!mutex_own(&kernel_mutex)
|
||||||
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
|
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
|
||||||
MTR_MEMO_X_LOCK));
|
MTR_MEMO_X_LOCK));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
latch = fil_space_get_latch(space);
|
latch = fil_space_get_latch(space);
|
||||||
|
|
||||||
mtr_x_lock(latch, mtr);
|
mtr_x_lock(latch, mtr);
|
||||||
@ -2050,12 +2060,12 @@ fseg_create_general(
|
|||||||
/* Read the next segment id from space header and increment the
|
/* Read the next segment id from space header and increment the
|
||||||
value in space header */
|
value in space header */
|
||||||
|
|
||||||
seg_id = mtr_read_dulint(space_header + FSP_SEG_ID, MLOG_8BYTES, mtr);
|
seg_id = mtr_read_dulint(space_header + FSP_SEG_ID, mtr);
|
||||||
|
|
||||||
mlog_write_dulint(space_header + FSP_SEG_ID, ut_dulint_add(seg_id, 1),
|
mlog_write_dulint(space_header + FSP_SEG_ID, ut_dulint_add(seg_id, 1),
|
||||||
MLOG_8BYTES, mtr);
|
mtr);
|
||||||
|
|
||||||
mlog_write_dulint(inode + FSEG_ID, seg_id, MLOG_8BYTES, mtr);
|
mlog_write_dulint(inode + FSEG_ID, seg_id, mtr);
|
||||||
mlog_write_ulint(inode + FSEG_NOT_FULL_N_USED, 0, MLOG_4BYTES, mtr);
|
mlog_write_ulint(inode + FSEG_NOT_FULL_N_USED, 0, MLOG_4BYTES, mtr);
|
||||||
|
|
||||||
flst_init(inode + FSEG_FREE, mtr);
|
flst_init(inode + FSEG_FREE, mtr);
|
||||||
@ -2170,9 +2180,11 @@ fseg_n_reserved_pages(
|
|||||||
|
|
||||||
space = buf_frame_get_space_id(header);
|
space = buf_frame_get_space_id(header);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!mutex_own(&kernel_mutex)
|
ut_ad(!mutex_own(&kernel_mutex)
|
||||||
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
|
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
|
||||||
MTR_MEMO_X_LOCK));
|
MTR_MEMO_X_LOCK));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
mtr_x_lock(fil_space_get_latch(space), mtr);
|
mtr_x_lock(fil_space_get_latch(space), mtr);
|
||||||
|
|
||||||
inode = fseg_inode_get(header, mtr);
|
inode = fseg_inode_get(header, mtr);
|
||||||
@ -2235,8 +2247,8 @@ fseg_fill_free_list(
|
|||||||
|
|
||||||
xdes_set_state(descr, XDES_FSEG, mtr);
|
xdes_set_state(descr, XDES_FSEG, mtr);
|
||||||
|
|
||||||
seg_id = mtr_read_dulint(inode + FSEG_ID, MLOG_8BYTES, mtr);
|
seg_id = mtr_read_dulint(inode + FSEG_ID, mtr);
|
||||||
mlog_write_dulint(descr + XDES_ID, seg_id, MLOG_8BYTES, mtr);
|
mlog_write_dulint(descr + XDES_ID, seg_id, mtr);
|
||||||
|
|
||||||
flst_add_last(inode + FSEG_FREE, descr + XDES_FLST_NODE, mtr);
|
flst_add_last(inode + FSEG_FREE, descr + XDES_FLST_NODE, mtr);
|
||||||
hint += FSP_EXTENT_SIZE;
|
hint += FSP_EXTENT_SIZE;
|
||||||
@ -2277,10 +2289,10 @@ fseg_alloc_free_extent(
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
seg_id = mtr_read_dulint(inode + FSEG_ID, MLOG_8BYTES, mtr);
|
seg_id = mtr_read_dulint(inode + FSEG_ID, mtr);
|
||||||
|
|
||||||
xdes_set_state(descr, XDES_FSEG, mtr);
|
xdes_set_state(descr, XDES_FSEG, mtr);
|
||||||
mlog_write_dulint(descr + XDES_ID, seg_id, MLOG_8BYTES, mtr);
|
mlog_write_dulint(descr + XDES_ID, seg_id, mtr);
|
||||||
flst_add_last(inode + FSEG_FREE, descr + XDES_FLST_NODE, mtr);
|
flst_add_last(inode + FSEG_FREE, descr + XDES_FLST_NODE, mtr);
|
||||||
|
|
||||||
/* Try to fill the segment free list */
|
/* Try to fill the segment free list */
|
||||||
@ -2330,7 +2342,7 @@ fseg_alloc_free_page_low(
|
|||||||
ut_ad((direction >= FSP_UP) && (direction <= FSP_NO_DIR));
|
ut_ad((direction >= FSP_UP) && (direction <= FSP_NO_DIR));
|
||||||
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N) ==
|
ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N) ==
|
||||||
FSEG_MAGIC_N_VALUE);
|
FSEG_MAGIC_N_VALUE);
|
||||||
seg_id = mtr_read_dulint(seg_inode + FSEG_ID, MLOG_8BYTES, mtr);
|
seg_id = mtr_read_dulint(seg_inode + FSEG_ID, mtr);
|
||||||
|
|
||||||
ut_ad(ut_dulint_cmp(seg_id, ut_dulint_zero) > 0);
|
ut_ad(ut_dulint_cmp(seg_id, ut_dulint_zero) > 0);
|
||||||
|
|
||||||
@ -2351,8 +2363,7 @@ fseg_alloc_free_page_low(
|
|||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
if ((xdes_get_state(descr, mtr) == XDES_FSEG)
|
if ((xdes_get_state(descr, mtr) == XDES_FSEG)
|
||||||
&& (0 == ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID,
|
&& (0 == ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID,
|
||||||
MLOG_8BYTES, mtr),
|
mtr), seg_id))
|
||||||
seg_id))
|
|
||||||
&& (xdes_get_bit(descr, XDES_FREE_BIT,
|
&& (xdes_get_bit(descr, XDES_FREE_BIT,
|
||||||
hint % FSP_EXTENT_SIZE, mtr) == TRUE)) {
|
hint % FSP_EXTENT_SIZE, mtr) == TRUE)) {
|
||||||
|
|
||||||
@ -2374,8 +2385,7 @@ fseg_alloc_free_page_low(
|
|||||||
ut_a(ret_descr == descr);
|
ut_a(ret_descr == descr);
|
||||||
|
|
||||||
xdes_set_state(ret_descr, XDES_FSEG, mtr);
|
xdes_set_state(ret_descr, XDES_FSEG, mtr);
|
||||||
mlog_write_dulint(ret_descr + XDES_ID, seg_id, MLOG_8BYTES,
|
mlog_write_dulint(ret_descr + XDES_ID, seg_id, mtr);
|
||||||
mtr);
|
|
||||||
flst_add_last(seg_inode + FSEG_FREE,
|
flst_add_last(seg_inode + FSEG_FREE,
|
||||||
ret_descr + XDES_FLST_NODE, mtr);
|
ret_descr + XDES_FLST_NODE, mtr);
|
||||||
|
|
||||||
@ -2404,8 +2414,7 @@ fseg_alloc_free_page_low(
|
|||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
} else if ((xdes_get_state(descr, mtr) == XDES_FSEG)
|
} else if ((xdes_get_state(descr, mtr) == XDES_FSEG)
|
||||||
&& (0 == ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID,
|
&& (0 == ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID,
|
||||||
MLOG_8BYTES, mtr),
|
mtr), seg_id))
|
||||||
seg_id))
|
|
||||||
&& (!xdes_is_full(descr, mtr))) {
|
&& (!xdes_is_full(descr, mtr))) {
|
||||||
|
|
||||||
/* 4. We can take the page from the same extent as the
|
/* 4. We can take the page from the same extent as the
|
||||||
@ -2506,7 +2515,9 @@ fseg_alloc_free_page_low(
|
|||||||
|
|
||||||
ut_a(page == buf_page_get(space, ret_page, RW_X_LATCH, mtr));
|
ut_a(page == buf_page_get(space, ret_page, RW_X_LATCH, mtr));
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
|
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* The prior contents of the page should be ignored */
|
/* The prior contents of the page should be ignored */
|
||||||
fsp_init_file_page(page, mtr);
|
fsp_init_file_page(page, mtr);
|
||||||
@ -2560,9 +2571,11 @@ fseg_alloc_free_page_general(
|
|||||||
|
|
||||||
space = buf_frame_get_space_id(seg_header);
|
space = buf_frame_get_space_id(seg_header);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!mutex_own(&kernel_mutex)
|
ut_ad(!mutex_own(&kernel_mutex)
|
||||||
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
|
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
|
||||||
MTR_MEMO_X_LOCK));
|
MTR_MEMO_X_LOCK));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
latch = fil_space_get_latch(space);
|
latch = fil_space_get_latch(space);
|
||||||
|
|
||||||
mtr_x_lock(latch, mtr);
|
mtr_x_lock(latch, mtr);
|
||||||
@ -2708,9 +2721,11 @@ fsp_reserve_free_extents(
|
|||||||
ulint n_pages_added;
|
ulint n_pages_added;
|
||||||
|
|
||||||
ut_ad(mtr);
|
ut_ad(mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!mutex_own(&kernel_mutex)
|
ut_ad(!mutex_own(&kernel_mutex)
|
||||||
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
|
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
|
||||||
MTR_MEMO_X_LOCK));
|
MTR_MEMO_X_LOCK));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
*n_reserved = n_ext;
|
*n_reserved = n_ext;
|
||||||
|
|
||||||
latch = fil_space_get_latch(space);
|
latch = fil_space_get_latch(space);
|
||||||
@ -2808,8 +2823,9 @@ fsp_get_available_space_in_free_extents(
|
|||||||
rw_lock_t* latch;
|
rw_lock_t* latch;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!mutex_own(&kernel_mutex));
|
ut_ad(!mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
mtr_start(&mtr);
|
mtr_start(&mtr);
|
||||||
|
|
||||||
latch = fil_space_get_latch(space);
|
latch = fil_space_get_latch(space);
|
||||||
@ -2963,7 +2979,7 @@ fseg_free_page_low(
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: If the InnoDB recovery crashes here, see section 6.1\n"
|
"InnoDB: If the InnoDB recovery crashes here, see section 6.1\n"
|
||||||
"InnoDB: of http://www.innodb.com/ibman.html about forcing recovery.\n");
|
"InnoDB: of http://www.innodb.com/ibman.html about forcing recovery.\n");
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
state = xdes_get_state(descr, mtr);
|
state = xdes_get_state(descr, mtr);
|
||||||
@ -3022,7 +3038,7 @@ fseg_free_page_low(
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: If the InnoDB recovery crashes here, see section 6.1\n"
|
"InnoDB: If the InnoDB recovery crashes here, see section 6.1\n"
|
||||||
"InnoDB: of http://www.innodb.com/ibman.html about forcing recovery.\n");
|
"InnoDB: of http://www.innodb.com/ibman.html about forcing recovery.\n");
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
not_full_n_used = mtr_read_ulint(seg_inode + FSEG_NOT_FULL_N_USED,
|
not_full_n_used = mtr_read_ulint(seg_inode + FSEG_NOT_FULL_N_USED,
|
||||||
@ -3066,9 +3082,11 @@ fseg_free_page(
|
|||||||
{
|
{
|
||||||
fseg_inode_t* seg_inode;
|
fseg_inode_t* seg_inode;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!mutex_own(&kernel_mutex)
|
ut_ad(!mutex_own(&kernel_mutex)
|
||||||
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
|
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
|
||||||
MTR_MEMO_X_LOCK));
|
MTR_MEMO_X_LOCK));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
mtr_x_lock(fil_space_get_latch(space), mtr);
|
mtr_x_lock(fil_space_get_latch(space), mtr);
|
||||||
|
|
||||||
seg_inode = fseg_inode_get(seg_header, mtr);
|
seg_inode = fseg_inode_get(seg_header, mtr);
|
||||||
@ -3103,8 +3121,8 @@ fseg_free_extent(
|
|||||||
|
|
||||||
ut_a(xdes_get_state(descr, mtr) == XDES_FSEG);
|
ut_a(xdes_get_state(descr, mtr) == XDES_FSEG);
|
||||||
ut_a(0 == ut_dulint_cmp(
|
ut_a(0 == ut_dulint_cmp(
|
||||||
mtr_read_dulint(descr + XDES_ID, MLOG_8BYTES, mtr),
|
mtr_read_dulint(descr + XDES_ID, mtr),
|
||||||
mtr_read_dulint(seg_inode + FSEG_ID, MLOG_8BYTES, mtr)));
|
mtr_read_dulint(seg_inode + FSEG_ID, mtr)));
|
||||||
|
|
||||||
first_page_in_extent = page - (page % FSP_EXTENT_SIZE);
|
first_page_in_extent = page - (page % FSP_EXTENT_SIZE);
|
||||||
|
|
||||||
@ -3175,9 +3193,11 @@ fseg_free_step(
|
|||||||
|
|
||||||
space = buf_frame_get_space_id(header);
|
space = buf_frame_get_space_id(header);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!mutex_own(&kernel_mutex)
|
ut_ad(!mutex_own(&kernel_mutex)
|
||||||
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
|
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
|
||||||
MTR_MEMO_X_LOCK));
|
MTR_MEMO_X_LOCK));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
mtr_x_lock(fil_space_get_latch(space), mtr);
|
mtr_x_lock(fil_space_get_latch(space), mtr);
|
||||||
|
|
||||||
descr = xdes_get_descriptor(space, buf_frame_get_page_no(header), mtr);
|
descr = xdes_get_descriptor(space, buf_frame_get_page_no(header), mtr);
|
||||||
@ -3248,9 +3268,11 @@ fseg_free_step_not_header(
|
|||||||
|
|
||||||
space = buf_frame_get_space_id(header);
|
space = buf_frame_get_space_id(header);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!mutex_own(&kernel_mutex)
|
ut_ad(!mutex_own(&kernel_mutex)
|
||||||
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
|
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
|
||||||
MTR_MEMO_X_LOCK));
|
MTR_MEMO_X_LOCK));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
mtr_x_lock(fil_space_get_latch(space), mtr);
|
mtr_x_lock(fil_space_get_latch(space), mtr);
|
||||||
|
|
||||||
inode = fseg_inode_get(header, mtr);
|
inode = fseg_inode_get(header, mtr);
|
||||||
@ -3392,7 +3414,7 @@ fseg_validate_low(
|
|||||||
|
|
||||||
space = buf_frame_get_space_id(inode);
|
space = buf_frame_get_space_id(inode);
|
||||||
|
|
||||||
seg_id = mtr_read_dulint(inode + FSEG_ID, MLOG_8BYTES, mtr2);
|
seg_id = mtr_read_dulint(inode + FSEG_ID, mtr2);
|
||||||
n_used = mtr_read_ulint(inode + FSEG_NOT_FULL_N_USED,
|
n_used = mtr_read_ulint(inode + FSEG_NOT_FULL_N_USED,
|
||||||
MLOG_4BYTES, mtr2);
|
MLOG_4BYTES, mtr2);
|
||||||
flst_validate(inode + FSEG_FREE, mtr2);
|
flst_validate(inode + FSEG_FREE, mtr2);
|
||||||
@ -3411,8 +3433,7 @@ fseg_validate_low(
|
|||||||
ut_a(xdes_get_n_used(descr, &mtr) == 0);
|
ut_a(xdes_get_n_used(descr, &mtr) == 0);
|
||||||
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
|
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
|
||||||
ut_a(0 == ut_dulint_cmp(
|
ut_a(0 == ut_dulint_cmp(
|
||||||
mtr_read_dulint(descr + XDES_ID, MLOG_8BYTES,
|
mtr_read_dulint(descr + XDES_ID, &mtr), seg_id));
|
||||||
&mtr), seg_id));
|
|
||||||
|
|
||||||
node_addr = flst_get_next_addr(descr + XDES_FLST_NODE, &mtr);
|
node_addr = flst_get_next_addr(descr + XDES_FLST_NODE, &mtr);
|
||||||
mtr_commit(&mtr);
|
mtr_commit(&mtr);
|
||||||
@ -3432,8 +3453,7 @@ fseg_validate_low(
|
|||||||
ut_a(xdes_get_n_used(descr, &mtr) < FSP_EXTENT_SIZE);
|
ut_a(xdes_get_n_used(descr, &mtr) < FSP_EXTENT_SIZE);
|
||||||
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
|
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
|
||||||
ut_a(0 == ut_dulint_cmp(
|
ut_a(0 == ut_dulint_cmp(
|
||||||
mtr_read_dulint(descr + XDES_ID, MLOG_8BYTES,
|
mtr_read_dulint(descr + XDES_ID, &mtr), seg_id));
|
||||||
&mtr), seg_id));
|
|
||||||
|
|
||||||
n_used2 += xdes_get_n_used(descr, &mtr);
|
n_used2 += xdes_get_n_used(descr, &mtr);
|
||||||
|
|
||||||
@ -3454,8 +3474,7 @@ fseg_validate_low(
|
|||||||
ut_a(xdes_get_n_used(descr, &mtr) == FSP_EXTENT_SIZE);
|
ut_a(xdes_get_n_used(descr, &mtr) == FSP_EXTENT_SIZE);
|
||||||
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
|
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
|
||||||
ut_a(0 == ut_dulint_cmp(
|
ut_a(0 == ut_dulint_cmp(
|
||||||
mtr_read_dulint(descr + XDES_ID, MLOG_8BYTES,
|
mtr_read_dulint(descr + XDES_ID, &mtr), seg_id));
|
||||||
&mtr), seg_id));
|
|
||||||
|
|
||||||
node_addr = flst_get_next_addr(descr + XDES_FLST_NODE, &mtr);
|
node_addr = flst_get_next_addr(descr + XDES_FLST_NODE, &mtr);
|
||||||
mtr_commit(&mtr);
|
mtr_commit(&mtr);
|
||||||
@ -3520,7 +3539,7 @@ fseg_print_low(
|
|||||||
|
|
||||||
reserved = fseg_n_reserved_pages_low(inode, &used, mtr);
|
reserved = fseg_n_reserved_pages_low(inode, &used, mtr);
|
||||||
|
|
||||||
d_var = mtr_read_dulint(inode + FSEG_ID, MLOG_8BYTES, mtr);
|
d_var = mtr_read_dulint(inode + FSEG_ID, mtr);
|
||||||
|
|
||||||
seg_id_low = ut_dulint_get_low(d_var);
|
seg_id_low = ut_dulint_get_low(d_var);
|
||||||
seg_id_high = ut_dulint_get_high(d_var);
|
seg_id_high = ut_dulint_get_high(d_var);
|
||||||
@ -3838,7 +3857,7 @@ fsp_print(
|
|||||||
n_free_frag = flst_get_len(header + FSP_FREE_FRAG, &mtr);
|
n_free_frag = flst_get_len(header + FSP_FREE_FRAG, &mtr);
|
||||||
n_full_frag = flst_get_len(header + FSP_FULL_FRAG, &mtr);
|
n_full_frag = flst_get_len(header + FSP_FULL_FRAG, &mtr);
|
||||||
|
|
||||||
d_var = mtr_read_dulint(header + FSP_SEG_ID, MLOG_8BYTES, &mtr);
|
d_var = mtr_read_dulint(header + FSP_SEG_ID, &mtr);
|
||||||
|
|
||||||
seg_id_low = ut_dulint_get_low(d_var);
|
seg_id_low = ut_dulint_get_low(d_var);
|
||||||
seg_id_high = ut_dulint_get_high(d_var);
|
seg_id_high = ut_dulint_get_high(d_var);
|
||||||
|
@ -89,8 +89,9 @@ ha_insert_for_fold(
|
|||||||
ulint hash;
|
ulint hash;
|
||||||
|
|
||||||
ut_ad(table && data);
|
ut_ad(table && data);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
hash = hash_calc_hash(fold, table);
|
hash = hash_calc_hash(fold, table);
|
||||||
|
|
||||||
cell = hash_get_nth_cell(table, hash);
|
cell = hash_get_nth_cell(table, hash);
|
||||||
@ -186,8 +187,9 @@ ha_delete(
|
|||||||
{
|
{
|
||||||
ha_node_t* node;
|
ha_node_t* node;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
node = ha_search_with_data(table, fold, data);
|
node = ha_search_with_data(table, fold, data);
|
||||||
|
|
||||||
ut_a(node);
|
ut_a(node);
|
||||||
@ -237,8 +239,9 @@ ha_remove_all_nodes_to_page(
|
|||||||
{
|
{
|
||||||
ha_node_t* node;
|
ha_node_t* node;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
node = ha_chain_get_first(table, fold);
|
node = ha_chain_get_first(table, fold);
|
||||||
|
|
||||||
while (node) {
|
while (node) {
|
||||||
|
@ -22,6 +22,7 @@ hash_mutex_enter(
|
|||||||
hash_table_t* table, /* in: hash table */
|
hash_table_t* table, /* in: hash table */
|
||||||
ulint fold) /* in: fold */
|
ulint fold) /* in: fold */
|
||||||
{
|
{
|
||||||
|
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||||
mutex_enter(hash_get_mutex(table, fold));
|
mutex_enter(hash_get_mutex(table, fold));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,41 +35,10 @@ hash_mutex_exit(
|
|||||||
hash_table_t* table, /* in: hash table */
|
hash_table_t* table, /* in: hash table */
|
||||||
ulint fold) /* in: fold */
|
ulint fold) /* in: fold */
|
||||||
{
|
{
|
||||||
|
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||||
mutex_exit(hash_get_mutex(table, fold));
|
mutex_exit(hash_get_mutex(table, fold));
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************
|
|
||||||
Reserves all the mutexes of a hash table, in an ascending order. */
|
|
||||||
|
|
||||||
void
|
|
||||||
hash_mutex_enter_all(
|
|
||||||
/*=================*/
|
|
||||||
hash_table_t* table) /* in: hash table */
|
|
||||||
{
|
|
||||||
ulint i;
|
|
||||||
|
|
||||||
for (i = 0; i < table->n_mutexes; i++) {
|
|
||||||
|
|
||||||
mutex_enter(table->mutexes + i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************
|
|
||||||
Releases all the mutexes of a hash table. */
|
|
||||||
|
|
||||||
void
|
|
||||||
hash_mutex_exit_all(
|
|
||||||
/*================*/
|
|
||||||
hash_table_t* table) /* in: hash table */
|
|
||||||
{
|
|
||||||
ulint i;
|
|
||||||
|
|
||||||
for (i = 0; i < table->n_mutexes; i++) {
|
|
||||||
|
|
||||||
mutex_exit(table->mutexes + i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
Creates a hash table with >= n array cells. The actual number of cells is
|
Creates a hash table with >= n array cells. The actual number of cells is
|
||||||
chosen to be a prime number slightly bigger than n. */
|
chosen to be a prime number slightly bigger than n. */
|
||||||
@ -98,7 +68,9 @@ hash_create(
|
|||||||
table->mutexes = NULL;
|
table->mutexes = NULL;
|
||||||
table->heaps = NULL;
|
table->heaps = NULL;
|
||||||
table->heap = NULL;
|
table->heap = NULL;
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
table->magic_n = HASH_TABLE_MAGIC_N;
|
table->magic_n = HASH_TABLE_MAGIC_N;
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
|
|
||||||
/* Initialize the cell array */
|
/* Initialize the cell array */
|
||||||
|
|
||||||
@ -119,6 +91,7 @@ hash_table_free(
|
|||||||
/*============*/
|
/*============*/
|
||||||
hash_table_t* table) /* in, own: hash table */
|
hash_table_t* table) /* in, own: hash table */
|
||||||
{
|
{
|
||||||
|
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||||
ut_a(table->mutexes == NULL);
|
ut_a(table->mutexes == NULL);
|
||||||
|
|
||||||
ut_free(table->array);
|
ut_free(table->array);
|
||||||
@ -140,6 +113,7 @@ hash_create_mutexes(
|
|||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
ut_a(n_mutexes == ut_2_power_up(n_mutexes));
|
ut_a(n_mutexes == ut_2_power_up(n_mutexes));
|
||||||
|
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||||
|
|
||||||
table->mutexes = mem_alloc(n_mutexes * sizeof(mutex_t));
|
table->mutexes = mem_alloc(n_mutexes * sizeof(mutex_t));
|
||||||
|
|
||||||
|
@ -270,7 +270,9 @@ ibuf_header_page_get(
|
|||||||
|
|
||||||
page = buf_page_get(space, FSP_IBUF_HEADER_PAGE_NO, RW_X_LATCH, mtr);
|
page = buf_page_get(space, FSP_IBUF_HEADER_PAGE_NO, RW_X_LATCH, mtr);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_IBUF_HEADER);
|
buf_page_dbg_add_level(page, SYNC_IBUF_HEADER);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(page);
|
return(page);
|
||||||
}
|
}
|
||||||
@ -295,7 +297,9 @@ ibuf_tree_root_get(
|
|||||||
|
|
||||||
page = buf_page_get(space, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH,
|
page = buf_page_get(space, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH,
|
||||||
mtr);
|
mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(page);
|
return(page);
|
||||||
}
|
}
|
||||||
@ -407,7 +411,9 @@ ibuf_data_sizes_update(
|
|||||||
{
|
{
|
||||||
ulint old_size;
|
ulint old_size;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&ibuf_mutex));
|
ut_ad(mutex_own(&ibuf_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
old_size = data->size;
|
old_size = data->size;
|
||||||
|
|
||||||
@ -489,7 +495,9 @@ ibuf_data_init_for_space(
|
|||||||
|
|
||||||
root = buf_page_get(space, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH,
|
root = buf_page_get(space, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH,
|
||||||
&mtr);
|
&mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(root, SYNC_TREE_NODE);
|
buf_page_dbg_add_level(root, SYNC_TREE_NODE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
data->size = 0;
|
data->size = 0;
|
||||||
data->n_inserts = 0;
|
data->n_inserts = 0;
|
||||||
@ -721,7 +729,9 @@ ibuf_bitmap_get_map_page(
|
|||||||
|
|
||||||
page = buf_page_get(space, ibuf_bitmap_page_no_calc(page_no),
|
page = buf_page_get(space, ibuf_bitmap_page_no_calc(page_no),
|
||||||
RW_X_LATCH, mtr);
|
RW_X_LATCH, mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_IBUF_BITMAP);
|
buf_page_dbg_add_level(page, SYNC_IBUF_BITMAP);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(page);
|
return(page);
|
||||||
}
|
}
|
||||||
@ -1446,7 +1456,9 @@ ibuf_data_enough_free_for_insert(
|
|||||||
/* out: TRUE if enough free pages in list */
|
/* out: TRUE if enough free pages in list */
|
||||||
ibuf_data_t* data) /* in: ibuf data for the space */
|
ibuf_data_t* data) /* in: ibuf data for the space */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&ibuf_mutex));
|
ut_ad(mutex_own(&ibuf_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* We want a big margin of free pages, because a B-tree can sometimes
|
/* We want a big margin of free pages, because a B-tree can sometimes
|
||||||
grow in size also if records are deleted from it, as the node pointers
|
grow in size also if records are deleted from it, as the node pointers
|
||||||
@ -1472,7 +1484,9 @@ ibuf_data_too_much_free(
|
|||||||
/* out: TRUE if enough free pages in list */
|
/* out: TRUE if enough free pages in list */
|
||||||
ibuf_data_t* data) /* in: ibuf data for the space */
|
ibuf_data_t* data) /* in: ibuf data for the space */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&ibuf_mutex));
|
ut_ad(mutex_own(&ibuf_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (data->free_list_len >= 3 + data->size / 2 + 3 * data->height) {
|
if (data->free_list_len >= 3 + data->size / 2 + 3 * data->height) {
|
||||||
|
|
||||||
@ -1532,7 +1546,9 @@ ibuf_add_free_page(
|
|||||||
|
|
||||||
page = buf_page_get(space, page_no, RW_X_LATCH, &mtr);
|
page = buf_page_get(space, page_no, RW_X_LATCH, &mtr);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE_NEW);
|
buf_page_dbg_add_level(page, SYNC_TREE_NODE_NEW);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
ibuf_enter();
|
ibuf_enter();
|
||||||
|
|
||||||
@ -1653,7 +1669,9 @@ ibuf_remove_free_page(
|
|||||||
|
|
||||||
page = buf_page_get(space, page_no, RW_X_LATCH, &mtr);
|
page = buf_page_get(space, page_no, RW_X_LATCH, &mtr);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* Remove the page from the free list and update the ibuf size data */
|
/* Remove the page from the free list and update the ibuf size data */
|
||||||
|
|
||||||
@ -1701,7 +1719,9 @@ ibuf_free_excess_pages(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(rw_lock_own(fil_space_get_latch(space), RW_LOCK_EX));
|
ut_ad(rw_lock_own(fil_space_get_latch(space), RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(rw_lock_get_x_lock_count(fil_space_get_latch(space)) == 1);
|
ut_ad(rw_lock_get_x_lock_count(fil_space_get_latch(space)) == 1);
|
||||||
ut_ad(!ibuf_inside());
|
ut_ad(!ibuf_inside());
|
||||||
|
|
||||||
@ -2208,7 +2228,9 @@ ibuf_get_volume_buffered(
|
|||||||
|
|
||||||
prev_page = buf_page_get(0, prev_page_no, RW_X_LATCH, mtr);
|
prev_page = buf_page_get(0, prev_page_no, RW_X_LATCH, mtr);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(prev_page, SYNC_TREE_NODE);
|
buf_page_dbg_add_level(prev_page, SYNC_TREE_NODE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
rec = page_get_supremum_rec(prev_page);
|
rec = page_get_supremum_rec(prev_page);
|
||||||
rec = page_rec_get_prev(rec);
|
rec = page_rec_get_prev(rec);
|
||||||
@ -2269,7 +2291,9 @@ count_later:
|
|||||||
|
|
||||||
next_page = buf_page_get(0, next_page_no, RW_X_LATCH, mtr);
|
next_page = buf_page_get(0, next_page_no, RW_X_LATCH, mtr);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(next_page, SYNC_TREE_NODE);
|
buf_page_dbg_add_level(next_page, SYNC_TREE_NODE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
rec = page_get_infimum_rec(next_page);
|
rec = page_get_infimum_rec(next_page);
|
||||||
rec = page_rec_get_next(rec);
|
rec = page_rec_get_next(rec);
|
||||||
@ -3018,7 +3042,9 @@ loop:
|
|||||||
IB__FILE__, __LINE__,
|
IB__FILE__, __LINE__,
|
||||||
&mtr);
|
&mtr);
|
||||||
ut_a(success);
|
ut_a(success);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Position pcur in the insert buffer at the first entry for this
|
/* Position pcur in the insert buffer at the first entry for this
|
||||||
@ -3261,7 +3287,9 @@ ibuf_validate_low(void)
|
|||||||
ibuf_data_t* data;
|
ibuf_data_t* data;
|
||||||
ulint sum_sizes;
|
ulint sum_sizes;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&ibuf_mutex));
|
ut_ad(mutex_own(&ibuf_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
sum_sizes = 0;
|
sum_sizes = 0;
|
||||||
|
|
||||||
|
@ -18,21 +18,20 @@
|
|||||||
noinst_HEADERS = btr0btr.h btr0btr.ic btr0cur.h btr0cur.ic \
|
noinst_HEADERS = btr0btr.h btr0btr.ic btr0cur.h btr0cur.ic \
|
||||||
btr0pcur.h btr0pcur.ic btr0sea.h btr0sea.ic btr0types.h \
|
btr0pcur.h btr0pcur.ic btr0sea.h btr0sea.ic btr0types.h \
|
||||||
buf0buf.h buf0buf.ic buf0flu.h buf0flu.ic buf0lru.h \
|
buf0buf.h buf0buf.ic buf0flu.h buf0flu.ic buf0lru.h \
|
||||||
buf0lru.ic buf0rea.h buf0types.h com0com.h com0com.ic \
|
buf0lru.ic buf0rea.h buf0types.h data0data.h data0data.ic data0type.h \
|
||||||
com0shm.h com0shm.ic data0data.h data0data.ic data0type.h \
|
|
||||||
data0type.ic data0types.h db0err.h dict0boot.h \
|
data0type.ic data0types.h db0err.h dict0boot.h \
|
||||||
dict0boot.ic dict0crea.h dict0crea.ic dict0dict.h \
|
dict0boot.ic dict0crea.h dict0crea.ic dict0dict.h \
|
||||||
dict0dict.ic dict0load.h dict0load.ic dict0mem.h \
|
dict0dict.ic dict0load.h dict0load.ic dict0mem.h \
|
||||||
dict0mem.ic dict0types.h dyn0dyn.h dyn0dyn.ic eval0eval.h \
|
dict0mem.ic dict0types.h dyn0dyn.h dyn0dyn.ic eval0eval.h \
|
||||||
eval0eval.ic eval0proc.h eval0proc.ic fil0fil.h fsp0fsp.h \
|
eval0eval.ic eval0proc.h eval0proc.ic fil0fil.h fsp0fsp.h \
|
||||||
fsp0fsp.ic fut0fut.h fut0fut.ic fut0lst.h fut0lst.ic \
|
fsp0fsp.ic fut0fut.h fut0fut.ic fut0lst.h fut0lst.ic \
|
||||||
ha0ha.h ha0ha.ic hash0hash.h hash0hash.ic ib_odbc.h \
|
ha0ha.h ha0ha.ic hash0hash.h hash0hash.ic \
|
||||||
ibuf0ibuf.h ibuf0ibuf.ic ibuf0types.h lock0lock.h \
|
ibuf0ibuf.h ibuf0ibuf.ic ibuf0types.h lock0lock.h \
|
||||||
lock0lock.ic lock0types.h log0log.h log0log.ic log0recv.h \
|
lock0lock.ic lock0types.h log0log.h log0log.ic log0recv.h \
|
||||||
log0recv.ic mach0data.h mach0data.ic makefilewin.i \
|
log0recv.ic mach0data.h mach0data.ic makefilewin.i \
|
||||||
mem0dbg.h mem0dbg.ic mem0mem.h mem0mem.ic mem0pool.h \
|
mem0dbg.h mem0dbg.ic mem0mem.h mem0mem.ic mem0pool.h \
|
||||||
mem0pool.ic mtr0log.h mtr0log.ic mtr0mtr.h mtr0mtr.ic \
|
mem0pool.ic mtr0log.h mtr0log.ic mtr0mtr.h mtr0mtr.ic \
|
||||||
mtr0types.h odbc0odbc.h os0file.h os0proc.h os0proc.ic \
|
mtr0types.h os0file.h os0proc.h os0proc.ic \
|
||||||
os0shm.h os0shm.ic os0sync.h os0sync.ic os0thread.h \
|
os0shm.h os0shm.ic os0sync.h os0sync.ic os0thread.h \
|
||||||
os0thread.ic page0cur.h page0cur.ic page0page.h \
|
os0thread.ic page0cur.h page0cur.ic page0page.h \
|
||||||
page0page.ic page0types.h pars0grm.h pars0opt.h \
|
page0page.ic page0types.h pars0grm.h pars0opt.h \
|
||||||
|
@ -45,8 +45,7 @@ btr_page_set_index_id(
|
|||||||
dulint id, /* in: index id */
|
dulint id, /* in: index id */
|
||||||
mtr_t* mtr) /* in: mtr */
|
mtr_t* mtr) /* in: mtr */
|
||||||
{
|
{
|
||||||
mlog_write_dulint(page + PAGE_HEADER + PAGE_INDEX_ID, id,
|
mlog_write_dulint(page + PAGE_HEADER + PAGE_INDEX_ID, id, mtr);
|
||||||
MLOG_8BYTES, mtr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************
|
/******************************************************************
|
||||||
|
@ -44,8 +44,10 @@ btr_search_info_update(
|
|||||||
{
|
{
|
||||||
btr_search_t* info;
|
btr_search_t* info;
|
||||||
|
|
||||||
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED)
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
&& !rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
|
||||||
|
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
info = btr_search_get_info(index);
|
info = btr_search_get_info(index);
|
||||||
|
|
||||||
|
@ -562,11 +562,11 @@ buf_awe_map_page_to_frame(
|
|||||||
we need to map the page should also
|
we need to map the page should also
|
||||||
add the block to the
|
add the block to the
|
||||||
awe_LRU_free_mapped list */
|
awe_LRU_free_mapped list */
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
Adds latch level info for the rw-lock protecting the buffer frame. This
|
Adds latch level info for the rw-lock protecting the buffer frame. This
|
||||||
should be called in the debug version after a successful latching of a
|
should be called in the debug version after a successful latching of a
|
||||||
page if we know the latching order level of the acquired latch. If
|
page if we know the latching order level of the acquired latch. */
|
||||||
UNIV_SYNC_DEBUG is not defined, compiles to an empty function. */
|
|
||||||
UNIV_INLINE
|
UNIV_INLINE
|
||||||
void
|
void
|
||||||
buf_page_dbg_add_level(
|
buf_page_dbg_add_level(
|
||||||
@ -574,6 +574,7 @@ buf_page_dbg_add_level(
|
|||||||
buf_frame_t* frame, /* in: buffer page where we have acquired
|
buf_frame_t* frame, /* in: buffer page where we have acquired
|
||||||
a latch */
|
a latch */
|
||||||
ulint level); /* in: latching order level */
|
ulint level); /* in: latching order level */
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
Gets a pointer to the memory frame of a block. */
|
Gets a pointer to the memory frame of a block. */
|
||||||
UNIV_INLINE
|
UNIV_INLINE
|
||||||
|
@ -130,7 +130,9 @@ buf_pool_clock_tic(void)
|
|||||||
/*====================*/
|
/*====================*/
|
||||||
/* out: new clock value */
|
/* out: new clock value */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
buf_pool->ulint_clock++;
|
buf_pool->ulint_clock++;
|
||||||
|
|
||||||
@ -221,7 +223,7 @@ buf_block_align(
|
|||||||
"InnoDB: how to force recovery.\n",
|
"InnoDB: how to force recovery.\n",
|
||||||
(long)ptr, (long)frame_zero,
|
(long)ptr, (long)frame_zero,
|
||||||
(long)(buf_pool->high_end));
|
(long)(buf_pool->high_end));
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
block = *(buf_pool->blocks_of_frames + (((ulint)(ptr - frame_zero))
|
block = *(buf_pool->blocks_of_frames + (((ulint)(ptr - frame_zero))
|
||||||
@ -257,7 +259,7 @@ buf_frame_align(
|
|||||||
"InnoDB: how to force recovery.\n",
|
"InnoDB: how to force recovery.\n",
|
||||||
(long)ptr, (long)(buf_pool->frame_zero),
|
(long)ptr, (long)(buf_pool->frame_zero),
|
||||||
(long)(buf_pool->high_end));
|
(long)(buf_pool->high_end));
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(frame);
|
return(frame);
|
||||||
@ -447,8 +449,10 @@ buf_frame_modify_clock_inc(
|
|||||||
|
|
||||||
block = buf_block_align(frame);
|
block = buf_block_align(frame);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0))
|
ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0))
|
||||||
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
|
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
|
||||||
|
#endif /*UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
UT_DULINT_INC(block->modify_clock);
|
UT_DULINT_INC(block->modify_clock);
|
||||||
|
|
||||||
@ -466,8 +470,10 @@ buf_block_modify_clock_inc(
|
|||||||
/* out: new value */
|
/* out: new value */
|
||||||
buf_block_t* block) /* in: block */
|
buf_block_t* block) /* in: block */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0))
|
ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0))
|
||||||
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
|
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
UT_DULINT_INC(block->modify_clock);
|
UT_DULINT_INC(block->modify_clock);
|
||||||
|
|
||||||
@ -490,8 +496,10 @@ buf_frame_get_modify_clock(
|
|||||||
|
|
||||||
block = buf_block_align(frame);
|
block = buf_block_align(frame);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
|
||||||
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
|
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(block->modify_clock);
|
return(block->modify_clock);
|
||||||
}
|
}
|
||||||
@ -542,7 +550,9 @@ buf_page_hash_get(
|
|||||||
ulint fold;
|
ulint fold;
|
||||||
|
|
||||||
ut_ad(buf_pool);
|
ut_ad(buf_pool);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* Look for the page in the hash table */
|
/* Look for the page in the hash table */
|
||||||
|
|
||||||
@ -642,6 +652,7 @@ buf_page_release(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
Adds latch level info for the rw-lock protecting the buffer frame. This
|
Adds latch level info for the rw-lock protecting the buffer frame. This
|
||||||
should be called in the debug version after a successful latching of a
|
should be called in the debug version after a successful latching of a
|
||||||
@ -656,7 +667,6 @@ buf_page_dbg_add_level(
|
|||||||
ulint level __attribute__((unused))) /* in: latching order
|
ulint level __attribute__((unused))) /* in: latching order
|
||||||
level */
|
level */
|
||||||
{
|
{
|
||||||
#ifdef UNIV_SYNC_DEBUG
|
|
||||||
sync_thread_add_level(&(buf_block_align(frame)->lock), level);
|
sync_thread_add_level(&(buf_block_align(frame)->lock), level);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
@ -40,8 +40,10 @@ buf_flush_note_modification(
|
|||||||
ut_ad(block);
|
ut_ad(block);
|
||||||
ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
|
ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
|
||||||
ut_ad(block->buf_fix_count > 0);
|
ut_ad(block->buf_fix_count > 0);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
|
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
|
||||||
ut_ad(mutex_own(&(buf_pool->mutex)));
|
ut_ad(mutex_own(&(buf_pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
ut_ad(ut_dulint_cmp(mtr->start_lsn, ut_dulint_zero) != 0);
|
ut_ad(ut_dulint_cmp(mtr->start_lsn, ut_dulint_zero) != 0);
|
||||||
ut_ad(mtr->modifications);
|
ut_ad(mtr->modifications);
|
||||||
@ -76,7 +78,9 @@ buf_flush_recv_note_modification(
|
|||||||
ut_ad(block);
|
ut_ad(block);
|
||||||
ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
|
ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
|
||||||
ut_ad(block->buf_fix_count > 0);
|
ut_ad(block->buf_fix_count > 0);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
|
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
mutex_enter(&(buf_pool->mutex));
|
mutex_enter(&(buf_pool->mutex));
|
||||||
|
|
||||||
|
@ -1,125 +0,0 @@
|
|||||||
/******************************************************
|
|
||||||
The communication primitives
|
|
||||||
|
|
||||||
(c) 1995 Innobase Oy
|
|
||||||
|
|
||||||
Created 9/23/1995 Heikki Tuuri
|
|
||||||
*******************************************************/
|
|
||||||
|
|
||||||
/* This module defines a standard datagram communication
|
|
||||||
function interface for use in the database. We assume that
|
|
||||||
the communication medium is reliable. */
|
|
||||||
|
|
||||||
#ifndef com0com_h
|
|
||||||
#define com0com_h
|
|
||||||
|
|
||||||
#include "univ.i"
|
|
||||||
|
|
||||||
/* The communications endpoint type definition */
|
|
||||||
typedef struct com_endpoint_struct com_endpoint_t;
|
|
||||||
|
|
||||||
/* Possible endpoint communication types */
|
|
||||||
#define COM_SHM 1 /* communication through shared memory */
|
|
||||||
|
|
||||||
/* Option numbers for endpoint */
|
|
||||||
#define COM_OPT_MAX_DGRAM_SIZE 1
|
|
||||||
|
|
||||||
/* Error numbers */
|
|
||||||
#define COM_ERR_NOT_SPECIFIED 1
|
|
||||||
#define COM_ERR_NOT_BOUND 2
|
|
||||||
#define COM_ERR_ALREADY_BOUND 3
|
|
||||||
#define COM_ERR_MAX_DATAGRAM_SIZE_NOT_SET 4
|
|
||||||
#define COM_ERR_DATA_BUFFER_TOO_SMALL 5
|
|
||||||
#define COM_ERR_ADDR_BUFFER_TOO_SMALL 6
|
|
||||||
#define COM_ERR_DATA_TOO_LONG 7
|
|
||||||
#define COM_ERR_ADDR_TOO_LONG 8
|
|
||||||
#define COM_ERR_DGRAM_NOT_DELIVERED 9
|
|
||||||
|
|
||||||
/* Maximum allowed address length in bytes */
|
|
||||||
#define COM_MAX_ADDR_LEN 100
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
Creates a communications endpoint. */
|
|
||||||
|
|
||||||
com_endpoint_t*
|
|
||||||
com_endpoint_create(
|
|
||||||
/*================*/
|
|
||||||
/* out, own: communications endpoint, NULL if
|
|
||||||
did not succeed */
|
|
||||||
ulint type); /* in: communication type of endpoint:
|
|
||||||
only COM_SHM supported */
|
|
||||||
/*************************************************************************
|
|
||||||
Frees a communications endpoint. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_endpoint_free(
|
|
||||||
/*==============*/
|
|
||||||
/* out: O if succeed, else error number */
|
|
||||||
com_endpoint_t* ep); /* in, own: communications endpoint */
|
|
||||||
/*************************************************************************
|
|
||||||
Sets an option, like the maximum datagram size for an endpoint.
|
|
||||||
The options may vary depending on the endpoint type. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_endpoint_set_option(
|
|
||||||
/*====================*/
|
|
||||||
/* out: 0 if succeed, else error number */
|
|
||||||
com_endpoint_t* ep, /* in: endpoint */
|
|
||||||
ulint optno, /* in: option number, only
|
|
||||||
COM_OPT_MAX_DGRAM_SIZE currently supported */
|
|
||||||
byte* optval, /* in: pointer to a buffer containing the
|
|
||||||
option value to set */
|
|
||||||
ulint optlen);/* in: option value buffer length */
|
|
||||||
/*************************************************************************
|
|
||||||
Binds a communications endpoint to a specified address. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_bind(
|
|
||||||
/*=====*/
|
|
||||||
/* out: 0 if succeed, else error number */
|
|
||||||
com_endpoint_t* ep, /* in: communications endpoint */
|
|
||||||
char* name, /* in: address name */
|
|
||||||
ulint len); /* in: name length */
|
|
||||||
/*************************************************************************
|
|
||||||
Waits for a datagram to arrive at an endpoint. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_recvfrom(
|
|
||||||
/*=========*/
|
|
||||||
/* out: 0 if succeed, else error number */
|
|
||||||
com_endpoint_t* ep, /* in: communications endpoint */
|
|
||||||
byte* buf, /* out: datagram buffer; the buffer must be
|
|
||||||
supplied by the caller */
|
|
||||||
ulint buf_len,/* in: datagram buffer length */
|
|
||||||
ulint* len, /* out: datagram length */
|
|
||||||
char* from, /* out: address name buffer; the buffer must be
|
|
||||||
supplied by the caller */
|
|
||||||
ulint from_len,/* in: address name buffer length */
|
|
||||||
ulint* addr_len);/* out: address name length */
|
|
||||||
/*************************************************************************
|
|
||||||
Sends a datagram to a specified destination. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_sendto(
|
|
||||||
/*=======*/
|
|
||||||
/* out: 0 if succeed, else error number */
|
|
||||||
com_endpoint_t* ep, /* in: communications endpoint */
|
|
||||||
byte* buf, /* in: datagram buffer */
|
|
||||||
ulint len, /* in: datagram length */
|
|
||||||
char* to, /* in: address name buffer */
|
|
||||||
ulint tolen); /* in: address name length */
|
|
||||||
/*************************************************************************
|
|
||||||
Gets the maximum datagram size for an endpoint. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_endpoint_get_max_size(
|
|
||||||
/*======================*/
|
|
||||||
/* out: maximum size */
|
|
||||||
com_endpoint_t* ep); /* in: endpoint */
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef UNIV_NONINL
|
|
||||||
#include "com0com.ic"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,7 +0,0 @@
|
|||||||
/******************************************************
|
|
||||||
The communication primitives
|
|
||||||
|
|
||||||
(c) 1995 Innobase Oy
|
|
||||||
|
|
||||||
Created 9/23/1995 Heikki Tuuri
|
|
||||||
*******************************************************/
|
|
@ -1,103 +0,0 @@
|
|||||||
/******************************************************
|
|
||||||
The communication through shared memory
|
|
||||||
|
|
||||||
(c) 1995 Innobase Oy
|
|
||||||
|
|
||||||
Created 9/23/1995 Heikki Tuuri
|
|
||||||
*******************************************************/
|
|
||||||
|
|
||||||
#ifndef com0shm_h
|
|
||||||
#define com0shm_h
|
|
||||||
|
|
||||||
#include "univ.i"
|
|
||||||
|
|
||||||
typedef struct com_shm_endpoint_struct com_shm_endpoint_t;
|
|
||||||
|
|
||||||
/* The performance of communication in NT depends on how
|
|
||||||
many times a system call is made (excluding os_thread_yield,
|
|
||||||
as that is the fastest way to switch thread).
|
|
||||||
The following variable counts such events. */
|
|
||||||
|
|
||||||
extern ulint com_shm_system_call_count;
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
Creates a communications endpoint. */
|
|
||||||
|
|
||||||
com_shm_endpoint_t*
|
|
||||||
com_shm_endpoint_create(void);
|
|
||||||
/*=========================*/
|
|
||||||
/* out, own: communications endpoint, NULL if
|
|
||||||
did not succeed */
|
|
||||||
/*************************************************************************
|
|
||||||
Frees a communications endpoint. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_shm_endpoint_free(
|
|
||||||
/*==================*/
|
|
||||||
/* out: O if succeed, else error number */
|
|
||||||
com_shm_endpoint_t* ep);/* in, own: communications endpoint */
|
|
||||||
/*************************************************************************
|
|
||||||
Sets an option, like the maximum datagram size for an endpoint.
|
|
||||||
The options may vary depending on the endpoint type. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_shm_endpoint_set_option(
|
|
||||||
/*========================*/
|
|
||||||
/* out: 0 if succeed, else error number */
|
|
||||||
com_shm_endpoint_t* ep, /* in: endpoint */
|
|
||||||
ulint optno, /* in: option number, only
|
|
||||||
COM_OPT_MAX_DGRAM_SIZE currently supported */
|
|
||||||
byte* optval, /* in: pointer to a buffer containing the
|
|
||||||
option value to set */
|
|
||||||
ulint optlen);/* in: option value buffer length */
|
|
||||||
/*************************************************************************
|
|
||||||
Bind a communications endpoint to a specified address. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_shm_bind(
|
|
||||||
/*=========*/
|
|
||||||
/* out: 0 if succeed, else error number */
|
|
||||||
com_shm_endpoint_t* ep, /* in: communications endpoint */
|
|
||||||
char* name, /* in: address name */
|
|
||||||
ulint len); /* in: address name length */
|
|
||||||
/*************************************************************************
|
|
||||||
Waits for a datagram to arrive at an endpoint. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_shm_recvfrom(
|
|
||||||
/*=============*/
|
|
||||||
/* out: 0 if succeed, else error number */
|
|
||||||
com_shm_endpoint_t* ep, /* in: communications endpoint */
|
|
||||||
byte* buf, /* out: datagram buffer; the buffer is
|
|
||||||
supplied by the caller */
|
|
||||||
ulint buf_len,/* in: datagram buffer length */
|
|
||||||
ulint* len, /* out: datagram length */
|
|
||||||
char* from, /* out: address name buffer; the buffer is
|
|
||||||
supplied by the caller */
|
|
||||||
ulint from_len,/* in: address name buffer length */
|
|
||||||
ulint* addr_len);/* out: address name length */
|
|
||||||
/*************************************************************************
|
|
||||||
Sends a datagram to the specified destination. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_shm_sendto(
|
|
||||||
/*===========*/
|
|
||||||
/* out: 0 if succeed, else error number */
|
|
||||||
com_shm_endpoint_t* ep, /* in: communications endpoint */
|
|
||||||
byte* buf, /* in: datagram buffer */
|
|
||||||
ulint len, /* in: datagram length */
|
|
||||||
char* to, /* in: address name buffer */
|
|
||||||
ulint tolen); /* in: address name length */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
com_shm_endpoint_get_size(
|
|
||||||
/*======================*/
|
|
||||||
com_shm_endpoint_t* ep);
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef UNIV_NONINL
|
|
||||||
#include "com0shm.ic"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,7 +0,0 @@
|
|||||||
/******************************************************
|
|
||||||
Communication through shared memory
|
|
||||||
|
|
||||||
(c) 1995 Innobase Oy
|
|
||||||
|
|
||||||
Created 9/23/1995 Heikki Tuuri
|
|
||||||
*******************************************************/
|
|
@ -402,9 +402,11 @@ struct dtuple_struct {
|
|||||||
UT_LIST_NODE_T(dtuple_t) tuple_list;
|
UT_LIST_NODE_T(dtuple_t) tuple_list;
|
||||||
/* data tuples can be linked into a
|
/* data tuples can be linked into a
|
||||||
list using this field */
|
list using this field */
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
ulint magic_n;
|
ulint magic_n;
|
||||||
};
|
|
||||||
#define DATA_TUPLE_MAGIC_N 65478679
|
#define DATA_TUPLE_MAGIC_N 65478679
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
|
};
|
||||||
|
|
||||||
/* A slot for a field in a big rec vector */
|
/* A slot for a field in a big rec vector */
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ dtype_get_fixed_size(
|
|||||||
case DATA_VARMYSQL:
|
case DATA_VARMYSQL:
|
||||||
case DATA_BLOB:
|
case DATA_BLOB:
|
||||||
return(0);
|
return(0);
|
||||||
default: ut_a(0);
|
default: ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -543,7 +543,9 @@ dict_table_check_if_in_cache_low(
|
|||||||
ulint table_fold;
|
ulint table_fold;
|
||||||
|
|
||||||
ut_ad(table_name);
|
ut_ad(table_name);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* Look for the table name in the hash table */
|
/* Look for the table name in the hash table */
|
||||||
table_fold = ut_fold_string(table_name);
|
table_fold = ut_fold_string(table_name);
|
||||||
@ -566,7 +568,9 @@ dict_table_get_low(
|
|||||||
dict_table_t* table;
|
dict_table_t* table;
|
||||||
|
|
||||||
ut_ad(table_name);
|
ut_ad(table_name);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
table = dict_table_check_if_in_cache_low(table_name);
|
table = dict_table_check_if_in_cache_low(table_name);
|
||||||
|
|
||||||
@ -621,7 +625,9 @@ dict_table_get_on_id_low(
|
|||||||
dict_table_t* table;
|
dict_table_t* table;
|
||||||
ulint fold;
|
ulint fold;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
UT_NOT_USED(trx);
|
UT_NOT_USED(trx);
|
||||||
|
|
||||||
/* Look for the table name in the hash table */
|
/* Look for the table name in the hash table */
|
||||||
|
@ -198,10 +198,11 @@ struct dict_tree_struct{
|
|||||||
the list; if the tree is of the mixed
|
the list; if the tree is of the mixed
|
||||||
type, the first index in the list is the
|
type, the first index in the list is the
|
||||||
index of the cluster which owns the tree */
|
index of the cluster which owns the tree */
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
ulint magic_n;/* magic number */
|
ulint magic_n;/* magic number */
|
||||||
};
|
|
||||||
|
|
||||||
#define DICT_TREE_MAGIC_N 7545676
|
#define DICT_TREE_MAGIC_N 7545676
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
|
};
|
||||||
|
|
||||||
/* Data structure for an index */
|
/* Data structure for an index */
|
||||||
struct dict_index_struct{
|
struct dict_index_struct{
|
||||||
@ -247,7 +248,10 @@ struct dict_index_struct{
|
|||||||
ulint stat_n_leaf_pages;
|
ulint stat_n_leaf_pages;
|
||||||
/* approximate number of leaf pages in the
|
/* approximate number of leaf pages in the
|
||||||
index tree */
|
index tree */
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
ulint magic_n;/* magic number */
|
ulint magic_n;/* magic number */
|
||||||
|
#define DICT_INDEX_MAGIC_N 76789786
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Data structure for a foreign key constraint; an example:
|
/* Data structure for a foreign key constraint; an example:
|
||||||
@ -298,9 +302,6 @@ a foreign key constraint is enforced, therefore RESTRICT just means no flag */
|
|||||||
#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16
|
#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16
|
||||||
#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32
|
#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32
|
||||||
|
|
||||||
|
|
||||||
#define DICT_INDEX_MAGIC_N 76789786
|
|
||||||
|
|
||||||
/* Data structure for a database table */
|
/* Data structure for a database table */
|
||||||
struct dict_table_struct{
|
struct dict_table_struct{
|
||||||
dulint id; /* id of the table or cluster */
|
dulint id; /* id of the table or cluster */
|
||||||
@ -420,9 +421,11 @@ struct dict_table_struct{
|
|||||||
SELECT MAX(auto inc column) */
|
SELECT MAX(auto inc column) */
|
||||||
ib_longlong autoinc;/* autoinc counter value to give to the
|
ib_longlong autoinc;/* autoinc counter value to give to the
|
||||||
next inserted row */
|
next inserted row */
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
ulint magic_n;/* magic number */
|
ulint magic_n;/* magic number */
|
||||||
};
|
|
||||||
#define DICT_TABLE_MAGIC_N 76333786
|
#define DICT_TABLE_MAGIC_N 76333786
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
|
};
|
||||||
|
|
||||||
/* Data structure for a stored procedure */
|
/* Data structure for a stored procedure */
|
||||||
struct dict_proc_struct{
|
struct dict_proc_struct{
|
||||||
|
@ -30,7 +30,9 @@ fut_get_ptr(
|
|||||||
|
|
||||||
ptr = buf_page_get(space, addr.page, rw_latch, mtr) + addr.boffset;
|
ptr = buf_page_get(space, addr.page, rw_latch, mtr) + addr.boffset;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(ptr, SYNC_NO_ORDER_CHECK);
|
buf_page_dbg_add_level(ptr, SYNC_NO_ORDER_CHECK);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(ptr);
|
return(ptr);
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,9 @@ ha_search(
|
|||||||
{
|
{
|
||||||
ha_node_t* node;
|
ha_node_t* node;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
node = ha_chain_get_first(table, fold);
|
node = ha_chain_get_first(table, fold);
|
||||||
|
|
||||||
@ -111,7 +113,9 @@ ha_search_and_get_data(
|
|||||||
{
|
{
|
||||||
ha_node_t* node;
|
ha_node_t* node;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
node = ha_chain_get_first(table, fold);
|
node = ha_chain_get_first(table, fold);
|
||||||
|
|
||||||
@ -170,7 +174,9 @@ ha_search_with_data(
|
|||||||
{
|
{
|
||||||
ha_node_t* node;
|
ha_node_t* node;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
node = ha_chain_get_first(table, fold);
|
node = ha_chain_get_first(table, fold);
|
||||||
|
|
||||||
@ -200,7 +206,9 @@ ha_search_and_delete_if_found(
|
|||||||
{
|
{
|
||||||
ha_node_t* node;
|
ha_node_t* node;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
node = ha_search_with_data(table, fold, data);
|
node = ha_search_with_data(table, fold, data);
|
||||||
|
|
||||||
|
@ -53,15 +53,24 @@ hash_calc_hash(
|
|||||||
/* out: hashed value */
|
/* out: hashed value */
|
||||||
ulint fold, /* in: folded value */
|
ulint fold, /* in: folded value */
|
||||||
hash_table_t* table); /* in: hash table */
|
hash_table_t* table); /* in: hash table */
|
||||||
|
/************************************************************************
|
||||||
|
Assert that the mutex for the table in a hash operation is owned. */
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
|
# define HASH_ASSERT_OWNED(TABLE, FOLD) \
|
||||||
|
ut_ad(!(TABLE)->mutexes || mutex_own(hash_get_mutex(TABLE, FOLD)));
|
||||||
|
#else
|
||||||
|
# define HASH_ASSERT_OWNED(TABLE, FOLD)
|
||||||
|
#endif
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Inserts a struct to a hash table. */
|
Inserts a struct to a hash table. */
|
||||||
|
|
||||||
#define HASH_INSERT(TYPE, NAME, TABLE, FOLD, DATA)\
|
#define HASH_INSERT(TYPE, NAME, TABLE, FOLD, DATA)\
|
||||||
{\
|
do {\
|
||||||
hash_cell_t* cell3333;\
|
hash_cell_t* cell3333;\
|
||||||
TYPE* struct3333;\
|
TYPE* struct3333;\
|
||||||
\
|
\
|
||||||
ut_ad(!(TABLE)->mutexes || mutex_own(hash_get_mutex(TABLE, FOLD)));\
|
HASH_ASSERT_OWNED(TABLE, FOLD)\
|
||||||
\
|
\
|
||||||
(DATA)->NAME = NULL;\
|
(DATA)->NAME = NULL;\
|
||||||
\
|
\
|
||||||
@ -79,17 +88,17 @@ Inserts a struct to a hash table. */
|
|||||||
\
|
\
|
||||||
struct3333->NAME = DATA;\
|
struct3333->NAME = DATA;\
|
||||||
}\
|
}\
|
||||||
}
|
} while (0)
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Deletes a struct from a hash table. */
|
Deletes a struct from a hash table. */
|
||||||
|
|
||||||
#define HASH_DELETE(TYPE, NAME, TABLE, FOLD, DATA)\
|
#define HASH_DELETE(TYPE, NAME, TABLE, FOLD, DATA)\
|
||||||
{\
|
do {\
|
||||||
hash_cell_t* cell3333;\
|
hash_cell_t* cell3333;\
|
||||||
TYPE* struct3333;\
|
TYPE* struct3333;\
|
||||||
\
|
\
|
||||||
ut_ad(!(TABLE)->mutexes || mutex_own(hash_get_mutex(TABLE, FOLD)));\
|
HASH_ASSERT_OWNED(TABLE, FOLD)\
|
||||||
\
|
\
|
||||||
cell3333 = hash_get_nth_cell(TABLE, hash_calc_hash(FOLD, TABLE));\
|
cell3333 = hash_get_nth_cell(TABLE, hash_calc_hash(FOLD, TABLE));\
|
||||||
\
|
\
|
||||||
@ -100,13 +109,13 @@ Deletes a struct from a hash table. */
|
|||||||
\
|
\
|
||||||
while (struct3333->NAME != DATA) {\
|
while (struct3333->NAME != DATA) {\
|
||||||
\
|
\
|
||||||
ut_a(struct3333)\
|
ut_a(struct3333);\
|
||||||
struct3333 = struct3333->NAME;\
|
struct3333 = struct3333->NAME;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
struct3333->NAME = DATA->NAME;\
|
struct3333->NAME = DATA->NAME;\
|
||||||
}\
|
}\
|
||||||
}
|
} while (0)
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Gets the first struct in a hash chain, NULL if none. */
|
Gets the first struct in a hash chain, NULL if none. */
|
||||||
@ -124,7 +133,7 @@ Looks for a struct in a hash table. */
|
|||||||
#define HASH_SEARCH(NAME, TABLE, FOLD, DATA, TEST)\
|
#define HASH_SEARCH(NAME, TABLE, FOLD, DATA, TEST)\
|
||||||
{\
|
{\
|
||||||
\
|
\
|
||||||
ut_ad(!(TABLE)->mutexes || mutex_own(hash_get_mutex(TABLE, FOLD)));\
|
HASH_ASSERT_OWNED(TABLE, FOLD)\
|
||||||
\
|
\
|
||||||
(DATA) = HASH_GET_FIRST(TABLE, hash_calc_hash(FOLD, TABLE));\
|
(DATA) = HASH_GET_FIRST(TABLE, hash_calc_hash(FOLD, TABLE));\
|
||||||
\
|
\
|
||||||
@ -160,7 +169,7 @@ the heap. The fold value must be stored in the struct NODE in a field named
|
|||||||
'fold'. */
|
'fold'. */
|
||||||
|
|
||||||
#define HASH_DELETE_AND_COMPACT(TYPE, NAME, TABLE, NODE)\
|
#define HASH_DELETE_AND_COMPACT(TYPE, NAME, TABLE, NODE)\
|
||||||
{\
|
do {\
|
||||||
TYPE* node111;\
|
TYPE* node111;\
|
||||||
TYPE* top_node111;\
|
TYPE* top_node111;\
|
||||||
hash_cell_t* cell111;\
|
hash_cell_t* cell111;\
|
||||||
@ -211,33 +220,7 @@ the heap. The fold value must be stored in the struct NODE in a field named
|
|||||||
/* Free the space occupied by the top node */\
|
/* Free the space occupied by the top node */\
|
||||||
\
|
\
|
||||||
mem_heap_free_top(hash_get_heap(TABLE, fold111), sizeof(TYPE));\
|
mem_heap_free_top(hash_get_heap(TABLE, fold111), sizeof(TYPE));\
|
||||||
}
|
} while (0)
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
Calculates the number of stored structs in a hash table. */
|
|
||||||
|
|
||||||
#define HASH_GET_N_NODES(TYPE, NAME, TABLE, N)\
|
|
||||||
{\
|
|
||||||
hash_cell_t* cell3333;\
|
|
||||||
TYPE* struct3333;\
|
|
||||||
ulint i3333;\
|
|
||||||
\
|
|
||||||
(N) = 0;\
|
|
||||||
\
|
|
||||||
for (i3333 = 0; i3333 < hash_get_n_cells(TABLE); i3333++) {\
|
|
||||||
\
|
|
||||||
cell3333 = hash_get_nth_cell(TABLE, i3333);\
|
|
||||||
\
|
|
||||||
struct3333 = cell3333->node;\
|
|
||||||
\
|
|
||||||
while (struct3333) {\
|
|
||||||
\
|
|
||||||
(N) = (N) + 1;\
|
|
||||||
\
|
|
||||||
struct = HASH_GET_NEXT(NAME, struct3333);\
|
|
||||||
}\
|
|
||||||
}\
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
Gets the mutex index for a fold value in a hash table. */
|
Gets the mutex index for a fold value in a hash table. */
|
||||||
@ -300,21 +283,6 @@ hash_mutex_exit(
|
|||||||
/*============*/
|
/*============*/
|
||||||
hash_table_t* table, /* in: hash table */
|
hash_table_t* table, /* in: hash table */
|
||||||
ulint fold); /* in: fold */
|
ulint fold); /* in: fold */
|
||||||
/****************************************************************
|
|
||||||
Reserves all the mutexes of a hash table, in an ascending order. */
|
|
||||||
|
|
||||||
void
|
|
||||||
hash_mutex_enter_all(
|
|
||||||
/*=================*/
|
|
||||||
hash_table_t* table); /* in: hash table */
|
|
||||||
/****************************************************************
|
|
||||||
Releases all the mutexes of a hash table. */
|
|
||||||
|
|
||||||
void
|
|
||||||
hash_mutex_exit_all(
|
|
||||||
/*================*/
|
|
||||||
hash_table_t* table); /* in: hash table */
|
|
||||||
|
|
||||||
|
|
||||||
struct hash_cell_struct{
|
struct hash_cell_struct{
|
||||||
void* node; /* hash chain node, NULL if none */
|
void* node; /* hash chain node, NULL if none */
|
||||||
@ -335,10 +303,11 @@ struct hash_table_struct {
|
|||||||
memory heaps; there are then n_mutexes many of
|
memory heaps; there are then n_mutexes many of
|
||||||
these heaps */
|
these heaps */
|
||||||
mem_heap_t* heap;
|
mem_heap_t* heap;
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
ulint magic_n;
|
ulint magic_n;
|
||||||
};
|
|
||||||
|
|
||||||
#define HASH_TABLE_MAGIC_N 76561114
|
#define HASH_TABLE_MAGIC_N 76561114
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
|
};
|
||||||
|
|
||||||
#ifndef UNIV_NONINL
|
#ifndef UNIV_NONINL
|
||||||
#include "hash0hash.ic"
|
#include "hash0hash.ic"
|
||||||
|
@ -18,6 +18,7 @@ hash_get_nth_cell(
|
|||||||
hash_table_t* table, /* in: hash table */
|
hash_table_t* table, /* in: hash table */
|
||||||
ulint n) /* in: cell index */
|
ulint n) /* in: cell index */
|
||||||
{
|
{
|
||||||
|
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||||
ut_ad(n < table->n_cells);
|
ut_ad(n < table->n_cells);
|
||||||
|
|
||||||
return(table->array + n);
|
return(table->array + n);
|
||||||
@ -32,6 +33,7 @@ hash_get_n_cells(
|
|||||||
/* out: number of cells */
|
/* out: number of cells */
|
||||||
hash_table_t* table) /* in: table */
|
hash_table_t* table) /* in: table */
|
||||||
{
|
{
|
||||||
|
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||||
return(table->n_cells);
|
return(table->n_cells);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,6 +47,7 @@ hash_calc_hash(
|
|||||||
ulint fold, /* in: folded value */
|
ulint fold, /* in: folded value */
|
||||||
hash_table_t* table) /* in: hash table */
|
hash_table_t* table) /* in: hash table */
|
||||||
{
|
{
|
||||||
|
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||||
return(ut_hash_ulint(fold, table->n_cells));
|
return(ut_hash_ulint(fold, table->n_cells));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +61,7 @@ hash_get_mutex_no(
|
|||||||
hash_table_t* table, /* in: hash table */
|
hash_table_t* table, /* in: hash table */
|
||||||
ulint fold) /* in: fold */
|
ulint fold) /* in: fold */
|
||||||
{
|
{
|
||||||
|
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||||
return(ut_2pow_remainder(fold, table->n_mutexes));
|
return(ut_2pow_remainder(fold, table->n_mutexes));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,6 +75,7 @@ hash_get_nth_heap(
|
|||||||
hash_table_t* table, /* in: hash table */
|
hash_table_t* table, /* in: hash table */
|
||||||
ulint i) /* in: index of the heap */
|
ulint i) /* in: index of the heap */
|
||||||
{
|
{
|
||||||
|
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||||
ut_ad(i < table->n_mutexes);
|
ut_ad(i < table->n_mutexes);
|
||||||
|
|
||||||
return(table->heaps[i]);
|
return(table->heaps[i]);
|
||||||
@ -88,6 +93,8 @@ hash_get_heap(
|
|||||||
{
|
{
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
|
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||||
|
|
||||||
if (table->heap) {
|
if (table->heap) {
|
||||||
return(table->heap);
|
return(table->heap);
|
||||||
}
|
}
|
||||||
@ -107,6 +114,7 @@ hash_get_nth_mutex(
|
|||||||
hash_table_t* table, /* in: hash table */
|
hash_table_t* table, /* in: hash table */
|
||||||
ulint i) /* in: index of the mutex */
|
ulint i) /* in: index of the mutex */
|
||||||
{
|
{
|
||||||
|
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
|
||||||
ut_ad(i < table->n_mutexes);
|
ut_ad(i < table->n_mutexes);
|
||||||
|
|
||||||
return(table->mutexes + i);
|
return(table->mutexes + i);
|
||||||
|
@ -1,149 +0,0 @@
|
|||||||
/******************************************************
|
|
||||||
Innobase ODBC client library header; this is equivalent to
|
|
||||||
the standard sql.h ODBC header file
|
|
||||||
|
|
||||||
(c) 1998 Innobase Oy
|
|
||||||
|
|
||||||
Created 2/22/1998 Heikki Tuuri
|
|
||||||
*******************************************************/
|
|
||||||
|
|
||||||
#ifndef ib_odbc_h
|
|
||||||
#define ib_odbc_h
|
|
||||||
|
|
||||||
typedef unsigned char UCHAR;
|
|
||||||
typedef signed char SCHAR;
|
|
||||||
typedef long int SDWORD;
|
|
||||||
typedef short int SWORD;
|
|
||||||
typedef unsigned long int UDWORD;
|
|
||||||
typedef unsigned short int UWORD;
|
|
||||||
|
|
||||||
typedef void* PTR;
|
|
||||||
|
|
||||||
typedef void* HENV;
|
|
||||||
typedef void* HDBC;
|
|
||||||
typedef void* HSTMT;
|
|
||||||
|
|
||||||
typedef signed short RETCODE;
|
|
||||||
|
|
||||||
/* RETCODEs */
|
|
||||||
#define SQL_NO_DATA_FOUND (-3)
|
|
||||||
#define SQL_INVALID_HANDLE (-2)
|
|
||||||
#define SQL_ERROR (-1)
|
|
||||||
#define SQL_SUCCESS 0
|
|
||||||
|
|
||||||
/* Standard SQL datatypes, using ANSI type numbering */
|
|
||||||
#define SQL_CHAR 1
|
|
||||||
#define SQL_INTEGER 4
|
|
||||||
#define SQL_VARCHAR 12
|
|
||||||
|
|
||||||
/* C datatype to SQL datatype mapping */
|
|
||||||
#define SQL_C_CHAR SQL_CHAR
|
|
||||||
#define SQL_C_LONG SQL_INTEGER
|
|
||||||
|
|
||||||
/* Special length value */
|
|
||||||
#define SQL_NULL_DATA (-1)
|
|
||||||
|
|
||||||
#define SQL_PARAM_INPUT 1
|
|
||||||
#define SQL_PARAM_OUTPUT 4
|
|
||||||
|
|
||||||
/* Null handles */
|
|
||||||
#define SQL_NULL_HENV NULL
|
|
||||||
#define SQL_NULL_HDBC NULL
|
|
||||||
#define SQL_NULL_HSTM NULL
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
|
||||||
Allocates an SQL environment. */
|
|
||||||
|
|
||||||
RETCODE
|
|
||||||
SQLAllocEnv(
|
|
||||||
/*========*/
|
|
||||||
/* out: SQL_SUCCESS */
|
|
||||||
HENV* phenv); /* out: pointer to an environment handle */
|
|
||||||
/**************************************************************************
|
|
||||||
Allocates an SQL connection. */
|
|
||||||
|
|
||||||
RETCODE
|
|
||||||
SQLAllocConnect(
|
|
||||||
/*============*/
|
|
||||||
/* out: SQL_SUCCESS */
|
|
||||||
HENV henv, /* in: pointer to an environment handle */
|
|
||||||
HDBC* phdbc); /* out: pointer to a connection handle */
|
|
||||||
/**************************************************************************
|
|
||||||
Allocates an SQL statement. */
|
|
||||||
|
|
||||||
RETCODE
|
|
||||||
SQLAllocStmt(
|
|
||||||
/*=========*/
|
|
||||||
HDBC hdbc, /* in: SQL connection */
|
|
||||||
HSTMT* phstmt); /* out: pointer to a statement handle */
|
|
||||||
/**************************************************************************
|
|
||||||
Connects to a database server process (establishes a connection and a
|
|
||||||
session). */
|
|
||||||
|
|
||||||
RETCODE
|
|
||||||
SQLConnect(
|
|
||||||
/*=======*/
|
|
||||||
/* out: SQL_SUCCESS */
|
|
||||||
HDBC hdbc, /* in: SQL connection handle */
|
|
||||||
UCHAR* szDSN, /* in: data source name (server name) */
|
|
||||||
SWORD cbDSN, /* in: data source name length */
|
|
||||||
UCHAR* szUID, /* in: user name */
|
|
||||||
SWORD cbUID, /* in: user name length */
|
|
||||||
UCHAR* szAuthStr, /* in: password */
|
|
||||||
SWORD cbAuthStr); /* in: password length */
|
|
||||||
/**************************************************************************
|
|
||||||
Makes the server to parse and optimize an SQL string. */
|
|
||||||
|
|
||||||
RETCODE
|
|
||||||
SQLPrepare(
|
|
||||||
/*=======*/
|
|
||||||
/* out: SQL_SUCCESS */
|
|
||||||
HSTMT hstmt, /* in: statement handle */
|
|
||||||
UCHAR* szSqlStr, /* in: SQL string */
|
|
||||||
SDWORD cbSqlStr); /* in: SQL string length */
|
|
||||||
/**************************************************************************
|
|
||||||
Binds a parameter in a prepared statement. */
|
|
||||||
|
|
||||||
RETCODE
|
|
||||||
SQLBindParameter(
|
|
||||||
/*=============*/
|
|
||||||
/* out: SQL_SUCCESS */
|
|
||||||
HSTMT hstmt, /* in: statement handle */
|
|
||||||
UWORD ipar, /* in: parameter index, starting from 1 */
|
|
||||||
SWORD fParamType, /* in: SQL_PARAM_INPUT or SQL_PARAM_OUTPUT */
|
|
||||||
SWORD fCType, /* in: SQL_C_CHAR, ... */
|
|
||||||
SWORD fSqlType, /* in: SQL_CHAR, ... */
|
|
||||||
UDWORD cbColDef, /* in: precision: ignored */
|
|
||||||
SWORD ibScale, /* in: scale: ignored */
|
|
||||||
PTR rgbValue, /* in: pointer to a buffer for the data */
|
|
||||||
SDWORD cbValueMax, /* in: buffer size */
|
|
||||||
SDWORD* pcbValue); /* in: pointer to a buffer for the data
|
|
||||||
length or SQL_NULL_DATA */
|
|
||||||
/**************************************************************************
|
|
||||||
Executes a prepared statement where all parameters have been bound. */
|
|
||||||
|
|
||||||
RETCODE
|
|
||||||
SQLExecute(
|
|
||||||
/*=======*/
|
|
||||||
/* out: SQL_SUCCESS or SQL_ERROR */
|
|
||||||
HSTMT hstmt); /* in: statement handle */
|
|
||||||
/**************************************************************************
|
|
||||||
Queries an error message. */
|
|
||||||
|
|
||||||
RETCODE
|
|
||||||
SQLError(
|
|
||||||
/*=====*/
|
|
||||||
/* out: SQL_SUCCESS or SQL_NO_DATA_FOUND */
|
|
||||||
HENV henv, /* in: SQL_NULL_HENV */
|
|
||||||
HDBC hdbc, /* in: SQL_NULL_HDBC */
|
|
||||||
HSTMT hstmt, /* in: statement handle */
|
|
||||||
UCHAR* szSqlState, /* in/out: SQLSTATE as a null-terminated string,
|
|
||||||
(currently, always == "S1000") */
|
|
||||||
SDWORD* pfNativeError, /* out: native error code */
|
|
||||||
UCHAR* szErrorMsg, /* in/out: buffer for an error message as a
|
|
||||||
null-terminated string */
|
|
||||||
SWORD cbErrorMsgMax, /* in: buffer size for szErrorMsg */
|
|
||||||
SWORD* pcbErrorMsg); /* out: error message length */
|
|
||||||
|
|
||||||
#endif
|
|
@ -64,7 +64,9 @@ lock_clust_rec_some_has_impl(
|
|||||||
{
|
{
|
||||||
dulint trx_id;
|
dulint trx_id;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(index->type & DICT_CLUSTERED);
|
ut_ad(index->type & DICT_CLUSTERED);
|
||||||
ut_ad(page_rec_is_user_rec(rec));
|
ut_ad(page_rec_is_user_rec(rec));
|
||||||
|
|
||||||
|
@ -255,7 +255,9 @@ log_block_init(
|
|||||||
{
|
{
|
||||||
ulint no;
|
ulint no;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
no = log_block_convert_lsn_to_no(lsn);
|
no = log_block_convert_lsn_to_no(lsn);
|
||||||
|
|
||||||
@ -277,7 +279,9 @@ log_block_init_in_old_format(
|
|||||||
{
|
{
|
||||||
ulint no;
|
ulint no;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
no = log_block_convert_lsn_to_no(lsn);
|
no = log_block_convert_lsn_to_no(lsn);
|
||||||
|
|
||||||
@ -407,7 +411,9 @@ log_get_online_backup_lsn_low(void)
|
|||||||
/* out: online_backup_lsn, the caller must
|
/* out: online_backup_lsn, the caller must
|
||||||
own the log_sys mutex */
|
own the log_sys mutex */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(log_sys->online_backup_state);
|
ut_ad(log_sys->online_backup_state);
|
||||||
|
|
||||||
return(log_sys->online_backup_lsn);
|
return(log_sys->online_backup_lsn);
|
||||||
@ -422,7 +428,9 @@ log_get_online_backup_state_low(void)
|
|||||||
/* out: online backup state, the caller must
|
/* out: online backup state, the caller must
|
||||||
own the log_sys mutex */
|
own the log_sys mutex */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(log_sys->online_backup_state);
|
return(log_sys->online_backup_state);
|
||||||
}
|
}
|
||||||
|
@ -88,25 +88,6 @@ mach_read_from_4(
|
|||||||
/*=============*/
|
/*=============*/
|
||||||
/* out: ulint integer */
|
/* out: ulint integer */
|
||||||
byte* b); /* in: pointer to four bytes */
|
byte* b); /* in: pointer to four bytes */
|
||||||
/***********************************************************
|
|
||||||
The following function is used to store data from a ulint to memory
|
|
||||||
in standard order:
|
|
||||||
we store the most significant byte to the lowest address. */
|
|
||||||
UNIV_INLINE
|
|
||||||
void
|
|
||||||
mach_write(
|
|
||||||
/*=======*/
|
|
||||||
byte* b, /* in: pointer to sizeof(ulint) bytes where to store */
|
|
||||||
ulint n); /* in: ulint integer to be stored */
|
|
||||||
/************************************************************
|
|
||||||
The following function is used to fetch data from memory to a ulint.
|
|
||||||
The most significant byte is at the lowest address. */
|
|
||||||
UNIV_INLINE
|
|
||||||
ulint
|
|
||||||
mach_read(
|
|
||||||
/*======*/
|
|
||||||
/* out: ulint integer */
|
|
||||||
byte* b); /* in: pointer to sizeof(ulint) bytes */
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
Writes a ulint in a compressed form. */
|
Writes a ulint in a compressed form. */
|
||||||
UNIV_INLINE
|
UNIV_INLINE
|
||||||
|
@ -167,44 +167,6 @@ mach_read_from_4(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************
|
|
||||||
The following function is used to store data from a ulint to memory
|
|
||||||
in standard order: we store the most significant byte to the lowest
|
|
||||||
address. */
|
|
||||||
UNIV_INLINE
|
|
||||||
void
|
|
||||||
mach_write(
|
|
||||||
/*=======*/
|
|
||||||
byte* b, /* in: pointer to 4 bytes where to store */
|
|
||||||
ulint n) /* in: ulint integer to be stored */
|
|
||||||
{
|
|
||||||
ut_ad(b);
|
|
||||||
|
|
||||||
b[0] = (byte)(n >> 24);
|
|
||||||
b[1] = (byte)(n >> 16);
|
|
||||||
b[2] = (byte)(n >> 8);
|
|
||||||
b[3] = (byte)n;
|
|
||||||
}
|
|
||||||
|
|
||||||
/************************************************************
|
|
||||||
The following function is used to fetch data from memory to a ulint.
|
|
||||||
The most significant byte is at the lowest address. */
|
|
||||||
UNIV_INLINE
|
|
||||||
ulint
|
|
||||||
mach_read(
|
|
||||||
/*======*/
|
|
||||||
/* out: ulint integer */
|
|
||||||
byte* b) /* in: pointer to 4 bytes */
|
|
||||||
{
|
|
||||||
ut_ad(b);
|
|
||||||
|
|
||||||
return( ((ulint)(b[0]) << 24)
|
|
||||||
+ ((ulint)(b[1]) << 16)
|
|
||||||
+ ((ulint)(b[2]) << 8)
|
|
||||||
+ (ulint)(b[3])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
Writes a ulint in a compressed form where the first byte codes the
|
Writes a ulint in a compressed form where the first byte codes the
|
||||||
length of the stored ulint. We look at the most significant bits of
|
length of the stored ulint. We look at the most significant bits of
|
||||||
|
@ -7,6 +7,7 @@ compilation module but is included in mem0mem.*.
|
|||||||
Created 6/8/1994 Heikki Tuuri
|
Created 6/8/1994 Heikki Tuuri
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifdef UNIV_MEM_DEBUG
|
||||||
extern mutex_t mem_hash_mutex;
|
extern mutex_t mem_hash_mutex;
|
||||||
extern ulint mem_current_allocated_memory;
|
extern ulint mem_current_allocated_memory;
|
||||||
|
|
||||||
@ -89,3 +90,4 @@ mem_field_trailer_set_check(byte* field, ulint check);
|
|||||||
|
|
||||||
ulint
|
ulint
|
||||||
mem_field_trailer_get_check(byte* field);
|
mem_field_trailer_get_check(byte* field);
|
||||||
|
#endif /* UNIV_MEM_DEBUG */
|
||||||
|
@ -32,7 +32,6 @@ mlog_write_dulint(
|
|||||||
/*==============*/
|
/*==============*/
|
||||||
byte* ptr, /* in: pointer where to write */
|
byte* ptr, /* in: pointer where to write */
|
||||||
dulint val, /* in: value to write */
|
dulint val, /* in: value to write */
|
||||||
byte type, /* in: MLOG_8BYTES */
|
|
||||||
mtr_t* mtr); /* in: mini-transaction handle */
|
mtr_t* mtr); /* in: mini-transaction handle */
|
||||||
/************************************************************
|
/************************************************************
|
||||||
Writes a string to a file page buffered in the buffer pool. Writes the
|
Writes a string to a file page buffered in the buffer pool. Writes the
|
||||||
|
@ -195,7 +195,6 @@ mtr_read_dulint(
|
|||||||
/*===========*/
|
/*===========*/
|
||||||
/* out: value read */
|
/* out: value read */
|
||||||
byte* ptr, /* in: pointer from where to read */
|
byte* ptr, /* in: pointer from where to read */
|
||||||
ulint type, /* in: MLOG_8BYTES */
|
|
||||||
mtr_t* mtr); /* in: mini-transaction handle */
|
mtr_t* mtr); /* in: mini-transaction handle */
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
This macro locks an rw-lock in s-mode. */
|
This macro locks an rw-lock in s-mode. */
|
||||||
@ -296,7 +295,12 @@ struct mtr_memo_slot_struct{
|
|||||||
|
|
||||||
/* Mini-transaction handle and buffer */
|
/* Mini-transaction handle and buffer */
|
||||||
struct mtr_struct{
|
struct mtr_struct{
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
ulint state; /* MTR_ACTIVE, MTR_COMMITTING, MTR_COMMITTED */
|
ulint state; /* MTR_ACTIVE, MTR_COMMITTING, MTR_COMMITTED */
|
||||||
|
#define MTR_ACTIVE 12231
|
||||||
|
#define MTR_COMMITTING 56456
|
||||||
|
#define MTR_COMMITTED 34676
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
dyn_array_t memo; /* memo stack for locks etc. */
|
dyn_array_t memo; /* memo stack for locks etc. */
|
||||||
dyn_array_t log; /* mini-transaction log */
|
dyn_array_t log; /* mini-transaction log */
|
||||||
ibool modifications;
|
ibool modifications;
|
||||||
@ -311,14 +315,11 @@ struct mtr_struct{
|
|||||||
this mtr */
|
this mtr */
|
||||||
dulint end_lsn;/* end lsn of the possible log entry for
|
dulint end_lsn;/* end lsn of the possible log entry for
|
||||||
this mtr */
|
this mtr */
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
ulint magic_n;
|
ulint magic_n;
|
||||||
};
|
|
||||||
|
|
||||||
#define MTR_MAGIC_N 54551
|
#define MTR_MAGIC_N 54551
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
#define MTR_ACTIVE 12231
|
};
|
||||||
#define MTR_COMMITTING 56456
|
|
||||||
#define MTR_COMMITTED 34676
|
|
||||||
|
|
||||||
#ifndef UNIV_NONINL
|
#ifndef UNIV_NONINL
|
||||||
#include "mtr0mtr.ic"
|
#include "mtr0mtr.ic"
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
/******************************************************
|
|
||||||
Innobase ODBC client library additional header
|
|
||||||
|
|
||||||
(c) 1998 Innobase Oy
|
|
||||||
|
|
||||||
Created 2/22/1998 Heikki Tuuri
|
|
||||||
*******************************************************/
|
|
||||||
|
|
||||||
#ifndef odbc0odbc_h
|
|
||||||
#define odbc0odbc_h
|
|
||||||
|
|
||||||
#include "ib_odbc.h"
|
|
||||||
|
|
||||||
/* Datagram size in communications */
|
|
||||||
#define ODBC_DATAGRAM_SIZE 8192
|
|
||||||
|
|
||||||
/* Communication address maximum length in bytes */
|
|
||||||
#define ODBC_ADDRESS_SIZE COM_MAX_ADDR_LEN
|
|
||||||
|
|
||||||
#endif
|
|
@ -20,6 +20,9 @@ extern ibool os_do_not_call_flush_at_each_write;
|
|||||||
extern ibool os_has_said_disk_full;
|
extern ibool os_has_said_disk_full;
|
||||||
extern ibool os_aio_print_debug;
|
extern ibool os_aio_print_debug;
|
||||||
|
|
||||||
|
extern ulint os_file_n_pending_preads;
|
||||||
|
extern ulint os_file_n_pending_pwrites;
|
||||||
|
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
|
|
||||||
/* We define always WIN_ASYNC_IO, and check at run-time whether
|
/* We define always WIN_ASYNC_IO, and check at run-time whether
|
||||||
|
@ -21,7 +21,9 @@ extern int yydebug;
|
|||||||
/* If the following is set TRUE, the lexer will print the SQL string
|
/* If the following is set TRUE, the lexer will print the SQL string
|
||||||
as it tokenizes it */
|
as it tokenizes it */
|
||||||
|
|
||||||
|
#ifdef UNIV_SQL_DEBUG
|
||||||
extern ibool pars_print_lexed;
|
extern ibool pars_print_lexed;
|
||||||
|
#endif /* UNIV_SQL_DEBUG */
|
||||||
|
|
||||||
/* Global variable used while parsing a single procedure or query : the code is
|
/* Global variable used while parsing a single procedure or query : the code is
|
||||||
NOT re-entrant */
|
NOT re-entrant */
|
||||||
@ -390,41 +392,18 @@ pars_procedure_definition(
|
|||||||
table */
|
table */
|
||||||
sym_node_t* param_list, /* in: parameter declaration list */
|
sym_node_t* param_list, /* in: parameter declaration list */
|
||||||
que_node_t* stat_list); /* in: statement list */
|
que_node_t* stat_list); /* in: statement list */
|
||||||
/*****************************************************************
|
|
||||||
Reads stored procedure input parameter values from a buffer. */
|
|
||||||
|
|
||||||
void
|
|
||||||
pars_proc_read_input_params_from_buf(
|
|
||||||
/*=================================*/
|
|
||||||
que_t* graph, /* in: query graph which contains a stored procedure */
|
|
||||||
byte* buf); /* in: buffer */
|
|
||||||
/*****************************************************************
|
|
||||||
Writes stored procedure output parameter values to a buffer. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
pars_proc_write_output_params_to_buf(
|
|
||||||
/*=================================*/
|
|
||||||
byte* buf, /* in: buffer which must be big enough */
|
|
||||||
que_t* graph); /* in: query graph which contains a stored procedure */
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
Parses a stored procedure call, when this is not within another stored
|
Parses a stored procedure call, when this is not within another stored
|
||||||
procedure, that is, the client issues a procedure call directly. */
|
procedure, that is, the client issues a procedure call directly.
|
||||||
|
In MySQL/InnoDB, stored InnoDB procedures are invoked via the
|
||||||
|
parsed procedure tree, not via InnoDB SQL, so this function is not used. */
|
||||||
|
|
||||||
que_fork_t*
|
que_fork_t*
|
||||||
pars_stored_procedure_call(
|
pars_stored_procedure_call(
|
||||||
/*=======================*/
|
/*=======================*/
|
||||||
/* out: query graph */
|
/* out: query graph */
|
||||||
sym_node_t* sym_node); /* in: stored procedure name */
|
sym_node_t* sym_node); /* in: stored procedure name */
|
||||||
/*****************************************************************
|
|
||||||
Writes info about query parameter markers (denoted with '?' in ODBC) into a
|
|
||||||
buffer. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
pars_write_query_param_info(
|
|
||||||
/*========================*/
|
|
||||||
/* out: number of bytes used for info in buf */
|
|
||||||
byte* buf, /* in: buffer which must be big enough */
|
|
||||||
que_fork_t* graph); /* in: parsed query graph */
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
Completes a query graph by adding query thread and fork nodes
|
Completes a query graph by adding query thread and fork nodes
|
||||||
above it and prepares the graph for running. The fork created is of
|
above it and prepares the graph for running. The fork created is of
|
||||||
|
@ -216,9 +216,7 @@ que_fork_start_command(
|
|||||||
QUE_THR_RUNNING state, or NULL; the query
|
QUE_THR_RUNNING state, or NULL; the query
|
||||||
thread should be executed by que_run_threads
|
thread should be executed by que_run_threads
|
||||||
by the caller */
|
by the caller */
|
||||||
que_fork_t* fork, /* in: a query fork */
|
que_fork_t* fork); /* in: a query fork */
|
||||||
ulint command,/* in: command SESS_COMM_FETCH_NEXT, ... */
|
|
||||||
ulint param); /* in: possible parameter to the command */
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
Gets the trx of a query thread. */
|
Gets the trx of a query thread. */
|
||||||
UNIV_INLINE
|
UNIV_INLINE
|
||||||
@ -388,11 +386,6 @@ struct que_fork_struct{
|
|||||||
sym_tab_t* sym_tab; /* symbol table of the query,
|
sym_tab_t* sym_tab; /* symbol table of the query,
|
||||||
generated by the parser, or NULL
|
generated by the parser, or NULL
|
||||||
if the graph was created 'by hand' */
|
if the graph was created 'by hand' */
|
||||||
ulint id; /* id of this query graph */
|
|
||||||
ulint command; /* command currently executed in the
|
|
||||||
graph */
|
|
||||||
ulint param; /* possible command parameter */
|
|
||||||
|
|
||||||
/* The following cur_... fields are relevant only in a select graph */
|
/* The following cur_... fields are relevant only in a select graph */
|
||||||
|
|
||||||
ulint cur_end; /* QUE_CUR_NOT_DEFINED, QUE_CUR_START,
|
ulint cur_end; /* QUE_CUR_NOT_DEFINED, QUE_CUR_START,
|
||||||
|
@ -145,10 +145,11 @@ struct ins_node_struct{
|
|||||||
entry_list and sys fields are stored here;
|
entry_list and sys fields are stored here;
|
||||||
if this is NULL, entry list should be created
|
if this is NULL, entry list should be created
|
||||||
and buffers for sys fields in row allocated */
|
and buffers for sys fields in row allocated */
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
ulint magic_n;
|
ulint magic_n;
|
||||||
};
|
|
||||||
|
|
||||||
#define INS_NODE_MAGIC_N 15849075
|
#define INS_NODE_MAGIC_N 15849075
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
|
};
|
||||||
|
|
||||||
/* Insert node types */
|
/* Insert node types */
|
||||||
#define INS_SEARCHED 0 /* INSERT INTO ... SELECT ... */
|
#define INS_SEARCHED 0 /* INSERT INTO ... SELECT ... */
|
||||||
|
@ -384,10 +384,11 @@ struct upd_node_struct{
|
|||||||
sym_node_t* table_sym;/* table node in symbol table */
|
sym_node_t* table_sym;/* table node in symbol table */
|
||||||
que_node_t* col_assign_list;
|
que_node_t* col_assign_list;
|
||||||
/* column assignment list */
|
/* column assignment list */
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
ulint magic_n;
|
ulint magic_n;
|
||||||
};
|
|
||||||
|
|
||||||
#define UPD_NODE_MAGIC_N 1579975
|
#define UPD_NODE_MAGIC_N 1579975
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
|
};
|
||||||
|
|
||||||
/* Node execution states */
|
/* Node execution states */
|
||||||
#define UPD_NODE_SET_IX_LOCK 1 /* execution came to the node from
|
#define UPD_NODE_SET_IX_LOCK 1 /* execution came to the node from
|
||||||
|
@ -107,8 +107,10 @@ row_upd_rec_sys_fields(
|
|||||||
dulint roll_ptr)/* in: roll ptr of the undo log record */
|
dulint roll_ptr)/* in: roll ptr of the undo log record */
|
||||||
{
|
{
|
||||||
ut_ad(index->type & DICT_CLUSTERED);
|
ut_ad(index->type & DICT_CLUSTERED);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!buf_block_align(rec)->is_hashed
|
ut_ad(!buf_block_align(rec)->is_hashed
|
||||||
|| rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
|| rw_lock_own(&btr_search_latch, RW_LOCK_EX));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
row_set_rec_trx_id(rec, index, trx->id);
|
row_set_rec_trx_id(rec, index, trx->id);
|
||||||
row_set_rec_roll_ptr(rec, index, roll_ptr);
|
row_set_rec_roll_ptr(rec, index, roll_ptr);
|
||||||
|
@ -13,7 +13,6 @@ Created 10/10/1995 Heikki Tuuri
|
|||||||
#include "univ.i"
|
#include "univ.i"
|
||||||
#include "sync0sync.h"
|
#include "sync0sync.h"
|
||||||
#include "os0sync.h"
|
#include "os0sync.h"
|
||||||
#include "com0com.h"
|
|
||||||
#include "que0types.h"
|
#include "que0types.h"
|
||||||
#include "trx0types.h"
|
#include "trx0types.h"
|
||||||
|
|
||||||
@ -405,9 +404,6 @@ struct srv_sys_struct{
|
|||||||
os_event_t operational; /* created threads must wait for the
|
os_event_t operational; /* created threads must wait for the
|
||||||
server to become operational by
|
server to become operational by
|
||||||
waiting for this event */
|
waiting for this event */
|
||||||
com_endpoint_t* endpoint; /* the communication endpoint of the
|
|
||||||
server */
|
|
||||||
|
|
||||||
srv_table_t* threads; /* server thread table */
|
srv_table_t* threads; /* server thread table */
|
||||||
UT_LIST_BASE_NODE_T(que_thr_t)
|
UT_LIST_BASE_NODE_T(que_thr_t)
|
||||||
tasks; /* task queue */
|
tasks; /* task queue */
|
||||||
|
@ -25,13 +25,16 @@ smaller than 30 and the order of the numerical values like below! */
|
|||||||
#define RW_NO_LATCH 3
|
#define RW_NO_LATCH 3
|
||||||
|
|
||||||
typedef struct rw_lock_struct rw_lock_t;
|
typedef struct rw_lock_struct rw_lock_t;
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
typedef struct rw_lock_debug_struct rw_lock_debug_t;
|
typedef struct rw_lock_debug_struct rw_lock_debug_t;
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
typedef UT_LIST_BASE_NODE_T(rw_lock_t) rw_lock_list_t;
|
typedef UT_LIST_BASE_NODE_T(rw_lock_t) rw_lock_list_t;
|
||||||
|
|
||||||
extern rw_lock_list_t rw_lock_list;
|
extern rw_lock_list_t rw_lock_list;
|
||||||
extern mutex_t rw_lock_list_mutex;
|
extern mutex_t rw_lock_list_mutex;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
/* The global mutex which protects debug info lists of all rw-locks.
|
/* The global mutex which protects debug info lists of all rw-locks.
|
||||||
To modify the debug info list of an rw-lock, this mutex has to be
|
To modify the debug info list of an rw-lock, this mutex has to be
|
||||||
|
|
||||||
@ -42,6 +45,7 @@ extern os_event_t rw_lock_debug_event; /* If deadlock detection does
|
|||||||
may wait for this event */
|
may wait for this event */
|
||||||
extern ibool rw_lock_debug_waiters; /* This is set to TRUE, if
|
extern ibool rw_lock_debug_waiters; /* This is set to TRUE, if
|
||||||
there may be waiters for the event */
|
there may be waiters for the event */
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
extern ulint rw_s_system_call_count;
|
extern ulint rw_s_system_call_count;
|
||||||
extern ulint rw_s_spin_wait_count;
|
extern ulint rw_s_spin_wait_count;
|
||||||
@ -327,6 +331,7 @@ ulint
|
|||||||
rw_lock_get_reader_count(
|
rw_lock_get_reader_count(
|
||||||
/*=====================*/
|
/*=====================*/
|
||||||
rw_lock_t* lock);
|
rw_lock_t* lock);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
Checks if the thread has locked the rw-lock in the specified mode, with
|
Checks if the thread has locked the rw-lock in the specified mode, with
|
||||||
the pass value == 0. */
|
the pass value == 0. */
|
||||||
@ -337,6 +342,7 @@ rw_lock_own(
|
|||||||
rw_lock_t* lock, /* in: rw-lock */
|
rw_lock_t* lock, /* in: rw-lock */
|
||||||
ulint lock_type); /* in: lock type: RW_LOCK_SHARED,
|
ulint lock_type); /* in: lock type: RW_LOCK_SHARED,
|
||||||
RW_LOCK_EX */
|
RW_LOCK_EX */
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
Checks if somebody has locked the rw-lock in the specified mode. */
|
Checks if somebody has locked the rw-lock in the specified mode. */
|
||||||
|
|
||||||
@ -346,6 +352,7 @@ rw_lock_is_locked(
|
|||||||
rw_lock_t* lock, /* in: rw-lock */
|
rw_lock_t* lock, /* in: rw-lock */
|
||||||
ulint lock_type); /* in: lock type: RW_LOCK_SHARED,
|
ulint lock_type); /* in: lock type: RW_LOCK_SHARED,
|
||||||
RW_LOCK_EX */
|
RW_LOCK_EX */
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
Prints debug info of an rw-lock. */
|
Prints debug info of an rw-lock. */
|
||||||
|
|
||||||
@ -392,6 +399,7 @@ void
|
|||||||
rw_lock_debug_print(
|
rw_lock_debug_print(
|
||||||
/*================*/
|
/*================*/
|
||||||
rw_lock_debug_t* info); /* in: debug struct */
|
rw_lock_debug_t* info); /* in: debug struct */
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* NOTE! The structure appears here only for the compiler to know its size.
|
/* NOTE! The structure appears here only for the compiler to know its size.
|
||||||
Do not use its fields directly! The structure used in the spin lock
|
Do not use its fields directly! The structure used in the spin lock
|
||||||
@ -434,10 +442,12 @@ struct rw_lock_struct {
|
|||||||
UT_LIST_NODE_T(rw_lock_t) list;
|
UT_LIST_NODE_T(rw_lock_t) list;
|
||||||
/* All allocated rw locks are put into a
|
/* All allocated rw locks are put into a
|
||||||
list */
|
list */
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
UT_LIST_BASE_NODE_T(rw_lock_debug_t) debug_list;
|
UT_LIST_BASE_NODE_T(rw_lock_debug_t) debug_list;
|
||||||
/* In the debug version: pointer to the debug
|
/* In the debug version: pointer to the debug
|
||||||
info list of the lock */
|
info list of the lock */
|
||||||
ulint level; /* Debug version: level in the global latching
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
ulint level; /* Level in the global latching
|
||||||
order; default SYNC_LEVEL_NONE */
|
order; default SYNC_LEVEL_NONE */
|
||||||
char* cfile_name; /* File name where lock created */
|
char* cfile_name; /* File name where lock created */
|
||||||
ulint cline; /* Line where created */
|
ulint cline; /* Line where created */
|
||||||
@ -450,6 +460,7 @@ struct rw_lock_struct {
|
|||||||
|
|
||||||
#define RW_LOCK_MAGIC_N 22643
|
#define RW_LOCK_MAGIC_N 22643
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
/* The structure for storing debug info of an rw-lock */
|
/* The structure for storing debug info of an rw-lock */
|
||||||
struct rw_lock_debug_struct {
|
struct rw_lock_debug_struct {
|
||||||
|
|
||||||
@ -464,6 +475,7 @@ struct rw_lock_debug_struct {
|
|||||||
/* Debug structs are linked in a two-way
|
/* Debug structs are linked in a two-way
|
||||||
list */
|
list */
|
||||||
};
|
};
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
#ifndef UNIV_NONINL
|
#ifndef UNIV_NONINL
|
||||||
#include "sync0rw.ic"
|
#include "sync0rw.ic"
|
||||||
|
@ -20,6 +20,7 @@ rw_lock_s_lock_spin(
|
|||||||
be passed to another thread to unlock */
|
be passed to another thread to unlock */
|
||||||
char* file_name,/* in: file name where lock requested */
|
char* file_name,/* in: file name where lock requested */
|
||||||
ulint line); /* in: line where requested */
|
ulint line); /* in: line where requested */
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
Inserts the debug information for an rw-lock. */
|
Inserts the debug information for an rw-lock. */
|
||||||
|
|
||||||
@ -40,7 +41,7 @@ rw_lock_remove_debug_info(
|
|||||||
rw_lock_t* lock, /* in: rw-lock */
|
rw_lock_t* lock, /* in: rw-lock */
|
||||||
ulint pass, /* in: pass value */
|
ulint pass, /* in: pass value */
|
||||||
ulint lock_type); /* in: lock type */
|
ulint lock_type); /* in: lock type */
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
Accessor functions for rw lock. */
|
Accessor functions for rw lock. */
|
||||||
@ -132,8 +133,9 @@ rw_lock_s_lock_low(
|
|||||||
char* file_name, /* in: file name where lock requested */
|
char* file_name, /* in: file name where lock requested */
|
||||||
ulint line) /* in: line where requested */
|
ulint line) /* in: line where requested */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(rw_lock_get_mutex(lock)));
|
ut_ad(mutex_own(rw_lock_get_mutex(lock)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
/* Check if the writer field is free */
|
/* Check if the writer field is free */
|
||||||
|
|
||||||
if (lock->writer == RW_LOCK_NOT_LOCKED) {
|
if (lock->writer == RW_LOCK_NOT_LOCKED) {
|
||||||
@ -144,7 +146,6 @@ rw_lock_s_lock_low(
|
|||||||
rw_lock_add_debug_info(lock, pass, RW_LOCK_SHARED, file_name,
|
rw_lock_add_debug_info(lock, pass, RW_LOCK_SHARED, file_name,
|
||||||
line);
|
line);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lock->last_s_file_name = file_name;
|
lock->last_s_file_name = file_name;
|
||||||
lock->last_s_line = line;
|
lock->last_s_line = line;
|
||||||
|
|
||||||
@ -236,7 +237,9 @@ rw_lock_s_lock_func(
|
|||||||
the threads which have s-locked a latch. This would use some CPU
|
the threads which have s-locked a latch. This would use some CPU
|
||||||
time. */
|
time. */
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED)); /* see NOTE above */
|
ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED)); /* see NOTE above */
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
mutex_enter(rw_lock_get_mutex(lock));
|
mutex_enter(rw_lock_get_mutex(lock));
|
||||||
|
|
||||||
|
@ -185,6 +185,7 @@ sync_thread_levels_empty_gen(
|
|||||||
allowed to be owned by the thread,
|
allowed to be owned by the thread,
|
||||||
also purge_is_running mutex is
|
also purge_is_running mutex is
|
||||||
allowed */
|
allowed */
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
Checks that the current thread owns the mutex. Works only
|
Checks that the current thread owns the mutex. Works only
|
||||||
in the debug version. */
|
in the debug version. */
|
||||||
@ -217,6 +218,7 @@ Prints debug info of currently reserved mutexes. */
|
|||||||
void
|
void
|
||||||
mutex_list_print_info(void);
|
mutex_list_print_info(void);
|
||||||
/*========================*/
|
/*========================*/
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
NOT to be used outside this module except in debugging! Gets the value
|
NOT to be used outside this module except in debugging! Gets the value
|
||||||
of the lock word. */
|
of the lock word. */
|
||||||
@ -225,6 +227,7 @@ ulint
|
|||||||
mutex_get_lock_word(
|
mutex_get_lock_word(
|
||||||
/*================*/
|
/*================*/
|
||||||
mutex_t* mutex); /* in: mutex */
|
mutex_t* mutex); /* in: mutex */
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
NOT to be used outside this module except in debugging! Gets the waiters
|
NOT to be used outside this module except in debugging! Gets the waiters
|
||||||
field in a mutex. */
|
field in a mutex. */
|
||||||
@ -234,6 +237,7 @@ mutex_get_waiters(
|
|||||||
/*==============*/
|
/*==============*/
|
||||||
/* out: value to set */
|
/* out: value to set */
|
||||||
mutex_t* mutex); /* in: mutex */
|
mutex_t* mutex); /* in: mutex */
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
LATCHING ORDER WITHIN THE DATABASE
|
LATCHING ORDER WITHIN THE DATABASE
|
||||||
@ -442,13 +446,13 @@ struct mutex_struct {
|
|||||||
Otherwise, this is 0. */
|
Otherwise, this is 0. */
|
||||||
UT_LIST_NODE_T(mutex_t) list; /* All allocated mutexes are put into
|
UT_LIST_NODE_T(mutex_t) list; /* All allocated mutexes are put into
|
||||||
a list. Pointers to the next and prev. */
|
a list. Pointers to the next and prev. */
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
|
const char* file_name; /* File where the mutex was locked */
|
||||||
|
ulint line; /* Line where the mutex was locked */
|
||||||
os_thread_id_t thread_id; /* Debug version: The thread id of the
|
os_thread_id_t thread_id; /* Debug version: The thread id of the
|
||||||
thread which locked the mutex. */
|
thread which locked the mutex. */
|
||||||
char* file_name; /* Debug version: File name where the mutex
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
was locked */
|
ulint level; /* Level in the global latching
|
||||||
ulint line; /* Debug version: Line where the mutex was
|
|
||||||
locked */
|
|
||||||
ulint level; /* Debug version: level in the global latching
|
|
||||||
order; default SYNC_LEVEL_NONE */
|
order; default SYNC_LEVEL_NONE */
|
||||||
char* cfile_name; /* File name where mutex created */
|
char* cfile_name; /* File name where mutex created */
|
||||||
ulint cline; /* Line where created */
|
ulint cline; /* Line where created */
|
||||||
|
@ -25,6 +25,7 @@ mutex_spin_wait(
|
|||||||
mutex_t* mutex, /* in: pointer to mutex */
|
mutex_t* mutex, /* in: pointer to mutex */
|
||||||
char* file_name,/* in: file name where mutex requested */
|
char* file_name,/* in: file name where mutex requested */
|
||||||
ulint line); /* in: line where requested */
|
ulint line); /* in: line where requested */
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
Sets the debug information for a reserved mutex. */
|
Sets the debug information for a reserved mutex. */
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ mutex_set_debug_info(
|
|||||||
mutex_t* mutex, /* in: mutex */
|
mutex_t* mutex, /* in: mutex */
|
||||||
char* file_name, /* in: file where requested */
|
char* file_name, /* in: file where requested */
|
||||||
ulint line); /* in: line where requested */
|
ulint line); /* in: line where requested */
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
Releases the threads waiting in the primary wait array for this mutex. */
|
Releases the threads waiting in the primary wait array for this mutex. */
|
||||||
|
|
||||||
@ -200,9 +202,9 @@ mutex_exit(
|
|||||||
/*=======*/
|
/*=======*/
|
||||||
mutex_t* mutex) /* in: pointer to mutex */
|
mutex_t* mutex) /* in: pointer to mutex */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(mutex));
|
ut_ad(mutex_own(mutex));
|
||||||
|
|
||||||
#ifdef UNIV_SYNC_DEBUG
|
|
||||||
mutex->thread_id = ULINT_UNDEFINED;
|
mutex->thread_id = ULINT_UNDEFINED;
|
||||||
|
|
||||||
sync_thread_reset_level(mutex);
|
sync_thread_reset_level(mutex);
|
||||||
@ -249,14 +251,9 @@ mutex_enter_func(
|
|||||||
the atomic test_and_set; we could peek, and possibly save time. */
|
the atomic test_and_set; we could peek, and possibly save time. */
|
||||||
|
|
||||||
if (!mutex_test_and_set(mutex)) {
|
if (!mutex_test_and_set(mutex)) {
|
||||||
|
|
||||||
#ifdef UNIV_SYNC_DEBUG
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
mutex_set_debug_info(mutex, file_name, line);
|
mutex_set_debug_info(mutex, file_name, line);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mutex->file_name = file_name;
|
|
||||||
mutex->line = line;
|
|
||||||
|
|
||||||
return; /* Succeeded! */
|
return; /* Succeeded! */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,9 @@ trx_rsegf_get(
|
|||||||
|
|
||||||
header = TRX_RSEG + buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
header = TRX_RSEG + buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(header, SYNC_RSEG_HEADER);
|
buf_page_dbg_add_level(header, SYNC_RSEG_HEADER);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(header);
|
return(header);
|
||||||
}
|
}
|
||||||
@ -45,7 +47,9 @@ trx_rsegf_get_new(
|
|||||||
|
|
||||||
header = TRX_RSEG + buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
header = TRX_RSEG + buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(header, SYNC_RSEG_HEADER_NEW);
|
buf_page_dbg_add_level(header, SYNC_RSEG_HEADER_NEW);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(header);
|
return(header);
|
||||||
}
|
}
|
||||||
@ -64,7 +68,7 @@ trx_rsegf_get_nth_undo(
|
|||||||
if (n >= TRX_RSEG_N_SLOTS) {
|
if (n >= TRX_RSEG_N_SLOTS) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: Error: trying to get slot %lu of rseg\n", (unsigned long) n);
|
"InnoDB: Error: trying to get slot %lu of rseg\n", (unsigned long) n);
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(mtr_read_ulint(rsegf + TRX_RSEG_UNDO_SLOTS +
|
return(mtr_read_ulint(rsegf + TRX_RSEG_UNDO_SLOTS +
|
||||||
@ -85,7 +89,7 @@ trx_rsegf_set_nth_undo(
|
|||||||
if (n >= TRX_RSEG_N_SLOTS) {
|
if (n >= TRX_RSEG_N_SLOTS) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: Error: trying to set slot %lu of rseg\n", (unsigned long) n);
|
"InnoDB: Error: trying to set slot %lu of rseg\n", (unsigned long) n);
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
mlog_write_ulint(rsegf + TRX_RSEG_UNDO_SLOTS + n * TRX_RSEG_SLOT_SIZE,
|
mlog_write_ulint(rsegf + TRX_RSEG_UNDO_SLOTS + n * TRX_RSEG_SLOT_SIZE,
|
||||||
|
@ -60,7 +60,9 @@ trx_sys_get_nth_rseg(
|
|||||||
trx_sys_t* sys, /* in: trx system */
|
trx_sys_t* sys, /* in: trx system */
|
||||||
ulint n) /* in: index of slot */
|
ulint n) /* in: index of slot */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(kernel_mutex)));
|
ut_ad(mutex_own(&(kernel_mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(n < TRX_SYS_N_RSEGS);
|
ut_ad(n < TRX_SYS_N_RSEGS);
|
||||||
|
|
||||||
return(sys->rseg_array[n]);
|
return(sys->rseg_array[n]);
|
||||||
@ -98,7 +100,9 @@ trx_sysf_get(
|
|||||||
header = TRX_SYS + buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO,
|
header = TRX_SYS + buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO,
|
||||||
RW_X_LATCH, mtr);
|
RW_X_LATCH, mtr);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(header, SYNC_TRX_SYS_HEADER);
|
buf_page_dbg_add_level(header, SYNC_TRX_SYS_HEADER);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(header);
|
return(header);
|
||||||
}
|
}
|
||||||
@ -115,7 +119,9 @@ trx_sysf_rseg_get_space(
|
|||||||
ulint i, /* in: slot index == rseg id */
|
ulint i, /* in: slot index == rseg id */
|
||||||
mtr_t* mtr) /* in: mtr */
|
mtr_t* mtr) /* in: mtr */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(kernel_mutex)));
|
ut_ad(mutex_own(&(kernel_mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(sys_header);
|
ut_ad(sys_header);
|
||||||
ut_ad(i < TRX_SYS_N_RSEGS);
|
ut_ad(i < TRX_SYS_N_RSEGS);
|
||||||
|
|
||||||
@ -138,7 +144,9 @@ trx_sysf_rseg_get_page_no(
|
|||||||
mtr_t* mtr) /* in: mtr */
|
mtr_t* mtr) /* in: mtr */
|
||||||
{
|
{
|
||||||
ut_ad(sys_header);
|
ut_ad(sys_header);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(kernel_mutex)));
|
ut_ad(mutex_own(&(kernel_mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(i < TRX_SYS_N_RSEGS);
|
ut_ad(i < TRX_SYS_N_RSEGS);
|
||||||
|
|
||||||
return(mtr_read_ulint(sys_header + TRX_SYS_RSEGS
|
return(mtr_read_ulint(sys_header + TRX_SYS_RSEGS
|
||||||
@ -158,7 +166,9 @@ trx_sysf_rseg_set_space(
|
|||||||
ulint space, /* in: space id */
|
ulint space, /* in: space id */
|
||||||
mtr_t* mtr) /* in: mtr */
|
mtr_t* mtr) /* in: mtr */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(kernel_mutex)));
|
ut_ad(mutex_own(&(kernel_mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(sys_header);
|
ut_ad(sys_header);
|
||||||
ut_ad(i < TRX_SYS_N_RSEGS);
|
ut_ad(i < TRX_SYS_N_RSEGS);
|
||||||
|
|
||||||
@ -182,7 +192,9 @@ trx_sysf_rseg_set_page_no(
|
|||||||
slot is reset to unused */
|
slot is reset to unused */
|
||||||
mtr_t* mtr) /* in: mtr */
|
mtr_t* mtr) /* in: mtr */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(kernel_mutex)));
|
ut_ad(mutex_own(&(kernel_mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(sys_header);
|
ut_ad(sys_header);
|
||||||
ut_ad(i < TRX_SYS_N_RSEGS);
|
ut_ad(i < TRX_SYS_N_RSEGS);
|
||||||
|
|
||||||
@ -236,7 +248,9 @@ trx_get_on_id(
|
|||||||
{
|
{
|
||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(kernel_mutex)));
|
ut_ad(mutex_own(&(kernel_mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
|
trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
|
||||||
|
|
||||||
@ -266,7 +280,9 @@ trx_list_get_min_trx_id(void)
|
|||||||
{
|
{
|
||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(kernel_mutex)));
|
ut_ad(mutex_own(&(kernel_mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
trx = UT_LIST_GET_LAST(trx_sys->trx_list);
|
trx = UT_LIST_GET_LAST(trx_sys->trx_list);
|
||||||
|
|
||||||
@ -289,7 +305,9 @@ trx_is_active(
|
|||||||
{
|
{
|
||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(kernel_mutex)));
|
ut_ad(mutex_own(&(kernel_mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (ut_dulint_cmp(trx_id, trx_list_get_min_trx_id()) < 0) {
|
if (ut_dulint_cmp(trx_id, trx_list_get_min_trx_id()) < 0) {
|
||||||
|
|
||||||
@ -325,7 +343,9 @@ trx_sys_get_new_trx_id(void)
|
|||||||
{
|
{
|
||||||
dulint id;
|
dulint id;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* VERY important: after the database is started, max_trx_id value is
|
/* VERY important: after the database is started, max_trx_id value is
|
||||||
divisible by TRX_SYS_TRX_ID_WRITE_MARGIN, and the following if
|
divisible by TRX_SYS_TRX_ID_WRITE_MARGIN, and the following if
|
||||||
@ -355,7 +375,9 @@ trx_sys_get_new_trx_no(void)
|
|||||||
/*========================*/
|
/*========================*/
|
||||||
/* out: new, allocated trx number */
|
/* out: new, allocated trx number */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(trx_sys_get_new_trx_id());
|
return(trx_sys_get_new_trx_id());
|
||||||
}
|
}
|
||||||
|
@ -203,13 +203,9 @@ trx_sig_send(
|
|||||||
ulint type, /* in: signal type */
|
ulint type, /* in: signal type */
|
||||||
ulint sender, /* in: TRX_SIG_SELF or
|
ulint sender, /* in: TRX_SIG_SELF or
|
||||||
TRX_SIG_OTHER_SESS */
|
TRX_SIG_OTHER_SESS */
|
||||||
ibool reply, /* in: TRUE if the sender of the signal
|
|
||||||
wants reply after the operation induced
|
|
||||||
by the signal is completed; if type
|
|
||||||
is TRX_SIG_END_WAIT, this must be
|
|
||||||
FALSE */
|
|
||||||
que_thr_t* receiver_thr, /* in: query thread which wants the
|
que_thr_t* receiver_thr, /* in: query thread which wants the
|
||||||
reply, or NULL */
|
reply, or NULL; if type is
|
||||||
|
TRX_SIG_END_WAIT, this must be NULL */
|
||||||
trx_savept_t* savept, /* in: possible rollback savepoint, or
|
trx_savept_t* savept, /* in: possible rollback savepoint, or
|
||||||
NULL */
|
NULL */
|
||||||
que_thr_t** next_thr); /* in/out: next query thread to run;
|
que_thr_t** next_thr); /* in/out: next query thread to run;
|
||||||
@ -225,7 +221,6 @@ been handled. */
|
|||||||
void
|
void
|
||||||
trx_sig_reply(
|
trx_sig_reply(
|
||||||
/*==========*/
|
/*==========*/
|
||||||
trx_t* trx, /* in: trx handle */
|
|
||||||
trx_sig_t* sig, /* in: signal */
|
trx_sig_t* sig, /* in: signal */
|
||||||
que_thr_t** next_thr); /* in/out: next query thread to run;
|
que_thr_t** next_thr); /* in/out: next query thread to run;
|
||||||
if the value which is passed in is
|
if the value which is passed in is
|
||||||
@ -297,15 +292,9 @@ struct trx_sig_struct{
|
|||||||
TRX_SIG_BEING_HANDLED */
|
TRX_SIG_BEING_HANDLED */
|
||||||
ulint sender; /* TRX_SIG_SELF or
|
ulint sender; /* TRX_SIG_SELF or
|
||||||
TRX_SIG_OTHER_SESS */
|
TRX_SIG_OTHER_SESS */
|
||||||
ibool reply; /* TRUE if the sender of the signal
|
que_thr_t* receiver; /* non-NULL if the sender of the signal
|
||||||
wants reply after the operation induced
|
wants reply after the operation induced
|
||||||
by the signal is completed; if this
|
by the signal is completed */
|
||||||
field is TRUE and the receiver field
|
|
||||||
below is NULL, then a SUCCESS message
|
|
||||||
is sent to the client of the session
|
|
||||||
to which this trx belongs */
|
|
||||||
que_thr_t* receiver; /* query thread which wants the reply,
|
|
||||||
or NULL */
|
|
||||||
trx_savept_t savept; /* possible rollback savepoint */
|
trx_savept_t savept; /* possible rollback savepoint */
|
||||||
UT_LIST_NODE_T(trx_sig_t)
|
UT_LIST_NODE_T(trx_sig_t)
|
||||||
signals; /* queue of pending signals to the
|
signals; /* queue of pending signals to the
|
||||||
|
@ -126,7 +126,9 @@ trx_undo_page_get(
|
|||||||
|
|
||||||
page = buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
page = buf_page_get(space, page_no, RW_X_LATCH, mtr);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_TRX_UNDO_PAGE);
|
buf_page_dbg_add_level(page, SYNC_TRX_UNDO_PAGE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(page);
|
return(page);
|
||||||
}
|
}
|
||||||
@ -146,7 +148,9 @@ trx_undo_page_get_s_latched(
|
|||||||
|
|
||||||
page = buf_page_get(space, page_no, RW_S_LATCH, mtr);
|
page = buf_page_get(space, page_no, RW_S_LATCH, mtr);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_TRX_UNDO_PAGE);
|
buf_page_dbg_add_level(page, SYNC_TRX_UNDO_PAGE);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(page);
|
return(page);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ Created 6/25/1996 Heikki Tuuri
|
|||||||
|
|
||||||
#include "univ.i"
|
#include "univ.i"
|
||||||
#include "ut0byte.h"
|
#include "ut0byte.h"
|
||||||
#include "hash0hash.h"
|
|
||||||
#include "trx0types.h"
|
#include "trx0types.h"
|
||||||
#include "srv0srv.h"
|
#include "srv0srv.h"
|
||||||
#include "trx0types.h"
|
#include "trx0types.h"
|
||||||
@ -19,52 +18,14 @@ Created 6/25/1996 Heikki Tuuri
|
|||||||
#include "que0types.h"
|
#include "que0types.h"
|
||||||
#include "data0data.h"
|
#include "data0data.h"
|
||||||
#include "rem0rec.h"
|
#include "rem0rec.h"
|
||||||
#include "com0com.h"
|
|
||||||
|
|
||||||
/* The session system global data structure */
|
|
||||||
extern sess_sys_t* sess_sys;
|
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
Sets the session id in a client message. */
|
|
||||||
|
|
||||||
void
|
|
||||||
sess_cli_msg_set_sess(
|
|
||||||
/*==================*/
|
|
||||||
byte* str, /* in/out: message string */
|
|
||||||
dulint sess_id);/* in: session id */
|
|
||||||
/***************************************************************************
|
|
||||||
Sets the message type of a message from the client. */
|
|
||||||
UNIV_INLINE
|
|
||||||
void
|
|
||||||
sess_cli_msg_set_type(
|
|
||||||
/*==================*/
|
|
||||||
byte* str, /* in: message string */
|
|
||||||
ulint type); /* in: message type */
|
|
||||||
/***************************************************************************
|
|
||||||
Gets the message type of a message from the server. */
|
|
||||||
UNIV_INLINE
|
|
||||||
ulint
|
|
||||||
sess_srv_msg_get_type(
|
|
||||||
/*==================*/
|
|
||||||
/* out: message type */
|
|
||||||
byte* str); /* in: message string */
|
|
||||||
/***************************************************************************
|
|
||||||
Creates a session sytem at database start. */
|
|
||||||
|
|
||||||
void
|
|
||||||
sess_sys_init_at_db_start(void);
|
|
||||||
/*===========================*/
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
Opens a session. */
|
Opens a session. */
|
||||||
|
|
||||||
sess_t*
|
sess_t*
|
||||||
sess_open(
|
sess_open(void);
|
||||||
/*======*/
|
/*============*/
|
||||||
/* out, own: session object */
|
/* out, own: session object */
|
||||||
com_endpoint_t* endpoint, /* in: communication endpoint used
|
|
||||||
for communicating with the client */
|
|
||||||
byte* addr_buf, /* in: client address */
|
|
||||||
ulint addr_len); /* in: client address length */
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
Closes a session, freeing the memory occupied by it, if it is in a state
|
Closes a session, freeing the memory occupied by it, if it is in a state
|
||||||
where it should be closed. */
|
where it should be closed. */
|
||||||
@ -74,200 +35,25 @@ sess_try_close(
|
|||||||
/*===========*/
|
/*===========*/
|
||||||
/* out: TRUE if closed */
|
/* out: TRUE if closed */
|
||||||
sess_t* sess); /* in, own: session object */
|
sess_t* sess); /* in, own: session object */
|
||||||
/*************************************************************************
|
|
||||||
Initializes the first fields of a message to client. */
|
|
||||||
|
|
||||||
void
|
|
||||||
sess_srv_msg_init(
|
|
||||||
/*==============*/
|
|
||||||
sess_t* sess, /* in: session object */
|
|
||||||
byte* buf, /* in: message buffer, must be at least of size
|
|
||||||
SESS_SRV_MSG_DATA */
|
|
||||||
ulint type); /* in: message type */
|
|
||||||
/*************************************************************************
|
|
||||||
Sends a simple message to client. */
|
|
||||||
|
|
||||||
void
|
|
||||||
sess_srv_msg_send_simple(
|
|
||||||
/*=====================*/
|
|
||||||
sess_t* sess, /* in: session object */
|
|
||||||
ulint type, /* in: message type */
|
|
||||||
ulint rel_kernel); /* in: SESS_RELEASE_KERNEL or
|
|
||||||
SESS_NOT_RELEASE_KERNEL */
|
|
||||||
/***************************************************************************
|
|
||||||
When a command has been completed, this function sends the message about it
|
|
||||||
to the client. */
|
|
||||||
|
|
||||||
void
|
|
||||||
sess_command_completed_message(
|
|
||||||
/*===========================*/
|
|
||||||
sess_t* sess, /* in: session */
|
|
||||||
byte* msg, /* in: message buffer */
|
|
||||||
ulint len); /* in: message data length */
|
|
||||||
|
|
||||||
|
|
||||||
/* The session handle. All fields are protected by the kernel mutex */
|
/* The session handle. All fields are protected by the kernel mutex */
|
||||||
struct sess_struct{
|
struct sess_struct{
|
||||||
dulint id; /* session id */
|
|
||||||
dulint usr_id; /* user id */
|
|
||||||
hash_node_t hash; /* hash chain node */
|
|
||||||
ulint refer_count; /* reference count to the session
|
|
||||||
object: when this drops to zero
|
|
||||||
and the session has no query graphs
|
|
||||||
left, discarding the session object
|
|
||||||
is allowed */
|
|
||||||
dulint error_count; /* if this counter has increased while
|
|
||||||
a thread is parsing an SQL command,
|
|
||||||
its graph should be discarded */
|
|
||||||
ibool disconnecting; /* TRUE if the session is to be
|
|
||||||
disconnected when its reference
|
|
||||||
count drops to 0 */
|
|
||||||
ulint state; /* state of the session */
|
ulint state; /* state of the session */
|
||||||
dulint msgs_sent; /* count of messages sent to the
|
|
||||||
client */
|
|
||||||
dulint msgs_recv; /* count of messages received from the
|
|
||||||
client */
|
|
||||||
ibool client_waits; /* when the session receives a message
|
|
||||||
from the client, this set to TRUE, and
|
|
||||||
when the session sends a message to
|
|
||||||
the client this is set to FALSE */
|
|
||||||
trx_t* trx; /* transaction object permanently
|
trx_t* trx; /* transaction object permanently
|
||||||
assigned for the session: the
|
assigned for the session: the
|
||||||
transaction instance designated by the
|
transaction instance designated by the
|
||||||
trx id changes, but the memory
|
trx id changes, but the memory
|
||||||
structure is preserved */
|
structure is preserved */
|
||||||
ulint next_graph_id; /* next query graph id to assign */
|
|
||||||
UT_LIST_BASE_NODE_T(que_t)
|
UT_LIST_BASE_NODE_T(que_t)
|
||||||
graphs; /* query graphs belonging to this
|
graphs; /* query graphs belonging to this
|
||||||
session */
|
session */
|
||||||
/*------------------------------*/
|
|
||||||
ulint err_no; /* latest error number, 0 if none */
|
|
||||||
char* err_str; /* latest error string */
|
|
||||||
ulint err_len; /* error string length */
|
|
||||||
/*------------------------------*/
|
|
||||||
com_endpoint_t* endpoint; /* server communications endpoint used
|
|
||||||
to communicate with the client */
|
|
||||||
char* addr_buf; /* client address string */
|
|
||||||
ulint addr_len; /* client address string length */
|
|
||||||
/*------------------------------*/
|
|
||||||
byte* big_msg; /* if the client sends a message which
|
|
||||||
does not fit in a single packet,
|
|
||||||
it is assembled in this buffer; if
|
|
||||||
this field is not NULL, it is assumed
|
|
||||||
that the message should be catenated
|
|
||||||
here */
|
|
||||||
ulint big_msg_size; /* size of the big message buffer */
|
|
||||||
ulint big_msg_len; /* length of data in the big message
|
|
||||||
buffer */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The session system; this is protected by the kernel mutex */
|
|
||||||
struct sess_sys_struct{
|
|
||||||
ulint state; /* state of the system:
|
|
||||||
SESS_SYS_RUNNING or
|
|
||||||
SESS_SYS_SHUTTING_DOWN */
|
|
||||||
sess_t* shutdown_req; /* if shutdown was requested by some
|
|
||||||
session, confirmation of shutdown
|
|
||||||
completion should be sent to this
|
|
||||||
session */
|
|
||||||
dulint free_sess_id; /* first unused session id */
|
|
||||||
hash_table_t* hash; /* hash table of the sessions */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/*---------------------------------------------------*/
|
|
||||||
/* The format of an incoming message from a client */
|
|
||||||
#define SESS_CLI_MSG_CHECKSUM 0 /* the checksum should be the first
|
|
||||||
field in the message */
|
|
||||||
#define SESS_CLI_MSG_SESS_ID 4 /* this is set to 0 if the client
|
|
||||||
wants to connect and establish
|
|
||||||
a new session */
|
|
||||||
#define SESS_CLI_MSG_SESS_ID_CHECK 12 /* checksum of the sess id field */
|
|
||||||
#define SESS_CLI_MSG_TYPE 16
|
|
||||||
#define SESS_CLI_MSG_NO 20
|
|
||||||
#define SESS_CLI_MSG_CONTINUE 28 /* 0, or SESS_MSG_FIRST_PART
|
|
||||||
SESS_MSG_MIDDLE_PART, or
|
|
||||||
SESS_MSG_LAST_PART */
|
|
||||||
#define SESS_CLI_MSG_CONT_SIZE 32 /* size of a multipart message in
|
|
||||||
kilobytes (rounded upwards) */
|
|
||||||
#define SESS_CLI_MSG_DATA 36
|
|
||||||
/*---------------------------------------------------*/
|
|
||||||
|
|
||||||
/* Client-to-session message types */
|
|
||||||
#define SESS_CLI_CONNECT 1
|
|
||||||
#define SESS_CLI_PREPARE 2
|
|
||||||
#define SESS_CLI_EXECUTE 3
|
|
||||||
#define SESS_CLI_BREAK_EXECUTION 4
|
|
||||||
|
|
||||||
/* Client-to-session statement command types */
|
|
||||||
#define SESS_COMM_FETCH_NEXT 1
|
|
||||||
#define SESS_COMM_FETCH_PREV 2
|
|
||||||
#define SESS_COMM_FETCH_FIRST 3
|
|
||||||
#define SESS_COMM_FETCH_LAST 4
|
|
||||||
#define SESS_COMM_FETCH_NTH 5
|
|
||||||
#define SESS_COMM_FETCH_NTH_LAST 6
|
|
||||||
#define SESS_COMM_EXECUTE 7
|
|
||||||
#define SESS_COMM_NO_COMMAND 8
|
|
||||||
|
|
||||||
/*---------------------------------------------------*/
|
|
||||||
/* The format of an outgoing message from a session to the client */
|
|
||||||
#define SESS_SRV_MSG_CHECKSUM 0 /* the checksum should be the first
|
|
||||||
field in the message */
|
|
||||||
#define SESS_SRV_MSG_SESS_ID 4
|
|
||||||
#define SESS_SRV_MSG_TYPE 12
|
|
||||||
#define SESS_SRV_MSG_NO 16
|
|
||||||
#define SESS_SRV_MSG_CONTINUE 24 /* 0, or SESS_MSG_FIRST_PART
|
|
||||||
SESS_MSG_MIDDLE_PART, or
|
|
||||||
SESS_MSG_LAST_PART */
|
|
||||||
#define SESS_SRV_MSG_CONT_SIZE 28 /* size of a multipart message
|
|
||||||
in kilobytes (rounded upward) */
|
|
||||||
#define SESS_SRV_MSG_DATA 32
|
|
||||||
/*---------------------------------------------------*/
|
|
||||||
|
|
||||||
/* Session-to-client message types */
|
|
||||||
#define SESS_SRV_ACCEPT_CONNECT 1
|
|
||||||
#define SESS_SRV_SUCCESS 2
|
|
||||||
#define SESS_SRV_ERROR 3
|
|
||||||
|
|
||||||
/* Multipart messages */
|
|
||||||
#define SESS_MSG_SINGLE_PART 0
|
|
||||||
#define SESS_MSG_FIRST_PART 1
|
|
||||||
#define SESS_MSG_MIDDLE_PART 2
|
|
||||||
#define SESS_MSG_LAST_PART 3
|
|
||||||
|
|
||||||
/* Error numbers */
|
|
||||||
#define SESS_ERR_NONE 0
|
|
||||||
#define SESS_ERR_TRX_COMMITTED 1
|
|
||||||
#define SESS_ERR_TRX_ROLLED_BACK 2
|
|
||||||
#define SESS_ERR_SESSION_DISCONNECTED 3
|
|
||||||
#define SESS_ERR_REPLY_FAILED 4
|
|
||||||
#define SESS_ERR_CANNOT_BREAK_OP 5
|
|
||||||
#define SESS_ERR_MSG_LOST 6
|
|
||||||
#define SESS_ERR_MSG_CORRUPTED 7
|
|
||||||
#define SESS_ERR_EXTRANEOUS_MSG 8
|
|
||||||
#define SESS_ERR_OUT_OF_MEMORY 9
|
|
||||||
#define SESS_ERR_SQL_ERROR 10
|
|
||||||
#define SESS_ERR_STMT_NOT_FOUND 11
|
|
||||||
#define SESS_ERR_STMT_NOT_READY 12
|
|
||||||
#define SESS_ERR_EXTRANEOUS_SRV_MSG 13
|
|
||||||
#define SESS_ERR_BREAK_BY_CLIENT 14
|
|
||||||
|
|
||||||
/* Session states */
|
/* Session states */
|
||||||
#define SESS_ACTIVE 1
|
#define SESS_ACTIVE 1
|
||||||
#define SESS_ERROR 2 /* session contains an error message
|
#define SESS_ERROR 2 /* session contains an error message
|
||||||
which has not yet been communicated
|
which has not yet been communicated
|
||||||
to the client */
|
to the client */
|
||||||
/* Session system states */
|
|
||||||
#define SESS_SYS_RUNNING 1
|
|
||||||
#define SESS_SYS_SHUTTING_DOWN 2
|
|
||||||
|
|
||||||
/* Session hash table size */
|
|
||||||
#define SESS_HASH_SIZE 1024
|
|
||||||
|
|
||||||
/* Flags used in sess_srv_msg_send */
|
|
||||||
#define SESS_RELEASE_KERNEL 1
|
|
||||||
#define SESS_NOT_RELEASE_KERNEL 2
|
|
||||||
|
|
||||||
#ifndef UNIV_NONINL
|
#ifndef UNIV_NONINL
|
||||||
#include "usr0sess.ic"
|
#include "usr0sess.ic"
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,27 +5,3 @@ Sessions
|
|||||||
|
|
||||||
Created 6/25/1996 Heikki Tuuri
|
Created 6/25/1996 Heikki Tuuri
|
||||||
*******************************************************/
|
*******************************************************/
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
Sets the message type of a message from the client. */
|
|
||||||
UNIV_INLINE
|
|
||||||
void
|
|
||||||
sess_cli_msg_set_type(
|
|
||||||
/*==================*/
|
|
||||||
byte* str, /* in: message string */
|
|
||||||
ulint type) /* in: message type */
|
|
||||||
{
|
|
||||||
mach_write_to_4(str + SESS_CLI_MSG_TYPE, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
Gets the message type of a message from the server. */
|
|
||||||
UNIV_INLINE
|
|
||||||
ulint
|
|
||||||
sess_srv_msg_get_type(
|
|
||||||
/*==================*/
|
|
||||||
/* out: message type */
|
|
||||||
byte* str) /* in: message string */
|
|
||||||
{
|
|
||||||
return(mach_read_from_4(str + SESS_SRV_MSG_TYPE));
|
|
||||||
}
|
|
||||||
|
@ -10,7 +10,5 @@ Created 6/25/1996 Heikki Tuuri
|
|||||||
#define usr0types_h
|
#define usr0types_h
|
||||||
|
|
||||||
typedef struct sess_struct sess_t;
|
typedef struct sess_struct sess_t;
|
||||||
typedef struct sess_sys_struct sess_sys_t;
|
|
||||||
typedef struct sess_sig_struct sess_sig_t;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,7 +10,6 @@ Created 1/30/1994 Heikki Tuuri
|
|||||||
#define ut0dbg_h
|
#define ut0dbg_h
|
||||||
|
|
||||||
#include "univ.i"
|
#include "univ.i"
|
||||||
#include <assert.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "os0thread.h"
|
#include "os0thread.h"
|
||||||
|
|
||||||
@ -24,7 +23,7 @@ extern const char* ut_dbg_msg_assert_fail;
|
|||||||
extern const char* ut_dbg_msg_trap;
|
extern const char* ut_dbg_msg_trap;
|
||||||
extern const char* ut_dbg_msg_stop;
|
extern const char* ut_dbg_msg_stop;
|
||||||
|
|
||||||
#define ut_a(EXPR)\
|
#define ut_a(EXPR) do {\
|
||||||
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
|
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
|
||||||
ut_print_timestamp(stderr);\
|
ut_print_timestamp(stderr);\
|
||||||
fprintf(stderr, ut_dbg_msg_assert_fail,\
|
fprintf(stderr, ut_dbg_msg_assert_fail,\
|
||||||
@ -33,38 +32,32 @@ extern const char* ut_dbg_msg_stop;
|
|||||||
fputs("InnoDB: Failing assertion: " #EXPR "\n", stderr);\
|
fputs("InnoDB: Failing assertion: " #EXPR "\n", stderr);\
|
||||||
fputs(ut_dbg_msg_trap, stderr);\
|
fputs(ut_dbg_msg_trap, stderr);\
|
||||||
ut_dbg_stop_threads = TRUE;\
|
ut_dbg_stop_threads = TRUE;\
|
||||||
(*ut_dbg_null_ptr)++;\
|
if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\
|
||||||
}\
|
}\
|
||||||
if (ut_dbg_stop_threads) {\
|
if (ut_dbg_stop_threads) {\
|
||||||
fprintf(stderr, ut_dbg_msg_stop,\
|
fprintf(stderr, ut_dbg_msg_stop,\
|
||||||
os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
|
os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
|
||||||
os_thread_sleep(1000000000);\
|
os_thread_sleep(1000000000);\
|
||||||
}
|
}\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#define ut_error\
|
#define ut_error do {\
|
||||||
ut_print_timestamp(stderr);\
|
ut_print_timestamp(stderr);\
|
||||||
fprintf(stderr, ut_dbg_msg_assert_fail,\
|
fprintf(stderr, ut_dbg_msg_assert_fail,\
|
||||||
os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
|
os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
|
||||||
fprintf(stderr, ut_dbg_msg_trap);\
|
fprintf(stderr, ut_dbg_msg_trap);\
|
||||||
ut_dbg_stop_threads = TRUE;\
|
ut_dbg_stop_threads = TRUE;\
|
||||||
(*ut_dbg_null_ptr)++;
|
if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#ifdef UNIV_DEBUG
|
#ifdef UNIV_DEBUG
|
||||||
#define ut_ad(EXPR) ut_a(EXPR)
|
#define ut_ad(EXPR) ut_a(EXPR)
|
||||||
#define ut_d(EXPR) {EXPR;}
|
#define ut_d(EXPR) do {EXPR;} while (0)
|
||||||
#else
|
#else
|
||||||
#define ut_ad(EXPR)
|
#define ut_ad(EXPR)
|
||||||
#define ut_d(EXPR)
|
#define ut_d(EXPR)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define UT_NOT_USED(A) A = A
|
#define UT_NOT_USED(A) A = A
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -953,7 +953,9 @@ lock_rec_get_next_on_page(
|
|||||||
ulint space;
|
ulint space;
|
||||||
ulint page_no;
|
ulint page_no;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(lock_get_type(lock) == LOCK_REC);
|
ut_ad(lock_get_type(lock) == LOCK_REC);
|
||||||
|
|
||||||
space = lock->un_member.rec_lock.space;
|
space = lock->un_member.rec_lock.space;
|
||||||
@ -990,7 +992,9 @@ lock_rec_get_first_on_page_addr(
|
|||||||
{
|
{
|
||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
lock = HASH_GET_FIRST(lock_sys->rec_hash,
|
lock = HASH_GET_FIRST(lock_sys->rec_hash,
|
||||||
lock_rec_hash(space, page_no));
|
lock_rec_hash(space, page_no));
|
||||||
@ -1048,7 +1052,9 @@ lock_rec_get_first_on_page(
|
|||||||
ulint space;
|
ulint space;
|
||||||
ulint page_no;
|
ulint page_no;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
hash = buf_frame_get_lock_hash_val(ptr);
|
hash = buf_frame_get_lock_hash_val(ptr);
|
||||||
|
|
||||||
@ -1080,7 +1086,9 @@ lock_rec_get_next(
|
|||||||
rec_t* rec, /* in: record on a page */
|
rec_t* rec, /* in: record on a page */
|
||||||
lock_t* lock) /* in: lock */
|
lock_t* lock) /* in: lock */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(lock_get_type(lock) == LOCK_REC);
|
ut_ad(lock_get_type(lock) == LOCK_REC);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -1109,7 +1117,9 @@ lock_rec_get_first(
|
|||||||
{
|
{
|
||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
lock = lock_rec_get_first_on_page(rec);
|
lock = lock_rec_get_first_on_page(rec);
|
||||||
|
|
||||||
@ -1197,7 +1207,9 @@ lock_rec_get_prev(
|
|||||||
ulint page_no;
|
ulint page_no;
|
||||||
lock_t* found_lock = NULL;
|
lock_t* found_lock = NULL;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(lock_get_type(in_lock) == LOCK_REC);
|
ut_ad(lock_get_type(in_lock) == LOCK_REC);
|
||||||
|
|
||||||
space = in_lock->un_member.rec_lock.space;
|
space = in_lock->un_member.rec_lock.space;
|
||||||
@ -1237,7 +1249,9 @@ lock_table_has(
|
|||||||
{
|
{
|
||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* Look for stronger locks the same trx already has on the table */
|
/* Look for stronger locks the same trx already has on the table */
|
||||||
|
|
||||||
@ -1281,7 +1295,9 @@ lock_rec_has_expl(
|
|||||||
{
|
{
|
||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad((precise_mode & LOCK_MODE_MASK) == LOCK_S
|
ut_ad((precise_mode & LOCK_MODE_MASK) == LOCK_S
|
||||||
|| (precise_mode & LOCK_MODE_MASK) == LOCK_X);
|
|| (precise_mode & LOCK_MODE_MASK) == LOCK_X);
|
||||||
ut_ad(!(precise_mode & LOCK_INSERT_INTENTION));
|
ut_ad(!(precise_mode & LOCK_INSERT_INTENTION));
|
||||||
@ -1328,7 +1344,9 @@ lock_rec_other_has_expl_req(
|
|||||||
{
|
{
|
||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(mode == LOCK_X || mode == LOCK_S);
|
ut_ad(mode == LOCK_X || mode == LOCK_S);
|
||||||
ut_ad(gap == 0 || gap == LOCK_GAP);
|
ut_ad(gap == 0 || gap == LOCK_GAP);
|
||||||
ut_ad(wait == 0 || wait == LOCK_WAIT);
|
ut_ad(wait == 0 || wait == LOCK_WAIT);
|
||||||
@ -1367,7 +1385,9 @@ lock_rec_other_has_conflicting(
|
|||||||
{
|
{
|
||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
lock = lock_rec_get_first(rec);
|
lock = lock_rec_get_first(rec);
|
||||||
|
|
||||||
@ -1399,7 +1419,9 @@ lock_rec_find_similar_on_page(
|
|||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
ulint heap_no;
|
ulint heap_no;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
heap_no = rec_get_heap_no(rec);
|
heap_no = rec_get_heap_no(rec);
|
||||||
|
|
||||||
@ -1433,7 +1455,9 @@ lock_sec_rec_some_has_impl_off_kernel(
|
|||||||
{
|
{
|
||||||
page_t* page;
|
page_t* page;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(!(index->type & DICT_CLUSTERED));
|
ut_ad(!(index->type & DICT_CLUSTERED));
|
||||||
ut_ad(page_rec_is_user_rec(rec));
|
ut_ad(page_rec_is_user_rec(rec));
|
||||||
|
|
||||||
@ -1491,7 +1515,9 @@ lock_rec_create(
|
|||||||
ulint n_bits;
|
ulint n_bits;
|
||||||
ulint n_bytes;
|
ulint n_bytes;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
page = buf_frame_align(rec);
|
page = buf_frame_align(rec);
|
||||||
space = buf_frame_get_space_id(page);
|
space = buf_frame_get_space_id(page);
|
||||||
@ -1575,7 +1601,9 @@ lock_rec_enqueue_waiting(
|
|||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* Test if there already is some other reason to suspend thread:
|
/* Test if there already is some other reason to suspend thread:
|
||||||
we do not enqueue a lock request if the query thread should be
|
we do not enqueue a lock request if the query thread should be
|
||||||
@ -1583,7 +1611,7 @@ lock_rec_enqueue_waiting(
|
|||||||
|
|
||||||
if (que_thr_stop(thr)) {
|
if (que_thr_stop(thr)) {
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
|
|
||||||
return(DB_QUE_THR_SUSPENDED);
|
return(DB_QUE_THR_SUSPENDED);
|
||||||
}
|
}
|
||||||
@ -1661,7 +1689,9 @@ lock_rec_add_to_queue(
|
|||||||
page_t* page;
|
page_t* page;
|
||||||
ibool somebody_waits = FALSE;
|
ibool somebody_waits = FALSE;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad((type_mode & (LOCK_WAIT | LOCK_GAP))
|
ut_ad((type_mode & (LOCK_WAIT | LOCK_GAP))
|
||||||
|| ((type_mode & LOCK_MODE_MASK) != LOCK_S)
|
|| ((type_mode & LOCK_MODE_MASK) != LOCK_S)
|
||||||
|| !lock_rec_other_has_expl_req(LOCK_X, 0, LOCK_WAIT, rec, trx));
|
|| !lock_rec_other_has_expl_req(LOCK_X, 0, LOCK_WAIT, rec, trx));
|
||||||
@ -1741,7 +1771,9 @@ lock_rec_lock_fast(
|
|||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
ulint heap_no;
|
ulint heap_no;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
|
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
|
||||||
|| lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
|
|| lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
|
||||||
ut_ad((LOCK_MODE_MASK & mode) != LOCK_X
|
ut_ad((LOCK_MODE_MASK & mode) != LOCK_X
|
||||||
@ -1805,7 +1837,9 @@ lock_rec_lock_slow(
|
|||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
ulint err;
|
ulint err;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
|
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
|
||||||
|| lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
|
|| lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
|
||||||
ut_ad((LOCK_MODE_MASK & mode) != LOCK_X
|
ut_ad((LOCK_MODE_MASK & mode) != LOCK_X
|
||||||
@ -1867,7 +1901,9 @@ lock_rec_lock(
|
|||||||
{
|
{
|
||||||
ulint err;
|
ulint err;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
|
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
|
||||||
|| lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
|
|| lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
|
||||||
ut_ad((LOCK_MODE_MASK & mode) != LOCK_X
|
ut_ad((LOCK_MODE_MASK & mode) != LOCK_X
|
||||||
@ -1905,7 +1941,9 @@ lock_rec_has_to_wait_in_queue(
|
|||||||
ulint page_no;
|
ulint page_no;
|
||||||
ulint heap_no;
|
ulint heap_no;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(lock_get_wait(wait_lock));
|
ut_ad(lock_get_wait(wait_lock));
|
||||||
ut_ad(lock_get_type(wait_lock) == LOCK_REC);
|
ut_ad(lock_get_type(wait_lock) == LOCK_REC);
|
||||||
|
|
||||||
@ -1938,7 +1976,9 @@ lock_grant(
|
|||||||
/*=======*/
|
/*=======*/
|
||||||
lock_t* lock) /* in: waiting lock request */
|
lock_t* lock) /* in: waiting lock request */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
lock_reset_lock_and_trx_wait(lock);
|
lock_reset_lock_and_trx_wait(lock);
|
||||||
|
|
||||||
@ -1980,7 +2020,9 @@ lock_rec_cancel(
|
|||||||
/*============*/
|
/*============*/
|
||||||
lock_t* lock) /* in: waiting record lock request */
|
lock_t* lock) /* in: waiting record lock request */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(lock_get_type(lock) == LOCK_REC);
|
ut_ad(lock_get_type(lock) == LOCK_REC);
|
||||||
|
|
||||||
/* Reset the bit (there can be only one set bit) in the lock bitmap */
|
/* Reset the bit (there can be only one set bit) in the lock bitmap */
|
||||||
@ -2013,7 +2055,9 @@ lock_rec_dequeue_from_page(
|
|||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(lock_get_type(in_lock) == LOCK_REC);
|
ut_ad(lock_get_type(in_lock) == LOCK_REC);
|
||||||
|
|
||||||
trx = in_lock->trx;
|
trx = in_lock->trx;
|
||||||
@ -2056,7 +2100,9 @@ lock_rec_discard(
|
|||||||
ulint page_no;
|
ulint page_no;
|
||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(lock_get_type(in_lock) == LOCK_REC);
|
ut_ad(lock_get_type(in_lock) == LOCK_REC);
|
||||||
|
|
||||||
trx = in_lock->trx;
|
trx = in_lock->trx;
|
||||||
@ -2085,7 +2131,9 @@ lock_rec_free_all_from_discard_page(
|
|||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
lock_t* next_lock;
|
lock_t* next_lock;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
space = buf_frame_get_space_id(page);
|
space = buf_frame_get_space_id(page);
|
||||||
page_no = buf_frame_get_page_no(page);
|
page_no = buf_frame_get_page_no(page);
|
||||||
@ -2118,7 +2166,9 @@ lock_rec_reset_and_release_wait(
|
|||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
ulint heap_no;
|
ulint heap_no;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
heap_no = rec_get_heap_no(rec);
|
heap_no = rec_get_heap_no(rec);
|
||||||
|
|
||||||
@ -2150,7 +2200,9 @@ lock_rec_inherit_to_gap(
|
|||||||
{
|
{
|
||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
lock = lock_rec_get_first(rec);
|
lock = lock_rec_get_first(rec);
|
||||||
|
|
||||||
@ -2180,7 +2232,9 @@ lock_rec_inherit_to_gap_if_gap_lock(
|
|||||||
{
|
{
|
||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
lock = lock_rec_get_first(rec);
|
lock = lock_rec_get_first(rec);
|
||||||
|
|
||||||
@ -2213,7 +2267,9 @@ lock_rec_move(
|
|||||||
ulint heap_no;
|
ulint heap_no;
|
||||||
ulint type_mode;
|
ulint type_mode;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
heap_no = rec_get_heap_no(donator);
|
heap_no = rec_get_heap_no(donator);
|
||||||
|
|
||||||
@ -2849,7 +2905,9 @@ lock_deadlock_occurs(
|
|||||||
char* err_buf;
|
char* err_buf;
|
||||||
|
|
||||||
ut_ad(trx && lock);
|
ut_ad(trx && lock);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
retry:
|
retry:
|
||||||
/* We check that adding this trx to the waits-for graph
|
/* We check that adding this trx to the waits-for graph
|
||||||
does not produce a cycle. First mark all active transactions
|
does not produce a cycle. First mark all active transactions
|
||||||
@ -2925,7 +2983,9 @@ lock_deadlock_recursive(
|
|||||||
ulint ret;
|
ulint ret;
|
||||||
|
|
||||||
ut_a(trx && start && wait_lock);
|
ut_a(trx && start && wait_lock);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (trx->deadlock_mark == 1) {
|
if (trx->deadlock_mark == 1) {
|
||||||
/* We have already exhaustively searched the subtree starting
|
/* We have already exhaustively searched the subtree starting
|
||||||
@ -3116,7 +3176,9 @@ lock_table_create(
|
|||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
|
|
||||||
ut_ad(table && trx);
|
ut_ad(table && trx);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (type_mode == LOCK_AUTO_INC) {
|
if (type_mode == LOCK_AUTO_INC) {
|
||||||
/* Only one trx can have the lock on the table
|
/* Only one trx can have the lock on the table
|
||||||
@ -3166,7 +3228,9 @@ lock_table_remove_low(
|
|||||||
dict_table_t* table;
|
dict_table_t* table;
|
||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
table = lock->un_member.tab_lock.table;
|
table = lock->un_member.tab_lock.table;
|
||||||
trx = lock->trx;
|
trx = lock->trx;
|
||||||
@ -3200,14 +3264,16 @@ lock_table_enqueue_waiting(
|
|||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* Test if there already is some other reason to suspend thread:
|
/* Test if there already is some other reason to suspend thread:
|
||||||
we do not enqueue a lock request if the query thread should be
|
we do not enqueue a lock request if the query thread should be
|
||||||
stopped anyway */
|
stopped anyway */
|
||||||
|
|
||||||
if (que_thr_stop(thr)) {
|
if (que_thr_stop(thr)) {
|
||||||
ut_a(0);
|
ut_error;
|
||||||
|
|
||||||
return(DB_QUE_THR_SUSPENDED);
|
return(DB_QUE_THR_SUSPENDED);
|
||||||
}
|
}
|
||||||
@ -3270,7 +3336,9 @@ lock_table_other_has_incompatible(
|
|||||||
{
|
{
|
||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
lock = UT_LIST_GET_LAST(table->locks);
|
lock = UT_LIST_GET_LAST(table->locks);
|
||||||
|
|
||||||
@ -3420,7 +3488,9 @@ lock_table_dequeue(
|
|||||||
{
|
{
|
||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(lock_get_type(in_lock) == LOCK_TABLE);
|
ut_ad(lock_get_type(in_lock) == LOCK_TABLE);
|
||||||
|
|
||||||
lock = UT_LIST_GET_NEXT(un_member.tab_lock.locks, in_lock);
|
lock = UT_LIST_GET_NEXT(un_member.tab_lock.locks, in_lock);
|
||||||
@ -3476,7 +3546,9 @@ lock_release_off_kernel(
|
|||||||
ulint count;
|
ulint count;
|
||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
lock = UT_LIST_GET_LAST(trx->trx_locks);
|
lock = UT_LIST_GET_LAST(trx->trx_locks);
|
||||||
|
|
||||||
@ -3537,7 +3609,9 @@ lock_cancel_waiting_and_release(
|
|||||||
/*============================*/
|
/*============================*/
|
||||||
lock_t* lock) /* in: waiting lock request */
|
lock_t* lock) /* in: waiting lock request */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (lock_get_type(lock) == LOCK_REC) {
|
if (lock_get_type(lock) == LOCK_REC) {
|
||||||
|
|
||||||
@ -3570,7 +3644,9 @@ lock_reset_all_on_table_for_trx(
|
|||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
lock_t* prev_lock;
|
lock_t* prev_lock;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
lock = UT_LIST_GET_LAST(trx->trx_locks);
|
lock = UT_LIST_GET_LAST(trx->trx_locks);
|
||||||
|
|
||||||
@ -3632,7 +3708,9 @@ lock_table_print(
|
|||||||
500 bytes */
|
500 bytes */
|
||||||
lock_t* lock) /* in: table type lock */
|
lock_t* lock) /* in: table type lock */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_a(lock_get_type(lock) == LOCK_TABLE);
|
ut_a(lock_get_type(lock) == LOCK_TABLE);
|
||||||
|
|
||||||
buf += sprintf(buf, "TABLE LOCK table %s trx id %lu %lu",
|
buf += sprintf(buf, "TABLE LOCK table %s trx id %lu %lu",
|
||||||
@ -3679,7 +3757,9 @@ lock_rec_print(
|
|||||||
char* buf_start = buf;
|
char* buf_start = buf;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_a(lock_get_type(lock) == LOCK_REC);
|
ut_a(lock_get_type(lock) == LOCK_REC);
|
||||||
|
|
||||||
space = lock->un_member.rec_lock.space;
|
space = lock->un_member.rec_lock.space;
|
||||||
@ -3743,7 +3823,9 @@ lock_rec_print(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (page) {
|
if (page) {
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_NO_ORDER_CHECK);
|
buf_page_dbg_add_level(page, SYNC_NO_ORDER_CHECK);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < lock_rec_get_n_bits(lock); i++) {
|
for (i = 0; i < lock_rec_get_n_bits(lock); i++) {
|
||||||
@ -3788,7 +3870,9 @@ lock_get_n_rec_locks(void)
|
|||||||
ulint n_locks = 0;
|
ulint n_locks = 0;
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
for (i = 0; i < hash_get_n_cells(lock_sys->rec_hash); i++) {
|
for (i = 0; i < hash_get_n_cells(lock_sys->rec_hash); i++) {
|
||||||
|
|
||||||
@ -4060,7 +4144,9 @@ lock_table_queue_validate(
|
|||||||
lock_t* lock;
|
lock_t* lock;
|
||||||
ibool is_waiting;
|
ibool is_waiting;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
is_waiting = FALSE;
|
is_waiting = FALSE;
|
||||||
|
|
||||||
@ -4213,12 +4299,16 @@ lock_rec_validate_page(
|
|||||||
ulint i;
|
ulint i;
|
||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!mutex_own(&kernel_mutex));
|
ut_ad(!mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
mtr_start(&mtr);
|
mtr_start(&mtr);
|
||||||
|
|
||||||
page = buf_page_get(space, page_no, RW_X_LATCH, &mtr);
|
page = buf_page_get(space, page_no, RW_X_LATCH, &mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_NO_ORDER_CHECK);
|
buf_page_dbg_add_level(page, SYNC_NO_ORDER_CHECK);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
lock_mutex_enter_kernel();
|
lock_mutex_enter_kernel();
|
||||||
loop:
|
loop:
|
||||||
@ -4464,7 +4554,9 @@ lock_rec_convert_impl_to_expl(
|
|||||||
{
|
{
|
||||||
trx_t* impl_trx;
|
trx_t* impl_trx;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(page_rec_is_user_rec(rec));
|
ut_ad(page_rec_is_user_rec(rec));
|
||||||
|
|
||||||
if (index->type & DICT_CLUSTERED) {
|
if (index->type & DICT_CLUSTERED) {
|
||||||
|
@ -133,7 +133,9 @@ log_buf_pool_get_oldest_modification(void)
|
|||||||
{
|
{
|
||||||
dulint lsn;
|
dulint lsn;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
lsn = buf_pool_get_oldest_modification();
|
lsn = buf_pool_get_oldest_modification();
|
||||||
|
|
||||||
@ -231,7 +233,9 @@ log_write_low(
|
|||||||
ulint data_len;
|
ulint data_len;
|
||||||
byte* log_block;
|
byte* log_block;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log->mutex)));
|
ut_ad(mutex_own(&(log->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
part_loop:
|
part_loop:
|
||||||
/* Calculate a part length */
|
/* Calculate a part length */
|
||||||
|
|
||||||
@ -298,7 +302,9 @@ log_close(void)
|
|||||||
log_t* log = log_sys;
|
log_t* log = log_sys;
|
||||||
ulint checkpoint_age;
|
ulint checkpoint_age;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log->mutex)));
|
ut_ad(mutex_own(&(log->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
lsn = log->lsn;
|
lsn = log->lsn;
|
||||||
|
|
||||||
@ -414,7 +420,9 @@ log_group_get_capacity(
|
|||||||
/* out: capacity in bytes */
|
/* out: capacity in bytes */
|
||||||
log_group_t* group) /* in: log group */
|
log_group_t* group) /* in: log group */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return((group->file_size - LOG_FILE_HDR_SIZE) * group->n_files);
|
return((group->file_size - LOG_FILE_HDR_SIZE) * group->n_files);
|
||||||
}
|
}
|
||||||
@ -430,7 +438,9 @@ log_group_calc_size_offset(
|
|||||||
ulint offset, /* in: real offset within the log group */
|
ulint offset, /* in: real offset within the log group */
|
||||||
log_group_t* group) /* in: log group */
|
log_group_t* group) /* in: log group */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(offset - LOG_FILE_HDR_SIZE * (1 + offset / group->file_size));
|
return(offset - LOG_FILE_HDR_SIZE * (1 + offset / group->file_size));
|
||||||
}
|
}
|
||||||
@ -446,7 +456,9 @@ log_group_calc_real_offset(
|
|||||||
ulint offset, /* in: size offset within the log group */
|
ulint offset, /* in: size offset within the log group */
|
||||||
log_group_t* group) /* in: log group */
|
log_group_t* group) /* in: log group */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
return(offset + LOG_FILE_HDR_SIZE
|
return(offset + LOG_FILE_HDR_SIZE
|
||||||
* (1 + offset / (group->file_size - LOG_FILE_HDR_SIZE)));
|
* (1 + offset / (group->file_size - LOG_FILE_HDR_SIZE)));
|
||||||
@ -469,7 +481,9 @@ log_group_calc_lsn_offset(
|
|||||||
ib_longlong group_size;
|
ib_longlong group_size;
|
||||||
ib_longlong offset;
|
ib_longlong offset;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* If total log file size is > 2 GB we can easily get overflows
|
/* If total log file size is > 2 GB we can easily get overflows
|
||||||
with 32-bit integers. Use 64-bit integers instead. */
|
with 32-bit integers. Use 64-bit integers instead. */
|
||||||
@ -583,7 +597,9 @@ log_calc_max_ages(void)
|
|||||||
ulint archive_margin;
|
ulint archive_margin;
|
||||||
ulint smallest_archive_margin;
|
ulint smallest_archive_margin;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!mutex_own(&(log_sys->mutex)));
|
ut_ad(!mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
mutex_enter(&(log_sys->mutex));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
@ -873,7 +889,9 @@ log_flush_do_unlocks(
|
|||||||
ulint code) /* in: any ORed combination of LOG_UNLOCK_FLUSH_LOCK
|
ulint code) /* in: any ORed combination of LOG_UNLOCK_FLUSH_LOCK
|
||||||
and LOG_UNLOCK_NONE_FLUSHED_LOCK */
|
and LOG_UNLOCK_NONE_FLUSHED_LOCK */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* NOTE that we must own the log mutex when doing the setting of the
|
/* NOTE that we must own the log mutex when doing the setting of the
|
||||||
events: this is because transactions will wait for these events to
|
events: this is because transactions will wait for these events to
|
||||||
@ -905,7 +923,9 @@ log_group_check_flush_completion(
|
|||||||
/* out: LOG_UNLOCK_NONE_FLUSHED_LOCK or 0 */
|
/* out: LOG_UNLOCK_NONE_FLUSHED_LOCK or 0 */
|
||||||
log_group_t* group) /* in: log group */
|
log_group_t* group) /* in: log group */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (!log_sys->one_flushed && group->n_pending_writes == 0) {
|
if (!log_sys->one_flushed && group->n_pending_writes == 0) {
|
||||||
|
|
||||||
@ -939,7 +959,9 @@ log_sys_check_flush_completion(void)
|
|||||||
ulint move_start;
|
ulint move_start;
|
||||||
ulint move_end;
|
ulint move_end;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (log_sys->n_pending_writes == 0) {
|
if (log_sys->n_pending_writes == 0) {
|
||||||
|
|
||||||
@ -1002,7 +1024,7 @@ log_io_complete(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_a(0); /* We currently use synchronous writing of the
|
ut_error; /* We currently use synchronous writing of the
|
||||||
logs and cannot end up here! */
|
logs and cannot end up here! */
|
||||||
|
|
||||||
if (srv_unix_file_flush_method != SRV_UNIX_O_DSYNC
|
if (srv_unix_file_flush_method != SRV_UNIX_O_DSYNC
|
||||||
@ -1046,7 +1068,9 @@ log_group_file_header_flush(
|
|||||||
|
|
||||||
UT_NOT_USED(type);
|
UT_NOT_USED(type);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
ut_a(nth_file < group->n_files);
|
ut_a(nth_file < group->n_files);
|
||||||
|
|
||||||
@ -1114,7 +1138,9 @@ log_group_write_buf(
|
|||||||
ulint next_offset;
|
ulint next_offset;
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_a(len % OS_FILE_LOG_BLOCK_SIZE == 0);
|
ut_a(len % OS_FILE_LOG_BLOCK_SIZE == 0);
|
||||||
ut_a(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
|
ut_a(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
|
||||||
|
|
||||||
@ -1513,7 +1539,9 @@ void
|
|||||||
log_complete_checkpoint(void)
|
log_complete_checkpoint(void)
|
||||||
/*=========================*/
|
/*=========================*/
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(log_sys->n_pending_checkpoint_writes == 0);
|
ut_ad(log_sys->n_pending_checkpoint_writes == 0);
|
||||||
|
|
||||||
log_sys->next_checkpoint_no
|
log_sys->next_checkpoint_no
|
||||||
@ -1604,7 +1632,9 @@ log_group_checkpoint(
|
|||||||
byte* buf;
|
byte* buf;
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_a(LOG_CHECKPOINT_SIZE <= OS_FILE_LOG_BLOCK_SIZE);
|
ut_a(LOG_CHECKPOINT_SIZE <= OS_FILE_LOG_BLOCK_SIZE);
|
||||||
|
|
||||||
buf = group->checkpoint_buf;
|
buf = group->checkpoint_buf;
|
||||||
@ -1758,7 +1788,9 @@ log_group_read_checkpoint_info(
|
|||||||
log_group_t* group, /* in: log group */
|
log_group_t* group, /* in: log group */
|
||||||
ulint field) /* in: LOG_CHECKPOINT_1 or LOG_CHECKPOINT_2 */
|
ulint field) /* in: LOG_CHECKPOINT_1 or LOG_CHECKPOINT_2 */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
log_sys->n_log_ios++;
|
log_sys->n_log_ios++;
|
||||||
|
|
||||||
@ -1776,7 +1808,9 @@ log_groups_write_checkpoint_info(void)
|
|||||||
{
|
{
|
||||||
log_group_t* group;
|
log_group_t* group;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
||||||
|
|
||||||
@ -2041,7 +2075,9 @@ log_group_read_log_seg(
|
|||||||
ulint source_offset;
|
ulint source_offset;
|
||||||
ibool sync;
|
ibool sync;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
sync = FALSE;
|
sync = FALSE;
|
||||||
|
|
||||||
@ -2113,9 +2149,11 @@ log_group_archive_file_header_write(
|
|||||||
byte* buf;
|
byte* buf;
|
||||||
ulint dest_offset;
|
ulint dest_offset;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_a(0);
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
ut_a(nth_file < group->n_files);
|
ut_a(nth_file < group->n_files);
|
||||||
|
|
||||||
@ -2152,9 +2190,11 @@ log_group_archive_completed_header_write(
|
|||||||
byte* buf;
|
byte* buf;
|
||||||
ulint dest_offset;
|
ulint dest_offset;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_a(0);
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_a(nth_file < group->n_files);
|
ut_a(nth_file < group->n_files);
|
||||||
|
|
||||||
buf = *(group->archive_file_header_bufs + nth_file);
|
buf = *(group->archive_file_header_bufs + nth_file);
|
||||||
@ -2193,9 +2233,11 @@ log_group_archive(
|
|||||||
ulint n_files;
|
ulint n_files;
|
||||||
ulint open_mode;
|
ulint open_mode;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_a(0);
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
start_lsn = log_sys->archived_lsn;
|
start_lsn = log_sys->archived_lsn;
|
||||||
|
|
||||||
@ -2320,9 +2362,11 @@ log_archive_groups(void)
|
|||||||
{
|
{
|
||||||
log_group_t* group;
|
log_group_t* group;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_a(0);
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
||||||
|
|
||||||
@ -2345,9 +2389,11 @@ log_archive_write_complete_groups(void)
|
|||||||
dulint end_lsn;
|
dulint end_lsn;
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_a(0);
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
||||||
|
|
||||||
@ -2409,9 +2455,11 @@ void
|
|||||||
log_archive_check_completion_low(void)
|
log_archive_check_completion_low(void)
|
||||||
/*==================================*/
|
/*==================================*/
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_a(0);
|
ut_a(0);
|
||||||
|
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (log_sys->n_pending_archive_ios == 0
|
if (log_sys->n_pending_archive_ios == 0
|
||||||
&& log_sys->archiving_phase == LOG_ARCHIVE_READ) {
|
&& log_sys->archiving_phase == LOG_ARCHIVE_READ) {
|
||||||
@ -2513,7 +2561,6 @@ loop:
|
|||||||
|
|
||||||
if (calc_new_limit) {
|
if (calc_new_limit) {
|
||||||
ut_a(log_sys->archive_buf_size % OS_FILE_LOG_BLOCK_SIZE
|
ut_a(log_sys->archive_buf_size % OS_FILE_LOG_BLOCK_SIZE
|
||||||
== 0);
|
|
||||||
limit_lsn = ut_dulint_add(start_lsn,
|
limit_lsn = ut_dulint_add(start_lsn,
|
||||||
log_sys->archive_buf_size);
|
log_sys->archive_buf_size);
|
||||||
|
|
||||||
@ -2649,7 +2696,9 @@ log_archive_close_groups(
|
|||||||
log_group_t* group;
|
log_group_t* group;
|
||||||
ulint trunc_len;
|
ulint trunc_len;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (log_sys->archiving_state == LOG_ARCH_OFF) {
|
if (log_sys->archiving_state == LOG_ARCH_OFF) {
|
||||||
|
|
||||||
@ -3172,7 +3221,9 @@ log_check_log_recs(
|
|||||||
byte* buf1;
|
byte* buf1;
|
||||||
byte* scan_buf;
|
byte* scan_buf;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
|
|
||||||
|
@ -165,14 +165,16 @@ void
|
|||||||
recv_sys_empty_hash(void)
|
recv_sys_empty_hash(void)
|
||||||
/*=====================*/
|
/*=====================*/
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(recv_sys->mutex)));
|
ut_ad(mutex_own(&(recv_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
if (recv_sys->n_addrs != 0) {
|
if (recv_sys->n_addrs != 0) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: Error: %lu pages with log records were left unprocessed!\n"
|
"InnoDB: Error: %lu pages with log records were left unprocessed!\n"
|
||||||
"InnoDB: Maximum page number with log records on it %lu\n",
|
"InnoDB: Maximum page number with log records on it %lu\n",
|
||||||
(ulong) recv_sys->n_addrs,
|
(ulong) recv_sys->n_addrs,
|
||||||
(ulong) recv_max_parsed_page_no);
|
(ulong) recv_max_parsed_page_no);
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
hash_table_free(recv_sys->addr_hash);
|
hash_table_free(recv_sys->addr_hash);
|
||||||
@ -1078,7 +1080,9 @@ recv_recover_page(
|
|||||||
&mtr);
|
&mtr);
|
||||||
ut_a(success);
|
ut_a(success);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page, SYNC_NO_ORDER_CHECK);
|
buf_page_dbg_add_level(page, SYNC_NO_ORDER_CHECK);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the newest modification lsn from the page */
|
/* Read the newest modification lsn from the page */
|
||||||
@ -1280,12 +1284,11 @@ loop:
|
|||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
|
ut_ad(!allow_ibuf == mutex_own(&log_sys->mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
if (!allow_ibuf) {
|
if (!allow_ibuf) {
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
|
||||||
|
|
||||||
recv_no_ibuf_operations = TRUE;
|
recv_no_ibuf_operations = TRUE;
|
||||||
} else {
|
|
||||||
ut_ad(!mutex_own(&(log_sys->mutex)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
recv_sys->apply_log_recs = TRUE;
|
recv_sys->apply_log_recs = TRUE;
|
||||||
@ -1317,8 +1320,10 @@ loop:
|
|||||||
page = buf_page_get(space, page_no,
|
page = buf_page_get(space, page_no,
|
||||||
RW_X_LATCH, &mtr);
|
RW_X_LATCH, &mtr);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(page,
|
buf_page_dbg_add_level(page,
|
||||||
SYNC_NO_ORDER_CHECK);
|
SYNC_NO_ORDER_CHECK);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
recv_recover_page(FALSE, FALSE, page,
|
recv_recover_page(FALSE, FALSE, page,
|
||||||
space, page_no);
|
space, page_no);
|
||||||
mtr_commit(&mtr);
|
mtr_commit(&mtr);
|
||||||
@ -1541,7 +1546,9 @@ recv_update_replicate(
|
|||||||
|
|
||||||
replica = buf_page_get(space + RECV_REPLICA_SPACE_ADD, page_no,
|
replica = buf_page_get(space + RECV_REPLICA_SPACE_ADD, page_no,
|
||||||
RW_X_LATCH, &mtr);
|
RW_X_LATCH, &mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(replica, SYNC_NO_ORDER_CHECK);
|
buf_page_dbg_add_level(replica, SYNC_NO_ORDER_CHECK);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
ptr = recv_parse_or_apply_log_rec_body(type, body, end_ptr, replica,
|
ptr = recv_parse_or_apply_log_rec_body(type, body, end_ptr, replica,
|
||||||
&mtr);
|
&mtr);
|
||||||
@ -1610,7 +1617,9 @@ recv_compare_replicate(
|
|||||||
|
|
||||||
replica = buf_page_get(space + RECV_REPLICA_SPACE_ADD, page_no,
|
replica = buf_page_get(space + RECV_REPLICA_SPACE_ADD, page_no,
|
||||||
RW_X_LATCH, &mtr);
|
RW_X_LATCH, &mtr);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(replica, SYNC_NO_ORDER_CHECK);
|
buf_page_dbg_add_level(replica, SYNC_NO_ORDER_CHECK);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
recv_check_identical(page + FIL_PAGE_DATA,
|
recv_check_identical(page + FIL_PAGE_DATA,
|
||||||
replica + FIL_PAGE_DATA,
|
replica + FIL_PAGE_DATA,
|
||||||
@ -1651,7 +1660,9 @@ recv_compare_spaces(
|
|||||||
IB__FILE__, __LINE__,
|
IB__FILE__, __LINE__,
|
||||||
&mtr);
|
&mtr);
|
||||||
if (frame) {
|
if (frame) {
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(frame, SYNC_NO_ORDER_CHECK);
|
buf_page_dbg_add_level(frame, SYNC_NO_ORDER_CHECK);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_memcpy(page, frame, UNIV_PAGE_SIZE);
|
ut_memcpy(page, frame, UNIV_PAGE_SIZE);
|
||||||
} else {
|
} else {
|
||||||
/* Read it from file */
|
/* Read it from file */
|
||||||
@ -1664,7 +1675,9 @@ recv_compare_spaces(
|
|||||||
IB__FILE__, __LINE__,
|
IB__FILE__, __LINE__,
|
||||||
&mtr);
|
&mtr);
|
||||||
if (frame) {
|
if (frame) {
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
buf_page_dbg_add_level(frame, SYNC_NO_ORDER_CHECK);
|
buf_page_dbg_add_level(frame, SYNC_NO_ORDER_CHECK);
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_memcpy(replica, frame, UNIV_PAGE_SIZE);
|
ut_memcpy(replica, frame, UNIV_PAGE_SIZE);
|
||||||
} else {
|
} else {
|
||||||
/* Read it from file */
|
/* Read it from file */
|
||||||
@ -1916,7 +1929,9 @@ recv_parse_log_recs(
|
|||||||
byte* body;
|
byte* body;
|
||||||
ulint n_recs;
|
ulint n_recs;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(!ut_dulint_is_zero(recv_sys->parse_start_lsn));
|
ut_ad(!ut_dulint_is_zero(recv_sys->parse_start_lsn));
|
||||||
loop:
|
loop:
|
||||||
ptr = recv_sys->buf + recv_sys->recovered_offset;
|
ptr = recv_sys->buf + recv_sys->recovered_offset;
|
||||||
@ -2899,8 +2914,9 @@ recv_reset_logs(
|
|||||||
{
|
{
|
||||||
log_group_t* group;
|
log_group_t* group;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(log_sys->mutex)));
|
ut_ad(mutex_own(&(log_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
log_sys->lsn = ut_dulint_align_up(lsn, OS_FILE_LOG_BLOCK_SIZE);
|
log_sys->lsn = ut_dulint_align_up(lsn, OS_FILE_LOG_BLOCK_SIZE);
|
||||||
|
|
||||||
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
group = UT_LIST_GET_FIRST(log_sys->log_groups);
|
||||||
|
@ -7,6 +7,7 @@ but is included in mem0mem.* !
|
|||||||
Created 6/9/1994 Heikki Tuuri
|
Created 6/9/1994 Heikki Tuuri
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifdef UNIV_MEM_DEBUG
|
||||||
mutex_t mem_hash_mutex; /* The mutex which protects in the
|
mutex_t mem_hash_mutex; /* The mutex which protects in the
|
||||||
debug version the hash table containing
|
debug version the hash table containing
|
||||||
the list of live memory heaps, and
|
the list of live memory heaps, and
|
||||||
@ -16,12 +17,11 @@ mutex_t mem_hash_mutex; /* The mutex which protects in the
|
|||||||
extent of memory allocations. Only used in the debug version.
|
extent of memory allocations. Only used in the debug version.
|
||||||
Protected by mem_hash_mutex above. */
|
Protected by mem_hash_mutex above. */
|
||||||
|
|
||||||
ulint mem_n_created_heaps = 0;
|
static ulint mem_n_created_heaps = 0;
|
||||||
ulint mem_n_allocations = 0;
|
static ulint mem_n_allocations = 0;
|
||||||
ulint mem_total_allocated_memory = 0;
|
static ulint mem_total_allocated_memory = 0;
|
||||||
ulint mem_current_allocated_memory = 0;
|
static ulint mem_current_allocated_memory = 0;
|
||||||
ulint mem_max_allocated_memory = 0;
|
static ulint mem_max_allocated_memory = 0;
|
||||||
ulint mem_last_print_info = 0;
|
|
||||||
|
|
||||||
/* Size of the hash table for memory management tracking */
|
/* Size of the hash table for memory management tracking */
|
||||||
#define MEM_HASH_SIZE 997
|
#define MEM_HASH_SIZE 997
|
||||||
@ -43,12 +43,12 @@ struct mem_hash_node_struct {
|
|||||||
typedef UT_LIST_BASE_NODE_T(mem_hash_node_t) mem_hash_cell_t;
|
typedef UT_LIST_BASE_NODE_T(mem_hash_node_t) mem_hash_cell_t;
|
||||||
|
|
||||||
/* The hash table of allocated heaps */
|
/* The hash table of allocated heaps */
|
||||||
mem_hash_cell_t mem_hash_table[MEM_HASH_SIZE];
|
static mem_hash_cell_t mem_hash_table[MEM_HASH_SIZE];
|
||||||
|
|
||||||
/* The base node of the list of all allocated heaps */
|
/* The base node of the list of all allocated heaps */
|
||||||
mem_hash_cell_t mem_all_list_base;
|
static mem_hash_cell_t mem_all_list_base;
|
||||||
|
|
||||||
ibool mem_hash_initialized = FALSE;
|
static ibool mem_hash_initialized = FALSE;
|
||||||
|
|
||||||
|
|
||||||
UNIV_INLINE
|
UNIV_INLINE
|
||||||
@ -65,45 +65,44 @@ mem_hash_get_nth_cell(ulint i)
|
|||||||
|
|
||||||
return(&(mem_hash_table[i]));
|
return(&(mem_hash_table[i]));
|
||||||
}
|
}
|
||||||
|
#endif /* UNIV_MEM_DEBUG */
|
||||||
|
|
||||||
/* Accessor functions for a memory field in the debug version */
|
/* Accessor functions for a memory field in the debug version */
|
||||||
|
|
||||||
void
|
void
|
||||||
mem_field_header_set_len(byte* field, ulint len)
|
mem_field_header_set_len(byte* field, ulint len)
|
||||||
{
|
{
|
||||||
ut_ad(len >= 0);
|
mach_write_to_4(field - 2 * sizeof(ulint), len);
|
||||||
|
|
||||||
mach_write(field - 2 * sizeof(ulint), len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ulint
|
ulint
|
||||||
mem_field_header_get_len(byte* field)
|
mem_field_header_get_len(byte* field)
|
||||||
{
|
{
|
||||||
return(mach_read(field - 2 * sizeof(ulint)));
|
return(mach_read_from_4(field - 2 * sizeof(ulint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mem_field_header_set_check(byte* field, ulint check)
|
mem_field_header_set_check(byte* field, ulint check)
|
||||||
{
|
{
|
||||||
mach_write(field - sizeof(ulint), check);
|
mach_write_to_4(field - sizeof(ulint), check);
|
||||||
}
|
}
|
||||||
|
|
||||||
ulint
|
ulint
|
||||||
mem_field_header_get_check(byte* field)
|
mem_field_header_get_check(byte* field)
|
||||||
{
|
{
|
||||||
return(mach_read(field - sizeof(ulint)));
|
return(mach_read_from_4(field - sizeof(ulint)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
mem_field_trailer_set_check(byte* field, ulint check)
|
mem_field_trailer_set_check(byte* field, ulint check)
|
||||||
{
|
{
|
||||||
mach_write(field + mem_field_header_get_len(field), check);
|
mach_write_to_4(field + mem_field_header_get_len(field), check);
|
||||||
}
|
}
|
||||||
|
|
||||||
ulint
|
ulint
|
||||||
mem_field_trailer_get_check(byte* field)
|
mem_field_trailer_get_check(byte* field)
|
||||||
{
|
{
|
||||||
return(mach_read(field +
|
return(mach_read_from_4(field +
|
||||||
mem_field_header_get_len(field)));
|
mem_field_header_get_len(field)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,6 +163,7 @@ mem_field_init(
|
|||||||
mem_field_header_set_check(usr_buf, rnd);
|
mem_field_header_set_check(usr_buf, rnd);
|
||||||
mem_field_trailer_set_check(usr_buf, rnd);
|
mem_field_trailer_set_check(usr_buf, rnd);
|
||||||
|
|
||||||
|
#ifdef UNIV_MEM_DEBUG
|
||||||
/* Update the memory allocation information */
|
/* Update the memory allocation information */
|
||||||
|
|
||||||
mutex_enter(&mem_hash_mutex);
|
mutex_enter(&mem_hash_mutex);
|
||||||
@ -182,6 +182,7 @@ mem_field_init(
|
|||||||
combination of 0xBA and 0xBE */
|
combination of 0xBA and 0xBE */
|
||||||
|
|
||||||
mem_init_buf(usr_buf, n);
|
mem_init_buf(usr_buf, n);
|
||||||
|
#endif /* UNIV_MEM_DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
@ -191,12 +192,14 @@ void
|
|||||||
mem_field_erase(
|
mem_field_erase(
|
||||||
/*============*/
|
/*============*/
|
||||||
byte* buf, /* in: memory field */
|
byte* buf, /* in: memory field */
|
||||||
ulint n) /* in: how many bytes the user requested */
|
ulint n __attribute__((unused)))
|
||||||
|
/* in: how many bytes the user requested */
|
||||||
{
|
{
|
||||||
byte* usr_buf;
|
byte* usr_buf;
|
||||||
|
|
||||||
usr_buf = buf + MEM_FIELD_HEADER_SIZE;
|
usr_buf = buf + MEM_FIELD_HEADER_SIZE;
|
||||||
|
|
||||||
|
#ifdef UNIV_MEM_DEBUG
|
||||||
mutex_enter(&mem_hash_mutex);
|
mutex_enter(&mem_hash_mutex);
|
||||||
mem_current_allocated_memory -= n;
|
mem_current_allocated_memory -= n;
|
||||||
mutex_exit(&mem_hash_mutex);
|
mutex_exit(&mem_hash_mutex);
|
||||||
@ -208,8 +211,10 @@ mem_field_erase(
|
|||||||
combination of 0xDE and 0xAD */
|
combination of 0xDE and 0xAD */
|
||||||
|
|
||||||
mem_erase_buf(buf, MEM_SPACE_NEEDED(n));
|
mem_erase_buf(buf, MEM_SPACE_NEEDED(n));
|
||||||
|
#endif /* UNIV_MEM_DEBUG */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef UNIV_MEM_DEBUG
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
Initializes a buffer to a random combination of hex BA and BE.
|
Initializes a buffer to a random combination of hex BA and BE.
|
||||||
Used to initialize allocated memory. */
|
Used to initialize allocated memory. */
|
||||||
@ -372,6 +377,7 @@ mem_hash_remove(
|
|||||||
|
|
||||||
mutex_exit(&mem_hash_mutex);
|
mutex_exit(&mem_hash_mutex);
|
||||||
}
|
}
|
||||||
|
#endif /* UNIV_MEM_DEBUG */
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
Checks a memory heap for consistency and prints the contents if requested.
|
Checks a memory heap for consistency and prints the contents if requested.
|
||||||
|
@ -259,7 +259,9 @@ mem_pool_fill_free_list(
|
|||||||
mem_area_t* area2;
|
mem_area_t* area2;
|
||||||
ibool ret;
|
ibool ret;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&(pool->mutex)));
|
ut_ad(mutex_own(&(pool->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
if (i >= 63) {
|
if (i >= 63) {
|
||||||
/* We come here when we have run out of space in the
|
/* We come here when we have run out of space in the
|
||||||
@ -296,7 +298,7 @@ mem_pool_fill_free_list(
|
|||||||
if (UT_LIST_GET_LEN(pool->free_list[i + 1]) == 0) {
|
if (UT_LIST_GET_LEN(pool->free_list[i + 1]) == 0) {
|
||||||
mem_analyze_corruption((byte*)area);
|
mem_analyze_corruption((byte*)area);
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
UT_LIST_REMOVE(free_list, pool->free_list[i + 1], area);
|
UT_LIST_REMOVE(free_list, pool->free_list[i + 1], area);
|
||||||
@ -374,7 +376,7 @@ mem_area_alloc(
|
|||||||
"InnoDB: Probably a race condition because now the area is marked free!\n");
|
"InnoDB: Probably a race condition because now the area is marked free!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UT_LIST_GET_LEN(pool->free_list[n]) == 0) {
|
if (UT_LIST_GET_LEN(pool->free_list[n]) == 0) {
|
||||||
@ -384,7 +386,7 @@ mem_area_alloc(
|
|||||||
(ulong) n);
|
(ulong) n);
|
||||||
mem_analyze_corruption((byte*)area);
|
mem_analyze_corruption((byte*)area);
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_ad(mem_area_get_size(area) == ut_2_exp(n));
|
ut_ad(mem_area_get_size(area) == ut_2_exp(n));
|
||||||
@ -480,7 +482,7 @@ mem_area_free(
|
|||||||
"InnoDB: element is marked free!\n");
|
"InnoDB: element is marked free!\n");
|
||||||
|
|
||||||
mem_analyze_corruption((byte*)area);
|
mem_analyze_corruption((byte*)area);
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
size = mem_area_get_size(area);
|
size = mem_area_get_size(area);
|
||||||
@ -491,7 +493,7 @@ mem_area_free(
|
|||||||
"InnoDB: previous allocated area!\n");
|
"InnoDB: previous allocated area!\n");
|
||||||
|
|
||||||
mem_analyze_corruption((byte*)area);
|
mem_analyze_corruption((byte*)area);
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UNIV_LIGHT_MEM_DEBUG
|
#ifdef UNIV_LIGHT_MEM_DEBUG
|
||||||
@ -508,7 +510,7 @@ mem_area_free(
|
|||||||
(ulong) size, (ulong) next_size);
|
(ulong) size, (ulong) next_size);
|
||||||
mem_analyze_corruption((byte*)area);
|
mem_analyze_corruption((byte*)area);
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -59,7 +59,7 @@ mlog_write_initial_log_record(
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: Error: trying to write to a stray memory location %lx\n",
|
"InnoDB: Error: trying to write to a stray memory location %lx\n",
|
||||||
(ulong) ptr);
|
(ulong) ptr);
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_ptr = mlog_open(mtr, 20);
|
log_ptr = mlog_open(mtr, 20);
|
||||||
@ -222,7 +222,7 @@ mlog_write_ulint(
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: Error: trying to write to a stray memory location %lx\n",
|
"InnoDB: Error: trying to write to a stray memory location %lx\n",
|
||||||
(ulong) ptr);
|
(ulong) ptr);
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == MLOG_1BYTE) {
|
if (type == MLOG_1BYTE) {
|
||||||
@ -261,7 +261,6 @@ mlog_write_dulint(
|
|||||||
/*==============*/
|
/*==============*/
|
||||||
byte* ptr, /* in: pointer where to write */
|
byte* ptr, /* in: pointer where to write */
|
||||||
dulint val, /* in: value to write */
|
dulint val, /* in: value to write */
|
||||||
byte type, /* in: MLOG_8BYTES */
|
|
||||||
mtr_t* mtr) /* in: mini-transaction handle */
|
mtr_t* mtr) /* in: mini-transaction handle */
|
||||||
{
|
{
|
||||||
byte* log_ptr;
|
byte* log_ptr;
|
||||||
@ -270,11 +269,10 @@ mlog_write_dulint(
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: Error: trying to write to a stray memory location %lx\n",
|
"InnoDB: Error: trying to write to a stray memory location %lx\n",
|
||||||
(ulong) ptr);
|
(ulong) ptr);
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_ad(ptr && mtr);
|
ut_ad(ptr && mtr);
|
||||||
ut_ad(type == MLOG_8BYTES);
|
|
||||||
|
|
||||||
mach_write_to_8(ptr, val);
|
mach_write_to_8(ptr, val);
|
||||||
|
|
||||||
@ -286,7 +284,8 @@ mlog_write_dulint(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_ptr = mlog_write_initial_log_record_fast(ptr, type, log_ptr, mtr);
|
log_ptr = mlog_write_initial_log_record_fast(ptr, MLOG_8BYTES,
|
||||||
|
log_ptr, mtr);
|
||||||
|
|
||||||
mach_write_to_2(log_ptr, ptr - buf_frame_align(ptr));
|
mach_write_to_2(log_ptr, ptr - buf_frame_align(ptr));
|
||||||
log_ptr += 2;
|
log_ptr += 2;
|
||||||
@ -314,7 +313,7 @@ mlog_write_string(
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: Error: trying to write to a stray memory location %lx\n",
|
"InnoDB: Error: trying to write to a stray memory location %lx\n",
|
||||||
(ulong) ptr);
|
(ulong) ptr);
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
ut_ad(ptr && mtr);
|
ut_ad(ptr && mtr);
|
||||||
ut_a(len < UNIV_PAGE_SIZE);
|
ut_a(len < UNIV_PAGE_SIZE);
|
||||||
|
@ -495,13 +495,11 @@ mtr_read_dulint(
|
|||||||
/*===========*/
|
/*===========*/
|
||||||
/* out: value read */
|
/* out: value read */
|
||||||
byte* ptr, /* in: pointer from where to read */
|
byte* ptr, /* in: pointer from where to read */
|
||||||
ulint type __attribute__((unused)), /* in: MLOG_8BYTES */
|
|
||||||
mtr_t* mtr __attribute__((unused)))
|
mtr_t* mtr __attribute__((unused)))
|
||||||
/* in: mini-transaction handle */
|
/* in: mini-transaction handle */
|
||||||
{
|
{
|
||||||
ut_ad(mtr->state == MTR_ACTIVE);
|
ut_ad(mtr->state == MTR_ACTIVE);
|
||||||
ut_ad(ptr && mtr);
|
ut_ad(ptr && mtr);
|
||||||
ut_ad(type == MLOG_8BYTES);
|
|
||||||
ut_ad(mtr_memo_contains(mtr, buf_block_align(ptr),
|
ut_ad(mtr_memo_contains(mtr, buf_block_align(ptr),
|
||||||
MTR_MEMO_PAGE_S_FIX) ||
|
MTR_MEMO_PAGE_S_FIX) ||
|
||||||
mtr_memo_contains(mtr, buf_block_align(ptr),
|
mtr_memo_contains(mtr, buf_block_align(ptr),
|
||||||
|
@ -1068,7 +1068,7 @@ try_again:
|
|||||||
} else if (type == OS_DATA_FILE) {
|
} else if (type == OS_DATA_FILE) {
|
||||||
type_str = "DATA";
|
type_str = "DATA";
|
||||||
} else {
|
} else {
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (purpose == OS_FILE_AIO) {
|
if (purpose == OS_FILE_AIO) {
|
||||||
@ -1076,7 +1076,7 @@ try_again:
|
|||||||
} else if (purpose == OS_FILE_NORMAL) {
|
} else if (purpose == OS_FILE_NORMAL) {
|
||||||
purpose_str = "NORMAL";
|
purpose_str = "NORMAL";
|
||||||
} else {
|
} else {
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* printf("Opening file %s, mode %s, type %s, purpose %s\n",
|
/* printf("Opening file %s, mode %s, type %s, purpose %s\n",
|
||||||
@ -1558,7 +1558,7 @@ os_file_flush(
|
|||||||
|
|
||||||
/* It is a fatal error if a file flush does not succeed, because then
|
/* It is a fatal error if a file flush does not succeed, because then
|
||||||
the database can get corrupt on disk */
|
the database can get corrupt on disk */
|
||||||
ut_a(0);
|
ut_error;
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
#else
|
#else
|
||||||
@ -1593,7 +1593,7 @@ os_file_flush(
|
|||||||
|
|
||||||
/* It is a fatal error if a file flush does not succeed, because then
|
/* It is a fatal error if a file flush does not succeed, because then
|
||||||
the database can get corrupt on disk */
|
the database can get corrupt on disk */
|
||||||
ut_a(0);
|
ut_error;
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
#endif
|
#endif
|
||||||
@ -2430,7 +2430,7 @@ os_aio_get_array_no(
|
|||||||
|
|
||||||
return(3);
|
return(3);
|
||||||
} else {
|
} else {
|
||||||
ut_a(0);
|
ut_error;
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@ -2457,7 +2457,7 @@ os_aio_get_array_from_no(
|
|||||||
|
|
||||||
return(os_aio_write_array);
|
return(os_aio_write_array);
|
||||||
} else {
|
} else {
|
||||||
ut_a(0);
|
ut_error;
|
||||||
|
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
@ -3047,7 +3047,7 @@ os_aio_posix_handle(
|
|||||||
|
|
||||||
if (sig != SIGRTMIN + 1 + array_no) {
|
if (sig != SIGRTMIN + 1 + array_no) {
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
@ -3312,7 +3312,7 @@ consecutive_loop:
|
|||||||
slot->name, (ulong) slot->offset_high,
|
slot->name, (ulong) slot->offset_high,
|
||||||
(ulong) slot->offset,
|
(ulong) slot->offset,
|
||||||
(ulong) total_len);
|
(ulong) total_len);
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do a 'last millisecond' check that the page end
|
/* Do a 'last millisecond' check that the page end
|
||||||
|
@ -716,7 +716,7 @@ page_cur_parse_insert_rec(
|
|||||||
|
|
||||||
buf_page_print(page);
|
buf_page_print(page);
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_memcpy(buf, rec_get_start(cursor_rec), mismatch_index);
|
ut_memcpy(buf, rec_get_start(cursor_rec), mismatch_index);
|
||||||
|
@ -110,7 +110,7 @@ page_dir_find_owner_slot(
|
|||||||
|
|
||||||
buf_page_print(page);
|
buf_page_print(page);
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
i--;
|
i--;
|
||||||
@ -441,7 +441,7 @@ page_copy_rec_list_end_no_locks(
|
|||||||
(ulong)(rec - page),
|
(ulong)(rec - page),
|
||||||
(ulong)(page_cur_get_rec(&cur1) - page),
|
(ulong)(page_cur_get_rec(&cur1) - page),
|
||||||
(ulong)(page_cur_get_rec(&cur2) - new_page));
|
(ulong)(page_cur_get_rec(&cur2) - new_page));
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
page_cur_move_to_next(&cur1);
|
page_cur_move_to_next(&cur1);
|
||||||
|
@ -627,7 +627,7 @@ Linux.
|
|||||||
#define malloc(A) mem_alloc(A)
|
#define malloc(A) mem_alloc(A)
|
||||||
#define free(A) mem_free(A)
|
#define free(A) mem_free(A)
|
||||||
#define realloc(P, A) mem_realloc(P, A, __FILE__, __LINE__)
|
#define realloc(P, A) mem_realloc(P, A, __FILE__, __LINE__)
|
||||||
#define exit(A) ut_a(0)
|
#define exit(A) ut_error
|
||||||
|
|
||||||
#define YY_INPUT(buf, result, max_size) pars_get_lex_chars(buf, &result, max_size)
|
#define YY_INPUT(buf, result, max_size) pars_get_lex_chars(buf, &result, max_size)
|
||||||
#define comment 1
|
#define comment 1
|
||||||
|
@ -29,13 +29,14 @@ on 1/27/1998 */
|
|||||||
#include "trx0trx.h"
|
#include "trx0trx.h"
|
||||||
#include "trx0roll.h"
|
#include "trx0roll.h"
|
||||||
#include "lock0lock.h"
|
#include "lock0lock.h"
|
||||||
#include "odbc0odbc.h"
|
|
||||||
#include "eval0eval.h"
|
#include "eval0eval.h"
|
||||||
|
|
||||||
|
#ifdef UNIV_SQL_DEBUG
|
||||||
/* If the following is set TRUE, the lexer will print the SQL string
|
/* If the following is set TRUE, the lexer will print the SQL string
|
||||||
as it tokenizes it */
|
as it tokenizes it */
|
||||||
|
|
||||||
ibool pars_print_lexed = FALSE;
|
ibool pars_print_lexed = FALSE;
|
||||||
|
#endif /* UNIV_SQL_DEBUG */
|
||||||
|
|
||||||
/* Global variable used while parsing a single procedure or query : the code is
|
/* Global variable used while parsing a single procedure or query : the code is
|
||||||
NOT re-entrant */
|
NOT re-entrant */
|
||||||
@ -389,7 +390,7 @@ pars_resolve_exp_variables_and_types(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!node) {
|
if (!node) {
|
||||||
printf("PARSER ERROR: Unresolved identifier %s\n",
|
fprintf(stderr, "PARSER ERROR: Unresolved identifier %s\n",
|
||||||
sym_node->name);
|
sym_node->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,25 +522,6 @@ pars_resolve_exp_list_columns(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************
|
|
||||||
Retrieves the stored procedure definition for a procedure name. */
|
|
||||||
static
|
|
||||||
void
|
|
||||||
pars_retrieve_procedure_def(
|
|
||||||
/*========================*/
|
|
||||||
sym_node_t* sym_node) /* in: procedure name node */
|
|
||||||
{
|
|
||||||
ut_a(sym_node);
|
|
||||||
ut_a(que_node_get_type(sym_node) == QUE_NODE_SYMBOL);
|
|
||||||
|
|
||||||
sym_node->resolved = TRUE;
|
|
||||||
sym_node->token_type = SYM_PROCEDURE_NAME;
|
|
||||||
|
|
||||||
sym_node->procedure_def = dict_procedure_get((char*)sym_node->name,
|
|
||||||
NULL);
|
|
||||||
ut_a(sym_node->procedure_def);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
Retrieves the table definition for a table name id. */
|
Retrieves the table definition for a table name id. */
|
||||||
static
|
static
|
||||||
@ -1662,216 +1644,19 @@ pars_procedure_definition(
|
|||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
Parses a stored procedure call, when this is not within another stored
|
Parses a stored procedure call, when this is not within another stored
|
||||||
procedure, that is, the client issues a procedure call directly. */
|
procedure, that is, the client issues a procedure call directly.
|
||||||
|
In MySQL/InnoDB, stored InnoDB procedures are invoked via the
|
||||||
|
parsed procedure tree, not via InnoDB SQL, so this function is not used. */
|
||||||
|
|
||||||
que_fork_t*
|
que_fork_t*
|
||||||
pars_stored_procedure_call(
|
pars_stored_procedure_call(
|
||||||
/*=======================*/
|
/*=======================*/
|
||||||
/* out: query graph */
|
/* out: query graph */
|
||||||
sym_node_t* sym_node) /* in: stored procedure name */
|
sym_node_t* sym_node __attribute__((unused)))
|
||||||
|
/* in: stored procedure name */
|
||||||
{
|
{
|
||||||
call_node_t* node;
|
ut_error;
|
||||||
que_fork_t* fork;
|
return(NULL);
|
||||||
que_thr_t* thr;
|
|
||||||
mem_heap_t* heap;
|
|
||||||
|
|
||||||
heap = pars_sym_tab_global->heap;
|
|
||||||
|
|
||||||
fork = que_fork_create(NULL, NULL, QUE_FORK_PROCEDURE_CALL, heap);
|
|
||||||
fork->trx = NULL;
|
|
||||||
|
|
||||||
thr = que_thr_create(fork, heap);
|
|
||||||
|
|
||||||
node = mem_heap_alloc(heap, sizeof(call_node_t));
|
|
||||||
|
|
||||||
thr->child = node;
|
|
||||||
|
|
||||||
node->common.type = QUE_NODE_CALL;
|
|
||||||
node->common.parent = thr;
|
|
||||||
|
|
||||||
sym_node->token_type = SYM_PROCEDURE_NAME;
|
|
||||||
|
|
||||||
pars_retrieve_procedure_def(sym_node);
|
|
||||||
|
|
||||||
node->procedure_def = sym_node->procedure_def;
|
|
||||||
node->proc_name = sym_node;
|
|
||||||
|
|
||||||
node->sym_tab = pars_sym_tab_global;
|
|
||||||
|
|
||||||
pars_sym_tab_global->query_graph = fork;
|
|
||||||
|
|
||||||
return(fork);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************
|
|
||||||
Writes info about query parameter markers (denoted with '?' in ODBC) into a
|
|
||||||
buffer. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
pars_write_query_param_info(
|
|
||||||
/*========================*/
|
|
||||||
/* out: number of bytes used for info in buf */
|
|
||||||
byte* buf, /* in: buffer which must be big enough */
|
|
||||||
que_fork_t* graph) /* in: parsed query graph */
|
|
||||||
{
|
|
||||||
que_thr_t* thr;
|
|
||||||
call_node_t* call_node;
|
|
||||||
dict_proc_t* procedure_def;
|
|
||||||
que_t* stored_graph;
|
|
||||||
proc_node_t* proc_node;
|
|
||||||
sym_node_t* param;
|
|
||||||
ulint n_params;
|
|
||||||
ibool is_input;
|
|
||||||
|
|
||||||
/* We currently support parameter markers only in stored procedure
|
|
||||||
calls, and there ALL procedure parameters must be marked with '?':
|
|
||||||
no literal values are allowed */
|
|
||||||
|
|
||||||
thr = UT_LIST_GET_FIRST(graph->thrs);
|
|
||||||
|
|
||||||
n_params = 0;
|
|
||||||
|
|
||||||
if (que_node_get_type(thr->child) == QUE_NODE_CALL) {
|
|
||||||
call_node = thr->child;
|
|
||||||
|
|
||||||
procedure_def = call_node->procedure_def;
|
|
||||||
|
|
||||||
stored_graph = dict_procedure_reserve_parsed_copy(
|
|
||||||
procedure_def);
|
|
||||||
proc_node = que_fork_get_child(stored_graph);
|
|
||||||
|
|
||||||
param = proc_node->param_list;
|
|
||||||
|
|
||||||
while (param) {
|
|
||||||
if (param->param_type == PARS_INPUT) {
|
|
||||||
is_input = TRUE;
|
|
||||||
} else {
|
|
||||||
is_input = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
mach_write_to_1(buf + 4 + n_params, is_input);
|
|
||||||
|
|
||||||
n_params++;
|
|
||||||
|
|
||||||
param = que_node_get_next(param);
|
|
||||||
}
|
|
||||||
|
|
||||||
dict_procedure_release_parsed_copy(stored_graph);
|
|
||||||
}
|
|
||||||
|
|
||||||
mach_write_to_4(buf, n_params);
|
|
||||||
|
|
||||||
return(4 + n_params);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************
|
|
||||||
Reads stored procedure input parameter values from a buffer. */
|
|
||||||
|
|
||||||
void
|
|
||||||
pars_proc_read_input_params_from_buf(
|
|
||||||
/*=================================*/
|
|
||||||
que_t* graph, /* in: query graph which contains a stored procedure */
|
|
||||||
byte* buf) /* in: buffer */
|
|
||||||
{
|
|
||||||
que_thr_t* thr;
|
|
||||||
proc_node_t* proc_node;
|
|
||||||
sym_node_t* param;
|
|
||||||
byte* ptr;
|
|
||||||
ulint len;
|
|
||||||
lint odbc_len;
|
|
||||||
|
|
||||||
ut_ad(graph->fork_type == QUE_FORK_PROCEDURE);
|
|
||||||
|
|
||||||
thr = UT_LIST_GET_FIRST(graph->thrs);
|
|
||||||
|
|
||||||
proc_node = thr->child;
|
|
||||||
|
|
||||||
ptr = buf;
|
|
||||||
|
|
||||||
param = proc_node->param_list;
|
|
||||||
|
|
||||||
while (param) {
|
|
||||||
if (param->param_type == PARS_INPUT) {
|
|
||||||
odbc_len = (lint)mach_read_from_4(ptr);
|
|
||||||
|
|
||||||
ptr += 4;
|
|
||||||
|
|
||||||
if (odbc_len == SQL_NULL_DATA) {
|
|
||||||
len = UNIV_SQL_NULL;
|
|
||||||
} else {
|
|
||||||
len = (ulint)odbc_len;
|
|
||||||
}
|
|
||||||
|
|
||||||
eval_node_copy_and_alloc_val(param, ptr, len);
|
|
||||||
|
|
||||||
if (len != UNIV_SQL_NULL) {
|
|
||||||
ptr += len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
param = que_node_get_next(param);
|
|
||||||
}
|
|
||||||
|
|
||||||
ut_ad(ptr - buf < ODBC_DATAGRAM_SIZE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************
|
|
||||||
Writes stored procedure output parameter values to a buffer. */
|
|
||||||
|
|
||||||
ulint
|
|
||||||
pars_proc_write_output_params_to_buf(
|
|
||||||
/*=================================*/
|
|
||||||
/* out: bytes used in buf */
|
|
||||||
byte* buf, /* in: buffer which must be big enough */
|
|
||||||
que_t* graph) /* in: query graph which contains a stored procedure */
|
|
||||||
{
|
|
||||||
que_thr_t* thr;
|
|
||||||
proc_node_t* proc_node;
|
|
||||||
sym_node_t* param;
|
|
||||||
dfield_t* dfield;
|
|
||||||
byte* ptr;
|
|
||||||
ulint len;
|
|
||||||
lint odbc_len;
|
|
||||||
|
|
||||||
ut_ad(graph->fork_type == QUE_FORK_PROCEDURE);
|
|
||||||
|
|
||||||
thr = UT_LIST_GET_FIRST(graph->thrs);
|
|
||||||
|
|
||||||
proc_node = thr->child;
|
|
||||||
|
|
||||||
ptr = buf;
|
|
||||||
|
|
||||||
param = proc_node->param_list;
|
|
||||||
|
|
||||||
while (param) {
|
|
||||||
if (param->param_type == PARS_OUTPUT) {
|
|
||||||
dfield = que_node_get_val(param);
|
|
||||||
|
|
||||||
len = dfield_get_len(dfield);
|
|
||||||
|
|
||||||
if (len == UNIV_SQL_NULL) {
|
|
||||||
odbc_len = SQL_NULL_DATA;
|
|
||||||
} else {
|
|
||||||
odbc_len = (lint)len;
|
|
||||||
}
|
|
||||||
|
|
||||||
mach_write_to_4(ptr, (ulint)odbc_len);
|
|
||||||
|
|
||||||
ptr += 4;
|
|
||||||
|
|
||||||
if (len != UNIV_SQL_NULL) {
|
|
||||||
ut_memcpy(ptr, dfield_get_data(dfield), len);
|
|
||||||
|
|
||||||
ptr += len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
param = que_node_get_next(param);
|
|
||||||
}
|
|
||||||
|
|
||||||
ut_ad(ptr - buf < ODBC_DATAGRAM_SIZE);
|
|
||||||
|
|
||||||
return((ulint)(ptr - buf));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
@ -1886,13 +1671,12 @@ pars_get_lex_chars(
|
|||||||
in the buffer */
|
in the buffer */
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
char print_buf[16];
|
|
||||||
|
|
||||||
len = pars_sym_tab_global->string_len
|
len = pars_sym_tab_global->string_len
|
||||||
- pars_sym_tab_global->next_char_pos;
|
- pars_sym_tab_global->next_char_pos;
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
#ifdef YYDEBUG
|
#ifdef YYDEBUG
|
||||||
/* printf("SQL string ends\n"); */
|
/* fputs("SQL string ends\n", stderr); */
|
||||||
#endif
|
#endif
|
||||||
*result = 0;
|
*result = 0;
|
||||||
|
|
||||||
@ -1903,18 +1687,18 @@ pars_get_lex_chars(
|
|||||||
len = max_size;
|
len = max_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef UNIV_SQL_DEBUG
|
||||||
if (pars_print_lexed) {
|
if (pars_print_lexed) {
|
||||||
|
|
||||||
if (len >= 5) {
|
if (len >= 5) {
|
||||||
len = 5;
|
len = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
ut_memcpy(print_buf, pars_sym_tab_global->sql_string +
|
fwrite(pars_sym_tab_global->sql_string +
|
||||||
pars_sym_tab_global->next_char_pos, len);
|
pars_sym_tab_global->next_char_pos,
|
||||||
print_buf[len] = '\0';
|
1, len, stderr);
|
||||||
|
|
||||||
printf("%s", print_buf);
|
|
||||||
}
|
}
|
||||||
|
#endif /* UNIV_SQL_DEBUG */
|
||||||
|
|
||||||
ut_memcpy(buf, pars_sym_tab_global->sql_string +
|
ut_memcpy(buf, pars_sym_tab_global->sql_string +
|
||||||
pars_sym_tab_global->next_char_pos, len);
|
pars_sym_tab_global->next_char_pos, len);
|
||||||
@ -1944,7 +1728,7 @@ yyerror(
|
|||||||
{
|
{
|
||||||
ut_ad(s);
|
ut_ad(s);
|
||||||
|
|
||||||
printf("PARSER ERROR: Syntax error in SQL string\n");
|
fputs("PARSER ERROR: Syntax error in SQL string\n", stderr);
|
||||||
|
|
||||||
ut_error;
|
ut_error;
|
||||||
}
|
}
|
||||||
@ -1968,10 +1752,10 @@ pars_sql(
|
|||||||
|
|
||||||
heap = mem_heap_create(256);
|
heap = mem_heap_create(256);
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
/* Currently, the parser is not reentrant: */
|
/* Currently, the parser is not reentrant: */
|
||||||
|
|
||||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
pars_sym_tab_global = sym_tab_create(heap);
|
pars_sym_tab_global = sym_tab_create(heap);
|
||||||
|
|
||||||
len = ut_strlen(str);
|
len = ut_strlen(str);
|
||||||
@ -1996,7 +1780,7 @@ pars_sql(
|
|||||||
|
|
||||||
graph->sym_tab = pars_sym_tab_global;
|
graph->sym_tab = pars_sym_tab_global;
|
||||||
|
|
||||||
/* printf("SQL graph size %lu\n", mem_heap_get_size(heap)); */
|
/* fprintf(stderr, "SQL graph size %lu\n", mem_heap_get_size(heap)); */
|
||||||
|
|
||||||
return(graph);
|
return(graph);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ Created 5/27/1996 Heikki Tuuri
|
|||||||
#include "log0log.h"
|
#include "log0log.h"
|
||||||
#include "eval0proc.h"
|
#include "eval0proc.h"
|
||||||
#include "eval0eval.h"
|
#include "eval0eval.h"
|
||||||
#include "odbc0odbc.h"
|
|
||||||
|
|
||||||
#define QUE_PARALLELIZE_LIMIT (64 * 256 * 256 * 256)
|
#define QUE_PARALLELIZE_LIMIT (64 * 256 * 256 * 256)
|
||||||
#define QUE_ROUND_ROBIN_LIMIT (64 * 256 * 256 * 256)
|
#define QUE_ROUND_ROBIN_LIMIT (64 * 256 * 256 * 256)
|
||||||
@ -83,7 +82,9 @@ que_graph_publish(
|
|||||||
que_t* graph, /* in: graph */
|
que_t* graph, /* in: graph */
|
||||||
sess_t* sess) /* in: session */
|
sess_t* sess) /* in: session */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
UT_LIST_ADD_LAST(graphs, sess->graphs, graph);
|
UT_LIST_ADD_LAST(graphs, sess->graphs, graph);
|
||||||
}
|
}
|
||||||
@ -190,7 +191,9 @@ que_thr_end_wait(
|
|||||||
{
|
{
|
||||||
ibool was_active;
|
ibool was_active;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(thr);
|
ut_ad(thr);
|
||||||
ut_ad((thr->state == QUE_THR_LOCK_WAIT)
|
ut_ad((thr->state == QUE_THR_LOCK_WAIT)
|
||||||
|| (thr->state == QUE_THR_PROCEDURE_WAIT)
|
|| (thr->state == QUE_THR_PROCEDURE_WAIT)
|
||||||
@ -229,7 +232,9 @@ que_thr_end_wait_no_next_thr(
|
|||||||
|
|
||||||
ut_a(thr->state == QUE_THR_LOCK_WAIT); /* In MySQL this is the
|
ut_a(thr->state == QUE_THR_LOCK_WAIT); /* In MySQL this is the
|
||||||
only possible state here */
|
only possible state here */
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(thr);
|
ut_ad(thr);
|
||||||
ut_ad((thr->state == QUE_THR_LOCK_WAIT)
|
ut_ad((thr->state == QUE_THR_LOCK_WAIT)
|
||||||
|| (thr->state == QUE_THR_PROCEDURE_WAIT)
|
|| (thr->state == QUE_THR_PROCEDURE_WAIT)
|
||||||
@ -279,16 +284,10 @@ que_fork_start_command(
|
|||||||
QUE_THR_RUNNING state, or NULL; the query
|
QUE_THR_RUNNING state, or NULL; the query
|
||||||
thread should be executed by que_run_threads
|
thread should be executed by que_run_threads
|
||||||
by the caller */
|
by the caller */
|
||||||
que_fork_t* fork, /* in: a query fork */
|
que_fork_t* fork) /* in: a query fork */
|
||||||
ulint command,/* in: command SESS_COMM_FETCH_NEXT, ... */
|
|
||||||
ulint param) /* in: possible parameter to the command */
|
|
||||||
{
|
{
|
||||||
que_thr_t* thr;
|
que_thr_t* thr;
|
||||||
|
|
||||||
/* Set the command parameters in the fork root */
|
|
||||||
fork->command = command;
|
|
||||||
fork->param = param;
|
|
||||||
|
|
||||||
fork->state = QUE_FORK_ACTIVE;
|
fork->state = QUE_FORK_ACTIVE;
|
||||||
|
|
||||||
fork->last_sel_node = NULL;
|
fork->last_sel_node = NULL;
|
||||||
@ -370,7 +369,9 @@ que_fork_error_handle(
|
|||||||
{
|
{
|
||||||
que_thr_t* thr;
|
que_thr_t* thr;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
ut_ad(trx->sess->state == SESS_ERROR);
|
ut_ad(trx->sess->state == SESS_ERROR);
|
||||||
ut_ad(UT_LIST_GET_LEN(trx->reply_signals) == 0);
|
ut_ad(UT_LIST_GET_LEN(trx->reply_signals) == 0);
|
||||||
ut_ad(UT_LIST_GET_LEN(trx->wait_thrs) == 0);
|
ut_ad(UT_LIST_GET_LEN(trx->wait_thrs) == 0);
|
||||||
@ -484,7 +485,7 @@ que_graph_free_recursive(
|
|||||||
"que_thr struct appears corrupt; magic n %lu\n",
|
"que_thr struct appears corrupt; magic n %lu\n",
|
||||||
(unsigned long) thr->magic_n);
|
(unsigned long) thr->magic_n);
|
||||||
mem_analyze_corruption((byte*)thr);
|
mem_analyze_corruption((byte*)thr);
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
thr->magic_n = QUE_THR_MAGIC_FREED;
|
thr->magic_n = QUE_THR_MAGIC_FREED;
|
||||||
@ -596,7 +597,7 @@ que_graph_free_recursive(
|
|||||||
"que_node struct appears corrupt; type %lu\n",
|
"que_node struct appears corrupt; type %lu\n",
|
||||||
(unsigned long) que_node_get_type(node));
|
(unsigned long) que_node_get_type(node));
|
||||||
mem_analyze_corruption((byte*)node);
|
mem_analyze_corruption((byte*)node);
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -640,7 +641,9 @@ que_graph_try_free(
|
|||||||
{
|
{
|
||||||
sess_t* sess;
|
sess_t* sess;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
sess = (graph->trx)->sess;
|
sess = (graph->trx)->sess;
|
||||||
|
|
||||||
@ -665,49 +668,20 @@ does nothing! */
|
|||||||
void
|
void
|
||||||
que_thr_handle_error(
|
que_thr_handle_error(
|
||||||
/*=================*/
|
/*=================*/
|
||||||
que_thr_t* thr, /* in: query thread */
|
que_thr_t* thr __attribute((unused)),
|
||||||
ulint err_no, /* in: error number */
|
/* in: query thread */
|
||||||
byte* err_str,/* in, own: error string or NULL; NOTE: the
|
ulint err_no __attribute((unused)),
|
||||||
|
/* in: error number */
|
||||||
|
byte* err_str __attribute((unused)),
|
||||||
|
/* in, own: error string or NULL; NOTE: the
|
||||||
function will take care of freeing of the
|
function will take care of freeing of the
|
||||||
string! */
|
string! */
|
||||||
ulint err_len)/* in: error string length */
|
ulint err_len __attribute((unused)))
|
||||||
|
/* in: error string length */
|
||||||
{
|
{
|
||||||
UT_NOT_USED(thr);
|
|
||||||
UT_NOT_USED(err_no);
|
|
||||||
UT_NOT_USED(err_str);
|
|
||||||
UT_NOT_USED(err_len);
|
|
||||||
|
|
||||||
/* Does nothing */
|
/* Does nothing */
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************
|
|
||||||
Builds a command completed-message to the client. */
|
|
||||||
static
|
|
||||||
ulint
|
|
||||||
que_build_srv_msg(
|
|
||||||
/*==============*/
|
|
||||||
/* out: message data length */
|
|
||||||
byte* buf, /* in: message buffer */
|
|
||||||
que_fork_t* fork, /* in: query graph where execution completed */
|
|
||||||
sess_t* sess) /* in: session */
|
|
||||||
{
|
|
||||||
ulint len;
|
|
||||||
|
|
||||||
/* Currently, we only support stored procedures: */
|
|
||||||
ut_ad(fork->fork_type == QUE_FORK_PROCEDURE);
|
|
||||||
|
|
||||||
if (sess->state == SESS_ERROR) {
|
|
||||||
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
sess_srv_msg_init(sess, buf, SESS_SRV_SUCCESS);
|
|
||||||
|
|
||||||
len = pars_proc_write_output_params_to_buf(buf + SESS_SRV_MSG_DATA,
|
|
||||||
fork);
|
|
||||||
return(len);
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
Performs an execution step on a thr node. */
|
Performs an execution step on a thr node. */
|
||||||
static
|
static
|
||||||
@ -804,10 +778,6 @@ que_thr_dec_refer_count(
|
|||||||
que_fork_t* fork;
|
que_fork_t* fork;
|
||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
sess_t* sess;
|
sess_t* sess;
|
||||||
ibool send_srv_msg = FALSE;
|
|
||||||
ibool release_stored_proc = FALSE;
|
|
||||||
ulint msg_len = 0;
|
|
||||||
byte msg_buf[ODBC_DATAGRAM_SIZE];
|
|
||||||
ulint fork_type;
|
ulint fork_type;
|
||||||
ibool stopped;
|
ibool stopped;
|
||||||
|
|
||||||
@ -828,8 +798,8 @@ que_thr_dec_refer_count(
|
|||||||
already canceled before we came here: continue
|
already canceled before we came here: continue
|
||||||
running the thread */
|
running the thread */
|
||||||
|
|
||||||
/* printf(
|
/* fputs("!!!!!!!! Wait already ended: continue thr\n",
|
||||||
"!!!!!!!!!! Wait already ended: continue thr\n"); */
|
stderr); */
|
||||||
|
|
||||||
if (next_thr && *next_thr == NULL) {
|
if (next_thr && *next_thr == NULL) {
|
||||||
*next_thr = thr;
|
*next_thr = thr;
|
||||||
@ -882,40 +852,13 @@ que_thr_dec_refer_count(
|
|||||||
} else if (fork_type == QUE_FORK_MYSQL_INTERFACE) {
|
} else if (fork_type == QUE_FORK_MYSQL_INTERFACE) {
|
||||||
|
|
||||||
/* Do nothing */
|
/* Do nothing */
|
||||||
} else if (fork->common.parent == NULL
|
|
||||||
&& fork->caller == NULL
|
|
||||||
&& UT_LIST_GET_LEN(trx->signals) == 0) {
|
|
||||||
|
|
||||||
ut_a(0); /* not used in MySQL */
|
|
||||||
|
|
||||||
/* Reply to the client */
|
|
||||||
|
|
||||||
/* que_thr_add_update_info(thr); */
|
|
||||||
|
|
||||||
fork->state = QUE_FORK_COMMAND_WAIT;
|
|
||||||
|
|
||||||
msg_len = que_build_srv_msg(msg_buf, fork, sess);
|
|
||||||
|
|
||||||
send_srv_msg = TRUE;
|
|
||||||
|
|
||||||
if (fork->fork_type == QUE_FORK_PROCEDURE) {
|
|
||||||
|
|
||||||
release_stored_proc = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ut_ad(trx->graph == fork);
|
|
||||||
|
|
||||||
trx->graph = NULL;
|
|
||||||
} else {
|
} else {
|
||||||
/* Subprocedure calls not implemented yet */
|
ut_error; /* not used in MySQL */
|
||||||
ut_a(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UT_LIST_GET_LEN(trx->signals) > 0 && trx->n_active_thrs == 0) {
|
if (UT_LIST_GET_LEN(trx->signals) > 0 && trx->n_active_thrs == 0) {
|
||||||
|
|
||||||
ut_ad(!send_srv_msg);
|
|
||||||
|
|
||||||
/* If the trx is signaled and its query thread count drops to
|
/* If the trx is signaled and its query thread count drops to
|
||||||
zero, then we start processing a signal; from it we may get
|
zero, then we start processing a signal; from it we may get
|
||||||
a new query thread to run */
|
a new query thread to run */
|
||||||
@ -929,26 +872,6 @@ que_thr_dec_refer_count(
|
|||||||
}
|
}
|
||||||
|
|
||||||
mutex_exit(&kernel_mutex);
|
mutex_exit(&kernel_mutex);
|
||||||
|
|
||||||
if (send_srv_msg) {
|
|
||||||
/* Note that, as we do not own the kernel mutex at this point,
|
|
||||||
and neither do we own it all the time when doing the actual
|
|
||||||
communication operation within the next function, it is
|
|
||||||
possible that the messages will not get delivered in the right
|
|
||||||
sequential order. This is possible if the client communicates
|
|
||||||
an extra message to the server while the message below is still
|
|
||||||
undelivered. But then the client should notice that there
|
|
||||||
is an error in the order numbers of the messages. */
|
|
||||||
|
|
||||||
sess_command_completed_message(sess, msg_buf, msg_len);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (release_stored_proc) {
|
|
||||||
|
|
||||||
/* Return the stored procedure graph to the dictionary cache */
|
|
||||||
|
|
||||||
dict_procedure_release_parsed_copy(fork);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
@ -966,7 +889,9 @@ que_thr_stop(
|
|||||||
que_t* graph;
|
que_t* graph;
|
||||||
ibool ret = TRUE;
|
ibool ret = TRUE;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
graph = thr->graph;
|
graph = thr->graph;
|
||||||
trx = graph->trx;
|
trx = graph->trx;
|
||||||
@ -1063,7 +988,7 @@ que_thr_move_to_run_state_for_mysql(
|
|||||||
|
|
||||||
mem_analyze_corruption((byte*)thr);
|
mem_analyze_corruption((byte*)thr);
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!thr->is_active) {
|
if (!thr->is_active) {
|
||||||
@ -1100,7 +1025,7 @@ que_thr_stop_for_mysql_no_error(
|
|||||||
|
|
||||||
mem_analyze_corruption((byte*)thr);
|
mem_analyze_corruption((byte*)thr);
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
thr->state = QUE_THR_COMPLETED;
|
thr->state = QUE_THR_COMPLETED;
|
||||||
@ -1120,58 +1045,55 @@ que_node_print_info(
|
|||||||
que_node_t* node) /* in: query graph node */
|
que_node_t* node) /* in: query graph node */
|
||||||
{
|
{
|
||||||
ulint type;
|
ulint type;
|
||||||
char* str;
|
const char* str;
|
||||||
ulint addr;
|
|
||||||
|
|
||||||
type = que_node_get_type(node);
|
type = que_node_get_type(node);
|
||||||
|
|
||||||
addr = (ulint)node;
|
|
||||||
|
|
||||||
if (type == QUE_NODE_SELECT) {
|
if (type == QUE_NODE_SELECT) {
|
||||||
str = (char *) "SELECT";
|
str = "SELECT";
|
||||||
} else if (type == QUE_NODE_INSERT) {
|
} else if (type == QUE_NODE_INSERT) {
|
||||||
str = (char *) "INSERT";
|
str = "INSERT";
|
||||||
} else if (type == QUE_NODE_UPDATE) {
|
} else if (type == QUE_NODE_UPDATE) {
|
||||||
str = (char *) "UPDATE";
|
str = "UPDATE";
|
||||||
} else if (type == QUE_NODE_WHILE) {
|
} else if (type == QUE_NODE_WHILE) {
|
||||||
str = (char *) "WHILE";
|
str = "WHILE";
|
||||||
} else if (type == QUE_NODE_ASSIGNMENT) {
|
} else if (type == QUE_NODE_ASSIGNMENT) {
|
||||||
str = (char *) "ASSIGNMENT";
|
str = "ASSIGNMENT";
|
||||||
} else if (type == QUE_NODE_IF) {
|
} else if (type == QUE_NODE_IF) {
|
||||||
str = (char *) "IF";
|
str = "IF";
|
||||||
} else if (type == QUE_NODE_FETCH) {
|
} else if (type == QUE_NODE_FETCH) {
|
||||||
str = (char *) "FETCH";
|
str = "FETCH";
|
||||||
} else if (type == QUE_NODE_OPEN) {
|
} else if (type == QUE_NODE_OPEN) {
|
||||||
str = (char *) "OPEN";
|
str = "OPEN";
|
||||||
} else if (type == QUE_NODE_PROC) {
|
} else if (type == QUE_NODE_PROC) {
|
||||||
str = (char *) "STORED PROCEDURE";
|
str = "STORED PROCEDURE";
|
||||||
} else if (type == QUE_NODE_FUNC) {
|
} else if (type == QUE_NODE_FUNC) {
|
||||||
str = (char *) "FUNCTION";
|
str = "FUNCTION";
|
||||||
} else if (type == QUE_NODE_LOCK) {
|
} else if (type == QUE_NODE_LOCK) {
|
||||||
str = (char *) "LOCK";
|
str = "LOCK";
|
||||||
} else if (type == QUE_NODE_THR) {
|
} else if (type == QUE_NODE_THR) {
|
||||||
str = (char *) "QUERY THREAD";
|
str = "QUERY THREAD";
|
||||||
} else if (type == QUE_NODE_COMMIT) {
|
} else if (type == QUE_NODE_COMMIT) {
|
||||||
str = (char *) "COMMIT";
|
str = "COMMIT";
|
||||||
} else if (type == QUE_NODE_UNDO) {
|
} else if (type == QUE_NODE_UNDO) {
|
||||||
str = (char *) "UNDO ROW";
|
str = "UNDO ROW";
|
||||||
} else if (type == QUE_NODE_PURGE) {
|
} else if (type == QUE_NODE_PURGE) {
|
||||||
str = (char *) "PURGE ROW";
|
str = "PURGE ROW";
|
||||||
} else if (type == QUE_NODE_ROLLBACK) {
|
} else if (type == QUE_NODE_ROLLBACK) {
|
||||||
str = (char *) "ROLLBACK";
|
str = "ROLLBACK";
|
||||||
} else if (type == QUE_NODE_CREATE_TABLE) {
|
} else if (type == QUE_NODE_CREATE_TABLE) {
|
||||||
str = (char *) "CREATE TABLE";
|
str = "CREATE TABLE";
|
||||||
} else if (type == QUE_NODE_CREATE_INDEX) {
|
} else if (type == QUE_NODE_CREATE_INDEX) {
|
||||||
str = (char *) "CREATE INDEX";
|
str = "CREATE INDEX";
|
||||||
} else if (type == QUE_NODE_FOR) {
|
} else if (type == QUE_NODE_FOR) {
|
||||||
str = (char *) "FOR LOOP";
|
str = "FOR LOOP";
|
||||||
} else if (type == QUE_NODE_RETURN) {
|
} else if (type == QUE_NODE_RETURN) {
|
||||||
str = (char *) "RETURN";
|
str = "RETURN";
|
||||||
} else {
|
} else {
|
||||||
str = (char *) "UNKNOWN NODE TYPE";
|
str = "UNKNOWN NODE TYPE";
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Node type %lu: %s, address %lx\n", (unsigned long) type, str,
|
fprintf(stderr, "Node type %lu: %s, address %lx\n", (unsigned long) type, str,
|
||||||
(unsigned long) addr);
|
(unsigned long) addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1202,7 +1124,7 @@ que_thr_step(
|
|||||||
|
|
||||||
#ifdef UNIV_DEBUG
|
#ifdef UNIV_DEBUG
|
||||||
if (que_trace_on) {
|
if (que_trace_on) {
|
||||||
printf("To execute: ");
|
fputs("To execute: ", stderr);
|
||||||
que_node_print_info(node);
|
que_node_print_info(node);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1299,7 +1221,9 @@ que_run_threads(
|
|||||||
ulint loop_count;
|
ulint loop_count;
|
||||||
|
|
||||||
ut_ad(thr->state == QUE_THR_RUNNING);
|
ut_ad(thr->state == QUE_THR_RUNNING);
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(!mutex_own(&kernel_mutex));
|
ut_ad(!mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
/* cumul_resource counts how much resources the OS thread (NOT the
|
/* cumul_resource counts how much resources the OS thread (NOT the
|
||||||
query thread) has spent in this function */
|
query thread) has spent in this function */
|
||||||
|
@ -55,8 +55,9 @@ read_view_oldest_copy_or_open_new(
|
|||||||
ulint n;
|
ulint n;
|
||||||
ulint i;
|
ulint i;
|
||||||
|
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
old_view = UT_LIST_GET_LAST(trx_sys->view_list);
|
old_view = UT_LIST_GET_LAST(trx_sys->view_list);
|
||||||
|
|
||||||
if (old_view == NULL) {
|
if (old_view == NULL) {
|
||||||
@ -132,9 +133,9 @@ read_view_open_now(
|
|||||||
read_view_t* view;
|
read_view_t* view;
|
||||||
trx_t* trx;
|
trx_t* trx;
|
||||||
ulint n;
|
ulint n;
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
view = read_view_create_low(UT_LIST_GET_LEN(trx_sys->trx_list), heap);
|
view = read_view_create_low(UT_LIST_GET_LEN(trx_sys->trx_list), heap);
|
||||||
|
|
||||||
view->creator = cr_trx;
|
view->creator = cr_trx;
|
||||||
@ -195,8 +196,9 @@ read_view_close(
|
|||||||
/*============*/
|
/*============*/
|
||||||
read_view_t* view) /* in: read view */
|
read_view_t* view) /* in: read view */
|
||||||
{
|
{
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(mutex_own(&kernel_mutex));
|
ut_ad(mutex_own(&kernel_mutex));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
UT_LIST_REMOVE(view_list, trx_sys->view_list, view);
|
UT_LIST_REMOVE(view_list, trx_sys->view_list, view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,7 +283,7 @@ cmp_whole_field(
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"InnoDB: unknown type number %lu\n",
|
"InnoDB: unknown type number %lu\n",
|
||||||
(ulong) data_type);
|
(ulong) data_type);
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -108,12 +108,12 @@ rec_get_nth_field(
|
|||||||
if (n > 1024) {
|
if (n > 1024) {
|
||||||
fprintf(stderr, "Error: trying to access field %lu in rec\n",
|
fprintf(stderr, "Error: trying to access field %lu in rec\n",
|
||||||
(ulong) n);
|
(ulong) n);
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rec == NULL) {
|
if (rec == NULL) {
|
||||||
fprintf(stderr, "Error: rec is NULL pointer\n");
|
fprintf(stderr, "Error: rec is NULL pointer\n");
|
||||||
ut_a(0);
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rec_get_1byte_offs_flag(rec)) {
|
if (rec_get_1byte_offs_flag(rec)) {
|
||||||
|
@ -80,9 +80,9 @@ ins_node_create(
|
|||||||
node->trx_id = ut_dulint_zero;
|
node->trx_id = ut_dulint_zero;
|
||||||
|
|
||||||
node->entry_sys_heap = mem_heap_create(128);
|
node->entry_sys_heap = mem_heap_create(128);
|
||||||
|
#ifdef UNIV_DEBUG
|
||||||
node->magic_n = INS_NODE_MAGIC_N;
|
node->magic_n = INS_NODE_MAGIC_N;
|
||||||
|
#endif /* UNIV_DEBUG */
|
||||||
return(node);
|
return(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,6 +194,7 @@ ins_node_set_new_row(
|
|||||||
ins_node_t* node, /* in: insert node */
|
ins_node_t* node, /* in: insert node */
|
||||||
dtuple_t* row) /* in: new row (or first row) for the node */
|
dtuple_t* row) /* in: new row (or first row) for the node */
|
||||||
{
|
{
|
||||||
|
ut_ad(node->magic_n == INS_NODE_MAGIC_N);
|
||||||
node->state = INS_NODE_SET_IX_LOCK;
|
node->state = INS_NODE_SET_IX_LOCK;
|
||||||
node->index = NULL;
|
node->index = NULL;
|
||||||
node->entry = NULL;
|
node->entry = NULL;
|
||||||
@ -855,7 +856,7 @@ row_ins_foreign_check_on_constraint(
|
|||||||
"InnoDB: Make a detailed bug report and send it\n");
|
"InnoDB: Make a detailed bug report and send it\n");
|
||||||
fprintf(stderr, "InnoDB: to mysql@lists.mysql.com\n");
|
fprintf(stderr, "InnoDB: to mysql@lists.mysql.com\n");
|
||||||
|
|
||||||
ut_a(0);
|
ut_error;
|
||||||
*/
|
*/
|
||||||
err = DB_SUCCESS;
|
err = DB_SUCCESS;
|
||||||
|
|
||||||
@ -1031,7 +1032,9 @@ row_ins_check_foreign_constraint(
|
|||||||
mtr_t mtr;
|
mtr_t mtr;
|
||||||
|
|
||||||
run_again:
|
run_again:
|
||||||
|
#ifdef UNIV_SYNC_DEBUG
|
||||||
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_SHARED));
|
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_SHARED));
|
||||||
|
#endif /* UNIV_SYNC_DEBUG */
|
||||||
|
|
||||||
err = DB_SUCCESS;
|
err = DB_SUCCESS;
|
||||||
|
|
||||||
@ -2040,6 +2043,7 @@ row_ins(
|
|||||||
ulint err;
|
ulint err;
|
||||||
|
|
||||||
ut_ad(node && thr);
|
ut_ad(node && thr);
|
||||||
|
ut_ad(node->magic_n == INS_NODE_MAGIC_N);
|
||||||
|
|
||||||
if (node->state == INS_NODE_ALLOC_ROW_ID) {
|
if (node->state == INS_NODE_ALLOC_ROW_ID) {
|
||||||
|
|
||||||
@ -2104,7 +2108,7 @@ row_ins_step(
|
|||||||
trx_start_if_not_started(trx);
|
trx_start_if_not_started(trx);
|
||||||
|
|
||||||
node = thr->run_node;
|
node = thr->run_node;
|
||||||
|
ut_ad(node->magic_n == INS_NODE_MAGIC_N);
|
||||||
ut_ad(que_node_get_type(node) == QUE_NODE_INSERT);
|
ut_ad(que_node_get_type(node) == QUE_NODE_INSERT);
|
||||||
|
|
||||||
parent = que_node_get_parent(node);
|
parent = que_node_get_parent(node);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user