Commit 161fea4a authored by cmiller@zippy.cornsilk.net's avatar cmiller@zippy.cornsilk.net

Merge bk-internal.mysql.com:/home/bk/mysql-5.1

into  zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-maint
parents 60e178bb b9847507
...@@ -1242,6 +1242,7 @@ mysql-test/gmon.out ...@@ -1242,6 +1242,7 @@ mysql-test/gmon.out
mysql-test/install_test_db mysql-test/install_test_db
mysql-test/mtr mysql-test/mtr
mysql-test/mysql-test-run mysql-test/mysql-test-run
mysql-test/mysql-test-run-shell
mysql-test/mysql-test-run.log mysql-test/mysql-test-run.log
mysql-test/mysql_test_run_new mysql-test/mysql_test_run_new
mysql-test/ndb/ndbcluster mysql-test/ndb/ndbcluster
......
...@@ -22,11 +22,15 @@ BUILT_SOURCES= $(top_builddir)/include/mysqld_error.h \ ...@@ -22,11 +22,15 @@ BUILT_SOURCES= $(top_builddir)/include/mysqld_error.h \
$(top_builddir)/include/sql_state.h \ $(top_builddir)/include/sql_state.h \
$(top_builddir)/include/mysqld_ername.h $(top_builddir)/include/mysqld_ername.h
pkginclude_HEADERS= $(BUILT_SOURCES) pkginclude_HEADERS= $(BUILT_SOURCES)
CLEANFILES = $(BUILT_SOURCES) DISTCLEANFILES = $(BUILT_SOURCES)
SUBDIRS = @yassl_dir@ SUBDIRS = @yassl_dir@
# This will build mysqld_error.h and sql_state.h # This will build mysqld_error.h, mysqld_ername.h and sql_state.h
$(top_builddir)/include/mysqld_error.h: comp_err$(EXEEXT) # NOTE Built files should depend on their sources to avoid
# the built files being rebuilt in source dist
$(top_builddir)/include/mysqld_error.h: comp_err.c \
$(top_srcdir)/sql/share/errmsg.txt
$(MAKE) $(AM_MAKEFLAGS) comp_err$(EXEEXT)
$(top_builddir)/extra/comp_err$(EXEEXT) \ $(top_builddir)/extra/comp_err$(EXEEXT) \
--charset=$(top_srcdir)/sql/share/charsets \ --charset=$(top_srcdir)/sql/share/charsets \
--out-dir=$(top_builddir)/sql/share/ \ --out-dir=$(top_builddir)/sql/share/ \
...@@ -37,9 +41,10 @@ $(top_builddir)/include/mysqld_error.h: comp_err$(EXEEXT) ...@@ -37,9 +41,10 @@ $(top_builddir)/include/mysqld_error.h: comp_err$(EXEEXT)
$(top_builddir)/include/mysqld_ername.h: $(top_builddir)/include/mysqld_error.h $(top_builddir)/include/mysqld_ername.h: $(top_builddir)/include/mysqld_error.h
$(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h $(top_builddir)/include/sql_state.h: $(top_builddir)/include/mysqld_error.h
bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \ bin_PROGRAMS = replace perror resolveip my_print_defaults \
resolve_stack_dump mysql_waitpid innochecksum resolve_stack_dump mysql_waitpid innochecksum
noinst_PROGRAMS = charset2html noinst_PROGRAMS = charset2html
EXTRA_PROGRAMS = comp_err
EXTRA_DIST = CMakeLists.txt EXTRA_DIST = CMakeLists.txt
perror.o: perror.c perror.o: perror.c
......
...@@ -6,3 +6,7 @@ libyassl_la_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \ ...@@ -6,3 +6,7 @@ libyassl_la_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \
template_instnt.cpp timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp template_instnt.cpp timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp
EXTRA_DIST = $(wildcard ../include/*.hpp) $(wildcard ../include/openssl/*.h) EXTRA_DIST = $(wildcard ../include/*.hpp) $(wildcard ../include/openssl/*.h)
AM_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX AM_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX
# Don't update the files from bitkeeper
%::SCCS/s.%
INCLUDES = -I../include -I../../mySTL INCLUDES = -I../include -I../../mySTL
bin_PROGRAMS = benchmark bin_PROGRAMS = benchmark
benchmark_SOURCES = benchmark.cpp benchmark_SOURCES = benchmark.cpp
benchmark_LDFLAGS = -L../src benchmark_LDADD = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
benchmark_LDADD = -ltaocrypt
benchmark_CXXFLAGS = -DYASSL_PURE_C benchmark_CXXFLAGS = -DYASSL_PURE_C
benchmark_DEPENDENCIES = ../src/libtaocrypt.la
EXTRA_DIST = benchmark.dsp rsa1024.der dh1024.der dsa1024.der make.bat EXTRA_DIST = benchmark.dsp rsa1024.der dh1024.der dsa1024.der make.bat
...@@ -11,3 +11,7 @@ libtaocrypt_la_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp \ ...@@ -11,3 +11,7 @@ libtaocrypt_la_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp \
libtaocrypt_la_CXXFLAGS = @yassl_taocrypt_extra_cxxflags@ -DYASSL_PURE_C libtaocrypt_la_CXXFLAGS = @yassl_taocrypt_extra_cxxflags@ -DYASSL_PURE_C
EXTRA_DIST = $(wildcard ../include/*.hpp) EXTRA_DIST = $(wildcard ../include/*.hpp)
# Don't update the files from bitkeeper
%::SCCS/s.%
INCLUDES = -I../include -I../../mySTL INCLUDES = -I../include -I../../mySTL
bin_PROGRAMS = test bin_PROGRAMS = test
test_SOURCES = test.cpp test_SOURCES = test.cpp
test_LDFLAGS = -L../src test_LDADD = $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
test_LDADD = -ltaocrypt
test_DEPENDENCIES = ../src/libtaocrypt.la
test_CXXFLAGS = -DYASSL_PURE_C test_CXXFLAGS = -DYASSL_PURE_C
EXTRA_DIST = make.bat EXTRA_DIST = make.bat
...@@ -4,8 +4,11 @@ testsuite_SOURCES = testsuite.cpp ../taocrypt/test/test.cpp \ ...@@ -4,8 +4,11 @@ testsuite_SOURCES = testsuite.cpp ../taocrypt/test/test.cpp \
../examples/client/client.cpp ../examples/server/server.cpp \ ../examples/client/client.cpp ../examples/server/server.cpp \
../examples/echoclient/echoclient.cpp \ ../examples/echoclient/echoclient.cpp \
../examples/echoserver/echoserver.cpp ../examples/echoserver/echoserver.cpp
testsuite_LDFLAGS = -L../src/ -L../taocrypt/src
testsuite_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX -DNO_MAIN_DRIVER testsuite_CXXFLAGS = -DYASSL_PURE_C -DYASSL_PREFIX -DNO_MAIN_DRIVER
testsuite_LDADD = -lyassl -ltaocrypt testsuite_LDADD = $(top_builddir)/extra/yassl/src/libyassl.la \
testsuite_DEPENDENCIES = ../src/libyassl.la ../taocrypt/src/libtaocrypt.la $(top_builddir)/extra/yassl/taocrypt/src/libtaocrypt.la
EXTRA_DIST = testsuite.dsp test.hpp input quit make.bat EXTRA_DIST = testsuite.dsp test.hpp input quit make.bat
# Don't update the files from bitkeeper
%::SCCS/s.%
...@@ -22,14 +22,15 @@ DIST_SUBDIRS=ndb ...@@ -22,14 +22,15 @@ DIST_SUBDIRS=ndb
benchdir_root= $(prefix) benchdir_root= $(prefix)
testdir = $(benchdir_root)/mysql-test testdir = $(benchdir_root)/mysql-test
EXTRA_SCRIPTS = mysql-test-run.sh install_test_db.sh valgrind.supp $(PRESCRIPTS) EXTRA_SCRIPTS = mysql-test-run-shell.sh install_test_db.sh \
EXTRA_DIST = $(EXTRA_SCRIPTS) valgrind.supp $(PRESCRIPTS)
GENSCRIPTS = mysql-test-run install_test_db mtr EXTRA_DIST = $(EXTRA_SCRIPTS)
GENSCRIPTS = mysql-test-run-shell install_test_db mtr mysql-test-run
PRESCRIPTS = mysql-test-run.pl PRESCRIPTS = mysql-test-run.pl
test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS) test_SCRIPTS = $(GENSCRIPTS) $(PRESCRIPTS)
test_DATA = std_data/client-key.pem std_data/client-cert.pem \ test_DATA = std_data/client-key.pem std_data/client-cert.pem \
std_data/cacert.pem std_data/server-cert.pem \ std_data/cacert.pem std_data/server-cert.pem \
std_data/server-key.pem std_data/server-key.pem
CLEANFILES = $(GENSCRIPTS) CLEANFILES = $(GENSCRIPTS)
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I.. INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I..
...@@ -118,6 +119,11 @@ mtr: ...@@ -118,6 +119,11 @@ mtr:
$(RM) -f mtr $(RM) -f mtr
$(LN_S) mysql-test-run.pl mtr $(LN_S) mysql-test-run.pl mtr
# mysql-test-run - a shortcut for executing mysql-test-run.pl
mysql-test-run:
$(RM) -f mysql-test-run
$(LN_S) mysql-test-run.pl mysql-test-run
SUFFIXES = .sh SUFFIXES = .sh
.sh: .sh:
......
...@@ -4,12 +4,4 @@ disable_query_log; ...@@ -4,12 +4,4 @@ disable_query_log;
show variables like "have_ndbcluster"; show variables like "have_ndbcluster";
enable_query_log; enable_query_log;
# Check that NDB is installed and known to be working
# This will disable ndb from the shell script 'mysql-test-run'
-- require r/have_ndb_status_ok.require
disable_query_log;
eval select "$NDB_STATUS_OK" as ndb_status_ok;
enable_query_log;
...@@ -62,7 +62,7 @@ sub collect_test_cases ($) { ...@@ -62,7 +62,7 @@ sub collect_test_cases ($) {
foreach my $tname ( @::opt_cases ) { # Run in specified order, no sort foreach my $tname ( @::opt_cases ) { # Run in specified order, no sort
my $elem= undef; my $elem= undef;
my $component_id= undef; my $component_id= undef;
# Get rid of directory part (path). Leave the extension since it is used # Get rid of directory part (path). Leave the extension since it is used
# to understand type of the test. # to understand type of the test.
...@@ -538,8 +538,6 @@ sub mtr_options_from_test_file($$) { ...@@ -538,8 +538,6 @@ sub mtr_options_from_test_file($$) {
while ( my $line= <$F> ) while ( my $line= <$F> )
{ {
chomp;
next if ( $line !~ /^--/ ); next if ( $line !~ /^--/ );
# Match this line against tag in "tags" array # Match this line against tag in "tags" array
......
...@@ -476,14 +476,6 @@ sub mtr_kill_leftovers () { ...@@ -476,14 +476,6 @@ sub mtr_kill_leftovers () {
mtr_debug("Got pid: $pid from file '$pidfile'"); mtr_debug("Got pid: $pid from file '$pidfile'");
# Race, could have been removed between I tested with -f
# and the unlink() below, so I better check again with -f
if ( ! unlink($pidfile) and -f $pidfile )
{
mtr_error("can't remove $pidfile");
}
if ( $::glob_cygwin_perl or kill(0, $pid) ) if ( $::glob_cygwin_perl or kill(0, $pid) )
{ {
mtr_debug("There is process with pid $pid -- scheduling for kill."); mtr_debug("There is process with pid $pid -- scheduling for kill.");
......
...@@ -905,13 +905,13 @@ sub command_line_setup () { ...@@ -905,13 +905,13 @@ sub command_line_setup () {
if ( ! $opt_testcase_timeout ) if ( ! $opt_testcase_timeout )
{ {
$opt_testcase_timeout= $default_testcase_timeout; $opt_testcase_timeout= $default_testcase_timeout;
$opt_testcase_timeout*= 10 if defined $opt_valgrind; $opt_testcase_timeout*= 10 if $opt_valgrind;
} }
if ( ! $opt_suite_timeout ) if ( ! $opt_suite_timeout )
{ {
$opt_suite_timeout= $default_suite_timeout; $opt_suite_timeout= $default_suite_timeout;
$opt_suite_timeout*= 4 if defined $opt_valgrind; $opt_suite_timeout*= 6 if $opt_valgrind;
} }
# Increase times to wait for executables to start if using valgrind # Increase times to wait for executables to start if using valgrind
...@@ -943,6 +943,7 @@ sub command_line_setup () { ...@@ -943,6 +943,7 @@ sub command_line_setup () {
$master->[0]= $master->[0]=
{ {
pid => 0,
type => "master", type => "master",
idx => 0, idx => 0,
path_myddir => "$opt_vardir/master-data", path_myddir => "$opt_vardir/master-data",
...@@ -958,6 +959,7 @@ sub command_line_setup () { ...@@ -958,6 +959,7 @@ sub command_line_setup () {
$master->[1]= $master->[1]=
{ {
pid => 0,
type => "master", type => "master",
idx => 1, idx => 1,
path_myddir => "$opt_vardir/master1-data", path_myddir => "$opt_vardir/master1-data",
...@@ -973,6 +975,7 @@ sub command_line_setup () { ...@@ -973,6 +975,7 @@ sub command_line_setup () {
$slave->[0]= $slave->[0]=
{ {
pid => 0,
type => "slave", type => "slave",
idx => 0, idx => 0,
path_myddir => "$opt_vardir/slave-data", path_myddir => "$opt_vardir/slave-data",
...@@ -989,6 +992,7 @@ sub command_line_setup () { ...@@ -989,6 +992,7 @@ sub command_line_setup () {
$slave->[1]= $slave->[1]=
{ {
pid => 0,
type => "slave", type => "slave",
idx => 1, idx => 1,
path_myddir => "$opt_vardir/slave1-data", path_myddir => "$opt_vardir/slave1-data",
...@@ -1004,6 +1008,7 @@ sub command_line_setup () { ...@@ -1004,6 +1008,7 @@ sub command_line_setup () {
$slave->[2]= $slave->[2]=
{ {
pid => 0,
type => "slave", type => "slave",
idx => 2, idx => 2,
path_myddir => "$opt_vardir/slave2-data", path_myddir => "$opt_vardir/slave2-data",
...@@ -1064,7 +1069,7 @@ sub command_line_setup () { ...@@ -1064,7 +1069,7 @@ sub command_line_setup () {
connect_string => "$opt_ndbconnectstring", connect_string => "$opt_ndbconnectstring",
path_pid => "$data_dir/ndb_3.pid", # Nodes + 1 path_pid => "$data_dir/ndb_3.pid", # Nodes + 1
pid => 0, # pid of ndb_mgmd pid => 0, # pid of ndb_mgmd
installed_ok => 'NO', installed_ok => 0,
}; };
$data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port_slave"; $data_dir= "$opt_vardir/ndbcluster-$opt_ndbcluster_port_slave";
...@@ -1077,7 +1082,7 @@ sub command_line_setup () { ...@@ -1077,7 +1082,7 @@ sub command_line_setup () {
connect_string => "$opt_ndbconnectstring_slave", connect_string => "$opt_ndbconnectstring_slave",
path_pid => "$data_dir/ndb_2.pid", # Nodes + 1 path_pid => "$data_dir/ndb_2.pid", # Nodes + 1
pid => 0, # pid of ndb_mgmd pid => 0, # pid of ndb_mgmd
installed_ok => 'NO', installed_ok => 0,
}; };
# Init pids of ndbd's # Init pids of ndbd's
...@@ -1172,9 +1177,9 @@ sub executable_setup () { ...@@ -1172,9 +1177,9 @@ sub executable_setup () {
"$path_client_bindir/mysqld-nt", "$path_client_bindir/mysqld-nt",
"$path_client_bindir/mysqld", "$path_client_bindir/mysqld",
"$path_client_bindir/mysqld-max", "$path_client_bindir/mysqld-max",
"$path_client_bindir/mysqld-debug",
"$glob_basedir/sql/release/mysqld", "$glob_basedir/sql/release/mysqld",
"$glob_basedir/sql/debug/mysqld"); "$glob_basedir/sql/debug/mysqld");
"$path_client_bindir/mysqld-debug",
$path_language= mtr_path_exists("$glob_basedir/share/english/", $path_language= mtr_path_exists("$glob_basedir/share/english/",
"$glob_basedir/sql/share/english/"); "$glob_basedir/sql/share/english/");
$path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets", $path_charsetsdir= mtr_path_exists("$glob_basedir/share/charsets",
...@@ -1539,7 +1544,8 @@ sub environment_setup () { ...@@ -1539,7 +1544,8 @@ sub environment_setup () {
my $cmdline_mysql= my $cmdline_mysql=
"$exe_mysql --no-defaults --host=localhost --user=root --password= " . "$exe_mysql --no-defaults --host=localhost --user=root --password= " .
"--port=$master->[0]->{'port'} " . "--port=$master->[0]->{'port'} " .
"--socket=$master->[0]->{'path_sock'}"; "--socket=$master->[0]->{'path_sock'} ".
"--character-sets-dir=$path_charsetsdir";
$ENV{'MYSQL'}= $cmdline_mysql; $ENV{'MYSQL'}= $cmdline_mysql;
...@@ -1662,7 +1668,7 @@ sub kill_running_server () { ...@@ -1662,7 +1668,7 @@ sub kill_running_server () {
{ {
# Ensure that no old mysqld test servers are running # Ensure that no old mysqld test servers are running
# This is different from terminating processes we have # This is different from terminating processes we have
# started from ths run of the script, this is terminating # started from this run of the script, this is terminating
# leftovers from previous runs. # leftovers from previous runs.
mtr_report("Killing Possible Leftover Processes"); mtr_report("Killing Possible Leftover Processes");
...@@ -2256,9 +2262,9 @@ sub mysql_install_db () { ...@@ -2256,9 +2262,9 @@ sub mysql_install_db () {
if ( $use_slaves ) if ( $use_slaves )
{ {
install_db('slave', $slave->[0]->{'path_myddir'}); install_db('slave1', $slave->[0]->{'path_myddir'});
install_db('slave', $slave->[1]->{'path_myddir'}); install_db('slave2', $slave->[1]->{'path_myddir'});
install_db('slave', $slave->[2]->{'path_myddir'}); install_db('slave3', $slave->[2]->{'path_myddir'});
} }
if ( ! $opt_skip_im ) if ( ! $opt_skip_im )
...@@ -2280,21 +2286,18 @@ sub mysql_install_db () { ...@@ -2280,21 +2286,18 @@ sub mysql_install_db () {
next if !$cluster->{'pid'}; next if !$cluster->{'pid'};
$cluster->{'installed_ok'}= "YES"; # Assume install suceeds $cluster->{'installed_ok'}= 1; # Assume install suceeds
if (ndbcluster_wait_started($cluster, "")) if (ndbcluster_wait_started($cluster, ""))
{ {
# failed to install, disable usage and flag that its no ok # failed to install, disable usage and flag that its no ok
mtr_report("ndbcluster_install of $cluster->{'name'} failed"); mtr_report("ndbcluster_install of $cluster->{'name'} failed");
$cluster->{"installed_ok"}= "NO"; $cluster->{"installed_ok"}= 0;
$cluster_started_ok= 0; $cluster_started_ok= 0;
} }
} }
$ENV{'NDB_STATUS_OK'}= $clusters->[0]->{'installed_ok'};
$ENV{'NDB_SLAVE_STATUS_OK'}= $clusters->[1]->{'installed_ok'};;
if ( ! $cluster_started_ok ) if ( ! $cluster_started_ok )
{ {
if ( $opt_force) if ( $opt_force)
...@@ -2372,6 +2375,12 @@ sub install_db ($$) { ...@@ -2372,6 +2375,12 @@ sub install_db ($$) {
mtr_add_arg($args, "--skip-ndbcluster"); mtr_add_arg($args, "--skip-ndbcluster");
mtr_add_arg($args, "--tmpdir=."); mtr_add_arg($args, "--tmpdir=.");
if ( $opt_debug )
{
mtr_add_arg($args, "--debug=d:t:i:A,%s/log/bootstrap_%s.trace",
$opt_vardir_trace, $type);
}
if ( ! $opt_netware ) if ( ! $opt_netware )
{ {
mtr_add_arg($args, "--language=%s", $path_language); mtr_add_arg($args, "--language=%s", $path_language);
...@@ -2505,7 +2514,7 @@ sub run_testcase_check_skip_test($) ...@@ -2505,7 +2514,7 @@ sub run_testcase_check_skip_test($)
} }
# If test needs cluster, check that master installed ok # If test needs cluster, check that master installed ok
if ( $tinfo->{'ndb_test'} and $clusters->[0]->{'installed_ok'} eq "NO" ) if ( $tinfo->{'ndb_test'} and !$clusters->[0]->{'installed_ok'} )
{ {
mtr_report_test_name($tinfo); mtr_report_test_name($tinfo);
mtr_report_test_failed($tinfo); mtr_report_test_failed($tinfo);
...@@ -2514,7 +2523,7 @@ sub run_testcase_check_skip_test($) ...@@ -2514,7 +2523,7 @@ sub run_testcase_check_skip_test($)
# If test needs slave cluster, check that it installed ok # If test needs slave cluster, check that it installed ok
if ( $tinfo->{'ndb_test'} and $tinfo->{'slave_num'} and if ( $tinfo->{'ndb_test'} and $tinfo->{'slave_num'} and
$clusters->[1]->{'installed_ok'} eq "NO" ) !$clusters->[1]->{'installed_ok'} )
{ {
mtr_report_test_name($tinfo); mtr_report_test_name($tinfo);
mtr_report_test_failed($tinfo); mtr_report_test_failed($tinfo);
...@@ -2879,7 +2888,7 @@ sub mysqld_arguments ($$$$$) { ...@@ -2879,7 +2888,7 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--console", $prefix); mtr_add_arg($args, "%s--console", $prefix);
mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir); mtr_add_arg($args, "%s--basedir=%s", $prefix, $path_my_basedir);
mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir); mtr_add_arg($args, "%s--character-sets-dir=%s", $prefix, $path_charsetsdir);
mtr_add_arg($args, "%s--core", $prefix);
mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix); mtr_add_arg($args, "%s--log-bin-trust-function-creators", $prefix);
mtr_add_arg($args, "%s--default-character-set=latin1", $prefix); mtr_add_arg($args, "%s--default-character-set=latin1", $prefix);
mtr_add_arg($args, "%s--language=%s", $prefix, $path_language); mtr_add_arg($args, "%s--language=%s", $prefix, $path_language);
...@@ -2940,8 +2949,6 @@ sub mysqld_arguments ($$$$$) { ...@@ -2940,8 +2949,6 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--datadir=%s", $prefix, mtr_add_arg($args, "%s--datadir=%s", $prefix,
$slave->[$idx]->{'path_myddir'}); $slave->[$idx]->{'path_myddir'});
# FIXME slave get this option twice?!
mtr_add_arg($args, "%s--exit-info=256", $prefix);
mtr_add_arg($args, "%s--init-rpl-role=slave", $prefix); mtr_add_arg($args, "%s--init-rpl-role=slave", $prefix);
if (! $opt_skip_slave_binlog) if (! $opt_skip_slave_binlog)
{ {
...@@ -3059,9 +3066,22 @@ sub mysqld_arguments ($$$$$) { ...@@ -3059,9 +3066,22 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--user=root", $prefix); mtr_add_arg($args, "%s--user=root", $prefix);
} }
my $found_skip_core= 0;
foreach my $arg ( @opt_extra_mysqld_opt, @$extra_opt ) foreach my $arg ( @opt_extra_mysqld_opt, @$extra_opt )
{ {
mtr_add_arg($args, "%s%s", $prefix, $arg); # Allow --skip-core-file to be set in master.opt file
if ($arg eq "--skip-core-file")
{
$found_skip_core= 1;
}
else
{
mtr_add_arg($args, "%s%s", $prefix, $arg);
}
}
if ( !$found_skip_core )
{
mtr_add_arg($args, "%s%s", $prefix, "--core-file");
} }
if ( $opt_bench ) if ( $opt_bench )
...@@ -3071,7 +3091,6 @@ sub mysqld_arguments ($$$$$) { ...@@ -3071,7 +3091,6 @@ sub mysqld_arguments ($$$$$) {
} }
elsif ( $type eq 'master' ) elsif ( $type eq 'master' )
{ {
mtr_add_arg($args, "%s--exit-info=256", $prefix);
mtr_add_arg($args, "%s--open-files-limit=1024", $prefix); mtr_add_arg($args, "%s--open-files-limit=1024", $prefix);
mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'}); mtr_add_arg($args, "%s--log=%s", $prefix, $master->[0]->{'path_mylog'});
} }
...@@ -3103,13 +3122,13 @@ sub mysqld_start ($$$) { ...@@ -3103,13 +3122,13 @@ sub mysqld_start ($$$) {
{ {
$exe= $exe_master_mysqld; $exe= $exe_master_mysqld;
} }
if ( $type eq 'slave' ) elsif ( $type eq 'slave' )
{ {
$exe= $exe_slave_mysqld; $exe= $exe_slave_mysqld;
} }
else else
{ {
$exe= $exe_mysqld; mtr_error("Unknown 'type' \"$type\" passed to mysqld_start");
} }
mtr_init_args(\$args); mtr_init_args(\$args);
...@@ -3410,7 +3429,6 @@ sub run_testcase_stop_servers($$$) { ...@@ -3410,7 +3429,6 @@ sub run_testcase_stop_servers($$$) {
my %admin_pids; # hash of admin processes that requests shutdown my %admin_pids; # hash of admin processes that requests shutdown
my @kill_pids; # list of processes to shutdown/kill my @kill_pids; # list of processes to shutdown/kill
# Remember if we restarted for this test case # Remember if we restarted for this test case
$tinfo->{'restarted'}= $do_restart; $tinfo->{'restarted'}= $do_restart;
...@@ -3720,7 +3738,6 @@ sub run_check_testcase ($$) { ...@@ -3720,7 +3738,6 @@ sub run_check_testcase ($$) {
sub run_mysqltest ($) { sub run_mysqltest ($) {
my ($tinfo)= @_; my ($tinfo)= @_;
my $exe= $exe_mysqltest; my $exe= $exe_mysqltest;
my $args; my $args;
......
...@@ -262,6 +262,13 @@ desc t3; ...@@ -262,6 +262,13 @@ desc t3;
Field Type Null Key Default Extra Field Type Null Key Default Extra
a decimal(21,2) NO 0.00 a decimal(21,2) NO 0.00
drop table t1,t2,t3; drop table t1,t2,t3;
select 1e-308, 1.00000001e-300, 100000000e-300;
1e-308 1.00000001e-300 100000000e-300
0 1.00000001e-300 1e-292
select 10e307;
10e307
1e+308
End of 4.1 tests
create table t1 (s1 float(0,2)); create table t1 (s1 float(0,2));
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1'). ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
create table t1 (s1 float(1,2)); create table t1 (s1 float(1,2));
......
...@@ -6,31 +6,3 @@ use prn; ...@@ -6,31 +6,3 @@ use prn;
ERROR 42000: Unknown database 'prn' ERROR 42000: Unknown database 'prn'
create table nu (a int); create table nu (a int);
drop table nu; drop table nu;
CREATE TABLE `t1` (
`TIM` datetime NOT NULL,
`VAL` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `t2` (
`TIM` datetime NOT NULL,
`VAL` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `mt` (
`TIM` datetime NOT NULL,
`VAL` double default NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST
UNION=(`t1`,`t2`);
INSERT INTO mt VALUES ('2006-01-01',0);
ALTER TABLE `t2` RENAME TO `t`;
INSERT INTO mt VALUES ('2006-01-01',0);
ERROR HY000: Can't lock file (errno: 155)
select * from mt;
ERROR HY000: Can't lock file (errno: 155)
FLUSH TABLES;
select * from mt;
ERROR HY000: Can't find file: 'mt' (errno: 2)
ALTER TABLE `t` RENAME TO `t2`;
INSERT INTO mt VALUES ('2006-01-01',0);
select * from mt;
TIM VAL
2006-01-01 00:00:00 0
2006-01-01 00:00:00 0
--skip-stack-trace --skip-core-file
...@@ -42,8 +42,5 @@ rpl_multi_engine : BUG#22583 2006-09-23 lars ...@@ -42,8 +42,5 @@ rpl_multi_engine : BUG#22583 2006-09-23 lars
#rpl_ndb_idempotent : BUG#21298 2006-07-27 msvensson #rpl_ndb_idempotent : BUG#21298 2006-07-27 msvensson
#rpl_row_basic_7ndb : BUG#21298 2006-07-27 msvensson #rpl_row_basic_7ndb : BUG#21298 2006-07-27 msvensson
#rpl_truncate_7ndb : BUG#21298 2006-07-27 msvensson #rpl_truncate_7ndb : BUG#21298 2006-07-27 msvensson
crash_commit_before : 2006-08-02 msvensson
func_group : BUG#21924 2006-08-30 reggie
func_in : BUG#21925 2006-08-30 reggie
ndb_binlog_discover : bug#21806 2006-08-24 ndb_binlog_discover : bug#21806 2006-08-24
ndb_autodiscover3 : bug#21806 ndb_autodiscover3 : bug#21806
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# i.e. lower_case_filesystem=OFF # i.e. lower_case_filesystem=OFF
# #
-- source include/have_case_sensitive_file_system.inc -- source include/have_case_sensitive_file_system.inc
-- source include/not_embedded.inc
connect (master,localhost,root,,); connect (master,localhost,root,,);
connection master; connection master;
......
...@@ -178,7 +178,16 @@ show warnings; ...@@ -178,7 +178,16 @@ show warnings;
desc t3; desc t3;
drop table t1,t2,t3; drop table t1,t2,t3;
# End of 4.1 tests #
# Bug #22129: A small double precision number becomes zero
#
# check if underflows are detected correctly
select 1e-308, 1.00000001e-300, 100000000e-300;
# check if overflows are detected correctly
select 10e307;
--echo End of 4.1 tests
# #
# bug #12694 (float(m,d) specifications) # bug #12694 (float(m,d) specifications)
......
...@@ -18,42 +18,3 @@ create table nu (a int); ...@@ -18,42 +18,3 @@ create table nu (a int);
drop table nu; drop table nu;
# End of 4.1 tests # End of 4.1 tests
#
# Bug #20789: Merge Subtable Rename Causes Crash
#
CREATE TABLE `t1` (
`TIM` datetime NOT NULL,
`VAL` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `t2` (
`TIM` datetime NOT NULL,
`VAL` double default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `mt` (
`TIM` datetime NOT NULL,
`VAL` double default NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST
UNION=(`t1`,`t2`);
# insert into the merge table and thus open it.
INSERT INTO mt VALUES ('2006-01-01',0);
# Alter one of the tables that are part of the merge table
ALTER TABLE `t2` RENAME TO `t`;
# Insert into the merge table that has just been altered
--error 1015
INSERT INTO mt VALUES ('2006-01-01',0);
--error 1015
select * from mt;
FLUSH TABLES;
--error 1017
select * from mt;
# Alter one of the tables that are part of the merge table
ALTER TABLE `t` RENAME TO `t2`;
INSERT INTO mt VALUES ('2006-01-01',0);
select * from mt;
...@@ -27,7 +27,7 @@ INCLUDES = @ZLIB_INCLUDES@ \ ...@@ -27,7 +27,7 @@ INCLUDES = @ZLIB_INCLUDES@ \
WRAPLIBS= @WRAPLIBS@ WRAPLIBS= @WRAPLIBS@
SUBDIRS = share SUBDIRS = share
libexec_PROGRAMS = mysqld libexec_PROGRAMS = mysqld
noinst_PROGRAMS = gen_lex_hash EXTRA_PROGRAMS = gen_lex_hash
bin_PROGRAMS = mysql_tzinfo_to_sql bin_PROGRAMS = mysql_tzinfo_to_sql
gen_lex_hash_LDFLAGS = @NOINST_LDFLAGS@ gen_lex_hash_LDFLAGS = @NOINST_LDFLAGS@
LDADD = $(top_builddir)/vio/libvio.a \ LDADD = $(top_builddir)/vio/libvio.a \
...@@ -157,7 +157,11 @@ sql_yacc.o: sql_yacc.cc sql_yacc.h $(HEADERS) ...@@ -157,7 +157,11 @@ sql_yacc.o: sql_yacc.cc sql_yacc.h $(HEADERS)
@echo "If it fails, re-run configure with --with-low-memory" @echo "If it fails, re-run configure with --with-low-memory"
$(CXXCOMPILE) $(LM_CFLAGS) -c $< $(CXXCOMPILE) $(LM_CFLAGS) -c $<
lex_hash.h: gen_lex_hash$(EXEEXT) # This generates lex_hash.h
# NOTE Built sources should depend on their sources not the tool
# this avoid the rebuild of the built files in a source dist
lex_hash.h: gen_lex_hash.cc lex.h
$(MAKE) $(AM_MAKEFLAGS) gen_lex_hash$(EXEEXT)
./gen_lex_hash$(EXEEXT) > $@ ./gen_lex_hash$(EXEEXT) > $@
# the following three should eventually be moved out of this directory # the following three should eventually be moved out of this directory
......
...@@ -1353,7 +1353,7 @@ event_tail: ...@@ -1353,7 +1353,7 @@ event_tail:
Lex->sql_command= SQLCOM_CREATE_EVENT; Lex->sql_command= SQLCOM_CREATE_EVENT;
Lex->expr_allows_subselect= TRUE; Lex->expr_allows_subselect= TRUE;
} }
;
ev_schedule_time: EVERY_SYM expr interval ev_schedule_time: EVERY_SYM expr interval
{ {
...@@ -1366,7 +1366,7 @@ ev_schedule_time: EVERY_SYM expr interval ...@@ -1366,7 +1366,7 @@ ev_schedule_time: EVERY_SYM expr interval
{ {
Lex->event_parse_data->item_execute_at= $2; Lex->event_parse_data->item_execute_at= $2;
} }
; ;
opt_ev_status: /* empty */ { $$= 0; } opt_ev_status: /* empty */ { $$= 0; }
| ENABLE_SYM | ENABLE_SYM
......
This diff is collapsed.
This diff is collapsed.
...@@ -76,20 +76,20 @@ btr_pcur_store_position( ...@@ -76,20 +76,20 @@ btr_pcur_store_position(
{ {
page_cur_t* page_cursor; page_cur_t* page_cursor;
rec_t* rec; rec_t* rec;
dict_tree_t* tree; dict_index_t* index;
page_t* page; page_t* page;
ulint offs; ulint offs;
ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED); ut_a(cursor->pos_state == BTR_PCUR_IS_POSITIONED);
ut_ad(cursor->latch_mode != BTR_NO_LATCHES); ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
tree = btr_cur_get_tree(btr_pcur_get_btr_cur(cursor)); index = btr_cur_get_index(btr_pcur_get_btr_cur(cursor));
page_cursor = btr_pcur_get_page_cur(cursor); page_cursor = btr_pcur_get_page_cur(cursor);
rec = page_cur_get_rec(page_cursor); rec = page_cur_get_rec(page_cursor);
page = ut_align_down(rec, UNIV_PAGE_SIZE); page = page_align(rec);
offs = ut_align_offset(rec, UNIV_PAGE_SIZE); offs = page_offset(rec);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page), ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
MTR_MEMO_PAGE_S_FIX) MTR_MEMO_PAGE_S_FIX)
...@@ -133,13 +133,13 @@ btr_pcur_store_position( ...@@ -133,13 +133,13 @@ btr_pcur_store_position(
} }
cursor->old_stored = BTR_PCUR_OLD_STORED; cursor->old_stored = BTR_PCUR_OLD_STORED;
cursor->old_rec = dict_tree_copy_rec_order_prefix cursor->old_rec = dict_index_copy_rec_order_prefix(
(tree, rec, &cursor->old_n_fields, index, rec, &cursor->old_n_fields,
&cursor->old_rec_buf, &cursor->buf_size); &cursor->old_rec_buf, &cursor->buf_size);
cursor->block_when_stored = buf_block_align(page); cursor->block_when_stored = buf_block_align(page);
cursor->modify_clock = buf_block_get_modify_clock cursor->modify_clock = buf_block_get_modify_clock(
(cursor->block_when_stored); cursor->block_when_stored);
} }
/****************************************************************** /******************************************************************
...@@ -197,13 +197,15 @@ btr_pcur_restore_position( ...@@ -197,13 +197,15 @@ btr_pcur_restore_position(
btr_pcur_t* cursor, /* in: detached persistent cursor */ btr_pcur_t* cursor, /* in: detached persistent cursor */
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
dict_tree_t* tree; dict_index_t* index;
page_t* page; page_t* page;
dtuple_t* tuple; dtuple_t* tuple;
ulint mode; ulint mode;
ulint old_mode; ulint old_mode;
mem_heap_t* heap; mem_heap_t* heap;
index = btr_cur_get_index(btr_pcur_get_btr_cur(cursor));
if (UNIV_UNLIKELY(cursor->old_stored != BTR_PCUR_OLD_STORED) if (UNIV_UNLIKELY(cursor->old_stored != BTR_PCUR_OLD_STORED)
|| UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED || UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED
&& cursor->pos_state != BTR_PCUR_IS_POSITIONED)) { && cursor->pos_state != BTR_PCUR_IS_POSITIONED)) {
...@@ -215,17 +217,16 @@ btr_pcur_restore_position( ...@@ -215,17 +217,16 @@ btr_pcur_restore_position(
ut_error; ut_error;
} }
if (UNIV_UNLIKELY if (UNIV_UNLIKELY(
(cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
|| cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) { || cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
/* In these cases we do not try an optimistic restoration, /* In these cases we do not try an optimistic restoration,
but always do a search */ but always do a search */
btr_cur_open_at_index_side btr_cur_open_at_index_side(
(cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE, cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE,
btr_pcur_get_btr_cur(cursor)->index, latch_mode, index, latch_mode, btr_pcur_get_btr_cur(cursor), mtr);
btr_pcur_get_btr_cur(cursor), mtr);
cursor->block_when_stored cursor->block_when_stored
= buf_block_align(btr_pcur_get_page(cursor)); = buf_block_align(btr_pcur_get_page(cursor));
...@@ -242,10 +243,10 @@ btr_pcur_restore_position( ...@@ -242,10 +243,10 @@ btr_pcur_restore_position(
|| UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) { || UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) {
/* Try optimistic restoration */ /* Try optimistic restoration */
if (UNIV_LIKELY if (UNIV_LIKELY(buf_page_optimistic_get(
(buf_page_optimistic_get(latch_mode, latch_mode,
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 #ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_TREE_NODE); buf_page_dbg_add_level(page, SYNC_TREE_NODE);
...@@ -255,20 +256,18 @@ btr_pcur_restore_position( ...@@ -255,20 +256,18 @@ btr_pcur_restore_position(
rec_t* rec; rec_t* rec;
ulint* offsets1; ulint* offsets1;
ulint* offsets2; ulint* offsets2;
dict_index_t* index;
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
cursor->latch_mode = latch_mode; cursor->latch_mode = latch_mode;
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
rec = btr_pcur_get_rec(cursor); rec = btr_pcur_get_rec(cursor);
index = btr_pcur_get_btr_cur(cursor)->index;
heap = mem_heap_create(256); heap = mem_heap_create(256);
offsets1 = rec_get_offsets offsets1 = rec_get_offsets(
(cursor->old_rec, index, NULL, cursor->old_rec, index, NULL,
cursor->old_n_fields, &heap); cursor->old_n_fields, &heap);
offsets2 = rec_get_offsets offsets2 = rec_get_offsets(
(rec, index, NULL, rec, index, NULL,
cursor->old_n_fields, &heap); cursor->old_n_fields, &heap);
ut_ad(!cmp_rec_rec(cursor->old_rec, ut_ad(!cmp_rec_rec(cursor->old_rec,
rec, offsets1, offsets2, rec, offsets1, offsets2,
...@@ -286,9 +285,8 @@ btr_pcur_restore_position( ...@@ -286,9 +285,8 @@ btr_pcur_restore_position(
heap = mem_heap_create(256); heap = mem_heap_create(256);
tree = btr_cur_get_tree(btr_pcur_get_btr_cur(cursor)); tuple = dict_index_build_data_tuple(index, cursor->old_rec,
tuple = dict_tree_build_data_tuple(tree, cursor->old_rec, cursor->old_n_fields, heap);
cursor->old_n_fields, heap);
/* Save the old search mode of the cursor */ /* Save the old search mode of the cursor */
old_mode = cursor->search_mode; old_mode = cursor->search_mode;
...@@ -302,8 +300,8 @@ btr_pcur_restore_position( ...@@ -302,8 +300,8 @@ btr_pcur_restore_position(
mode = PAGE_CUR_L; mode = PAGE_CUR_L;
} }
btr_pcur_open_with_no_init(btr_pcur_get_btr_cur(cursor)->index, tuple, btr_pcur_open_with_no_init(index, tuple, mode, latch_mode,
mode, latch_mode, cursor, 0, mtr); cursor, 0, mtr);
/* Restore the old search mode */ /* Restore the old search mode */
cursor->search_mode = old_mode; cursor->search_mode = old_mode;
...@@ -311,19 +309,18 @@ btr_pcur_restore_position( ...@@ -311,19 +309,18 @@ btr_pcur_restore_position(
if (cursor->rel_pos == BTR_PCUR_ON if (cursor->rel_pos == BTR_PCUR_ON
&& btr_pcur_is_on_user_rec(cursor, mtr) && btr_pcur_is_on_user_rec(cursor, mtr)
&& 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor), && 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
rec_get_offsets rec_get_offsets(
(btr_pcur_get_rec(cursor), btr_pcur_get_rec(cursor), index,
btr_pcur_get_btr_cur(cursor)->index, NULL, ULINT_UNDEFINED, &heap))) {
NULL, ULINT_UNDEFINED, &heap))) {
/* We have to store the NEW value for the modify clock, since /* We have to store the NEW value for the modify clock, since
the cursor can now be on a different page! But we can retain the cursor can now be on a different page! But we can retain
the value of old_rec */ the value of old_rec */
cursor->block_when_stored = buf_block_align cursor->block_when_stored = buf_block_align(
(btr_pcur_get_page(cursor)); btr_pcur_get_page(cursor));
cursor->modify_clock = buf_block_get_modify_clock cursor->modify_clock = buf_block_get_modify_clock(
(cursor->block_when_stored); cursor->block_when_stored);
cursor->old_stored = BTR_PCUR_OLD_STORED; cursor->old_stored = BTR_PCUR_OLD_STORED;
mem_heap_free(heap); mem_heap_free(heap);
......
This diff is collapsed.
...@@ -350,9 +350,9 @@ buf_page_is_corrupted( ...@@ -350,9 +350,9 @@ buf_page_is_corrupted(
if (srv_use_checksums) { if (srv_use_checksums) {
old_checksum = buf_calc_page_old_checksum(read_buf); old_checksum = buf_calc_page_old_checksum(read_buf);
old_checksum_field = mach_read_from_4 old_checksum_field = mach_read_from_4(
(read_buf + UNIV_PAGE_SIZE read_buf + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM); - FIL_PAGE_END_LSN_OLD_CHKSUM);
/* There are 2 valid formulas for old_checksum_field: /* There are 2 valid formulas for old_checksum_field:
...@@ -459,8 +459,8 @@ buf_page_print( ...@@ -459,8 +459,8 @@ buf_page_print(
if (dict_sys != NULL) { if (dict_sys != NULL) {
index = dict_index_find_on_id_low index = dict_index_find_on_id_low(
(btr_page_get_index_id(read_buf)); btr_page_get_index_id(read_buf));
if (index) { if (index) {
fputs("InnoDB: (", stderr); fputs("InnoDB: (", stderr);
dict_index_name_print(stderr, NULL, index); dict_index_name_print(stderr, NULL, index);
...@@ -598,8 +598,8 @@ buf_pool_init( ...@@ -598,8 +598,8 @@ buf_pool_init(
/* Allocate the virtual address space window, i.e., the /* Allocate the virtual address space window, i.e., the
buffer pool frames */ buffer pool frames */
buf_pool->frame_mem = os_awe_allocate_virtual_mem_window buf_pool->frame_mem = os_awe_allocate_virtual_mem_window(
(UNIV_PAGE_SIZE * (n_frames + 1)); UNIV_PAGE_SIZE * (n_frames + 1));
/* Allocate the physical memory for AWE and the AWE info array /* Allocate the physical memory for AWE and the AWE info array
for buf_pool */ for buf_pool */
...@@ -625,8 +625,8 @@ buf_pool_init( ...@@ -625,8 +625,8 @@ buf_pool_init(
} }
/*----------------------------------------*/ /*----------------------------------------*/
} else { } else {
buf_pool->frame_mem = os_mem_alloc_large buf_pool->frame_mem = os_mem_alloc_large(
(UNIV_PAGE_SIZE * (n_frames + 1), TRUE, FALSE); UNIV_PAGE_SIZE * (n_frames + 1), TRUE, FALSE);
} }
if (buf_pool->frame_mem == NULL) { if (buf_pool->frame_mem == NULL) {
...@@ -821,10 +821,10 @@ buf_awe_map_page_to_frame( ...@@ -821,10 +821,10 @@ buf_awe_map_page_to_frame(
} else { } else {
/* We can map block to the frame of bck */ /* We can map block to the frame of bck */
os_awe_map_physical_mem_to_window os_awe_map_physical_mem_to_window(
(bck->frame, bck->frame,
UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE, UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE,
block->awe_info); block->awe_info);
block->frame = bck->frame; block->frame = bck->frame;
...@@ -840,10 +840,10 @@ buf_awe_map_page_to_frame( ...@@ -840,10 +840,10 @@ buf_awe_map_page_to_frame(
bck); bck);
if (add_to_mapped_list) { if (add_to_mapped_list) {
UT_LIST_ADD_FIRST UT_LIST_ADD_FIRST(
(awe_LRU_free_mapped, awe_LRU_free_mapped,
buf_pool->awe_LRU_free_mapped, buf_pool->awe_LRU_free_mapped,
block); block);
} }
buf_pool->n_pages_awe_remapped++; buf_pool->n_pages_awe_remapped++;
...@@ -1583,7 +1583,7 @@ buf_page_init_for_backup_restore( ...@@ -1583,7 +1583,7 @@ buf_page_init_for_backup_restore(
block->is_hashed = FALSE; block->is_hashed = FALSE;
block->n_fields = 1; block->n_fields = 1;
block->n_bytes = 0; block->n_bytes = 0;
block->side = BTR_SEARCH_LEFT_SIDE; block->left_side = TRUE;
block->file_page_was_freed = FALSE; block->file_page_was_freed = FALSE;
} }
...@@ -1650,7 +1650,7 @@ buf_page_init( ...@@ -1650,7 +1650,7 @@ buf_page_init(
block->is_hashed = FALSE; block->is_hashed = FALSE;
block->n_fields = 1; block->n_fields = 1;
block->n_bytes = 0; block->n_bytes = 0;
block->side = BTR_SEARCH_LEFT_SIDE; block->left_side = TRUE;
block->file_page_was_freed = FALSE; block->file_page_was_freed = FALSE;
} }
...@@ -1710,8 +1710,8 @@ buf_page_init_for_read( ...@@ -1710,8 +1710,8 @@ buf_page_init_for_read(
mutex_enter(&(buf_pool->mutex)); mutex_enter(&(buf_pool->mutex));
if (fil_tablespace_deleted_or_being_deleted_in_mem if (fil_tablespace_deleted_or_being_deleted_in_mem(
(space, tablespace_version)) { space, tablespace_version)) {
*err = DB_TABLESPACE_DELETED; *err = DB_TABLESPACE_DELETED;
} }
...@@ -1891,10 +1891,10 @@ buf_page_io_complete( ...@@ -1891,10 +1891,10 @@ buf_page_io_complete(
/* If this page is not uninitialized and not in the /* If this page is not uninitialized and not in the
doublewrite buffer, then the page number and space id doublewrite buffer, then the page number and space id
should be the same as in block. */ should be the same as in block. */
ulint read_page_no = mach_read_from_4 ulint read_page_no = mach_read_from_4(
(block->frame + FIL_PAGE_OFFSET); block->frame + FIL_PAGE_OFFSET);
ulint read_space_id = mach_read_from_4 ulint read_space_id = mach_read_from_4(
(block->frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); block->frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
if (!block->space if (!block->space
&& trx_doublewrite_page_inside(block->offset)) { && trx_doublewrite_page_inside(block->offset)) {
...@@ -1980,9 +1980,9 @@ buf_page_io_complete( ...@@ -1980,9 +1980,9 @@ buf_page_io_complete(
} }
if (!recv_no_ibuf_operations) { if (!recv_no_ibuf_operations) {
ibuf_merge_or_delete_for_page ibuf_merge_or_delete_for_page(
(block->frame, block->space, block->frame, block->space, block->offset,
block->offset, TRUE); TRUE);
} }
} }
...@@ -2110,8 +2110,9 @@ buf_validate(void) ...@@ -2110,8 +2110,9 @@ buf_validate(void)
if (block->flush_type == BUF_FLUSH_LRU) { if (block->flush_type == BUF_FLUSH_LRU) {
n_lru_flush++; n_lru_flush++;
ut_a(rw_lock_is_locked ut_a(rw_lock_is_locked(
(&block->lock, RW_LOCK_SHARED)); &block->lock,
RW_LOCK_SHARED));
} else if (block->flush_type } else if (block->flush_type
== BUF_FLUSH_LIST) { == BUF_FLUSH_LIST) {
n_list_flush++; n_list_flush++;
......
...@@ -890,8 +890,8 @@ buf_flush_batch( ...@@ -890,8 +890,8 @@ buf_flush_batch(
old_page_count = page_count; old_page_count = page_count;
/* Try to flush also all the neighbors */ /* Try to flush also all the neighbors */
page_count += buf_flush_try_neighbors page_count += buf_flush_try_neighbors(
(space, offset, flush_type); space, offset, flush_type);
/* fprintf(stderr, /* fprintf(stderr,
"Flush type %lu, page no %lu, neighb %lu\n", "Flush type %lu, page no %lu, neighb %lu\n",
flush_type, offset, flush_type, offset,
......
...@@ -542,16 +542,16 @@ buf_LRU_old_adjust_len(void) ...@@ -542,16 +542,16 @@ buf_LRU_old_adjust_len(void)
if (old_len < new_len - BUF_LRU_OLD_TOLERANCE) { if (old_len < new_len - BUF_LRU_OLD_TOLERANCE) {
buf_pool->LRU_old = UT_LIST_GET_PREV buf_pool->LRU_old = UT_LIST_GET_PREV(
(LRU, buf_pool->LRU_old); LRU, buf_pool->LRU_old);
(buf_pool->LRU_old)->old = TRUE; (buf_pool->LRU_old)->old = TRUE;
buf_pool->LRU_old_len++; buf_pool->LRU_old_len++;
} else if (old_len > new_len + BUF_LRU_OLD_TOLERANCE) { } else if (old_len > new_len + BUF_LRU_OLD_TOLERANCE) {
(buf_pool->LRU_old)->old = FALSE; (buf_pool->LRU_old)->old = FALSE;
buf_pool->LRU_old = UT_LIST_GET_NEXT buf_pool->LRU_old = UT_LIST_GET_NEXT(
(LRU, buf_pool->LRU_old); LRU, buf_pool->LRU_old);
buf_pool->LRU_old_len--; buf_pool->LRU_old_len--;
} else { } else {
ut_a(buf_pool->LRU_old); /* Check that we did not ut_a(buf_pool->LRU_old); /* Check that we did not
......
...@@ -257,10 +257,10 @@ buf_read_ahead_random( ...@@ -257,10 +257,10 @@ buf_read_ahead_random(
mode: hence FALSE as the first parameter */ mode: hence FALSE as the first parameter */
if (!ibuf_bitmap_page(i)) { if (!ibuf_bitmap_page(i)) {
count += buf_read_page_low count += buf_read_page_low(
(&err, FALSE, &err, FALSE,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER, ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, tablespace_version, i); space, tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) { if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
...@@ -549,10 +549,10 @@ buf_read_ahead_linear( ...@@ -549,10 +549,10 @@ buf_read_ahead_linear(
aio mode: hence FALSE as the first parameter */ aio mode: hence FALSE as the first parameter */
if (!ibuf_bitmap_page(i)) { if (!ibuf_bitmap_page(i)) {
count += buf_read_page_low count += buf_read_page_low(
(&err, FALSE, &err, FALSE,
ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER, ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
space, tablespace_version, i); space, tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) { if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
......
...@@ -540,8 +540,8 @@ dtuple_convert_big_rec( ...@@ -540,8 +540,8 @@ dtuple_convert_big_rec(
n_fields = 0; n_fields = 0;
while (rec_get_converted_size(index, entry) while (rec_get_converted_size(index, entry)
>= ut_min(page_get_free_space_of_empty >= ut_min(page_get_free_space_of_empty(
(dict_table_is_comp(index->table)) / 2, dict_table_is_comp(index->table)) / 2,
REC_MAX_DATA_SIZE)) { REC_MAX_DATA_SIZE)) {
longest = 0; longest = 0;
...@@ -610,8 +610,8 @@ dtuple_convert_big_rec( ...@@ -610,8 +610,8 @@ dtuple_convert_big_rec(
vector->fields[n_fields].len = dfield->len vector->fields[n_fields].len = dfield->len
- DICT_MAX_INDEX_COL_LEN; - DICT_MAX_INDEX_COL_LEN;
vector->fields[n_fields].data = mem_heap_alloc vector->fields[n_fields].data = mem_heap_alloc(
(heap, vector->fields[n_fields].len); heap, vector->fields[n_fields].len);
/* Copy data (from the end of field) to big rec vector */ /* Copy data (from the end of field) to big rec vector */
......
...@@ -40,9 +40,6 @@ charset-collation code for them. */ ...@@ -40,9 +40,6 @@ charset-collation code for them. */
ulint data_mysql_default_charset_coll = 99999999; ulint data_mysql_default_charset_coll = 99999999;
dtype_t dtype_binary_val = {DATA_BINARY, 0, 0, 0, 0, 0};
dtype_t* dtype_binary = &dtype_binary_val;
/************************************************************************* /*************************************************************************
Determine how many bytes the first n characters of the given string occupy. Determine how many bytes the first n characters of the given string occupy.
If the string is shorter than n characters, returns the number of bytes If the string is shorter than n characters, returns the number of bytes
...@@ -53,7 +50,11 @@ dtype_get_at_most_n_mbchars( ...@@ -53,7 +50,11 @@ dtype_get_at_most_n_mbchars(
/*========================*/ /*========================*/
/* out: length of the prefix, /* out: length of the prefix,
in bytes */ in bytes */
const dtype_t* dtype, /* in: data type */ ulint prtype, /* in: precise type */
ulint mbminlen, /* in: minimum length of a
multi-byte character */
ulint mbmaxlen, /* in: maximum length of a
multi-byte character */
ulint prefix_len, /* in: length of the requested ulint prefix_len, /* in: length of the requested
prefix, in characters, multiplied by prefix, in characters, multiplied by
dtype_get_mbmaxlen(dtype) */ dtype_get_mbmaxlen(dtype) */
...@@ -63,12 +64,12 @@ dtype_get_at_most_n_mbchars( ...@@ -63,12 +64,12 @@ dtype_get_at_most_n_mbchars(
{ {
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
ut_a(data_len != UNIV_SQL_NULL); ut_a(data_len != UNIV_SQL_NULL);
ut_ad(!dtype->mbmaxlen || !(prefix_len % dtype->mbmaxlen)); ut_ad(!mbmaxlen || !(prefix_len % mbmaxlen));
if (dtype->mbminlen != dtype->mbmaxlen) { if (mbminlen != mbmaxlen) {
ut_a(!(prefix_len % dtype->mbmaxlen)); ut_a(!(prefix_len % mbmaxlen));
return(innobase_get_at_most_n_mbchars return(innobase_get_at_most_n_mbchars(
(dtype_get_charset_coll(dtype->prtype), dtype_get_charset_coll(prtype),
prefix_len, data_len, str)); prefix_len, data_len, str));
} }
...@@ -270,8 +271,6 @@ dtype_print( ...@@ -270,8 +271,6 @@ dtype_print(
} else if (prtype == DATA_TRX_ID) { } else if (prtype == DATA_TRX_ID) {
fputs("DATA_TRX_ID", stderr); fputs("DATA_TRX_ID", stderr);
len = DATA_TRX_ID_LEN; len = DATA_TRX_ID_LEN;
} else if (prtype == DATA_MIX_ID) {
fputs("DATA_MIX_ID", stderr);
} else if (prtype == DATA_ENGLISH) { } else if (prtype == DATA_ENGLISH) {
fputs("DATA_ENGLISH", stderr); fputs("DATA_ENGLISH", stderr);
} else { } else {
...@@ -291,38 +290,5 @@ dtype_print( ...@@ -291,38 +290,5 @@ dtype_print(
} }
} }
fprintf(stderr, " len %lu prec %lu", (ulong) len, (ulong) type->prec); fprintf(stderr, " len %lu", (ulong) len);
}
/***************************************************************************
Returns the maximum size of a data type. Note: types in system tables may be
incomplete and return incorrect information. */
ulint
dtype_get_max_size(
/*===============*/
/* out: maximum size (ULINT_MAX for
unbounded types) */
const dtype_t* type) /* in: type */
{
switch (type->mtype) {
case DATA_SYS:
case DATA_CHAR:
case DATA_FIXBINARY:
case DATA_INT:
case DATA_FLOAT:
case DATA_DOUBLE:
case DATA_MYSQL:
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
case DATA_VARMYSQL:
return(type->len);
case DATA_BLOB:
return(ULINT_MAX);
default:
ut_error;
}
return(ULINT_MAX);
} }
...@@ -58,8 +58,7 @@ dict_hdr_get_new_id( ...@@ -58,8 +58,7 @@ dict_hdr_get_new_id(
dulint id; dulint id;
mtr_t mtr; mtr_t mtr;
ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID) ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID));
|| (type == DICT_HDR_MIX_ID));
mtr_start(&mtr); mtr_start(&mtr);
...@@ -141,6 +140,7 @@ dict_hdr_create( ...@@ -141,6 +140,7 @@ dict_hdr_create(
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), mtr); ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
/* Obsolete, but we must initialize it to 0 anyway. */
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), mtr); ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
...@@ -214,7 +214,6 @@ dict_boot(void) ...@@ -214,7 +214,6 @@ dict_boot(void)
dict_index_t* index; dict_index_t* index;
dict_hdr_t* dict_hdr; dict_hdr_t* dict_hdr;
mtr_t mtr; mtr_t mtr;
ibool success;
mtr_start(&mtr); mtr_start(&mtr);
...@@ -236,25 +235,25 @@ dict_boot(void) ...@@ -236,25 +235,25 @@ dict_boot(void)
..._MARGIN, it will immediately be updated to the disk-based ..._MARGIN, it will immediately be updated to the disk-based
header. */ header. */
dict_sys->row_id = ut_dulint_add dict_sys->row_id = ut_dulint_add(
(ut_dulint_align_up(mtr_read_dulint ut_dulint_align_up(mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID,
(dict_hdr + DICT_HDR_ROW_ID, &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);
/* Insert into the dictionary cache the descriptions of the basic /* Insert into the dictionary cache the descriptions of the basic
system tables */ system tables */
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE, 8, 0); table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE, 8, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0); dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0); dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "N_COLS", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "N_COLS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "MIX_ID", DATA_BINARY, 0, 0, 0); dict_mem_table_add_col(table, "MIX_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "MIX_LEN", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "MIX_LEN", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "CLUSTER_NAME", DATA_BINARY, 0, 0, 0); dict_mem_table_add_col(table, "CLUSTER_NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4);
table->id = DICT_TABLES_ID; table->id = DICT_TABLES_ID;
...@@ -269,31 +268,30 @@ dict_boot(void) ...@@ -269,31 +268,30 @@ dict_boot(void)
index->id = DICT_TABLES_ID; index->id = DICT_TABLES_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint dict_index_add_to_cache(table, index,
(dict_hdr + DICT_HDR_TABLES, mtr_read_ulint(dict_hdr + DICT_HDR_TABLES,
MLOG_4BYTES, &mtr)); MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/ /*-------------------------*/
index = dict_mem_index_create("SYS_TABLES", "ID_IND", index = dict_mem_index_create("SYS_TABLES", "ID_IND",
DICT_HDR_SPACE, DICT_UNIQUE, 1); DICT_HDR_SPACE, DICT_UNIQUE, 1);
dict_mem_index_add_field(index, "ID", 0); dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_TABLE_IDS_ID; index->id = DICT_TABLE_IDS_ID;
success = dict_index_add_to_cache(table, index, dict_index_add_to_cache(table, index,
mtr_read_ulint mtr_read_ulint(dict_hdr + DICT_HDR_TABLE_IDS,
(dict_hdr + DICT_HDR_TABLE_IDS, MLOG_4BYTES, &mtr));
MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0); table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY,0,0,0); dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0); dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "MTYPE", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "MTYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "PRTYPE", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "PRTYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "LEN", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "LEN", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "PREC", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "PREC", DATA_INT, 0, 4);
table->id = DICT_COLUMNS_ID; table->id = DICT_COLUMNS_ID;
...@@ -308,20 +306,20 @@ dict_boot(void) ...@@ -308,20 +306,20 @@ dict_boot(void)
dict_mem_index_add_field(index, "POS", 0); dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_COLUMNS_ID; index->id = DICT_COLUMNS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint dict_index_add_to_cache(table, index,
(dict_hdr + DICT_HDR_COLUMNS, mtr_read_ulint(dict_hdr + DICT_HDR_COLUMNS,
MLOG_4BYTES, &mtr)); MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0); table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0,0,0); dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0); dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0); dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "N_FIELDS", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "N_FIELDS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "TYPE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "SPACE", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "PAGE_NO", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "PAGE_NO", DATA_INT, 0, 4);
/* The '+ 2' below comes from the 2 system fields */ /* The '+ 2' below comes from the 2 system fields */
#if DICT_SYS_INDEXES_PAGE_NO_FIELD != 6 + 2 #if DICT_SYS_INDEXES_PAGE_NO_FIELD != 6 + 2
...@@ -346,16 +344,16 @@ dict_boot(void) ...@@ -346,16 +344,16 @@ dict_boot(void)
dict_mem_index_add_field(index, "ID", 0); dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_INDEXES_ID; index->id = DICT_INDEXES_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint dict_index_add_to_cache(table, index,
(dict_hdr + DICT_HDR_INDEXES, mtr_read_ulint(dict_hdr + DICT_HDR_INDEXES,
MLOG_4BYTES, &mtr)); MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0); table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0);
dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0,0,0); dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, "COL_NAME", DATA_BINARY, 0,0,0); dict_mem_table_add_col(table, "COL_NAME", DATA_BINARY, 0, 0);
table->id = DICT_FIELDS_ID; table->id = DICT_FIELDS_ID;
dict_table_add_to_cache(table); dict_table_add_to_cache(table);
...@@ -369,10 +367,9 @@ dict_boot(void) ...@@ -369,10 +367,9 @@ dict_boot(void)
dict_mem_index_add_field(index, "POS", 0); dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_FIELDS_ID; index->id = DICT_FIELDS_ID;
success = dict_index_add_to_cache(table, index, mtr_read_ulint dict_index_add_to_cache(table, index,
(dict_hdr + DICT_HDR_FIELDS, mtr_read_ulint(dict_hdr + DICT_HDR_FIELDS,
MLOG_4BYTES, &mtr)); MLOG_4BYTES, &mtr));
ut_a(success);
mtr_commit(&mtr); mtr_commit(&mtr);
/*-------------------------*/ /*-------------------------*/
......
...@@ -78,14 +78,14 @@ dict_create_sys_tables_tuple( ...@@ -78,14 +78,14 @@ dict_create_sys_tables_tuple(
mach_write_to_4(ptr, DICT_TABLE_ORDINARY); mach_write_to_4(ptr, DICT_TABLE_ORDINARY);
dfield_set_data(dfield, ptr, 4); dfield_set_data(dfield, ptr, 4);
/* 6: MIX_ID ---------------------------*/ /* 6: MIX_ID (obsolete) ---------------------------*/
dfield = dtuple_get_nth_field(entry, 4); dfield = dtuple_get_nth_field(entry, 4);
ptr = mem_heap_alloc(heap, 8); ptr = mem_heap_alloc(heap, 8);
memset(ptr, 0, 8); memset(ptr, 0, 8);
dfield_set_data(dfield, ptr, 8); dfield_set_data(dfield, ptr, 8);
/* 7: MIX_LEN --------------------------*/ /* 7: MIX_LEN (obsolete) --------------------------*/
dfield = dtuple_get_nth_field(entry, 5); dfield = dtuple_get_nth_field(entry, 5);
...@@ -124,11 +124,12 @@ dict_create_sys_columns_tuple( ...@@ -124,11 +124,12 @@ dict_create_sys_columns_tuple(
mem_heap_t* heap) /* in: memory heap from which the memory for mem_heap_t* heap) /* in: memory heap from which the memory for
the built tuple is allocated */ the built tuple is allocated */
{ {
dict_table_t* sys_columns; dict_table_t* sys_columns;
dtuple_t* entry; dtuple_t* entry;
dict_col_t* column; const dict_col_t* column;
dfield_t* dfield; dfield_t* dfield;
byte* ptr; byte* ptr;
const char* col_name;
ut_ad(table && heap); ut_ad(table && heap);
...@@ -155,33 +156,34 @@ dict_create_sys_columns_tuple( ...@@ -155,33 +156,34 @@ dict_create_sys_columns_tuple(
/* 4: NAME ---------------------------*/ /* 4: NAME ---------------------------*/
dfield = dtuple_get_nth_field(entry, 2); dfield = dtuple_get_nth_field(entry, 2);
dfield_set_data(dfield, column->name, ut_strlen(column->name)); col_name = dict_table_get_col_name(table, i);
dfield_set_data(dfield, col_name, ut_strlen(col_name));
/* 5: MTYPE --------------------------*/ /* 5: MTYPE --------------------------*/
dfield = dtuple_get_nth_field(entry, 3); dfield = dtuple_get_nth_field(entry, 3);
ptr = mem_heap_alloc(heap, 4); ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, (column->type).mtype); mach_write_to_4(ptr, column->mtype);
dfield_set_data(dfield, ptr, 4); dfield_set_data(dfield, ptr, 4);
/* 6: PRTYPE -------------------------*/ /* 6: PRTYPE -------------------------*/
dfield = dtuple_get_nth_field(entry, 4); dfield = dtuple_get_nth_field(entry, 4);
ptr = mem_heap_alloc(heap, 4); ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, (column->type).prtype); mach_write_to_4(ptr, column->prtype);
dfield_set_data(dfield, ptr, 4); dfield_set_data(dfield, ptr, 4);
/* 7: LEN ----------------------------*/ /* 7: LEN ----------------------------*/
dfield = dtuple_get_nth_field(entry, 5); dfield = dtuple_get_nth_field(entry, 5);
ptr = mem_heap_alloc(heap, 4); ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, (column->type).len); mach_write_to_4(ptr, column->len);
dfield_set_data(dfield, ptr, 4); dfield_set_data(dfield, ptr, 4);
/* 8: PREC ---------------------------*/ /* 8: PREC ---------------------------*/
dfield = dtuple_get_nth_field(entry, 6); dfield = dtuple_get_nth_field(entry, 6);
ptr = mem_heap_alloc(heap, 4); ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, (column->type).prec); mach_write_to_4(ptr, 0/* unused */);
dfield_set_data(dfield, ptr, 4); dfield_set_data(dfield, ptr, 4);
/*---------------------------------*/ /*---------------------------------*/
...@@ -222,8 +224,7 @@ dict_build_table_def_step( ...@@ -222,8 +224,7 @@ dict_build_table_def_step(
row_len = 0; row_len = 0;
for (i = 0; i < table->n_def; i++) { for (i = 0; i < table->n_def; i++) {
row_len += dtype_get_min_size(dict_col_get_type row_len += dict_col_get_min_size(&table->cols[i]);
(&table->cols[i]));
} }
if (row_len > BTR_PAGE_MAX_REC_SIZE) { if (row_len > BTR_PAGE_MAX_REC_SIZE) {
return(DB_TOO_BIG_RECORD); return(DB_TOO_BIG_RECORD);
...@@ -238,7 +239,7 @@ dict_build_table_def_step( ...@@ -238,7 +239,7 @@ dict_build_table_def_step(
- page 3 will contain the root of the clustered index of the - page 3 will contain the root of the clustered index of the
table we create here. */ table we create here. */
table->space = 0; /* reset to zero for the call below */ ulint space = 0; /* reset to zero for the call below */
if (table->dir_path_of_temp_table) { if (table->dir_path_of_temp_table) {
/* We place tables created with CREATE TEMPORARY /* We place tables created with CREATE TEMPORARY
...@@ -251,9 +252,11 @@ dict_build_table_def_step( ...@@ -251,9 +252,11 @@ dict_build_table_def_step(
is_path = FALSE; is_path = FALSE;
} }
error = fil_create_new_single_table_tablespace error = fil_create_new_single_table_tablespace(
(&table->space, path_or_name, is_path, &space, path_or_name, is_path,
FIL_IBD_FILE_INITIAL_SIZE); FIL_IBD_FILE_INITIAL_SIZE);
table->space = space;
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
return(error); return(error);
...@@ -768,8 +771,8 @@ dict_truncate_index_tree( ...@@ -768,8 +771,8 @@ dict_truncate_index_tree(
appropriate field in the SYS_INDEXES record: this mini-transaction appropriate field in the SYS_INDEXES record: this mini-transaction
marks the B-tree totally truncated */ marks the B-tree totally truncated */
comp = page_is_comp(btr_page_get comp = page_is_comp(btr_page_get(space, root_page_no, RW_X_LATCH,
(space, root_page_no, RW_X_LATCH, mtr)); mtr));
btr_free_root(space, root_page_no, mtr); btr_free_root(space, root_page_no, mtr);
/* We will temporarily write FIL_NULL to the PAGE_NO field /* We will temporarily write FIL_NULL to the PAGE_NO field
...@@ -798,7 +801,7 @@ dict_truncate_index_tree( ...@@ -798,7 +801,7 @@ dict_truncate_index_tree(
root_page_no = btr_create(type, space, index_id, comp, mtr); root_page_no = btr_create(type, space, index_id, comp, mtr);
if (index) { if (index) {
index->tree->page = root_page_no; index->page = root_page_no;
} else { } else {
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
...@@ -1004,7 +1007,6 @@ dict_create_index_step( ...@@ -1004,7 +1007,6 @@ dict_create_index_step(
que_thr_t* thr) /* in: query thread */ que_thr_t* thr) /* in: query thread */
{ {
ind_node_t* node; ind_node_t* node;
ibool success;
ulint err = DB_ERROR; ulint err = DB_ERROR;
trx_t* trx; trx_t* trx;
...@@ -1088,10 +1090,8 @@ dict_create_index_step( ...@@ -1088,10 +1090,8 @@ dict_create_index_step(
if (node->state == INDEX_ADD_TO_CACHE) { if (node->state == INDEX_ADD_TO_CACHE) {
success = dict_index_add_to_cache(node->table, node->index, dict_index_add_to_cache(node->table, node->index,
node->page_no); node->page_no);
ut_a(success);
err = DB_SUCCESS; err = DB_SUCCESS;
} }
...@@ -1328,13 +1328,14 @@ dict_create_add_foreign_field_to_dictionary( ...@@ -1328,13 +1328,14 @@ dict_create_add_foreign_field_to_dictionary(
pars_info_add_str_literal(info, "ref_col_name", pars_info_add_str_literal(info, "ref_col_name",
foreign->referenced_col_names[field_nr]); foreign->referenced_col_names[field_nr]);
return(dict_foreign_eval_sql return(dict_foreign_eval_sql(
(info, "PROCEDURE P () IS\n" info,
"BEGIN\n" "PROCEDURE P () IS\n"
"INSERT INTO SYS_FOREIGN_COLS VALUES" "BEGIN\n"
"(:id, :pos, :for_col_name, :ref_col_name);\n" "INSERT INTO SYS_FOREIGN_COLS VALUES"
"END;\n", "(:id, :pos, :for_col_name, :ref_col_name);\n"
table, foreign, trx)); "END;\n",
table, foreign, trx));
} }
/************************************************************************ /************************************************************************
...@@ -1393,8 +1394,8 @@ dict_create_add_foreign_to_dictionary( ...@@ -1393,8 +1394,8 @@ dict_create_add_foreign_to_dictionary(
} }
for (i = 0; i < foreign->n_fields; i++) { for (i = 0; i < foreign->n_fields; i++) {
error = dict_create_add_foreign_field_to_dictionary error = dict_create_add_foreign_field_to_dictionary(
(i, table, foreign, trx); i, table, foreign, trx);
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
...@@ -1450,8 +1451,8 @@ dict_create_add_foreigns_to_dictionary( ...@@ -1450,8 +1451,8 @@ dict_create_add_foreigns_to_dictionary(
foreign; foreign;
foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) { foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) {
error = dict_create_add_foreign_to_dictionary error = dict_create_add_foreign_to_dictionary(&number, table,
(&number, table, foreign, trx); foreign, trx);
if (error != DB_SUCCESS) { if (error != DB_SUCCESS) {
......
This diff is collapsed.
...@@ -26,6 +26,25 @@ Created 4/24/1996 Heikki Tuuri ...@@ -26,6 +26,25 @@ Created 4/24/1996 Heikki Tuuri
#include "srv0start.h" #include "srv0start.h"
#include "srv0srv.h" #include "srv0srv.h"
/********************************************************************
Returns TRUE if index's i'th column's name is 'name' .*/
static
ibool
name_of_col_is(
/*===========*/
/* out: */
dict_table_t* table, /* in: table */
dict_index_t* index, /* in: index */
ulint i, /* in: */
const char* name) /* in: name to compare to */
{
ulint tmp = dict_col_get_no(dict_field_get_col(
dict_index_get_nth_field(
index, i)));
return(strcmp(name, dict_table_get_col_name(table, tmp)) == 0);
}
/************************************************************************ /************************************************************************
Finds the first table name in the given database. */ Finds the first table name in the given database. */
...@@ -331,7 +350,6 @@ dict_load_columns( ...@@ -331,7 +350,6 @@ dict_load_columns(
ulint mtype; ulint mtype;
ulint prtype; ulint prtype;
ulint col_len; ulint col_len;
ulint prec;
ulint i; ulint i;
mtr_t mtr; mtr_t mtr;
...@@ -356,7 +374,7 @@ dict_load_columns( ...@@ -356,7 +374,7 @@ dict_load_columns(
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE, btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &pcur, &mtr); BTR_SEARCH_LEAF, &pcur, &mtr);
for (i = 0; i < table->n_cols - DATA_N_SYS_COLS; i++) { for (i = 0; i + DATA_N_SYS_COLS < (ulint) table->n_cols; i++) {
rec = btr_pcur_get_rec(&pcur); rec = btr_pcur_get_rec(&pcur);
...@@ -372,8 +390,7 @@ dict_load_columns( ...@@ -372,8 +390,7 @@ dict_load_columns(
ut_ad(len == 4); ut_ad(len == 4);
ut_a(i == mach_read_from_4(field)); ut_a(i == mach_read_from_4(field));
ut_a(!strcmp("NAME", dict_field_get_col ut_a(name_of_col_is(sys_columns, sys_index, 4, "NAME"));
(dict_index_get_nth_field(sys_index, 4))->name));
field = rec_get_nth_field_old(rec, 4, &len); field = rec_get_nth_field_old(rec, 4, &len);
name = mem_heap_strdupl(heap, (char*) field, len); name = mem_heap_strdupl(heap, (char*) field, len);
...@@ -392,30 +409,25 @@ dict_load_columns( ...@@ -392,30 +409,25 @@ dict_load_columns(
/* Use the binary collation for /* Use the binary collation for
string columns of binary type. */ string columns of binary type. */
prtype = dtype_form_prtype prtype = dtype_form_prtype(
(prtype, prtype,
DATA_MYSQL_BINARY_CHARSET_COLL); DATA_MYSQL_BINARY_CHARSET_COLL);
} else { } else {
/* Use the default charset for /* Use the default charset for
other than binary columns. */ other than binary columns. */
prtype = dtype_form_prtype prtype = dtype_form_prtype(
(prtype, prtype,
data_mysql_default_charset_coll); data_mysql_default_charset_coll);
} }
} }
field = rec_get_nth_field_old(rec, 7, &len); field = rec_get_nth_field_old(rec, 7, &len);
col_len = mach_read_from_4(field); col_len = mach_read_from_4(field);
ut_a(!strcmp("PREC", dict_field_get_col ut_a(name_of_col_is(sys_columns, sys_index, 8, "PREC"));
(dict_index_get_nth_field(sys_index, 8))->name));
field = rec_get_nth_field_old(rec, 8, &len);
prec = mach_read_from_4(field);
dict_mem_table_add_col(table, name, mtype, prtype, col_len, dict_mem_table_add_col(table, name, mtype, prtype, col_len);
prec);
btr_pcur_move_to_next_user_rec(&pcur, &mtr); btr_pcur_move_to_next_user_rec(&pcur, &mtr);
} }
...@@ -526,13 +538,13 @@ dict_load_fields( ...@@ -526,13 +538,13 @@ dict_load_fields(
prefix_len = 0; prefix_len = 0;
} }
ut_a(!strcmp("COL_NAME", dict_field_get_col ut_a(name_of_col_is(sys_fields, sys_index, 4, "COL_NAME"));
(dict_index_get_nth_field(sys_index, 4))->name));
field = rec_get_nth_field_old(rec, 4, &len); field = rec_get_nth_field_old(rec, 4, &len);
dict_mem_index_add_field(index, mem_heap_strdupl dict_mem_index_add_field(index,
(heap, (char*) field, len), mem_heap_strdupl(heap,
(char*) field, len),
prefix_len); prefix_len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr); btr_pcur_move_to_next_user_rec(&pcur, &mtr);
...@@ -631,8 +643,7 @@ dict_load_indexes( ...@@ -631,8 +643,7 @@ dict_load_indexes(
ut_ad(len == 8); ut_ad(len == 8);
id = mach_read_from_8(field); id = mach_read_from_8(field);
ut_a(!strcmp("NAME", dict_field_get_col ut_a(name_of_col_is(sys_indexes, sys_index, 4, "NAME"));
(dict_index_get_nth_field(sys_index, 4))->name));
field = rec_get_nth_field_old(rec, 4, &name_len); field = rec_get_nth_field_old(rec, 4, &name_len);
name_buf = mem_heap_strdupl(heap, (char*) field, name_len); name_buf = mem_heap_strdupl(heap, (char*) field, name_len);
...@@ -646,8 +657,7 @@ dict_load_indexes( ...@@ -646,8 +657,7 @@ dict_load_indexes(
field = rec_get_nth_field_old(rec, 7, &len); field = rec_get_nth_field_old(rec, 7, &len);
space = mach_read_from_4(field); space = mach_read_from_4(field);
ut_a(!strcmp("PAGE_NO", dict_field_get_col ut_a(name_of_col_is(sys_indexes, sys_index, 8, "PAGE_NO"));
(dict_index_get_nth_field(sys_index, 8))->name));
field = rec_get_nth_field_old(rec, 8, &len); field = rec_get_nth_field_old(rec, 8, &len);
page_no = mach_read_from_4(field); page_no = mach_read_from_4(field);
...@@ -785,8 +795,7 @@ err_exit: ...@@ -785,8 +795,7 @@ err_exit:
goto err_exit; goto err_exit;
} }
ut_a(!strcmp("SPACE", dict_field_get_col ut_a(name_of_col_is(sys_tables, sys_index, 9, "SPACE"));
(dict_index_get_nth_field(sys_index, 9))->name));
field = rec_get_nth_field_old(rec, 9, &len); field = rec_get_nth_field_old(rec, 9, &len);
space = mach_read_from_4(field); space = mach_read_from_4(field);
...@@ -819,8 +828,7 @@ err_exit: ...@@ -819,8 +828,7 @@ err_exit:
} }
} }
ut_a(!strcmp("N_COLS", dict_field_get_col ut_a(name_of_col_is(sys_tables, sys_index, 4, "N_COLS"));
(dict_index_get_nth_field(sys_index, 4))->name));
field = rec_get_nth_field_old(rec, 4, &len); field = rec_get_nth_field_old(rec, 4, &len);
n_cols = mach_read_from_4(field); n_cols = mach_read_from_4(field);
...@@ -837,8 +845,7 @@ err_exit: ...@@ -837,8 +845,7 @@ err_exit:
table->ibd_file_missing = ibd_file_missing; table->ibd_file_missing = ibd_file_missing;
ut_a(!strcmp("ID", dict_field_get_col ut_a(name_of_col_is(sys_tables, sys_index, 3, "ID"));
(dict_index_get_nth_field(sys_index, 3))->name));
field = rec_get_nth_field_old(rec, 3, &len); field = rec_get_nth_field_old(rec, 3, &len);
table->id = mach_read_from_8(field); table->id = mach_read_from_8(field);
...@@ -925,8 +932,8 @@ dict_load_table_on_id( ...@@ -925,8 +932,8 @@ dict_load_table_on_id(
/*---------------------------------------------------*/ /*---------------------------------------------------*/
/* Get the secondary index based on ID for table SYS_TABLES */ /* Get the secondary index based on ID for table SYS_TABLES */
sys_tables = dict_sys->sys_tables; sys_tables = dict_sys->sys_tables;
sys_table_ids = dict_table_get_next_index sys_table_ids = dict_table_get_next_index(
(dict_table_get_first_index(sys_tables)); dict_table_get_first_index(sys_tables));
ut_a(!dict_table_is_comp(sys_tables)); ut_a(!dict_table_is_comp(sys_tables));
heap = mem_heap_create(256); heap = mem_heap_create(256);
...@@ -1032,11 +1039,11 @@ dict_load_foreign_cols( ...@@ -1032,11 +1039,11 @@ dict_load_foreign_cols(
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
foreign->foreign_col_names = mem_heap_alloc foreign->foreign_col_names = mem_heap_alloc(
(foreign->heap, foreign->n_fields * sizeof(void*)); foreign->heap, foreign->n_fields * sizeof(void*));
foreign->referenced_col_names = mem_heap_alloc foreign->referenced_col_names = mem_heap_alloc(
(foreign->heap, foreign->n_fields * sizeof(void*)); foreign->heap, foreign->n_fields * sizeof(void*));
mtr_start(&mtr); mtr_start(&mtr);
sys_foreign_cols = dict_table_get_low("SYS_FOREIGN_COLS"); sys_foreign_cols = dict_table_get_low("SYS_FOREIGN_COLS");
...@@ -1067,12 +1074,12 @@ dict_load_foreign_cols( ...@@ -1067,12 +1074,12 @@ dict_load_foreign_cols(
ut_a(i == mach_read_from_4(field)); ut_a(i == mach_read_from_4(field));
field = rec_get_nth_field_old(rec, 4, &len); field = rec_get_nth_field_old(rec, 4, &len);
foreign->foreign_col_names[i] = mem_heap_strdupl foreign->foreign_col_names[i] = mem_heap_strdupl(
(foreign->heap, (char*) field, len); foreign->heap, (char*) field, len);
field = rec_get_nth_field_old(rec, 5, &len); field = rec_get_nth_field_old(rec, 5, &len);
foreign->referenced_col_names[i] = mem_heap_strdupl foreign->referenced_col_names[i] = mem_heap_strdupl(
(foreign->heap, (char*) field, len); foreign->heap, (char*) field, len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr); btr_pcur_move_to_next_user_rec(&pcur, &mtr);
} }
...@@ -1165,8 +1172,8 @@ dict_load_foreign( ...@@ -1165,8 +1172,8 @@ dict_load_foreign(
foreign = dict_mem_foreign_create(); foreign = dict_mem_foreign_create();
foreign->n_fields = mach_read_from_4 foreign->n_fields = mach_read_from_4(
(rec_get_nth_field_old(rec, 5, &len)); rec_get_nth_field_old(rec, 5, &len));
ut_a(len == 4); ut_a(len == 4);
...@@ -1178,12 +1185,12 @@ dict_load_foreign( ...@@ -1178,12 +1185,12 @@ dict_load_foreign(
foreign->id = mem_heap_strdup(foreign->heap, id); foreign->id = mem_heap_strdup(foreign->heap, id);
field = rec_get_nth_field_old(rec, 3, &len); field = rec_get_nth_field_old(rec, 3, &len);
foreign->foreign_table_name = mem_heap_strdupl foreign->foreign_table_name = mem_heap_strdupl(
(foreign->heap, (char*) field, len); foreign->heap, (char*) field, len);
field = rec_get_nth_field_old(rec, 4, &len); field = rec_get_nth_field_old(rec, 4, &len);
foreign->referenced_table_name = mem_heap_strdupl foreign->referenced_table_name = mem_heap_strdupl(
(foreign->heap, (char*) field, len); foreign->heap, (char*) field, len);
btr_pcur_close(&pcur); btr_pcur_close(&pcur);
mtr_commit(&mtr); mtr_commit(&mtr);
...@@ -1257,8 +1264,8 @@ dict_load_foreigns( ...@@ -1257,8 +1264,8 @@ dict_load_foreigns(
/* Get the secondary index based on FOR_NAME from table /* Get the secondary index based on FOR_NAME from table
SYS_FOREIGN */ SYS_FOREIGN */
sec_index = dict_table_get_next_index sec_index = dict_table_get_next_index(
(dict_table_get_first_index(sys_foreign)); dict_table_get_first_index(sys_foreign));
start_load: start_load:
heap = mem_heap_create(256); heap = mem_heap_create(256);
...@@ -1289,7 +1296,8 @@ loop: ...@@ -1289,7 +1296,8 @@ loop:
following call does the comparison in the latin1_swedish_ci following call does the comparison in the latin1_swedish_ci
charset-collation, in a case-insensitive way. */ charset-collation, in a case-insensitive way. */
if (0 != cmp_data_data(dfield_get_type(dfield), if (0 != cmp_data_data(dfield_get_type(dfield)->mtype,
dfield_get_type(dfield)->prtype,
dfield_get_data(dfield), dfield_get_len(dfield), dfield_get_data(dfield), dfield_get_len(dfield),
field, len)) { field, len)) {
......
...@@ -66,6 +66,7 @@ dict_mem_table_create( ...@@ -66,6 +66,7 @@ dict_mem_table_create(
table->cols = mem_heap_alloc(heap, (n_cols + DATA_N_SYS_COLS) table->cols = mem_heap_alloc(heap, (n_cols + DATA_N_SYS_COLS)
* sizeof(dict_col_t)); * sizeof(dict_col_t));
table->col_names = NULL;
UT_LIST_INIT(table->indexes); UT_LIST_INIT(table->indexes);
table->auto_inc_lock = mem_heap_alloc(heap, lock_get_size()); table->auto_inc_lock = mem_heap_alloc(heap, lock_get_size());
...@@ -76,20 +77,22 @@ dict_mem_table_create( ...@@ -76,20 +77,22 @@ dict_mem_table_create(
UT_LIST_INIT(table->foreign_list); UT_LIST_INIT(table->foreign_list);
UT_LIST_INIT(table->referenced_list); UT_LIST_INIT(table->referenced_list);
#ifdef UNIV_DEBUG
table->does_not_fit_in_memory = FALSE; table->does_not_fit_in_memory = FALSE;
#endif /* UNIV_DEBUG */
table->stat_initialized = FALSE; table->stat_initialized = FALSE;
table->stat_modified_counter = 0; table->stat_modified_counter = 0;
table->max_row_size = 0; table->big_rows = 0;
mutex_create(&table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX); mutex_create(&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);
} }
...@@ -105,9 +108,74 @@ dict_mem_table_free( ...@@ -105,9 +108,74 @@ dict_mem_table_free(
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
mutex_free(&(table->autoinc_mutex)); mutex_free(&(table->autoinc_mutex));
if (table->col_names && (table->n_def < table->n_cols)) {
ut_free((void*)table->col_names);
}
mem_heap_free(table->heap); mem_heap_free(table->heap);
} }
/********************************************************************
Add 'name' to end of the col_names array (see dict_table_t::col_names). Call
ut_free on col_names (if not NULL), allocate new array (if heap, from it,
otherwise with ut_malloc), and copy col_names + name to it. */
static
const char*
dict_add_col_name(
/*==============*/
/* out: new column names array */
const char* col_names, /* in: existing column names, or
NULL */
ulint cols, /* in: number of existing columns */
const char* name, /* in: new column name */
mem_heap_t* heap) /* in: heap, or NULL */
{
ulint i;
ulint old_len;
ulint new_len;
ulint total_len;
const char* s;
char* res;
ut_a(((cols == 0) && !col_names) || ((cols > 0) && col_names));
ut_a(*name);
/* Find out length of existing array. */
if (col_names) {
s = col_names;
for (i = 0; i < cols; i++) {
s += strlen(s) + 1;
}
old_len = s - col_names;
} else {
old_len = 0;
}
new_len = strlen(name) + 1;
total_len = old_len + new_len;
if (heap) {
res = mem_heap_alloc(heap, total_len);
} else {
res = ut_malloc(total_len);
}
if (old_len > 0) {
memcpy(res, col_names, old_len);
}
memcpy(res + old_len, name, new_len);
if (col_names) {
ut_free((char*)col_names);
}
return(res);
}
/************************************************************************** /**************************************************************************
Adds a column definition to a table. */ Adds a column definition to a table. */
...@@ -118,29 +186,36 @@ dict_mem_table_add_col( ...@@ -118,29 +186,36 @@ dict_mem_table_add_col(
const char* name, /* in: column name */ const char* name, /* in: column name */
ulint mtype, /* in: main datatype */ ulint mtype, /* in: main datatype */
ulint prtype, /* in: precise type */ ulint prtype, /* in: precise type */
ulint len, /* in: length */ ulint len) /* in: precision */
ulint prec) /* in: precision */
{ {
dict_col_t* col; dict_col_t* col;
dtype_t* type; ulint mbminlen;
ulint mbmaxlen;
mem_heap_t* heap;
ut_ad(table && name); ut_ad(table && name);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
table->n_def++; table->n_def++;
col = dict_table_get_nth_col(table, table->n_def - 1); heap = table->n_def < table->n_cols ? NULL : table->heap;
table->col_names = dict_add_col_name(table->col_names,
table->n_def - 1,
name, heap);
col = (dict_col_t*) dict_table_get_nth_col(table, table->n_def - 1);
col->ind = table->n_def - 1; col->ind = table->n_def - 1;
col->name = mem_heap_strdup(table->heap, name);
col->table = table;
col->ord_part = 0; col->ord_part = 0;
col->clust_pos = ULINT_UNDEFINED; col->mtype = mtype;
col->prtype = prtype;
col->len = len;
type = dict_col_get_type(col); dtype_get_mblen(mtype, prtype, &mbminlen, &mbmaxlen);
dtype_set(type, mtype, prtype, len, prec); col->mbminlen = mbminlen;
col->mbmaxlen = mbmaxlen;
} }
/************************************************************************** /**************************************************************************
...@@ -171,6 +246,7 @@ dict_mem_index_create( ...@@ -171,6 +246,7 @@ dict_mem_index_create(
index->type = type; index->type = type;
index->space = space; index->space = space;
index->page = 0;
index->name = mem_heap_strdup(heap, index_name); index->name = mem_heap_strdup(heap, index_name);
index->table_name = table_name; index->table_name = table_name;
index->table = NULL; index->table = NULL;
...@@ -183,8 +259,10 @@ dict_mem_index_create( ...@@ -183,8 +259,10 @@ dict_mem_index_create(
index->stat_n_diff_key_vals = NULL; index->stat_n_diff_key_vals = NULL;
index->cached = FALSE; index->cached = FALSE;
memset(&index->lock, 0, sizeof index->lock);
#ifdef UNIV_DEBUG
index->magic_n = DICT_INDEX_MAGIC_N; index->magic_n = DICT_INDEX_MAGIC_N;
#endif /* UNIV_DEBUG */
return(index); return(index);
} }
......
...@@ -334,7 +334,7 @@ eval_predefined_2( ...@@ -334,7 +334,7 @@ eval_predefined_2(
if (len2 > len1) { if (len2 > len1) {
int_val = (lint) (len1 int_val = (lint) (len1
+ (eval_rnd % (len2 - len1 + 1))); + (eval_rnd % (len2 - len1 + 1)));
} else { } else {
int_val = (lint) len1; int_val = (lint) len1;
} }
......
...@@ -51,8 +51,8 @@ if_step( ...@@ -51,8 +51,8 @@ if_step(
for (;;) { for (;;) {
eval_exp(elsif_node->cond); eval_exp(elsif_node->cond);
if (eval_node_get_ibool_val if (eval_node_get_ibool_val(
(elsif_node->cond)) { elsif_node->cond)) {
/* The condition evaluated to TRUE: /* The condition evaluated to TRUE:
start execution from the first start execution from the first
......
...@@ -529,9 +529,8 @@ fil_node_open_file( ...@@ -529,9 +529,8 @@ fil_node_open_file(
os_file_read() in Windows to read from a file opened for os_file_read() in Windows to read from a file opened for
async I/O! */ async I/O! */
node->handle = os_file_create_simple_no_error_handling node->handle = os_file_create_simple_no_error_handling(
(node->name, node->name, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
if (!success) { if (!success) {
/* The following call prints an error message */ /* The following call prints an error message */
os_file_get_last_error(TRUE); os_file_get_last_error(TRUE);
...@@ -1564,9 +1563,9 @@ fil_write_flushed_lsn_to_data_files( ...@@ -1564,9 +1563,9 @@ fil_write_flushed_lsn_to_data_files(
while (node) { while (node) {
mutex_exit(&(fil_system->mutex)); mutex_exit(&(fil_system->mutex));
err = fil_write_lsn_and_arch_no_to_file err = fil_write_lsn_and_arch_no_to_file(
(space->id, sum_of_sizes, space->id, sum_of_sizes, lsn,
lsn, arch_log_no); arch_log_no);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
return(err); return(err);
...@@ -1936,9 +1935,9 @@ fil_op_log_parse_or_replay( ...@@ -1936,9 +1935,9 @@ fil_op_log_parse_or_replay(
ut_a(space_id != 0); ut_a(space_id != 0);
if (fil_create_new_single_table_tablespace if (fil_create_new_single_table_tablespace(
(&space_id, name, FALSE, &space_id, name, FALSE,
FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) { FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
ut_error; ut_error;
} }
} }
...@@ -2580,8 +2579,8 @@ fil_reset_too_high_lsns( ...@@ -2580,8 +2579,8 @@ fil_reset_too_high_lsns(
filepath = fil_make_ibd_name(name, FALSE); filepath = fil_make_ibd_name(name, FALSE);
file = os_file_create_simple_no_error_handling file = os_file_create_simple_no_error_handling(
(filepath, OS_FILE_OPEN, OS_FILE_READ_WRITE, &success); filepath, OS_FILE_OPEN, OS_FILE_READ_WRITE, &success);
if (!success) { if (!success) {
/* The following call prints an error message */ /* The following call prints an error message */
os_file_get_last_error(TRUE); os_file_get_last_error(TRUE);
...@@ -2654,8 +2653,8 @@ fil_reset_too_high_lsns( ...@@ -2654,8 +2653,8 @@ fil_reset_too_high_lsns(
if (ut_dulint_cmp(mach_read_from_8(page + FIL_PAGE_LSN), if (ut_dulint_cmp(mach_read_from_8(page + FIL_PAGE_LSN),
current_lsn) > 0) { current_lsn) > 0) {
/* We have to reset the lsn */ /* We have to reset the lsn */
space_id = mach_read_from_4 space_id = mach_read_from_4(
(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
page_no = mach_read_from_4(page + FIL_PAGE_OFFSET); page_no = mach_read_from_4(page + FIL_PAGE_OFFSET);
buf_flush_init_for_writing(page, current_lsn, space_id, buf_flush_init_for_writing(page, current_lsn, space_id,
...@@ -2735,8 +2734,8 @@ fil_open_single_table_tablespace( ...@@ -2735,8 +2734,8 @@ fil_open_single_table_tablespace(
filepath = fil_make_ibd_name(name, FALSE); filepath = fil_make_ibd_name(name, FALSE);
file = os_file_create_simple_no_error_handling file = os_file_create_simple_no_error_handling(
(filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success); filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
if (!success) { if (!success) {
/* The following call prints an error message */ /* The following call prints an error message */
os_file_get_last_error(TRUE); os_file_get_last_error(TRUE);
...@@ -2887,8 +2886,8 @@ fil_load_single_table_tablespace( ...@@ -2887,8 +2886,8 @@ fil_load_single_table_tablespace(
dict_casedn_str(filepath); dict_casedn_str(filepath);
# endif /* !UNIV_HOTBACKUP */ # endif /* !UNIV_HOTBACKUP */
#endif #endif
file = os_file_create_simple_no_error_handling file = os_file_create_simple_no_error_handling(
(filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success); filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
if (!success) { if (!success) {
/* The following call prints an error message */ /* The following call prints an error message */
os_file_get_last_error(TRUE); os_file_get_last_error(TRUE);
...@@ -3242,8 +3241,8 @@ fil_load_single_table_tablespaces(void) ...@@ -3242,8 +3241,8 @@ fil_load_single_table_tablespaces(void)
".ibd")) { ".ibd")) {
/* The name ends in .ibd; try opening /* The name ends in .ibd; try opening
the file */ the file */
fil_load_single_table_tablespace fil_load_single_table_tablespace(
(dbinfo.name, fileinfo.name); dbinfo.name, fileinfo.name);
} }
next_file_item: next_file_item:
ret = fil_file_readdir_next_file(&err, ret = fil_file_readdir_next_file(&err,
...@@ -3736,8 +3735,8 @@ fil_extend_tablespaces_to_stored_len(void) ...@@ -3736,8 +3735,8 @@ fil_extend_tablespaces_to_stored_len(void)
size_in_header = fsp_get_size_low(buf); size_in_header = fsp_get_size_low(buf);
success = fil_extend_space_to_desired_size success = fil_extend_space_to_desired_size(
(&actual_size, space->id, size_in_header); &actual_size, space->id, size_in_header);
if (!success) { if (!success) {
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: could not extend the" "InnoDB: Error: could not extend the"
...@@ -4082,9 +4081,9 @@ fil_io( ...@@ -4082,9 +4081,9 @@ fil_io(
for (;;) { for (;;) {
if (node == NULL) { if (node == NULL) {
fil_report_invalid_page_access fil_report_invalid_page_access(
(block_offset, space_id, block_offset, space_id, space->name,
space->name, byte_offset, len, type); byte_offset, len, type);
ut_error; ut_error;
} }
...@@ -4113,9 +4112,9 @@ fil_io( ...@@ -4113,9 +4112,9 @@ fil_io(
if (space->purpose == FIL_TABLESPACE && space->id != 0 if (space->purpose == FIL_TABLESPACE && space->id != 0
&& node->size <= block_offset) { && node->size <= block_offset) {
fil_report_invalid_page_access fil_report_invalid_page_access(
(block_offset, space_id, block_offset, space_id, space->name, byte_offset,
space->name, byte_offset, len, type); len, type);
ut_error; ut_error;
} }
...@@ -4384,10 +4383,10 @@ skip_flush: ...@@ -4384,10 +4383,10 @@ skip_flush:
space->is_in_unflushed_spaces = FALSE; space->is_in_unflushed_spaces = FALSE;
UT_LIST_REMOVE UT_LIST_REMOVE(
(unflushed_spaces, unflushed_spaces,
system->unflushed_spaces, system->unflushed_spaces,
space); space);
} }
} }
......
...@@ -768,8 +768,9 @@ xdes_lst_get_next( ...@@ -768,8 +768,9 @@ xdes_lst_get_next(
space = buf_frame_get_space_id(descr); space = buf_frame_get_space_id(descr);
return(xdes_lst_get_descriptor return(xdes_lst_get_descriptor(
(space, flst_get_next_addr(descr + XDES_FLST_NODE, mtr), mtr)); space,
flst_get_next_addr(descr + XDES_FLST_NODE, mtr), mtr));
} }
/************************************************************************ /************************************************************************
...@@ -1116,8 +1117,8 @@ fsp_try_extend_data_file( ...@@ -1116,8 +1117,8 @@ fsp_try_extend_data_file(
fprintf(stderr, fprintf(stderr,
"InnoDB: Error: Last data file size is %lu," "InnoDB: Error: Last data file size is %lu,"
" max size allowed %lu\n", " max size allowed %lu\n",
(ulong) srv_data_file_sizes (ulong) srv_data_file_sizes[
[srv_n_data_files - 1], srv_n_data_files - 1],
(ulong) srv_last_file_size_max); (ulong) srv_last_file_size_max);
} }
...@@ -1137,13 +1138,13 @@ fsp_try_extend_data_file( ...@@ -1137,13 +1138,13 @@ fsp_try_extend_data_file(
if (size < FSP_EXTENT_SIZE) { if (size < FSP_EXTENT_SIZE) {
/* Let us first extend the file to 64 pages */ /* Let us first extend the file to 64 pages */
success = fsp_try_extend_data_file_with_pages success = fsp_try_extend_data_file_with_pages(
(space, FSP_EXTENT_SIZE - 1, space, FSP_EXTENT_SIZE - 1,
header, mtr); header, mtr);
if (!success) { if (!success) {
new_size = mtr_read_ulint new_size = mtr_read_ulint(
(header + FSP_SIZE, header + FSP_SIZE,
MLOG_4BYTES, mtr); MLOG_4BYTES, mtr);
*actual_increase = new_size - old_size; *actual_increase = new_size - old_size;
...@@ -1246,9 +1247,9 @@ fsp_fill_free_list( ...@@ -1246,9 +1247,9 @@ fsp_fill_free_list(
/* Update the free limit info in the log system and make /* Update the free limit info in the log system and make
a checkpoint */ a checkpoint */
if (space == 0) { if (space == 0) {
log_fsp_current_free_limit_set_and_checkpoint log_fsp_current_free_limit_set_and_checkpoint(
((i + FSP_EXTENT_SIZE) (i + FSP_EXTENT_SIZE)
/ ((1024 * 1024) / UNIV_PAGE_SIZE)); / ((1024 * 1024) / UNIV_PAGE_SIZE));
} }
if (0 == i % XDES_DESCRIBED_PER_PAGE) { if (0 == i % XDES_DESCRIBED_PER_PAGE) {
...@@ -1967,8 +1968,8 @@ fseg_find_last_used_frag_page_slot( ...@@ -1967,8 +1968,8 @@ fseg_find_last_used_frag_page_slot(
ut_ad(inode && mtr); ut_ad(inode && mtr);
for (i = 0; i < FSEG_FRAG_ARR_N_SLOTS; i++) { for (i = 0; i < FSEG_FRAG_ARR_N_SLOTS; i++) {
page_no = fseg_get_nth_frag_page_no page_no = fseg_get_nth_frag_page_no(
(inode, FSEG_FRAG_ARR_N_SLOTS - i - 1, mtr); inode, FSEG_FRAG_ARR_N_SLOTS - i - 1, mtr);
if (page_no != FIL_NULL) { if (page_no != FIL_NULL) {
...@@ -2526,8 +2527,8 @@ fseg_alloc_free_page_low( ...@@ -2526,8 +2527,8 @@ fseg_alloc_free_page_low(
return(FIL_NULL); return(FIL_NULL);
} }
success = fsp_try_extend_data_file_with_pages success = fsp_try_extend_data_file_with_pages(
(space, ret_page, space_header, mtr); space, ret_page, space_header, mtr);
if (!success) { if (!success) {
/* No disk space left */ /* No disk space left */
return(FIL_NULL); return(FIL_NULL);
...@@ -3161,8 +3162,8 @@ fseg_free_extent( ...@@ -3161,8 +3162,8 @@ fseg_free_extent(
/* Drop search system page hash index if the page is /* Drop search system page hash index if the page is
found in the pool and is hashed */ found in the pool and is hashed */
btr_search_drop_page_hash_when_freed btr_search_drop_page_hash_when_freed(
(space, first_page_in_extent + i); space, first_page_in_extent + i);
} }
} }
...@@ -3176,8 +3177,8 @@ fseg_free_extent( ...@@ -3176,8 +3177,8 @@ fseg_free_extent(
flst_remove(seg_inode + FSEG_NOT_FULL, flst_remove(seg_inode + FSEG_NOT_FULL,
descr + XDES_FLST_NODE, mtr); descr + XDES_FLST_NODE, mtr);
not_full_n_used = mtr_read_ulint not_full_n_used = mtr_read_ulint(
(seg_inode + FSEG_NOT_FULL_N_USED, MLOG_4BYTES, mtr); seg_inode + FSEG_NOT_FULL_N_USED, MLOG_4BYTES, mtr);
descr_n_used = xdes_get_n_used(descr, mtr); descr_n_used = xdes_get_n_used(descr, mtr);
ut_a(not_full_n_used >= descr_n_used); ut_a(not_full_n_used >= descr_n_used);
...@@ -3758,15 +3759,15 @@ fsp_validate( ...@@ -3758,15 +3759,15 @@ fsp_validate(
mtr_start(&mtr); mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr); mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr seg_inode_page = fut_get_ptr(
(space, node_addr, RW_X_LATCH, &mtr) space, node_addr, RW_X_LATCH, &mtr)
- FSEG_INODE_PAGE_NODE; - FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode seg_inode = fsp_seg_inode_page_get_nth_inode(
(seg_inode_page, n, &mtr); seg_inode_page, n, &mtr);
ut_a(ut_dulint_cmp ut_a(ut_dulint_cmp(
(mach_read_from_8(seg_inode + FSEG_ID), mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0); ut_dulint_zero) != 0);
fseg_validate_low(seg_inode, &mtr); fseg_validate_low(seg_inode, &mtr);
descr_count += flst_get_len(seg_inode + FSEG_FREE, descr_count += flst_get_len(seg_inode + FSEG_FREE,
...@@ -3778,8 +3779,8 @@ fsp_validate( ...@@ -3778,8 +3779,8 @@ fsp_validate(
n_used2 += fseg_get_n_frag_pages(seg_inode, &mtr); n_used2 += fseg_get_n_frag_pages(seg_inode, &mtr);
next_node_addr = flst_get_next_addr next_node_addr = flst_get_next_addr(
(seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr); seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr); mtr_commit(&mtr);
} }
...@@ -3804,29 +3805,29 @@ fsp_validate( ...@@ -3804,29 +3805,29 @@ fsp_validate(
mtr_start(&mtr); mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr); mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr seg_inode_page = fut_get_ptr(
(space, node_addr, RW_X_LATCH, &mtr) space, node_addr, RW_X_LATCH, &mtr)
- FSEG_INODE_PAGE_NODE; - FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode seg_inode = fsp_seg_inode_page_get_nth_inode(
(seg_inode_page, n, &mtr); seg_inode_page, n, &mtr);
if (ut_dulint_cmp if (ut_dulint_cmp(
(mach_read_from_8(seg_inode + FSEG_ID), mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0) { ut_dulint_zero) != 0) {
fseg_validate_low(seg_inode, &mtr); fseg_validate_low(seg_inode, &mtr);
descr_count += flst_get_len descr_count += flst_get_len(
(seg_inode + FSEG_FREE, &mtr); seg_inode + FSEG_FREE, &mtr);
descr_count += flst_get_len descr_count += flst_get_len(
(seg_inode + FSEG_FULL, &mtr); seg_inode + FSEG_FULL, &mtr);
descr_count += flst_get_len descr_count += flst_get_len(
(seg_inode + FSEG_NOT_FULL, &mtr); seg_inode + FSEG_NOT_FULL, &mtr);
n_used2 += fseg_get_n_frag_pages n_used2 += fseg_get_n_frag_pages(
(seg_inode, &mtr); seg_inode, &mtr);
} }
next_node_addr = flst_get_next_addr next_node_addr = flst_get_next_addr(
(seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr); seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr); mtr_commit(&mtr);
} }
...@@ -3931,21 +3932,21 @@ fsp_print( ...@@ -3931,21 +3932,21 @@ fsp_print(
mtr_start(&mtr); mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr); mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr seg_inode_page = fut_get_ptr(
(space, node_addr, RW_X_LATCH, &mtr) space, node_addr, RW_X_LATCH, &mtr)
- FSEG_INODE_PAGE_NODE; - FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode seg_inode = fsp_seg_inode_page_get_nth_inode(
(seg_inode_page, n, &mtr); seg_inode_page, n, &mtr);
ut_a(ut_dulint_cmp ut_a(ut_dulint_cmp(
(mach_read_from_8(seg_inode + FSEG_ID), mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0); ut_dulint_zero) != 0);
fseg_print_low(seg_inode, &mtr); fseg_print_low(seg_inode, &mtr);
n_segs++; n_segs++;
next_node_addr = flst_get_next_addr next_node_addr = flst_get_next_addr(
(seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr); seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr); mtr_commit(&mtr);
} }
...@@ -3968,22 +3969,22 @@ fsp_print( ...@@ -3968,22 +3969,22 @@ fsp_print(
mtr_start(&mtr); mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr); mtr_x_lock(fil_space_get_latch(space), &mtr);
seg_inode_page = fut_get_ptr seg_inode_page = fut_get_ptr(
(space, node_addr, RW_X_LATCH, &mtr) space, node_addr, RW_X_LATCH, &mtr)
- FSEG_INODE_PAGE_NODE; - FSEG_INODE_PAGE_NODE;
seg_inode = fsp_seg_inode_page_get_nth_inode seg_inode = fsp_seg_inode_page_get_nth_inode(
(seg_inode_page, n, &mtr); seg_inode_page, n, &mtr);
if (ut_dulint_cmp if (ut_dulint_cmp(
(mach_read_from_8(seg_inode + FSEG_ID), mach_read_from_8(seg_inode + FSEG_ID),
ut_dulint_zero) != 0) { ut_dulint_zero) != 0) {
fseg_print_low(seg_inode, &mtr); fseg_print_low(seg_inode, &mtr);
n_segs++; n_segs++;
} }
next_node_addr = flst_get_next_addr next_node_addr = flst_get_next_addr(
(seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr); seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr); mtr_commit(&mtr);
} }
......
...@@ -3025,8 +3025,9 @@ ha_innobase::store_key_val_for_row( ...@@ -3025,8 +3025,9 @@ ha_innobase::store_key_val_for_row(
/****************************************************************** /******************************************************************
Builds a 'template' to the prebuilt struct. The template is used in fast Builds a 'template' to the prebuilt struct. The template is used in fast
retrieval of just those column values MySQL needs in its processing. */ retrieval of just those column values MySQL needs in its processing. */
static
void void
ha_innobase::build_template( build_template(
/*===========*/ /*===========*/
row_prebuilt_t* prebuilt, /* in: prebuilt struct */ row_prebuilt_t* prebuilt, /* in: prebuilt struct */
THD* thd, /* in: current user thread, used THD* thd, /* in: current user thread, used
...@@ -3167,8 +3168,8 @@ include_field: ...@@ -3167,8 +3168,8 @@ include_field:
templ->col_no = i; templ->col_no = i;
if (index == clust_index) { if (index == clust_index) {
templ->rec_field_no = (index->table->cols + i) templ->rec_field_no = dict_col_get_clust_pos_noninline(
->clust_pos; &index->table->cols[i], index);
} else { } else {
templ->rec_field_no = dict_index_get_nth_col_pos( templ->rec_field_no = dict_index_get_nth_col_pos(
index, i); index, i);
...@@ -3197,7 +3198,7 @@ include_field: ...@@ -3197,7 +3198,7 @@ include_field:
mysql_prefix_len = templ->mysql_col_offset mysql_prefix_len = templ->mysql_col_offset
+ templ->mysql_col_len; + templ->mysql_col_len;
} }
templ->type = index->table->cols[i].type.mtype; templ->type = index->table->cols[i].mtype;
templ->mysql_type = (ulint)field->type(); templ->mysql_type = (ulint)field->type();
if (templ->mysql_type == DATA_MYSQL_TRUE_VARCHAR) { if (templ->mysql_type == DATA_MYSQL_TRUE_VARCHAR) {
...@@ -3206,10 +3207,10 @@ include_field: ...@@ -3206,10 +3207,10 @@ include_field:
} }
templ->charset = dtype_get_charset_coll_noninline( templ->charset = dtype_get_charset_coll_noninline(
index->table->cols[i].type.prtype); index->table->cols[i].prtype);
templ->mbminlen = index->table->cols[i].type.mbminlen; templ->mbminlen = index->table->cols[i].mbminlen;
templ->mbmaxlen = index->table->cols[i].type.mbmaxlen; templ->mbmaxlen = index->table->cols[i].mbmaxlen;
templ->is_unsigned = index->table->cols[i].type.prtype templ->is_unsigned = index->table->cols[i].prtype
& DATA_UNSIGNED; & DATA_UNSIGNED;
if (templ->type == DATA_BLOB) { if (templ->type == DATA_BLOB) {
prebuilt->templ_contains_blob = TRUE; prebuilt->templ_contains_blob = TRUE;
...@@ -3227,8 +3228,9 @@ skip_field: ...@@ -3227,8 +3228,9 @@ skip_field:
for (i = 0; i < n_requested_fields; i++) { for (i = 0; i < n_requested_fields; i++) {
templ = prebuilt->mysql_template + i; templ = prebuilt->mysql_template + i;
templ->rec_field_no = templ->rec_field_no = dict_col_get_clust_pos_noninline(
(index->table->cols + templ->col_no)->clust_pos; &index->table->cols[templ->col_no],
clust_index);
} }
} }
} }
...@@ -3495,9 +3497,11 @@ calc_row_difference( ...@@ -3495,9 +3497,11 @@ calc_row_difference(
ulint col_type; ulint col_type;
ulint n_changed = 0; ulint n_changed = 0;
dfield_t dfield; dfield_t dfield;
dict_index_t* clust_index;
uint i; uint i;
n_fields = table->s->fields; n_fields = table->s->fields;
clust_index = dict_table_get_first_index_noninline(prebuilt->table);
/* We use upd_buff to convert changed fields */ /* We use upd_buff to convert changed fields */
buf = (byte*) upd_buff; buf = (byte*) upd_buff;
...@@ -3528,7 +3532,7 @@ calc_row_difference( ...@@ -3528,7 +3532,7 @@ calc_row_difference(
field_mysql_type = field->type(); field_mysql_type = field->type();
col_type = prebuilt->table->cols[i].type.mtype; col_type = prebuilt->table->cols[i].mtype;
switch (col_type) { switch (col_type) {
...@@ -3583,7 +3587,8 @@ calc_row_difference( ...@@ -3583,7 +3587,8 @@ calc_row_difference(
/* Let us use a dummy dfield to make the conversion /* Let us use a dummy dfield to make the conversion
from the MySQL column format to the InnoDB format */ from the MySQL column format to the InnoDB format */
dfield.type = (prebuilt->table->cols + i)->type; dict_col_copy_type_noninline(prebuilt->table->cols + i,
&dfield.type);
if (n_len != UNIV_SQL_NULL) { if (n_len != UNIV_SQL_NULL) {
buf = row_mysql_store_col_in_innobase_format( buf = row_mysql_store_col_in_innobase_format(
...@@ -3602,7 +3607,8 @@ calc_row_difference( ...@@ -3602,7 +3607,8 @@ calc_row_difference(
} }
ufield->exp = NULL; ufield->exp = NULL;
ufield->field_no = prebuilt->table->cols[i].clust_pos; ufield->field_no = dict_col_get_clust_pos_noninline(
&prebuilt->table->cols[i], clust_index);
n_changed++; n_changed++;
} }
} }
...@@ -4582,8 +4588,7 @@ create_table_def( ...@@ -4582,8 +4588,7 @@ create_table_def(
| nulls_allowed | unsigned_type | nulls_allowed | unsigned_type
| binary_type | long_true_varchar, | binary_type | long_true_varchar,
charset_no), charset_no),
col_len, col_len);
0);
} }
error = row_create_table_for_mysql(table, trx); error = row_create_table_for_mysql(table, trx);
...@@ -6176,25 +6181,11 @@ ha_innobase::start_stmt( ...@@ -6176,25 +6181,11 @@ ha_innobase::start_stmt(
1) ::store_lock(), 1) ::store_lock(),
2) ::external_lock(), 2) ::external_lock(),
3) ::init_table_handle_for_HANDLER(), and 3) ::init_table_handle_for_HANDLER(), and
4) :.transactional_table_lock(). */ 4) ::transactional_table_lock(). */
prebuilt->select_lock_type = prebuilt->select_lock_type =
prebuilt->stored_select_lock_type; prebuilt->stored_select_lock_type;
} }
if (prebuilt->stored_select_lock_type != LOCK_S
&& prebuilt->stored_select_lock_type != LOCK_X) {
sql_print_error(
"stored_select_lock_type is %lu inside "
"::start_stmt()!",
prebuilt->stored_select_lock_type);
/* Set the value to LOCK_X: this is just fault
tolerance, we do not know what the correct value
should be! */
prebuilt->select_lock_type = LOCK_X;
}
} }
trx->detailed_error[0] = '\0'; trx->detailed_error[0] = '\0';
......
...@@ -201,8 +201,6 @@ class ha_innobase: public handler ...@@ -201,8 +201,6 @@ class ha_innobase: public handler
int cmp_ref(const byte *ref1, const byte *ref2); int cmp_ref(const byte *ref1, const byte *ref2);
bool check_if_incompatible_data(HA_CREATE_INFO *info, bool check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes); uint table_changes);
void build_template(struct row_prebuilt_struct *prebuilt, THD *thd,
TABLE *table, uint templ_type);
}; };
extern SHOW_VAR innodb_status_variables[]; extern SHOW_VAR innodb_status_variables[];
......
This diff is collapsed.
...@@ -52,7 +52,7 @@ page_t* ...@@ -52,7 +52,7 @@ page_t*
btr_root_get( btr_root_get(
/*=========*/ /*=========*/
/* out: root page, x-latched */ /* out: root page, x-latched */
dict_tree_t* tree, /* in: index tree */ dict_index_t* index, /* in: index tree */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/****************************************************************** /******************************************************************
Gets a buffer page and declares its latching order level. */ Gets a buffer page and declares its latching order level. */
...@@ -255,7 +255,7 @@ that mtr holds an x-latch on the tree. */ ...@@ -255,7 +255,7 @@ that mtr holds an x-latch on the tree. */
void void
btr_insert_on_non_leaf_level( btr_insert_on_non_leaf_level(
/*=========================*/ /*=========================*/
dict_tree_t* tree, /* in: tree */ dict_index_t* index, /* in: index */
ulint level, /* in: level, must be > 0 */ ulint level, /* in: level, must be > 0 */
dtuple_t* tuple, /* in: the record to be inserted */ dtuple_t* tuple, /* in: the record to be inserted */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
...@@ -274,7 +274,7 @@ Deletes on the upper level the node pointer to a page. */ ...@@ -274,7 +274,7 @@ Deletes on the upper level the node pointer to a page. */
void void
btr_node_ptr_delete( btr_node_ptr_delete(
/*================*/ /*================*/
dict_tree_t* tree, /* in: index tree */ dict_index_t* index, /* in: index tree */
page_t* page, /* in: page whose node pointer is deleted */ page_t* page, /* in: page whose node pointer is deleted */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
...@@ -285,7 +285,7 @@ ibool ...@@ -285,7 +285,7 @@ ibool
btr_check_node_ptr( btr_check_node_ptr(
/*===============*/ /*===============*/
/* out: TRUE */ /* out: TRUE */
dict_tree_t* tree, /* in: index tree */ dict_index_t* index, /* in: index tree */
page_t* page, /* in: index page */ page_t* page, /* in: index page */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
...@@ -361,7 +361,7 @@ btr_page_alloc( ...@@ -361,7 +361,7 @@ btr_page_alloc(
/*===========*/ /*===========*/
/* out: new allocated page, x-latched; /* out: new allocated page, x-latched;
NULL if out of space */ NULL if out of space */
dict_tree_t* tree, /* in: index tree */ dict_index_t* index, /* in: index tree */
ulint hint_page_no, /* in: hint of a good page */ ulint hint_page_no, /* in: hint of a good page */
byte file_direction, /* in: direction where a possible byte file_direction, /* in: direction where a possible
page split is made */ page split is made */
...@@ -375,7 +375,7 @@ storage pages because the page must contain info on its level. */ ...@@ -375,7 +375,7 @@ storage pages because the page must contain info on its level. */
void void
btr_page_free( btr_page_free(
/*==========*/ /*==========*/
dict_tree_t* tree, /* in: index tree */ dict_index_t* index, /* in: index tree */
page_t* page, /* in: page to be freed, x-latched */ page_t* page, /* in: page to be freed, x-latched */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/****************************************************************** /******************************************************************
...@@ -386,7 +386,7 @@ argument. */ ...@@ -386,7 +386,7 @@ argument. */
void void
btr_page_free_low( btr_page_free_low(
/*==============*/ /*==============*/
dict_tree_t* tree, /* in: index tree */ dict_index_t* index, /* in: index tree */
page_t* page, /* in: page to be freed, x-latched */ page_t* page, /* in: page to be freed, x-latched */
ulint level, /* in: page level */ ulint level, /* in: page level */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
...@@ -397,14 +397,14 @@ Prints size info of a B-tree. */ ...@@ -397,14 +397,14 @@ Prints size info of a B-tree. */
void void
btr_print_size( btr_print_size(
/*===========*/ /*===========*/
dict_tree_t* tree); /* in: index tree */ dict_index_t* index); /* in: index tree */
/****************************************************************** /******************************************************************
Prints directories and other info of all nodes in the tree. */ Prints directories and other info of all nodes in the index. */
void void
btr_print_tree( btr_print_index(
/*===========*/ /*============*/
dict_tree_t* tree, /* in: tree */ dict_index_t* index, /* in: index */
ulint width); /* in: print this many entries from start ulint width); /* in: print this many entries from start
and end */ and end */
#endif /* UNIV_BTR_PRINT */ #endif /* UNIV_BTR_PRINT */
...@@ -425,10 +425,10 @@ btr_index_rec_validate( ...@@ -425,10 +425,10 @@ btr_index_rec_validate(
Checks the consistency of an index tree. */ Checks the consistency of an index tree. */
ibool ibool
btr_validate_tree( btr_validate_index(
/*==============*/ /*===============*/
/* out: TRUE if ok */ /* out: TRUE if ok */
dict_tree_t* tree, /* in: tree */ dict_index_t* index, /* in: index */
trx_t* trx); /* in: transaction or NULL */ trx_t* trx); /* in: transaction or NULL */
#define BTR_N_LEAF_PAGES 1 #define BTR_N_LEAF_PAGES 1
......
...@@ -204,7 +204,7 @@ btr_node_ptr_get_child_page_no( ...@@ -204,7 +204,7 @@ btr_node_ptr_get_child_page_no(
fprintf(stderr, fprintf(stderr,
"InnoDB: a nonsensical page number 0" "InnoDB: a nonsensical page number 0"
" in a node ptr record at offset %lu\n", " in a node ptr record at offset %lu\n",
(ulong) ut_align_offset(rec, UNIV_PAGE_SIZE)); (ulong) page_offset(rec));
buf_page_print(buf_frame_align(rec)); buf_page_print(buf_frame_align(rec));
} }
......
...@@ -59,13 +59,13 @@ btr_cur_get_page( ...@@ -59,13 +59,13 @@ btr_cur_get_page(
/* out: pointer to page */ /* out: pointer to page */
btr_cur_t* cursor);/* in: tree cursor */ btr_cur_t* cursor);/* in: tree cursor */
/************************************************************* /*************************************************************
Returns the tree of a cursor. */ Returns the index of a cursor. */
UNIV_INLINE UNIV_INLINE
dict_tree_t* dict_index_t*
btr_cur_get_tree( btr_cur_get_index(
/*=============*/ /*==============*/
/* out: tree */ /* out: index */
btr_cur_t* cursor);/* in: tree cursor */ btr_cur_t* cursor);/* in: B-tree cursor */
/************************************************************* /*************************************************************
Positions a tree cursor at a given record. */ Positions a tree cursor at a given record. */
UNIV_INLINE UNIV_INLINE
......
This diff is collapsed.
...@@ -445,7 +445,7 @@ selects, updates, and deletes. */ ...@@ -445,7 +445,7 @@ selects, updates, and deletes. */
struct btr_pcur_struct{ struct btr_pcur_struct{
btr_cur_t btr_cur; /* a B-tree cursor */ btr_cur_t btr_cur; /* a B-tree cursor */
ulint latch_mode; /* see FIXME note below! ulint latch_mode; /* see TODO note below!
BTR_SEARCH_LEAF, BTR_MODIFY_LEAF, BTR_SEARCH_LEAF, BTR_MODIFY_LEAF,
BTR_MODIFY_TREE, or BTR_NO_LATCHES, BTR_MODIFY_TREE, or BTR_NO_LATCHES,
depending on the latching state of depending on the latching state of
...@@ -473,7 +473,7 @@ struct btr_pcur_struct{ ...@@ -473,7 +473,7 @@ struct btr_pcur_struct{
dulint modify_clock; /* the modify clock value of the dulint modify_clock; /* the modify clock value of the
buffer block when the cursor position buffer block when the cursor position
was stored */ was stored */
ulint pos_state; /* see FIXME note below! ulint pos_state; /* see TODO note below!
BTR_PCUR_IS_POSITIONED, BTR_PCUR_IS_POSITIONED,
BTR_PCUR_WAS_POSITIONED, BTR_PCUR_WAS_POSITIONED,
BTR_PCUR_NOT_POSITIONED */ BTR_PCUR_NOT_POSITIONED */
...@@ -495,14 +495,18 @@ struct btr_pcur_struct{ ...@@ -495,14 +495,18 @@ struct btr_pcur_struct{
is not NULL */ is not NULL */
}; };
#define BTR_PCUR_IS_POSITIONED 1997660512 /* FIXME: currently, the state #define BTR_PCUR_IS_POSITIONED 1997660512 /* TODO: currently, the state
can be BTR_PCUR_IS_POSITIONED, can be BTR_PCUR_IS_POSITIONED,
though it really should be though it really should be
BTR_PCUR_WAS_POSITIONED, BTR_PCUR_WAS_POSITIONED,
because we have no obligation because we have no obligation
to commit the cursor with to commit the cursor with
mtr; similarly latch_mode may mtr; similarly latch_mode may
be out of date */ be out of date. This can
lead to problems if btr_pcur
is not used the right way;
all current code should be
ok. */
#define BTR_PCUR_WAS_POSITIONED 1187549791 #define BTR_PCUR_WAS_POSITIONED 1187549791
#define BTR_PCUR_NOT_POSITIONED 1328997689 #define BTR_PCUR_NOT_POSITIONED 1328997689
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment