Commit 192bf819 authored by unknown's avatar unknown

merge with 4.0


BitKeeper/etc/ignore:
  auto-union
VC++Files/comp_err/comp_err.dsp:
  Auto merged
VC++Files/my_print_defaults/my_print_defaults.dsp:
  Auto merged
VC++Files/myisampack/myisampack.dsp:
  Auto merged
acinclude.m4:
  Auto merged
innobase/buf/buf0buf.c:
  Auto merged
innobase/com/com0shm.c:
  Auto merged
innobase/data/data0data.c:
  Auto merged
innobase/ha/ha0ha.c:
  Auto merged
innobase/include/buf0buf.ic:
  Auto merged
innobase/include/dict0dict.h:
  Auto merged
innobase/include/ibuf0ibuf.h:
  Auto merged
innobase/include/lock0lock.h:
  Auto merged
innobase/include/mtr0log.h:
  Auto merged
innobase/include/mtr0mtr.h:
  Auto merged
innobase/include/os0proc.h:
  Auto merged
innobase/include/os0thread.h:
  Auto merged
innobase/include/srv0srv.h:
  Auto merged
innobase/include/sync0sync.h:
  Auto merged
innobase/lock/lock0lock.c:
  Auto merged
innobase/log/log0recv.c:
  Auto merged
innobase/mem/mem0dbg.c:
  Auto merged
innobase/mtr/mtr0mtr.c:
  Auto merged
innobase/os/os0proc.c:
  Auto merged
innobase/page/page0page.c:
  Auto merged
innobase/que/que0que.c:
  Auto merged
innobase/rem/rem0cmp.c:
  Auto merged
innobase/row/row0ins.c:
  Auto merged
innobase/row/row0mysql.c:
  Auto merged
innobase/srv/srv0start.c:
  Auto merged
innobase/sync/sync0sync.c:
  Auto merged
innobase/trx/trx0rec.c:
  Auto merged
innobase/trx/trx0trx.c:
  Auto merged
innobase/ut/ut0mem.c:
  Auto merged
innobase/ut/ut0ut.c:
  Auto merged
libmysql/libmysql.c:
  Auto merged
scripts/mysql_config.sh:
  Auto merged
sql/net_serv.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
parents 984750e1 522e83b6
...@@ -522,6 +522,7 @@ scripts/fill_help_tables ...@@ -522,6 +522,7 @@ scripts/fill_help_tables
scripts/fill_help_tables.sql scripts/fill_help_tables.sql
scripts/make_binary_distribution scripts/make_binary_distribution
scripts/make_sharedlib_distribution scripts/make_sharedlib_distribution
scripts/make_win_binary_distribution
scripts/make_win_src_distribution scripts/make_win_src_distribution
scripts/msql2mysql scripts/msql2mysql
scripts/mysql_config scripts/mysql_config
......
...@@ -3,12 +3,13 @@ ...@@ -3,12 +3,13 @@
use Getopt::Long; use Getopt::Long;
$opt_help=0; $opt_help=0;
$opt_tarball=$opt_builddir=""; $opt_tarball=$opt_builddir=$opt_suffix="";
GetOptions( GetOptions(
"help", "help",
"tarball=s", "tarball=s",
"builddir=s", "builddir=s",
"suffix=s"
) || print_help(); ) || print_help();
print_help() if ($opt_help); print_help() if ($opt_help);
...@@ -28,27 +29,54 @@ $scriptdir = `pwd`; ...@@ -28,27 +29,54 @@ $scriptdir = `pwd`;
mkdir($opt_builddir); mkdir($opt_builddir);
# Clean out any previous build # Clean out any previous build
system("rm -rf $basedir"); system("rm -rf $basedir");
mkdir($basedir);
mkdir("$basedir/tarball");
system("cp $opt_tarball $basedir/tarball"); # Unpack in the script directory
system("tar -zxvf $opt_tarball");
# Move to the build directory
system("mv $mysqlver $opt_builddir");
if (!chdir($basedir)) if (!chdir($basedir))
{ {
print "Do-win-build error: Could not change to $opt_builddir"; print "Do-win-build error: Could not change to $basedir";
exit 1; exit 1;
} }
mkdir("build"); # Check whether this is a classic edition build
chdir("build"); if ($opt_suffix =~ /-classic/)
{
# Blank out ha_innodb.cpp
chmod 0644, 'sql/ha_innodb.cpp';
open(OUT, '>', 'sql/ha_innodb.cpp');
close(OUT);
# Remove HAVE_INNOBASE_DB from the requisite project files
for $dspfile ('libmysqld/libmysqld.dsp', 'mysqldemb/mysqldemb.dsp', 'mysqlserver/mysqlserver.dsp', 'sql/mysqld.dsp', 'sql/mysqldmax.dsp')
{
open(IN, '<', $dspfile);
open(OUT, '>', "$dspfile.tmp");
while (readline IN)
{
s/\D \"HAVE_INNOBASE_DB\" //g;
print OUT $_;
}
close(IN);
close(OUT);
unlink $dspfile;
rename "$dspfile.tmp", $dspfile;
}
}
system("tar -zxvf ../tarball/$mysqlver-win-src.tar.gz"); # Perform compilation
system("\"$MSDEV\" mysql.dsw /MAKE \"ALL\" /OUT $mysqlver-build.log");
chdir($mysqlver); # Package binary
system("./scripts/make_win_binary_distribution --suffix=$opt_suffix");
system("\"$MSDEV\" mysql.dsw /MAKE \"ALL\" /OUT $mysqlver-build.log"); # Copy log back to script directory
system("cp $mysqlver$suffix-build.log $scriptdir");
system("cp $mysqlver-build.log $scriptdir"); # Move binary package to script directory
system("mv *.zip $scriptdir");
# #
# Print a help text message # Print a help text message
...@@ -62,7 +90,11 @@ Unpacks a Windows source distribution on the local machine and ...@@ -62,7 +90,11 @@ Unpacks a Windows source distribution on the local machine and
compiles it using VC++ 6.0. compiles it using VC++ 6.0.
This script is intended for Cygwin Perl. You must have a working This script is intended for Cygwin Perl. You must have a working
MSDEV.EXE in your path for compilation. MSDEV.EXE in your path for compilation, as well as the following:
sed
tar (GNU tar)
which
Options: Options:
...@@ -76,6 +108,13 @@ be moved to <builddir>/mysql-<version>/tarball and extracted under ...@@ -76,6 +108,13 @@ be moved to <builddir>/mysql-<version>/tarball and extracted under
<builddir>/mysql-<version>/build. <builddir>/mysql-<version>/build.
Default: /cygdrive/c/mysql-win-build Default: /cygdrive/c/mysql-win-build
--suffix=<suffix>
If specified, the resulting binary will have the specified suffix
in its name. If the suffix is "-classic", the project files will
be stripped of all occurrences of HAVE_INNOBASE_DB and
ha_innodb.cpp will be blanked out, to create classic edition
server binaries.
--tarball=<file> --tarball=<file>
Windows source tarball to use for this build. Must be of the form Windows source tarball to use for this build. Must be of the form
mysql[com]-x.x.x-win-src.tar.gz (REQUIRED) mysql[com]-x.x.x-win-src.tar.gz (REQUIRED)
......
...@@ -24,7 +24,7 @@ CFG=comp_err - Win32 Release ...@@ -24,7 +24,7 @@ CFG=comp_err - Win32 Release
# PROP AllowPerConfigDependencies 0 # PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName "" # PROP Scc_ProjName ""
# PROP Scc_LocalPath "" # PROP Scc_LocalPath ""
CPP=xicl6.exe CPP=cl.exe
RSC=rc.exe RSC=rc.exe
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0 # PROP BASE Use_Debug_Libraries 0
...@@ -45,9 +45,9 @@ RSC=rc.exe ...@@ -45,9 +45,9 @@ RSC=rc.exe
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=xilink6.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\lib_release\mysys.lib wsock32.lib ..\lib_release\strings.lib ..\lib_release\dbug.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"LIBC.lib" /out:"Release/comp-err.exe" # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\lib_release\mysys.lib wsock32.lib ..\lib_release\strings.lib ..\lib_release\dbug.lib /nologo /subsystem:console /machine:I386 /nodefaultlib:"LIBC.lib" /out:"../client_release/comp-err.exe"
# Begin Target # Begin Target
# Name "comp_err - Win32 Release" # Name "comp_err - Win32 Release"
......
...@@ -25,7 +25,7 @@ CFG=my_print_defaults - Win32 Debug ...@@ -25,7 +25,7 @@ CFG=my_print_defaults - Win32 Debug
# PROP AllowPerConfigDependencies 0 # PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName "" # PROP Scc_ProjName ""
# PROP Scc_LocalPath "" # PROP Scc_LocalPath ""
CPP=xicl6.exe CPP=cl.exe
RSC=rc.exe RSC=rc.exe
!IF "$(CFG)" == "my_print_defaults - Win32 Release" !IF "$(CFG)" == "my_print_defaults - Win32 Release"
...@@ -39,6 +39,7 @@ RSC=rc.exe ...@@ -39,6 +39,7 @@ RSC=rc.exe
# PROP Use_Debug_Libraries 0 # PROP Use_Debug_Libraries 0
# PROP Output_Dir "release" # PROP Output_Dir "release"
# PROP Intermediate_Dir "release" # PROP Intermediate_Dir "release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir "" # PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
...@@ -47,9 +48,9 @@ RSC=rc.exe ...@@ -47,9 +48,9 @@ RSC=rc.exe
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=xilink6.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /machine:I386 /out:"../client_release/my_print_defaults.exe"
!ELSEIF "$(CFG)" == "my_print_defaults - Win32 Debug" !ELSEIF "$(CFG)" == "my_print_defaults - Win32 Debug"
...@@ -71,9 +72,9 @@ LINK32=xilink6.exe ...@@ -71,9 +72,9 @@ LINK32=xilink6.exe
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=xilink6.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"LIBCMTD.lib" /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /debug /machine:I386 /nodefaultlib:"LIBCMTD.lib" /out:"../client_debug/my_print_defaults.exe" /pdbtype:sept
!ENDIF !ENDIF
......
...@@ -50,7 +50,7 @@ BSC32=bscmake.exe ...@@ -50,7 +50,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib setargv.obj /nologo /subsystem:console /machine:I386 # ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib setargv.obj /nologo /subsystem:console /machine:I386 /out:"../client_release/myisam_ftdump.exe"
!ELSEIF "$(CFG)" == "myisam_ftdump - Win32 Debug" !ELSEIF "$(CFG)" == "myisam_ftdump - Win32 Debug"
...@@ -75,7 +75,7 @@ BSC32=bscmake.exe ...@@ -75,7 +75,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=link.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib wsock32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /incremental:no /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib wsock32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/myisam_ftdump.exe" /pdbtype:sept
!ENDIF !ENDIF
......
...@@ -51,7 +51,7 @@ BSC32=bscmake.exe ...@@ -51,7 +51,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=xilink6.exe LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib setargv.obj /nologo /subsystem:console /machine:I386 # ADD LINK32 wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib setargv.obj /nologo /subsystem:console /machine:I386 /out:"../client_release/myisampack.exe"
!ELSEIF "$(CFG)" == "myisampack - Win32 Debug" !ELSEIF "$(CFG)" == "myisampack - Win32 Debug"
...@@ -76,7 +76,7 @@ BSC32=bscmake.exe ...@@ -76,7 +76,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo # ADD BSC32 /nologo
LINK32=xilink6.exe LINK32=xilink6.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib wsock32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /incremental:no /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib wsock32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib setargv.obj /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/myisampack.exe" /pdbtype:sept
!ENDIF !ENDIF
......
...@@ -1252,7 +1252,6 @@ dnl Some libs are listed several times, in order for gcc to sort out ...@@ -1252,7 +1252,6 @@ dnl Some libs are listed several times, in order for gcc to sort out
dnl circular references. dnl circular references.
innodb_libs="\ innodb_libs="\
\$(top_builddir)/innobase/usr/libusr.a\ \$(top_builddir)/innobase/usr/libusr.a\
\$(top_builddir)/innobase/odbc/libodbc.a\
\$(top_builddir)/innobase/srv/libsrv.a\ \$(top_builddir)/innobase/srv/libsrv.a\
\$(top_builddir)/innobase/dict/libdict.a\ \$(top_builddir)/innobase/dict/libdict.a\
\$(top_builddir)/innobase/que/libque.a\ \$(top_builddir)/innobase/que/libque.a\
......
...@@ -23,7 +23,7 @@ TAR = gtar ...@@ -23,7 +23,7 @@ TAR = gtar
noinst_HEADERS = ib_config.h noinst_HEADERS = ib_config.h
SUBDIRS = os ut btr buf com data dict dyn eval fil fsp fut \ SUBDIRS = os ut btr buf com data dict dyn eval fil fsp fut \
ha ibuf include lock log mach mem mtr odbc page \ ha ibuf include lock log mach mem mtr page \
pars que read rem row srv sync thr trx usr pars que read rem row srv sync thr trx usr
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
......
...@@ -1499,75 +1499,6 @@ function_exit: ...@@ -1499,75 +1499,6 @@ function_exit:
} }
} }
/************************************************************************
Prints info of the search system. */
void
btr_search_print_info(void)
/*=======================*/
{
printf("SEARCH SYSTEM INFO\n");
rw_lock_x_lock(&btr_search_latch);
/* ha_print_info(btr_search_sys->hash_index); */
rw_lock_x_unlock(&btr_search_latch);
}
/************************************************************************
Prints info of searches on an index. */
void
btr_search_index_print_info(
/*========================*/
dict_index_t* index) /* in: index */
{
btr_search_t* info;
printf("INDEX SEARCH INFO\n");
rw_lock_x_lock(&btr_search_latch);
info = btr_search_get_info(index);
printf("Searches %lu, hash succ %lu, fail %lu, patt succ %lu\n",
(ulong) info->n_searches, (ulong) info->n_hash_succ,
(ulong) info->n_hash_fail, (ulong) info->n_patt_succ);
printf("Total of page cur short succ for all indexes %lu\n",
(ulong) page_cur_short_succ);
rw_lock_x_unlock(&btr_search_latch);
}
/************************************************************************
Prints info of searches on a table. */
void
btr_search_table_print_info(
/*========================*/
char* name) /* in: table name */
{
dict_table_t* table;
dict_index_t* index;
mutex_enter(&(dict_sys->mutex));
table = dict_table_get_low(name);
ut_a(table);
mutex_exit(&(dict_sys->mutex));
index = dict_table_get_first_index(table);
while (index) {
btr_search_index_print_info(index);
index = dict_table_get_next_index(index);
}
}
/************************************************************************ /************************************************************************
Validates the search system. */ Validates the search system. */
......
...@@ -1813,21 +1813,6 @@ buf_page_io_complete( ...@@ -1813,21 +1813,6 @@ buf_page_io_complete(
"InnoDB: Error: page n:o stored in the page read in is %lu, should be %lu!\n", "InnoDB: Error: page n:o stored in the page read in is %lu, should be %lu!\n",
(ulong) read_page_no, (ulong) block->offset); (ulong) read_page_no, (ulong) block->offset);
} }
#ifdef notdefined
if (block->offset != 0 && read_page_no == 0) {
/* Check that the page is really uninited */
for (i = 0; i < UNIV_PAGE_SIZE; i++) {
if (*((block->frame) + i) != '\0') {
fprintf(stderr,
"InnoDB: Error: page n:o in the page read in is 0, but page %lu is inited!\n",
block->offset);
break;
}
}
}
#endif
/* From version 3.23.38 up we store the page checksum /* From version 3.23.38 up we store the page checksum
to the 4 first bytes of the page end lsn field */ to the 4 first bytes of the page end lsn field */
......
...@@ -964,19 +964,6 @@ loop: ...@@ -964,19 +964,6 @@ loop:
ut_ad(loop_count < 2); ut_ad(loop_count < 2);
#ifdef notdefined
if (!com_shm_get_not_empty(map)) {
/* There was no datagram, give up the time slice
for some writer thread to insert a datagram */
com_shm_exit(ep);
os_thread_yield();
com_shm_enter(ep);
}
#endif
com_shm_enter(ep); com_shm_enter(ep);
if (!com_shm_get_not_empty(map)) { if (!com_shm_get_not_empty(map)) {
...@@ -1131,18 +1118,6 @@ loop: ...@@ -1131,18 +1118,6 @@ loop:
ut_memcpy(com_shm_get_addr(map), com_shm_endpoint_get_addr(ep), ut_memcpy(com_shm_get_addr(map), com_shm_endpoint_get_addr(ep),
sender_len); sender_len);
com_shm_set_not_empty(map, TRUE); com_shm_set_not_empty(map, TRUE);
#ifdef notdefined
com_shm_exit(ep2);
/* Now we give up our time slice voluntarily to give some reader
thread chance to fetch the datagram */
os_thread_yield();
com_shm_enter(ep2);
if (com_shm_get_not_empty(map)) {
#endif
com_shm_system_call_count++; com_shm_system_call_count++;
com_shm_exit(ep2); com_shm_exit(ep2);
...@@ -1152,12 +1127,4 @@ loop: ...@@ -1152,12 +1127,4 @@ loop:
os_event_set(com_shm_endpoint_get_not_empty(ep2)); os_event_set(com_shm_endpoint_get_not_empty(ep2));
return(0); return(0);
#ifdef notdefined
}
com_shm_exit(ep2);
return(0);
#endif
} }
...@@ -727,416 +727,3 @@ dtuple_big_rec_free( ...@@ -727,416 +727,3 @@ dtuple_big_rec_free(
{ {
mem_heap_free(vector->heap); mem_heap_free(vector->heap);
} }
#ifdef notdefined
/******************************************************************
Generates random numbers, where 10/16 is uniformly
distributed between 0 and n1, 5/16 between 0 and n2,
and 1/16 between 0 and n3. */
static
ulint
dtuple_gen_rnd_ulint(
/*=================*/
/* out: random ulint */
ulint n1,
ulint n2,
ulint n3)
{
ulint m;
ulint n;
m = ut_rnd_gen_ulint() % 16;
if (m < 10) {
n = n1;
} else if (m < 15) {
n = n2;
} else {
n = n3;
}
m = ut_rnd_gen_ulint();
return(m % n);
}
/***************************************************************
Generates a random tuple. */
dtuple_t*
dtuple_gen_rnd_tuple(
/*=================*/
/* out: pointer to the tuple */
mem_heap_t* heap) /* in: memory heap where generated */
{
ulint n_fields;
dfield_t* field;
ulint len;
dtuple_t* tuple;
ulint i;
ulint j;
byte* ptr;
n_fields = dtuple_gen_rnd_ulint(5, 30, 300) + 1;
tuple = dtuple_create(heap, n_fields);
for (i = 0; i < n_fields; i++) {
if (n_fields < 7) {
len = dtuple_gen_rnd_ulint(5, 30, 400);
} else {
len = dtuple_gen_rnd_ulint(7, 5, 17);
}
field = dtuple_get_nth_field(tuple, i);
if (len == 0) {
dfield_set_data(field, NULL, UNIV_SQL_NULL);
} else {
ptr = mem_heap_alloc(heap, len);
dfield_set_data(field, ptr, len - 1);
for (j = 0; j < len; j++) {
*ptr = (byte)(65 +
dtuple_gen_rnd_ulint(22, 22, 22));
ptr++;
}
}
dtype_set(dfield_get_type(field), DATA_VARCHAR,
DATA_ENGLISH, 500, 0);
}
ut_a(dtuple_validate(tuple));
return(tuple);
}
/*******************************************************************
Generates a test tuple for sort and comparison tests. */
void
dtuple_gen_test_tuple(
/*==================*/
dtuple_t* tuple, /* in/out: a tuple with 3 fields */
ulint i) /* in: a number < 512 */
{
ulint j;
dfield_t* field;
void* data = NULL;
ulint len = 0;
for (j = 0; j < 3; j++) {
switch (i % 8) {
case 0:
data = ""; len = 0; break;
case 1:
data = "A"; len = 1; break;
case 2:
data = "AA"; len = 2; break;
case 3:
data = "AB"; len = 2; break;
case 4:
data = "B"; len = 1; break;
case 5:
data = "BA"; len = 2; break;
case 6:
data = "BB"; len = 2; break;
case 7:
len = UNIV_SQL_NULL; break;
}
field = dtuple_get_nth_field(tuple, 2 - j);
dfield_set_data(field, data, len);
dtype_set(dfield_get_type(field), DATA_VARCHAR,
DATA_ENGLISH, 100, 0);
i = i / 8;
}
ut_ad(dtuple_validate(tuple));
}
/*******************************************************************
Generates a test tuple for B-tree speed tests. */
void
dtuple_gen_test_tuple3(
/*===================*/
dtuple_t* tuple, /* in/out: a tuple with >= 3 fields */
ulint i, /* in: a number < 1000000 */
ulint type, /* in: DTUPLE_TEST_FIXED30, ... */
byte* buf) /* in: a buffer of size >= 16 bytes */
{
dfield_t* field;
ulint third_size;
ut_ad(tuple && buf);
ut_ad(i < 1000000);
field = dtuple_get_nth_field(tuple, 0);
ut_strcpy((char*)buf, "0000000");
buf[1] = (byte)('0' + (i / 100000) % 10);
buf[2] = (byte)('0' + (i / 10000) % 10);
buf[3] = (byte)('0' + (i / 1000) % 10);
buf[4] = (byte)('0' + (i / 100) % 10);
buf[5] = (byte)('0' + (i / 10) % 10);
buf[6] = (byte)('0' + (i % 10));
dfield_set_data(field, buf, 8);
dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 100, 0);
field = dtuple_get_nth_field(tuple, 1);
i = i % 1000; /* ut_rnd_gen_ulint() % 1000000; */
ut_strcpy((char*)buf + 8, "0000000");
buf[9] = (byte)('0' + (i / 100000) % 10);
buf[10] = (byte)('0' + (i / 10000) % 10);
buf[11] = (byte)('0' + (i / 1000) % 10);
buf[12] = (byte)('0' + (i / 100) % 10);
buf[13] = (byte)('0' + (i / 10) % 10);
buf[14] = (byte)('0' + (i % 10));
dfield_set_data(field, buf + 8, 8);
dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 100, 0);
field = dtuple_get_nth_field(tuple, 2);
data_rnd += 8757651;
if (type == DTUPLE_TEST_FIXED30) {
third_size = 30;
} else if (type == DTUPLE_TEST_RND30) {
third_size = data_rnd % 30;
} else if (type == DTUPLE_TEST_RND3500) {
third_size = data_rnd % 3500;
} else if (type == DTUPLE_TEST_FIXED2000) {
third_size = 2000;
} else if (type == DTUPLE_TEST_FIXED3) {
third_size = 3;
} else {
ut_error;
}
if (type == DTUPLE_TEST_FIXED30) {
dfield_set_data(field,
"12345678901234567890123456789", third_size);
} else {
dfield_set_data(field, data_buf, third_size);
}
dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 100, 0);
ut_ad(dtuple_validate(tuple));
}
/*******************************************************************
Generates a test tuple for B-tree speed tests. */
void
dtuple_gen_search_tuple3(
/*=====================*/
dtuple_t* tuple, /* in/out: a tuple with 1 or 2 fields */
ulint i, /* in: a number < 1000000 */
byte* buf) /* in: a buffer of size >= 16 bytes */
{
dfield_t* field;
ut_ad(tuple && buf);
ut_ad(i < 1000000);
field = dtuple_get_nth_field(tuple, 0);
ut_strcpy((char*)buf, "0000000");
buf[1] = (byte)('0' + (i / 100000) % 10);
buf[2] = (byte)('0' + (i / 10000) % 10);
buf[3] = (byte)('0' + (i / 1000) % 10);
buf[4] = (byte)('0' + (i / 100) % 10);
buf[5] = (byte)('0' + (i / 10) % 10);
buf[6] = (byte)('0' + (i % 10));
dfield_set_data(field, buf, 8);
dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 100, 0);
if (dtuple_get_n_fields(tuple) == 1) {
return;
}
field = dtuple_get_nth_field(tuple, 1);
i = (i * 1000) % 1000000;
ut_strcpy((char*)buf + 8, "0000000");
buf[9] = (byte)('0' + (i / 100000) % 10);
buf[10] = (byte)('0' + (i / 10000) % 10);
buf[11] = (byte)('0' + (i / 1000) % 10);
buf[12] = (byte)('0' + (i / 100) % 10);
buf[13] = (byte)('0' + (i / 10) % 10);
buf[14] = (byte)('0' + (i % 10));
dfield_set_data(field, buf + 8, 8);
dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 100, 0);
ut_ad(dtuple_validate(tuple));
}
/*******************************************************************
Generates a test tuple for TPC-A speed test. */
void
dtuple_gen_test_tuple_TPC_A(
/*========================*/
dtuple_t* tuple, /* in/out: a tuple with >= 3 fields */
ulint i, /* in: a number < 10000 */
byte* buf) /* in: a buffer of size >= 16 bytes */
{
dfield_t* field;
ulint third_size;
ut_ad(tuple && buf);
ut_ad(i < 10000);
field = dtuple_get_nth_field(tuple, 0);
ut_strcpy((char*)buf, "0000");
buf[0] = (byte)('0' + (i / 1000) % 10);
buf[1] = (byte)('0' + (i / 100) % 10);
buf[2] = (byte)('0' + (i / 10) % 10);
buf[3] = (byte)('0' + (i % 10));
dfield_set_data(field, buf, 5);
dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 100, 0);
field = dtuple_get_nth_field(tuple, 1);
dfield_set_data(field, buf + 8, 5);
dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 100, 0);
field = dtuple_get_nth_field(tuple, 2);
third_size = 90;
dfield_set_data(field, data_buf, third_size);
dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 100, 0);
ut_ad(dtuple_validate(tuple));
}
/*******************************************************************
Generates a test tuple for B-tree speed tests. */
void
dtuple_gen_search_tuple_TPC_A(
/*==========================*/
dtuple_t* tuple, /* in/out: a tuple with 1 field */
ulint i, /* in: a number < 10000 */
byte* buf) /* in: a buffer of size >= 16 bytes */
{
dfield_t* field;
ut_ad(tuple && buf);
ut_ad(i < 10000);
field = dtuple_get_nth_field(tuple, 0);
ut_strcpy((char*)buf, "0000");
buf[0] = (byte)('0' + (i / 1000) % 10);
buf[1] = (byte)('0' + (i / 100) % 10);
buf[2] = (byte)('0' + (i / 10) % 10);
buf[3] = (byte)('0' + (i % 10));
dfield_set_data(field, buf, 5);
dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 100, 0);
ut_ad(dtuple_validate(tuple));
}
/*******************************************************************
Generates a test tuple for TPC-C speed test. */
void
dtuple_gen_test_tuple_TPC_C(
/*========================*/
dtuple_t* tuple, /* in/out: a tuple with >= 12 fields */
ulint i, /* in: a number < 100000 */
byte* buf) /* in: a buffer of size >= 16 bytes */
{
dfield_t* field;
ulint size;
ulint j;
ut_ad(tuple && buf);
ut_ad(i < 100000);
field = dtuple_get_nth_field(tuple, 0);
buf[0] = (byte)('0' + (i / 10000) % 10);
buf[1] = (byte)('0' + (i / 1000) % 10);
buf[2] = (byte)('0' + (i / 100) % 10);
buf[3] = (byte)('0' + (i / 10) % 10);
buf[4] = (byte)('0' + (i % 10));
dfield_set_data(field, buf, 5);
dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 100, 0);
field = dtuple_get_nth_field(tuple, 1);
dfield_set_data(field, buf, 5);
dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 100, 0);
for (j = 0; j < 10; j++) {
field = dtuple_get_nth_field(tuple, 2 + j);
size = 24;
dfield_set_data(field, data_buf, size);
dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH,
100, 0);
}
ut_ad(dtuple_validate(tuple));
}
/*******************************************************************
Generates a test tuple for B-tree speed tests. */
void
dtuple_gen_search_tuple_TPC_C(
/*==========================*/
dtuple_t* tuple, /* in/out: a tuple with 1 field */
ulint i, /* in: a number < 100000 */
byte* buf) /* in: a buffer of size >= 16 bytes */
{
dfield_t* field;
ut_ad(tuple && buf);
ut_ad(i < 100000);
field = dtuple_get_nth_field(tuple, 0);
buf[0] = (byte)('0' + (i / 10000) % 10);
buf[1] = (byte)('0' + (i / 1000) % 10);
buf[2] = (byte)('0' + (i / 100) % 10);
buf[3] = (byte)('0' + (i / 10) % 10);
buf[4] = (byte)('0' + (i % 10));
dfield_set_data(field, buf, 5);
dtype_set(dfield_get_type(field), DATA_VARCHAR, DATA_ENGLISH, 100, 0);
ut_ad(dtuple_validate(tuple));
}
#endif /* notdefined */
...@@ -25,6 +25,11 @@ Created 1/8/1996 Heikki Tuuri ...@@ -25,6 +25,11 @@ Created 1/8/1996 Heikki Tuuri
#include "trx0roll.h" #include "trx0roll.h"
#include "usr0sess.h" #include "usr0sess.h"
/* Maximum lengths of identifiers in MySQL, in bytes */
#define MAX_TABLE_NAME_LEN 64
#define MAX_COLUMN_NAME_LEN 64
#define MAX_IDENTIFIER_LEN 255
/********************************************************************* /*********************************************************************
Based on a table object, this function builds the entry to be inserted Based on a table object, this function builds the entry to be inserted
in the SYS_TABLES system table. */ in the SYS_TABLES system table. */
...@@ -344,33 +349,6 @@ dict_build_col_def_step( ...@@ -344,33 +349,6 @@ dict_build_col_def_step(
return(DB_SUCCESS); return(DB_SUCCESS);
} }
#ifdef notdefined
/*************************************************************************
Creates the single index for a cluster: it contains all the columns of
the cluster definition in the order they were defined. */
static
void
dict_create_index_for_cluster_step(
/*===============================*/
tab_node_t* node) /* in: table create node */
{
dict_index_t* index;
ulint i;
dict_col_t* col;
index = dict_mem_index_create(table->name, "IND_DEFAULT_CLUSTERED",
table->space, DICT_CLUSTERED,
table->n_cols);
for (i = 0; i < table->n_cols; i++) {
col = dict_table_get_nth_col(table, i);
dict_mem_index_add_field(index, col->name, 0, 0);
}
(node->cluster)->index = index;
}
#endif
/********************************************************************* /*********************************************************************
Based on an index object, this function builds the entry to be inserted Based on an index object, this function builds the entry to be inserted
in the SYS_INDEXES system table. */ in the SYS_INDEXES system table. */
...@@ -767,26 +745,6 @@ dict_drop_index_tree( ...@@ -767,26 +745,6 @@ dict_drop_index_tree(
FIL_NULL, mtr); FIL_NULL, mtr);
} }
#ifdef notdefined
/*************************************************************************
Creates the default clustered index for a table: the records are ordered
by row id. */
void
dict_create_default_index(
/*======================*/
dict_table_t* table, /* in: table */
trx_t* trx) /* in: transaction handle */
{
dict_index_t* index;
index = dict_mem_index_create(table->name, "IND_DEFAULT_CLUSTERED",
table->space, DICT_CLUSTERED, 0);
dict_create_index(index, trx);
}
#endif
/************************************************************************* /*************************************************************************
Creates a table create graph. */ Creates a table create graph. */
...@@ -1237,6 +1195,7 @@ dict_create_add_foreigns_to_dictionary( ...@@ -1237,6 +1195,7 @@ dict_create_add_foreigns_to_dictionary(
que_t* graph; que_t* graph;
ulint number = start_id + 1; ulint number = start_id + 1;
ulint len; ulint len;
ulint namelen;
ulint error; ulint error;
char* ebuf = dict_foreign_err_buf; char* ebuf = dict_foreign_err_buf;
ulint i; ulint i;
...@@ -1267,15 +1226,21 @@ loop: ...@@ -1267,15 +1226,21 @@ loop:
"PROCEDURE ADD_FOREIGN_DEFS_PROC () IS\n" "PROCEDURE ADD_FOREIGN_DEFS_PROC () IS\n"
"BEGIN\n"); "BEGIN\n");
namelen = strlen(table->name);
ut_a(namelen < MAX_TABLE_NAME_LEN);
if (foreign->id == NULL) { if (foreign->id == NULL) {
/* Generate a new constraint id */ /* Generate a new constraint id */
foreign->id = mem_heap_alloc(foreign->heap, foreign->id = mem_heap_alloc(foreign->heap, namelen + 20);
ut_strlen(table->name) /* no overflow if number < 1e13 */
+ 20);
sprintf(foreign->id, "%s_ibfk_%lu", table->name, (ulong) number); sprintf(foreign->id, "%s_ibfk_%lu", table->name, (ulong) number);
number++; number++;
} }
ut_a(strlen(foreign->id) < MAX_IDENTIFIER_LEN);
ut_a(len < (sizeof buf)
- 46 - 2 * MAX_TABLE_NAME_LEN - MAX_IDENTIFIER_LEN - 20);
len += sprintf(buf + len, len += sprintf(buf + len,
"INSERT INTO SYS_FOREIGN VALUES('%s', '%s', '%s', %lu);\n", "INSERT INTO SYS_FOREIGN VALUES('%s', '%s', '%s', %lu);\n",
foreign->id, foreign->id,
...@@ -1285,6 +1250,9 @@ loop: ...@@ -1285,6 +1250,9 @@ loop:
+ (foreign->type << 24))); + (foreign->type << 24)));
for (i = 0; i < foreign->n_fields; i++) { for (i = 0; i < foreign->n_fields; i++) {
ut_a(len < (sizeof buf)
- 51 - 2 * MAX_COLUMN_NAME_LEN
- MAX_IDENTIFIER_LEN - 20);
len += sprintf(buf + len, len += sprintf(buf + len,
"INSERT INTO SYS_FOREIGN_COLS VALUES('%s', %lu, '%s', '%s');\n", "INSERT INTO SYS_FOREIGN_COLS VALUES('%s', %lu, '%s', '%s');\n",
...@@ -1294,6 +1262,7 @@ loop: ...@@ -1294,6 +1262,7 @@ loop:
foreign->referenced_col_names[i]); foreign->referenced_col_names[i]);
} }
ut_a(len < (sizeof buf) - 19)
len += sprintf(buf + len,"COMMIT WORK;\nEND;\n"); len += sprintf(buf + len,"COMMIT WORK;\nEND;\n");
graph = pars_sql(buf); graph = pars_sql(buf);
...@@ -1316,14 +1285,14 @@ loop: ...@@ -1316,14 +1285,14 @@ loop:
if (error == DB_DUPLICATE_KEY) { if (error == DB_DUPLICATE_KEY) {
mutex_enter(&dict_foreign_err_mutex); mutex_enter(&dict_foreign_err_mutex);
ut_sprintf_timestamp(ebuf); ut_sprintf_timestamp(ebuf);
ut_a(strlen(ebuf) < DICT_FOREIGN_ERR_BUF_LEN
- MAX_TABLE_NAME_LEN - MAX_IDENTIFIER_LEN - 201);
sprintf(ebuf + strlen(ebuf), sprintf(ebuf + strlen(ebuf),
" Error in foreign key constraint creation for table %.500s.\n" " Error in foreign key constraint creation for table %s.\n"
"A foreign key constraint of name %.500s\n" "A foreign key constraint of name %s\n"
"already exists (note that internally InnoDB adds 'databasename/'\n" "already exists (note that internally InnoDB adds 'databasename/'\n"
"in front of the user-defined constraint name).\n", table->name, foreign->id); "in front of the user-defined constraint name).\n", table->name, foreign->id);
ut_a(strlen(ebuf) < DICT_FOREIGN_ERR_BUF_LEN);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
return(error); return(error);
...@@ -1336,8 +1305,10 @@ loop: ...@@ -1336,8 +1305,10 @@ loop:
mutex_enter(&dict_foreign_err_mutex); mutex_enter(&dict_foreign_err_mutex);
ut_sprintf_timestamp(ebuf); ut_sprintf_timestamp(ebuf);
ut_a(strlen(ebuf) < DICT_FOREIGN_ERR_BUF_LEN
- MAX_TABLE_NAME_LEN - 124);
sprintf(ebuf + strlen(ebuf), sprintf(ebuf + strlen(ebuf),
" Internal error in foreign key constraint creation for table %.500s.\n" " Internal error in foreign key constraint creation for table %s.\n"
"See the MySQL .err log in the datadir for more information.\n", table->name); "See the MySQL .err log in the datadir for more information.\n", table->name);
mutex_exit(&dict_foreign_err_mutex); mutex_exit(&dict_foreign_err_mutex);
......
...@@ -790,19 +790,12 @@ fsp_init_file_page_low( ...@@ -790,19 +790,12 @@ fsp_init_file_page_low(
byte* ptr) /* in: pointer to a page */ byte* ptr) /* in: pointer to a page */
{ {
page_t* page; page_t* page;
#ifdef UNIV_BASIC_LOG_DEBUG
ulint i;
#endif
page = buf_frame_align(ptr); page = buf_frame_align(ptr);
buf_block_align(page)->check_index_page_at_flush = FALSE; buf_block_align(page)->check_index_page_at_flush = FALSE;
#ifdef UNIV_BASIC_LOG_DEBUG #ifdef UNIV_BASIC_LOG_DEBUG
/* printf("In log debug version: Erase the contents of the file page\n"); memset(page, 0xff, UNIV_PAGE_SIZE);
*/
for (i = 0; i < UNIV_PAGE_SIZE; i++) {
page[i] = (byte)0xFF;
}
#endif #endif
mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM, mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
ut_dulint_zero); ut_dulint_zero);
...@@ -812,6 +805,7 @@ fsp_init_file_page_low( ...@@ -812,6 +805,7 @@ fsp_init_file_page_low(
/*************************************************************** /***************************************************************
Inits a file page whose prior contents should be ignored. */ Inits a file page whose prior contents should be ignored. */
static
void void
fsp_init_file_page( fsp_init_file_page(
/*===============*/ /*===============*/
......
...@@ -65,33 +65,6 @@ ha_create( ...@@ -65,33 +65,6 @@ ha_create(
return(table); return(table);
} }
/*****************************************************************
Checks that a hash table node is in the chain. */
ibool
ha_node_in_chain(
/*=============*/
/* out: TRUE if in chain */
hash_cell_t* cell, /* in: hash table cell */
ha_node_t* node) /* in: external chain node */
{
ha_node_t* node2;
node2 = cell->node;
while (node2 != NULL) {
if (node2 == node) {
return(TRUE);
}
node2 = node2->next;
}
return(FALSE);
}
/***************************************************************** /*****************************************************************
Inserts an entry into a hash table. If an entry with the same fold number Inserts an entry into a hash table. If an entry with the same fold number
is found, its node is updated to point to the new data, and no new node is found, its node is updated to point to the new data, and no new node
......
...@@ -365,17 +365,6 @@ btr_cur_parse_update_in_place( ...@@ -365,17 +365,6 @@ btr_cur_parse_update_in_place(
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
page_t* page); /* in: page or NULL */ page_t* page); /* in: page or NULL */
/***************************************************************
Parses a redo log record of updating a record, but not in-place. */
byte*
btr_cur_parse_opt_update(
/*=====================*/
/* out: end of log record or NULL */
byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */
page_t* page, /* in: page or NULL */
mtr_t* mtr); /* in: mtr or NULL */
/******************************************************************** /********************************************************************
Parses the redo log record for delete marking or unmarking of a clustered Parses the redo log record for delete marking or unmarking of a clustered
index record. */ index record. */
......
...@@ -49,21 +49,6 @@ btr_search_info_update( ...@@ -49,21 +49,6 @@ btr_search_info_update(
dict_index_t* index, /* in: index of the cursor */ dict_index_t* index, /* in: index of the cursor */
btr_cur_t* cursor);/* in: cursor which was just positioned */ btr_cur_t* cursor);/* in: cursor which was just positioned */
/********************************************************************** /**********************************************************************
Tries to guess the right search position based on the search pattern info
of the index. */
ibool
btr_search_guess_on_pattern(
/*========================*/
/* out: TRUE if succeeded */
dict_index_t* index, /* in: index */
btr_search_t* info, /* in: index search info */
dtuple_t* tuple, /* in: logical record */
ulint mode, /* in: PAGE_CUR_L, ... */
ulint latch_mode, /* in: BTR_SEARCH_LEAF, ... */
btr_cur_t* cursor, /* out: tree cursor */
mtr_t* mtr); /* in: mtr */
/**********************************************************************
Tries to guess the right search position based on the hash search info Tries to guess the right search position based on the hash search info
of the index. Note that if mode is PAGE_CUR_LE, which is used in inserts, of the index. Note that if mode is PAGE_CUR_LE, which is used in inserts,
and the function returns TRUE, then cursor->up_match and cursor->low_match and the function returns TRUE, then cursor->up_match and cursor->low_match
...@@ -140,26 +125,6 @@ btr_search_update_hash_on_delete( ...@@ -140,26 +125,6 @@ btr_search_update_hash_on_delete(
record to delete using btr_cur_search_..., record to delete using btr_cur_search_...,
the record is not yet deleted */ the record is not yet deleted */
/************************************************************************ /************************************************************************
Prints info of the search system. */
void
btr_search_print_info(void);
/*=======================*/
/************************************************************************
Prints info of searches on an index. */
void
btr_search_index_print_info(
/*========================*/
dict_index_t* index); /* in: index */
/************************************************************************
Prints info of searches on a table. */
void
btr_search_table_print_info(
/*========================*/
char* name); /* in: table name */
/************************************************************************
Validates the search system. */ Validates the search system. */
ibool ibool
......
...@@ -496,6 +496,7 @@ buf_frame_get_modify_clock( ...@@ -496,6 +496,7 @@ buf_frame_get_modify_clock(
return(block->modify_clock); return(block->modify_clock);
} }
#ifdef UNIV_SYNC_DEBUG
/*********************************************************************** /***********************************************************************
Increments the bufferfix count. */ Increments the bufferfix count. */
UNIV_INLINE UNIV_INLINE
...@@ -515,7 +516,7 @@ buf_block_buf_fix_inc_debug( ...@@ -515,7 +516,7 @@ buf_block_buf_fix_inc_debug(
#endif #endif
block->buf_fix_count++; block->buf_fix_count++;
} }
#else /* UNIV_SYNC_DEBUG */
/*********************************************************************** /***********************************************************************
Increments the bufferfix count. */ Increments the bufferfix count. */
UNIV_INLINE UNIV_INLINE
...@@ -526,7 +527,7 @@ buf_block_buf_fix_inc( ...@@ -526,7 +527,7 @@ buf_block_buf_fix_inc(
{ {
block->buf_fix_count++; block->buf_fix_count++;
} }
#endif /* UNIV_SYNC_DEBUG */
/********************************************************************** /**********************************************************************
Returns the control block of a file page, NULL if not found. */ Returns the control block of a file page, NULL if not found. */
UNIV_INLINE UNIV_INLINE
......
...@@ -375,84 +375,6 @@ dtuple_big_rec_free( ...@@ -375,84 +375,6 @@ dtuple_big_rec_free(
/*================*/ /*================*/
big_rec_t* vector); /* in, own: big rec vector; it is big_rec_t* vector); /* in, own: big rec vector; it is
freed in this function */ freed in this function */
/***************************************************************
Generates a random tuple. */
dtuple_t*
dtuple_gen_rnd_tuple(
/*=================*/
/* out: pointer to the tuple */
mem_heap_t* heap); /* in: memory heap where generated */
/*******************************************************************
Generates a test tuple for sort and comparison tests. */
void
dtuple_gen_test_tuple(
/*==================*/
dtuple_t* tuple, /* in/out: a tuple with 3 fields */
ulint i); /* in: a number, 0 <= i < 512 */
/*******************************************************************
Generates a test tuple for B-tree speed tests. */
void
dtuple_gen_test_tuple3(
/*===================*/
dtuple_t* tuple, /* in/out: a tuple with 3 fields */
ulint i, /* in: a number < 1000000 */
ulint type, /* in: DTUPLE_TEST_FIXED30, ... */
byte* buf); /* in: a buffer of size >= 8 bytes */
/*******************************************************************
Generates a test tuple for B-tree speed tests. */
void
dtuple_gen_search_tuple3(
/*=====================*/
dtuple_t* tuple, /* in/out: a tuple with 1 or 2 fields */
ulint i, /* in: a number < 1000000 */
byte* buf); /* in: a buffer of size >= 8 bytes */
/*******************************************************************
Generates a test tuple for TPC-A speed test. */
void
dtuple_gen_test_tuple_TPC_A(
/*========================*/
dtuple_t* tuple, /* in/out: a tuple with >= 3 fields */
ulint i, /* in: a number < 10000 */
byte* buf); /* in: a buffer of size >= 16 bytes */
/*******************************************************************
Generates a test tuple for B-tree speed tests. */
void
dtuple_gen_search_tuple_TPC_A(
/*==========================*/
dtuple_t* tuple, /* in/out: a tuple with 1 field */
ulint i, /* in: a number < 10000 */
byte* buf); /* in: a buffer of size >= 16 bytes */
/*******************************************************************
Generates a test tuple for TPC-C speed test. */
void
dtuple_gen_test_tuple_TPC_C(
/*========================*/
dtuple_t* tuple, /* in/out: a tuple with >= 12 fields */
ulint i, /* in: a number < 100000 */
byte* buf); /* in: a buffer of size >= 16 bytes */
/*******************************************************************
Generates a test tuple for B-tree speed tests. */
void
dtuple_gen_search_tuple_TPC_C(
/*==========================*/
dtuple_t* tuple, /* in/out: a tuple with 1 field */
ulint i, /* in: a number < 100000 */
byte* buf); /* in: a buffer of size >= 16 bytes */
/* Types of the third field in dtuple_gen_test_tuple3 */
#define DTUPLE_TEST_FIXED30 1
#define DTUPLE_TEST_RND30 2
#define DTUPLE_TEST_RND3500 3
#define DTUPLE_TEST_FIXED2000 4
#define DTUPLE_TEST_FIXED3 5
/*######################################################################*/ /*######################################################################*/
......
...@@ -16,15 +16,6 @@ Created 1/8/1996 Heikki Tuuri ...@@ -16,15 +16,6 @@ Created 1/8/1996 Heikki Tuuri
#include "row0types.h" #include "row0types.h"
#include "mtr0mtr.h" #include "mtr0mtr.h"
/*************************************************************************
Creates the default clustered index for a table: the records are ordered
by row id. */
void
dict_create_default_index(
/*======================*/
dict_table_t* table, /* in: table */
trx_t* trx); /* in: transaction handle */
/************************************************************************* /*************************************************************************
Creates a table create graph. */ Creates a table create graph. */
......
...@@ -677,13 +677,6 @@ dict_index_get_tree( ...@@ -677,13 +677,6 @@ dict_index_get_tree(
/* out: index tree */ /* out: index tree */
dict_index_t* index); /* in: index */ dict_index_t* index); /* in: index */
/************************************************************************* /*************************************************************************
Gets the column data type. */
UNIV_INLINE
dtype_t*
dict_col_get_type(
/*==============*/
dict_col_t* col);
/*************************************************************************
Gets the field order criterion. */ Gets the field order criterion. */
UNIV_INLINE UNIV_INLINE
ulint ulint
......
...@@ -177,15 +177,6 @@ ibuf_page_low( ...@@ -177,15 +177,6 @@ ibuf_page_low(
mtr_t* mtr); /* in: mtr which will contain an x-latch to the mtr_t* mtr); /* in: mtr which will contain an x-latch to the
bitmap page if the page is not one of the fixed bitmap page if the page is not one of the fixed
address ibuf pages */ address ibuf pages */
/*************************************************************************
Checks if an index page has so much free space that the free bit should
be set TRUE in the ibuf bitmap. */
ibool
ibuf_index_page_has_free(
/*=====================*/
/* out: TRUE if there is enough free space */
page_t* page); /* in: non-unique secondary index page */
/*************************************************************************** /***************************************************************************
Frees excess pages from the ibuf free list. This function is called when an OS Frees excess pages from the ibuf free list. This function is called when an OS
thread calls fsp services to allocate a new file segment, or a new page to a thread calls fsp services to allocate a new file segment, or a new page to a
......
...@@ -442,14 +442,6 @@ lock_rec_hash( ...@@ -442,14 +442,6 @@ lock_rec_hash(
ulint space, /* in: space */ ulint space, /* in: space */
ulint page_no);/* in: page number */ ulint page_no);/* in: page number */
/************************************************************************* /*************************************************************************
Gets the mutex protecting record locks on a given page address. */
mutex_t*
lock_rec_get_mutex_for_addr(
/*========================*/
ulint space, /* in: space id */
ulint page_no);/* in: page number */
/*************************************************************************
Checks that a transaction id is sensible, i.e., not in the future. */ Checks that a transaction id is sensible, i.e., not in the future. */
ibool ibool
......
...@@ -60,6 +60,7 @@ mem_heap_validate_or_print( ...@@ -60,6 +60,7 @@ mem_heap_validate_or_print(
ulint* n_blocks); /* out: number of blocks in the heap, ulint* n_blocks); /* out: number of blocks in the heap,
if a NULL pointer is passed as this if a NULL pointer is passed as this
argument, it is ignored */ argument, it is ignored */
#ifdef UNIV_MEM_DEBUG
/****************************************************************** /******************************************************************
Prints the contents of a memory heap. */ Prints the contents of a memory heap. */
...@@ -67,6 +68,7 @@ void ...@@ -67,6 +68,7 @@ void
mem_heap_print( mem_heap_print(
/*===========*/ /*===========*/
mem_heap_t* heap); /* in: memory heap */ mem_heap_t* heap); /* in: memory heap */
#endif /* UNIV_MEM_DEBUG */
/****************************************************************** /******************************************************************
Checks that an object is a memory heap (or a block of it) */ Checks that an object is a memory heap (or a block of it) */
...@@ -83,20 +85,7 @@ mem_heap_validate( ...@@ -83,20 +85,7 @@ mem_heap_validate(
/*==============*/ /*==============*/
/* out: TRUE if ok */ /* out: TRUE if ok */
mem_heap_t* heap); /* in: memory heap */ mem_heap_t* heap); /* in: memory heap */
/********************************************************************* #ifdef UNIV_MEM_DEBUG
Prints information of dynamic memory usage and currently live
memory heaps or buffers. Can only be used in the debug version. */
void
mem_print_info(void);
/*=================*/
/*********************************************************************
Prints information of dynamic memory usage and currently allocated memory
heaps or buffers since the last ..._print_info or..._print_new_info. */
void
mem_print_new_info(void);
/*====================*/
/********************************************************************* /*********************************************************************
TRUE if no memory is currently allocated. */ TRUE if no memory is currently allocated. */
...@@ -118,6 +107,7 @@ ibool ...@@ -118,6 +107,7 @@ ibool
mem_validate(void); mem_validate(void);
/*===============*/ /*===============*/
/* out: TRUE if ok */ /* out: TRUE if ok */
#endif /* UNIV_MEM_DEBUG */
/**************************************************************** /****************************************************************
Tries to find neigboring memory allocation blocks and dumps to stderr Tries to find neigboring memory allocation blocks and dumps to stderr
the neighborhood of a given pointer. */ the neighborhood of a given pointer. */
......
...@@ -493,18 +493,6 @@ mem_alloc_func( ...@@ -493,18 +493,6 @@ mem_alloc_func(
ulint line /* in: line where created */ ulint line /* in: line where created */
) )
{ {
#ifdef notdefined
void* buf;
buf = mem_area_alloc(n, mem_comm_pool);
#ifdef UNIV_SET_MEM_TO_ZERO
memset(buf, '\0', n);
#endif
return(buf);
#else
mem_heap_t* heap; mem_heap_t* heap;
void* buf; void* buf;
...@@ -525,8 +513,6 @@ mem_alloc_func( ...@@ -525,8 +513,6 @@ mem_alloc_func(
ut_a((byte*)heap == (byte*)buf - MEM_BLOCK_HEADER_SIZE ut_a((byte*)heap == (byte*)buf - MEM_BLOCK_HEADER_SIZE
- MEM_FIELD_HEADER_SIZE); - MEM_FIELD_HEADER_SIZE);
return(buf); return(buf);
#endif
} }
/******************************************************************* /*******************************************************************
...@@ -542,17 +528,11 @@ mem_free_func( ...@@ -542,17 +528,11 @@ mem_free_func(
ulint line /* in: line where created */ ulint line /* in: line where created */
) )
{ {
#ifdef notdefined
mem_area_free(ptr, mem_comm_pool);
#else
mem_heap_t* heap; mem_heap_t* heap;
heap = (mem_heap_t*)((byte*)ptr - MEM_BLOCK_HEADER_SIZE heap = (mem_heap_t*)((byte*)ptr - MEM_BLOCK_HEADER_SIZE
- MEM_FIELD_HEADER_SIZE); - MEM_FIELD_HEADER_SIZE);
mem_heap_free_func(heap, file_name, line); mem_heap_free_func(heap, file_name, line);
#endif
} }
/********************************************************************* /*********************************************************************
......
...@@ -133,15 +133,6 @@ mlog_write_initial_log_record_fast( ...@@ -133,15 +133,6 @@ mlog_write_initial_log_record_fast(
byte type, /* in: log item type: MLOG_1BYTE, ... */ byte type, /* in: log item type: MLOG_1BYTE, ... */
byte* log_ptr,/* in: pointer to mtr log which has been opened */ byte* log_ptr,/* in: pointer to mtr log which has been opened */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/****************************************************************
Writes the contents of a mini-transaction log, if any, to the database log. */
dulint
mlog_write(
/*=======*/
dyn_array_t* mlog, /* in: mlog */
ibool* modifications); /* out: TRUE if there were
log items to write */
/************************************************************ /************************************************************
Parses an initial log record written by mlog_write_initial_log_record. */ Parses an initial log record written by mlog_write_initial_log_record. */
......
...@@ -132,16 +132,6 @@ void ...@@ -132,16 +132,6 @@ void
mtr_commit( mtr_commit(
/*=======*/ /*=======*/
mtr_t* mtr); /* in: mini-transaction */ mtr_t* mtr); /* in: mini-transaction */
/****************************************************************
Writes to the database log the full contents of the pages that this mtr is
the first to modify in the buffer pool. This function is called when the
database is in the online backup state. */
void
mtr_log_write_backup_entries(
/*=========================*/
mtr_t* mtr, /* in: mini-transaction */
dulint backup_lsn); /* in: online backup lsn */
/************************************************************** /**************************************************************
Sets and returns a savepoint in mtr. */ Sets and returns a savepoint in mtr. */
UNIV_INLINE UNIV_INLINE
......
...@@ -102,37 +102,6 @@ os_mem_alloc_nocache( ...@@ -102,37 +102,6 @@ os_mem_alloc_nocache(
/*=================*/ /*=================*/
/* out: allocated memory */ /* out: allocated memory */
ulint n); /* in: number of bytes */ ulint n); /* in: number of bytes */
#ifdef notdefined
/********************************************************************
Creates a new process. */
ibool
os_process_create(
/*==============*/
char* name, /* in: name of the executable to start
or its full path name */
char* cmd, /* in: command line for the starting
process, or NULL if no command line
specified */
os_process_t* proc, /* out: handle to the process */
os_process_id_t* id); /* out: process id */
/**************************************************************************
Exits a process. */
void
os_process_exit(
/*============*/
ulint code); /* in: exit code */
/**************************************************************************
Gets process exit code. */
ibool
os_process_get_exit_code(
/*=====================*/
/* out: TRUE if succeed, FALSE if fail */
os_process_t proc, /* in: handle to the process */
ulint* code); /* out: exit code */
#endif
/******************************************************************** /********************************************************************
Sets the priority boost for threads released from waiting within the current Sets the priority boost for threads released from waiting within the current
process. */ process. */
......
...@@ -99,13 +99,6 @@ os_thread_t ...@@ -99,13 +99,6 @@ os_thread_t
os_thread_get_curr(void); os_thread_get_curr(void);
/*====================*/ /*====================*/
/********************************************************************* /*********************************************************************
Waits for a thread to terminate. */
void
os_thread_wait(
/*===========*/
os_thread_t thread); /* in: thread to wait */
/*********************************************************************
Advises the os to give up remainder of the thread's time slice. */ Advises the os to give up remainder of the thread's time slice. */
void void
......
...@@ -6,24 +6,6 @@ Comparison services for records ...@@ -6,24 +6,6 @@ Comparison services for records
Created 7/1/1994 Heikki Tuuri Created 7/1/1994 Heikki Tuuri
************************************************************************/ ************************************************************************/
/*****************************************************************
This function is used to compare two data fields for which we know the
data type. */
int
cmp_data_data_slow(
/*===============*/
/* out: 1, 0, -1, if data1 is greater, equal,
less than data2, respectively */
dtype_t* cur_type,/* in: data type of the fields */
byte* data1, /* in: data field (== a pointer to a memory
buffer) */
ulint len1, /* in: data field length or UNIV_SQL_NULL */
byte* data2, /* in: data field (== a pointer to a memory
buffer) */
ulint len2); /* in: data field length or UNIV_SQL_NULL */
/***************************************************************** /*****************************************************************
This function is used to compare two data fields for which we know the This function is used to compare two data fields for which we know the
data type. */ data type. */
......
...@@ -68,16 +68,6 @@ row_build_index_entry( ...@@ -68,16 +68,6 @@ row_build_index_entry(
dict_index_t* index, /* in: index on the table */ dict_index_t* index, /* in: index on the table */
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 index entry is allocated */ the index entry is allocated */
/*********************************************************************
Builds an index entry from a row. */
void
row_build_index_entry_to_tuple(
/*===========================*/
dtuple_t* entry, /* in/out: index entry; the dtuple must have
enough fields for the index! */
dtuple_t* row, /* in: row */
dict_index_t* index); /* in: index on the table */
/*********************************************************************** /***********************************************************************
An inverse function to dict_row_build_index_entry. Builds a row from a An inverse function to dict_row_build_index_entry. Builds a row from a
record in a clustered index. */ record in a clustered index. */
...@@ -103,21 +93,6 @@ row_build( ...@@ -103,21 +93,6 @@ row_build(
mem_heap_t* heap); /* in: memory heap from which the memory mem_heap_t* heap); /* in: memory heap from which the memory
needed is allocated */ needed is allocated */
/*********************************************************************** /***********************************************************************
An inverse function to dict_row_build_index_entry. Builds a row from a
record in a clustered index. */
void
row_build_to_tuple(
/*===============*/
dtuple_t* row, /* in/out: row built; see the NOTE below! */
dict_index_t* index, /* in: clustered index */
rec_t* rec); /* in: record in the clustered index;
NOTE: the data fields in the row will point
directly into this record, therefore,
the buffer page of this record must be
at least s-latched and the latch held
as long as the row dtuple is used! */
/***********************************************************************
Converts an index record to a typed data tuple. */ Converts an index record to a typed data tuple. */
dtuple_t* dtuple_t*
......
...@@ -216,13 +216,7 @@ srv_boot(void); ...@@ -216,13 +216,7 @@ srv_boot(void);
/*==========*/ /*==========*/
/* out: DB_SUCCESS or error code */ /* out: DB_SUCCESS or error code */
/************************************************************************* /*************************************************************************
Initializes the server. */ Frees the OS fast mutex created in srv_boot(). */
void
srv_init(void);
/*==========*/
/*************************************************************************
Frees the OS fast mutex created in srv_init(). */
void void
srv_free(void); srv_free(void);
...@@ -272,23 +266,6 @@ srv_master_thread( ...@@ -272,23 +266,6 @@ srv_master_thread(
/* out: a dummy parameter */ /* out: a dummy parameter */
void* arg); /* in: a dummy parameter required by void* arg); /* in: a dummy parameter required by
os_thread_create */ os_thread_create */
/*************************************************************************
Reads a keyword and a value from a file. */
ulint
srv_read_init_val(
/*==============*/
/* out: DB_SUCCESS or error code */
FILE* initfile, /* in: file pointer */
char* keyword, /* in: keyword before value(s), or NULL if
no keyword read */
char* str_buf, /* in/out: buffer for a string value to read,
buffer size must be 10000 bytes, if NULL
then not read */
ulint* num_val, /* out: numerical value to read, if NULL
then not read */
ibool print_not_err); /* in: if TRUE, then we will not print
error messages to console */
/*********************************************************************** /***********************************************************************
Tells the Innobase server that there has been activity in the database Tells the Innobase server that there has been activity in the database
and wakes up the master thread if it is suspended (not sleeping). Used and wakes up the master thread if it is suspended (not sleeping). Used
......
...@@ -234,15 +234,6 @@ mutex_get_waiters( ...@@ -234,15 +234,6 @@ mutex_get_waiters(
/*==============*/ /*==============*/
/* out: value to set */ /* out: value to set */
mutex_t* mutex); /* in: mutex */ mutex_t* mutex); /* in: mutex */
/**********************************************************************
Implements the memory barrier operation which makes a serialization point to
the instruction flow. This is needed because the Pentium may speculatively
execute reads before preceding writes are committed. We could also use here
any LOCKed instruction (see Intel Software Dev. Manual, Vol. 3). */
void
mutex_fence(void);
/*=============*/
/* /*
LATCHING ORDER WITHIN THE DATABASE LATCHING ORDER WITHIN THE DATABASE
......
...@@ -343,179 +343,6 @@ lock_deadlock_recursive( ...@@ -343,179 +343,6 @@ lock_deadlock_recursive(
#define lock_mutex_enter_kernel() mutex_enter(&kernel_mutex) #define lock_mutex_enter_kernel() mutex_enter(&kernel_mutex)
#define lock_mutex_exit_kernel() mutex_exit(&kernel_mutex) #define lock_mutex_exit_kernel() mutex_exit(&kernel_mutex)
#ifdef notdefined
/*************************************************************************
Reserves the kernel mutex. This function is used in this module to allow
monitoring the contention degree on the kernel mutex caused by the lock
operations. */
UNIV_INLINE
void
lock_mutex_enter_kernel(void)
/*=========================*/
{
mutex_enter(&kernel_mutex);
}
/*************************************************************************
Releases the kernel mutex. This function is used in this module to allow
monitoring the contention degree on the kernel mutex caused by the lock
operations. */
UNIV_INLINE
void
lock_mutex_exit_kernel(void)
/*=========================*/
{
mutex_exit(&kernel_mutex);
}
#endif
#ifdef notdefined
/*************************************************************************
Gets the mutex protecting record locks for a page in the buffer pool. */
UNIV_INLINE
mutex_t*
lock_rec_get_mutex(
/*===============*/
byte* ptr) /* in: pointer to somewhere within a buffer frame */
{
return(buf_frame_get_lock_mutex(ptr));
}
/*************************************************************************
Reserves the mutex protecting record locks for a page in the buffer pool. */
UNIV_INLINE
void
lock_rec_mutex_enter(
/*=================*/
byte* ptr) /* in: pointer to somewhere within a buffer frame */
{
mutex_enter(lock_rec_get_mutex(ptr));
}
/*************************************************************************
Releases the mutex protecting record locks for a page in the buffer pool. */
UNIV_INLINE
void
lock_rec_mutex_exit(
/*================*/
byte* ptr) /* in: pointer to somewhere within a buffer frame */
{
mutex_exit(lock_rec_get_mutex(ptr));
}
/*************************************************************************
Checks if the caller owns the mutex to record locks of a page. Works only in
the debug version. */
UNIV_INLINE
ibool
lock_rec_mutex_own(
/*===============*/
/* out: TRUE if the current OS thread has reserved the
mutex */
byte* ptr) /* in: pointer to somewhere within a buffer frame */
{
return(mutex_own(lock_rec_get_mutex(ptr)));
}
/*************************************************************************
Gets the mutex protecting record locks on a given page address. */
mutex_t*
lock_rec_get_mutex_for_addr(
/*========================*/
ulint space, /* in: space id */
ulint page_no)/* in: page number */
{
return(hash_get_mutex(lock_sys->rec_hash,
lock_rec_fold(space, page_no)));
}
/*************************************************************************
Checks if the caller owns the mutex to record locks of a page. Works only in
the debug version. */
UNIV_INLINE
ibool
lock_rec_mutex_own_addr(
/*====================*/
ulint space, /* in: space id */
ulint page_no)/* in: page number */
{
return(mutex_own(lock_rec_get_mutex_for_addr(space, page_no)));
}
/*************************************************************************
Reserves all the mutexes protecting record locks. */
UNIV_INLINE
void
lock_rec_mutex_enter_all(void)
/*==========================*/
{
hash_table_t* table;
ulint n_mutexes;
ulint i;
table = lock_sys->rec_hash;
n_mutexes = table->n_mutexes;
for (i = 0; i < n_mutexes; i++) {
mutex_enter(hash_get_nth_mutex(table, i));
}
}
/*************************************************************************
Releases all the mutexes protecting record locks. */
UNIV_INLINE
void
lock_rec_mutex_exit_all(void)
/*=========================*/
{
hash_table_t* table;
ulint n_mutexes;
ulint i;
table = lock_sys->rec_hash;
n_mutexes = table->n_mutexes;
for (i = 0; i < n_mutexes; i++) {
mutex_exit(hash_get_nth_mutex(table, i));
}
}
/*************************************************************************
Checks that the current OS thread owns all the mutexes protecting record
locks. */
UNIV_INLINE
ibool
lock_rec_mutex_own_all(void)
/*========================*/
/* out: TRUE if owns all */
{
hash_table_t* table;
ulint n_mutexes;
ibool owns_yes = TRUE;
ulint i;
table = lock_sys->rec_hash;
n_mutexes = table->n_mutexes;
for (i = 0; i < n_mutexes; i++) {
if (!mutex_own(hash_get_nth_mutex(table, i))) {
owns_yes = FALSE;
}
}
return(owns_yes);
}
#endif
/************************************************************************* /*************************************************************************
Checks that a transaction id is sensible, i.e., not in the future. */ Checks that a transaction id is sensible, i.e., not in the future. */
...@@ -2023,7 +1850,7 @@ possible, enqueues a waiting lock request. This is a low-level function ...@@ -2023,7 +1850,7 @@ possible, enqueues a waiting lock request. This is a low-level function
which does NOT look at implicit locks! Checks lock compatibility within which does NOT look at implicit locks! Checks lock compatibility within
explicit locks. This function sets a normal next-key lock, or in the case explicit locks. This function sets a normal next-key lock, or in the case
of a page supremum record, a gap type lock. */ of a page supremum record, a gap type lock. */
static
ulint ulint
lock_rec_lock( lock_rec_lock(
/*==========*/ /*==========*/
...@@ -2105,7 +1932,7 @@ lock_rec_has_to_wait_in_queue( ...@@ -2105,7 +1932,7 @@ lock_rec_has_to_wait_in_queue(
/***************************************************************** /*****************************************************************
Grants a lock to a waiting lock request and releases the waiting Grants a lock to a waiting lock request and releases the waiting
transaction. */ transaction. */
static
void void
lock_grant( lock_grant(
/*=======*/ /*=======*/
...@@ -2172,7 +1999,7 @@ lock_rec_cancel( ...@@ -2172,7 +1999,7 @@ lock_rec_cancel(
Removes a record lock request, waiting or granted, from the queue and Removes a record lock request, waiting or granted, from the queue and
grants locks to other transactions in the queue if they now are entitled grants locks to other transactions in the queue if they now are entitled
to a lock. NOTE: all record locks contained in in_lock are removed. */ to a lock. NOTE: all record locks contained in in_lock are removed. */
static
void void
lock_rec_dequeue_from_page( lock_rec_dequeue_from_page(
/*=======================*/ /*=======================*/
...@@ -2343,7 +2170,7 @@ lock_rec_inherit_to_gap( ...@@ -2343,7 +2170,7 @@ lock_rec_inherit_to_gap(
Makes a record to inherit the gap locks (except LOCK_INSERT_INTENTION type) Makes a record to inherit the gap locks (except LOCK_INSERT_INTENTION type)
of another record as gap type locks, but does not reset the lock bits of the of another record as gap type locks, but does not reset the lock bits of the
other record. Also waiting lock requests are inherited as GRANTED gap locks. */ other record. Also waiting lock requests are inherited as GRANTED gap locks. */
static
void void
lock_rec_inherit_to_gap_if_gap_lock( lock_rec_inherit_to_gap_if_gap_lock(
/*================================*/ /*================================*/
...@@ -3583,7 +3410,7 @@ lock_table_has_to_wait_in_queue( ...@@ -3583,7 +3410,7 @@ lock_table_has_to_wait_in_queue(
Removes a table lock request, waiting or granted, from the queue and grants Removes a table lock request, waiting or granted, from the queue and grants
locks to other transactions in the queue, if they now are entitled to a locks to other transactions in the queue, if they now are entitled to a
lock. */ lock. */
static
void void
lock_table_dequeue( lock_table_dequeue(
/*===============*/ /*===============*/
......
...@@ -181,9 +181,10 @@ recv_sys_empty_hash(void) ...@@ -181,9 +181,10 @@ recv_sys_empty_hash(void)
recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 256); recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 256);
} }
#ifndef UNIV_LOG_DEBUG
/************************************************************ /************************************************************
Frees the recovery system. */ Frees the recovery system. */
static
void void
recv_sys_free(void) recv_sys_free(void)
/*===============*/ /*===============*/
...@@ -200,6 +201,7 @@ recv_sys_free(void) ...@@ -200,6 +201,7 @@ recv_sys_free(void)
mutex_exit(&(recv_sys->mutex)); mutex_exit(&(recv_sys->mutex));
} }
#endif /* !UNIV_LOG_DEBUG */
/************************************************************ /************************************************************
Truncates possible corrupted or extra records from a log group. */ Truncates possible corrupted or extra records from a log group. */
...@@ -358,7 +360,7 @@ Copies a log segment from the most up-to-date log group to the other log ...@@ -358,7 +360,7 @@ Copies a log segment from the most up-to-date log group to the other log
groups, so that they all contain the latest log data. Also writes the info groups, so that they all contain the latest log data. Also writes the info
about the latest checkpoint to the groups, and inits the fields in the group about the latest checkpoint to the groups, and inits the fields in the group
memory structs to up-to-date values. */ memory structs to up-to-date values. */
static
void void
recv_synchronize_groups( recv_synchronize_groups(
/*====================*/ /*====================*/
...@@ -1803,10 +1805,11 @@ recv_calc_lsn_on_data_add( ...@@ -1803,10 +1805,11 @@ recv_calc_lsn_on_data_add(
return(ut_dulint_add(lsn, lsn_len)); return(ut_dulint_add(lsn, lsn_len));
} }
#ifdef UNIV_LOG_DEBUG
/*********************************************************** /***********************************************************
Checks that the parser recognizes incomplete initial segments of a log Checks that the parser recognizes incomplete initial segments of a log
record as incomplete. */ record as incomplete. */
static
void void
recv_check_incomplete_log_recs( recv_check_incomplete_log_recs(
/*===========================*/ /*===========================*/
...@@ -1824,6 +1827,7 @@ recv_check_incomplete_log_recs( ...@@ -1824,6 +1827,7 @@ recv_check_incomplete_log_recs(
&page_no, &body)); &page_no, &body));
} }
} }
#endif /* UNIV_LOG_DEBUG */
/*********************************************************** /***********************************************************
Prints diagnostic info of corrupt log. */ Prints diagnostic info of corrupt log. */
......
...@@ -603,130 +603,7 @@ mem_heap_validate( ...@@ -603,130 +603,7 @@ mem_heap_validate(
return(TRUE); return(TRUE);
} }
/*********************************************************************
Prints information of dynamic memory usage and currently allocated
memory heaps or buffers. Can only be used in the debug version. */
static
void
mem_print_info_low(
/*===============*/
ibool print_all __attribute__((unused)))
/* in: if TRUE, all heaps are printed,
else only the heaps allocated after the
previous call of this function */
{
#ifdef UNIV_MEM_DEBUG #ifdef UNIV_MEM_DEBUG
mem_hash_node_t* node;
ulint n_heaps = 0;
ulint allocated_mem;
ulint ph_size;
ulint total_allocated_mem = 0;
ibool error;
ulint n_blocks;
#endif
FILE* outfile;
/* outfile = fopen("ibdebug", "a"); */
outfile = stdout;
fprintf(outfile, "\n");
fprintf(outfile,
"________________________________________________________\n");
fprintf(outfile, "MEMORY ALLOCATION INFORMATION\n\n");
#ifndef UNIV_MEM_DEBUG
mem_pool_print_info(outfile, mem_comm_pool);
fprintf(outfile,
"Sorry, non-debug version cannot give more memory info\n");
/* fclose(outfile); */
return;
#else
mutex_enter(&mem_hash_mutex);
fprintf(outfile, "LIST OF CREATED HEAPS AND ALLOCATED BUFFERS: \n\n");
if (!print_all) {
fprintf(outfile, "AFTER THE LAST PRINT INFO\n");
}
node = UT_LIST_GET_FIRST(mem_all_list_base);
while (node != NULL) {
n_heaps++;
if (!print_all && node->nth_heap < mem_last_print_info) {
goto next_heap;
}
mem_heap_validate_or_print(node->heap, NULL,
FALSE, &error, &allocated_mem,
&ph_size, &n_blocks);
total_allocated_mem += allocated_mem;
fprintf(outfile,
"%lu: file %s line %lu of size %lu phys.size %lu with %lu blocks, type %lu\n",
node->nth_heap, node->file_name, node->line,
allocated_mem, ph_size, n_blocks,
(node->heap)->type);
next_heap:
node = UT_LIST_GET_NEXT(all_list, node);
}
fprintf(outfile, "\n");
fprintf(outfile, "Current allocated memory : %lu\n",
mem_current_allocated_memory);
fprintf(outfile, "Current allocated heaps and buffers : %lu\n",
n_heaps);
fprintf(outfile, "Cumulative allocated memory : %lu\n",
mem_total_allocated_memory);
fprintf(outfile, "Maximum allocated memory : %lu\n",
mem_max_allocated_memory);
fprintf(outfile, "Cumulative created heaps and buffers : %lu\n",
mem_n_created_heaps);
fprintf(outfile, "Cumulative number of allocations : %lu\n",
mem_n_allocations);
mem_last_print_info = mem_n_created_heaps;
mutex_exit(&mem_hash_mutex);
mem_pool_print_info(outfile, mem_comm_pool);
/* mem_validate(); */
/* fclose(outfile); */
#endif
}
/*********************************************************************
Prints information of dynamic memory usage and currently allocated memory
heaps or buffers. Can only be used in the debug version. */
void
mem_print_info(void)
/*================*/
{
mem_print_info_low(TRUE);
}
/*********************************************************************
Prints information of dynamic memory usage and currently allocated memory
heaps or buffers since the last ..._print_info or..._print_new_info. */
void
mem_print_new_info(void)
/*====================*/
{
mem_print_info_low(FALSE);
}
/********************************************************************* /*********************************************************************
TRUE if no memory is currently allocated. */ TRUE if no memory is currently allocated. */
...@@ -735,8 +612,6 @@ mem_all_freed(void) ...@@ -735,8 +612,6 @@ mem_all_freed(void)
/*===============*/ /*===============*/
/* out: TRUE if no heaps exist */ /* out: TRUE if no heaps exist */
{ {
#ifdef UNIV_MEM_DEBUG
mem_hash_node_t* node; mem_hash_node_t* node;
ulint heap_count = 0; ulint heap_count = 0;
ulint i; ulint i;
...@@ -764,15 +639,6 @@ mem_all_freed(void) ...@@ -764,15 +639,6 @@ mem_all_freed(void)
} else { } else {
return(FALSE); return(FALSE);
} }
#else
printf(
"Sorry, non-debug version cannot check if all memory is freed.\n");
return(FALSE);
#endif
} }
/********************************************************************* /*********************************************************************
...@@ -783,8 +649,6 @@ mem_validate_no_assert(void) ...@@ -783,8 +649,6 @@ mem_validate_no_assert(void)
/*========================*/ /*========================*/
/* out: TRUE if error */ /* out: TRUE if error */
{ {
#ifdef UNIV_MEM_DEBUG
mem_hash_node_t* node; mem_hash_node_t* node;
ulint n_heaps = 0; ulint n_heaps = 0;
ulint allocated_mem; ulint allocated_mem;
...@@ -843,14 +707,6 @@ mem_validate_no_assert(void) ...@@ -843,14 +707,6 @@ mem_validate_no_assert(void)
mutex_exit(&mem_hash_mutex); mutex_exit(&mem_hash_mutex);
return(error); return(error);
#else
printf("Sorry, non-debug version cannot validate dynamic memory\n");
return(FALSE);
#endif
} }
/**************************************************************** /****************************************************************
...@@ -865,6 +721,7 @@ mem_validate(void) ...@@ -865,6 +721,7 @@ mem_validate(void)
return(TRUE); return(TRUE);
} }
#endif /* UNIV_MEM_DEBUG */
/**************************************************************** /****************************************************************
Tries to find neigboring memory allocation blocks and dumps to stderr Tries to find neigboring memory allocation blocks and dumps to stderr
......
...@@ -171,7 +171,7 @@ mtr_log_parse_full_page( ...@@ -171,7 +171,7 @@ mtr_log_parse_full_page(
/**************************************************************** /****************************************************************
Writes to the database log the full contents of the pages that this mtr has Writes to the database log the full contents of the pages that this mtr has
modified. */ modified. */
static
void void
mtr_log_write_backup_full_pages( mtr_log_write_backup_full_pages(
/*============================*/ /*============================*/
......
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
# & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
noinst_LIBRARIES = libodbc.a
libodbc_a_SOURCES = odbc0odbc.c
EXTRA_PROGRAMS =
include ..\include\makefile.i
innobase.lib: odbc0odbc.obj
lib -out:..\libs\innobase.lib odbc0odbc.obj ..\libs\btr.lib ..\libs\eval.lib ..\libs\ibuf.lib ..\libs\trx.lib ..\libs\pars.lib ..\libs\que.lib ..\libs\lock.lib ..\libs\row.lib ..\libs\read.lib ..\libs\srv.lib ..\libs\com.lib ..\libs\usr.lib ..\libs\thr.lib ..\libs\fut.lib ..\libs\fsp.lib ..\libs\page.lib ..\libs\dyn.lib ..\libs\mtr.lib ..\libs\log.lib ..\libs\rem.lib ..\libs\fil.lib ..\libs\buf.lib ..\libs\dict.lib ..\libs\data.lib ..\libs\mach.lib ..\libs\ha.lib ..\libs\ut.lib ..\libs\sync.lib ..\libs\mem.lib ..\libs\os.lib
odbc0odbc.obj: odbc0odbc.c
$(CCOM) $(CFL) -c odbc0odbc.c
/* Used to screen off linker 'undefined symbol' errors
when making an ODBC client library */
unsigned long srv_test_cache_evict;
void buf_frame_alloc(void)
{}
void buf_frame_free(void)
{}
void trx_create(void)
{}
void* kernel_mutex_temp;
void trx_sig_send(void)
{}
void rec_sprintf(void)
{}
void dtuple_sprintf(void)
{}
void pars_write_query_param_info (void)
{}
void que_graph_try_free (void)
{}
void pars_sql (void)
{}
void que_run_threads (void)
{}
void que_fork_start_command(void)
{}
void dict_procedure_add_to_cache(void)
{}
void dict_mem_procedure_create(void)
{}
void pars_proc_read_input_params_from_buf(void)
{}
void dict_procedure_reserve_parsed_copy(void)
{}
void* srv_sys;
void* srv_print_latch_waits;
void* srv_spin_wait_delay;
void* srv_n_spin_wait_rounds;
void* buf_debug_prints;
/******************************************************
Innobase ODBC client library
(c) 1998 Innobase Oy
Created 2/22/1998 Heikki Tuuri
*******************************************************/
#include "odbc0odbc.h"
#include "mem0mem.h"
#include "com0com.h"
#include "usr0sess.h"
#define ODBC_STAT_INITIAL 1
#define ODBC_STAT_PREPARED 2
#define ODBC_STAT_EXECUTED 3
typedef struct odbc_conn_struct odbc_conn_t;
typedef struct odbc_env_struct odbc_env_t;
/* ODBC parameter description struct */
typedef struct odbc_param_struct odbc_param_t;
struct odbc_param_struct{
ulint data_type; /* SQL_CHAR, ... */
ibool is_input; /* TRUE if an input parameter of a stored
procedure, FALSE if an output parameter */
byte* buf; /* buffer where the value is stored before
SQLExecute, or where it comes after SQLExecute
in the case of an output parameter */
lint* data_len; /* pointer to where the data len or the value
SQL_NULL_DATA is stored */
ulint buf_len; /* buffer size */
};
/* ODBC statement data structure */
typedef struct odbc_stat_struct odbc_stat_t;
struct odbc_stat_struct{
ulint state; /* ODBC_STAT_INITIAL,
ODBC_STAT_PREPARED,
ODBC_STAT_EXECUTED */
ulint id; /* statement id */
ulint n_params; /* number of parameters */
odbc_param_t* params; /* pointer to an array describing
the parameters, if any */
ulint n_params_bound; /* number of parameters that have
been bound: the statement cannot be
executed before n_params_bound
== n_params */
byte* error_msg; /* possible error message, or NULL;
allocated separately from dynamic
memory */
ulint error_msg_len; /* error mesage length if it is
non-NULL */
odbc_conn_t* conn; /* connection */
UT_LIST_NODE_T(odbc_stat_t)
stat_list; /* list of the statements of the
connection */
};
/* ODBC connection data structure */
struct odbc_conn_struct{
ibool connected; /* TRUE if connected */
char* server_name; /* server name where connected
(= server address) */
ulint server_name_len;/* length of the server name */
com_endpoint_t* com_endpoint; /* connection endpoint for this client
connection */
dulint out_msg_count; /* count of outgoing messages */
byte* out_datagram_buf;/* buffer for outgoing datagrams to
the server */
byte* in_datagram_buf;/* buffer for incoming datagrams from
the server */
byte* addr_buf; /* buffer for the address from which
an incoming datagram came; in practice,
this will be the server address */
dulint sess_id; /* user session id, once the
connection to the server is
established */
odbc_env_t* env; /* environment */
UT_LIST_BASE_NODE_T(odbc_stat_t)
stat_list; /* list of the statements of the
connection */
UT_LIST_NODE_T(odbc_conn_t)
conn_list; /* list of the connections of the
environment */
};
/* ODBC environment data structure */
struct odbc_env_struct{
UT_LIST_BASE_NODE_T(odbc_conn_t) conn_list;
/* list of the connections of the
environment */
};
/**************************************************************************
Gets the nth parameter description struct for a statement. */
UNIV_INLINE
odbc_param_t*
stat_get_nth_param(
/*===============*/
/* out: nth parameter */
odbc_stat_t* stat, /* in: pointer to statement handle */
ulint i) /* in: parameter index */
{
ut_ad(stat->n_params > i);
return(stat->params + i);
}
/**************************************************************************
Allocates an SQL environment. */
RETCODE
SQLAllocEnv(
/*========*/
/* out: SQL_SUCCESS */
HENV* phenv) /* out: pointer to an environment handle */
{
odbc_env_t* env;
if (!sync_initialized) {
sync_init();
mem_init(2000000);
}
env = mem_alloc(sizeof(odbc_env_t));
UT_LIST_INIT(env->conn_list);
*phenv = env;
return(SQL_SUCCESS);
}
/**************************************************************************
Allocates an SQL connection. */
RETCODE
SQLAllocConnect(
/*============*/
/* out: SQL_SUCCESS */
HENV henv, /* in: pointer to an environment handle */
HDBC* phdbc) /* out: pointer to a connection handle */
{
odbc_conn_t* conn;
odbc_env_t* env;
ut_a(henv);
env = henv;
conn = mem_alloc(sizeof(odbc_conn_t));
conn->connected = FALSE;
conn->env = env;
UT_LIST_INIT(conn->stat_list);
UT_LIST_ADD_LAST(conn_list, env->conn_list, conn);
*phdbc = conn;
return(SQL_SUCCESS);
}
/**************************************************************************
Allocates an SQL statement. */
RETCODE
SQLAllocStmt(
/*=========*/
HDBC hdbc, /* in: SQL connection */
HSTMT* phstmt) /* out: pointer to a statement handle */
{
odbc_conn_t* conn;
odbc_stat_t* stat;
ut_a(hdbc);
conn = hdbc;
stat = mem_alloc(sizeof(odbc_stat_t));
stat->state = ODBC_STAT_INITIAL;
stat->error_msg = NULL;
stat->conn = conn;
UT_LIST_ADD_LAST(stat_list, conn->stat_list, stat);
*phstmt = stat;
return(SQL_SUCCESS);
}
/**************************************************************************
Sends the message in datagram_buf to the server. */
static
void
odbc_send_cli_msg(
/*==============*/
odbc_conn_t* conn, /* in: connection, does not have to be
connected yet */
ulint len) /* in: message length (excluding the standard
header of size SESS_CLI_MSG_DATA) */
{
ulint ret;
ulint fold;
byte* msg;
ut_a(len + SESS_CLI_MSG_DATA <= ODBC_DATAGRAM_SIZE);
msg = conn->out_datagram_buf;
mach_write_to_8(msg + SESS_CLI_MSG_NO, conn->out_msg_count);
UT_DULINT_INC(conn->out_msg_count);
fold = ut_fold_binary(msg + 4, len + SESS_CLI_MSG_DATA - 4);
ut_ad(SESS_CLI_MSG_CHECKSUM == 0);
mach_write_to_4(msg + SESS_CLI_MSG_CHECKSUM, fold);
ret = com_sendto(conn->com_endpoint, msg, SESS_CLI_MSG_DATA + len,
conn->server_name, conn->server_name_len);
ut_a(ret == 0);
}
/**************************************************************************
Receives a message in datagram_buf from the server. */
static
void
odbc_recv_srv_msg(
/*==============*/
odbc_conn_t* conn, /* in: connection, does not have to be
connected yet */
ulint* len) /* out: received message length (excluding the
standard header of size SESS_SRV_MSG_DATA) */
{
ulint total_len;
ulint addr_len;
ulint ret;
ret = com_recvfrom(conn->com_endpoint, conn->in_datagram_buf,
ODBC_DATAGRAM_SIZE, &total_len, (char*)conn->addr_buf,
ODBC_ADDRESS_SIZE, &addr_len);
ut_a(ret == 0);
ut_a(total_len >= SESS_SRV_MSG_DATA);
*len = total_len - SESS_SRV_MSG_DATA;
}
/**************************************************************************
Connects to a database server process (establishes a connection and a
session). */
RETCODE
SQLConnect(
/*=======*/
/* out: SQL_SUCCESS */
HDBC hdbc, /* in: SQL connection handle */
UCHAR* szDSN, /* in: data source name (server name) */
SWORD cbDSN, /* in: data source name length */
UCHAR* szUID, /* in: user name */
SWORD cbUID, /* in: user name length */
UCHAR* szAuthStr, /* in: password */
SWORD cbAuthStr) /* in: password length */
{
com_endpoint_t* ep;
odbc_conn_t* conn;
ulint err;
ulint size;
byte* msg;
ulint len;
UCHAR catenated_name[100];
ut_a(hdbc && szDSN);
UT_NOT_USED(szUID);
UT_NOT_USED(cbUID);
UT_NOT_USED(szAuthStr);
UT_NOT_USED(cbAuthStr);
conn = hdbc;
ut_a(!conn->connected);
conn->server_name = mem_alloc(cbDSN);
ut_memcpy(conn->server_name, szDSN, cbDSN);
conn->server_name_len = cbDSN;
ep = com_endpoint_create(COM_SHM);
ut_a(ep);
conn->com_endpoint = ep;
conn->out_msg_count = ut_dulint_zero;
size = ODBC_DATAGRAM_SIZE;
err = com_endpoint_set_option(ep, COM_OPT_MAX_DGRAM_SIZE,
(byte*)&size, 4);
ut_a(err == 0);
/* Make the data source name catenated to user name as the
address of the communications endpoint */
ut_a((ulint)cbDSN + (ulint)cbUID < 100);
ut_memcpy(catenated_name, szDSN, (ulint)cbDSN);
ut_memcpy(catenated_name + (ulint)cbDSN, szUID, (ulint)cbUID);
err = com_bind(ep, (char*)catenated_name, (ulint)cbDSN
+ (ulint)cbUID);
ut_a(err == 0);
conn->in_datagram_buf = mem_alloc(ODBC_DATAGRAM_SIZE);
msg = mem_alloc(ODBC_DATAGRAM_SIZE);
conn->out_datagram_buf = msg;
conn->addr_buf = mem_alloc(ODBC_ADDRESS_SIZE);
/* Set the session id to dulint 0 as we are not yet connected */
sess_cli_msg_set_sess(msg, ut_dulint_zero);
sess_cli_msg_set_type(msg, SESS_CLI_CONNECT);
/*------------------------------------------*/
odbc_send_cli_msg(conn, 0);
odbc_recv_srv_msg(conn, &len);
/*------------------------------------------*/
ut_a(len == 0);
ut_a(sess_srv_msg_get_type(conn->in_datagram_buf)
== SESS_SRV_ACCEPT_CONNECT);
conn->sess_id = mach_read_from_8(conn->in_datagram_buf
+ SESS_SRV_MSG_SESS_ID);
/* Write the session id to out_datagram_buf: it will not be rewritten
until the connection is closed, as the session id will stay the same */
sess_cli_msg_set_sess(msg, conn->sess_id);
/* We currently only send single part messages: the following will
stay 0 during the connection */
mach_write_to_4(msg + SESS_CLI_MSG_CONTINUE, 0);
mach_write_to_4(msg + SESS_CLI_MSG_CONT_SIZE, 0);
conn->connected = TRUE;
return(SQL_SUCCESS);
}
/**************************************************************************
Stores an error message to a statement handle, so that it can be later
queried with SQLError. */
static
void
odbc_stat_store_error_msg(
/*======================*/
odbc_stat_t* stat, /* in: statement handle */
byte* msg, /* in: error message sent by the server */
ulint len) /* in: length of msg */
{
if (stat->error_msg) {
mem_free(stat->error_msg);
}
stat->error_msg_len = len;
len += SESS_SRV_MSG_DATA;
stat->error_msg = mem_alloc(len);
ut_memcpy(stat->error_msg, msg, len);
}
/**************************************************************************
Queries an error message. */
RETCODE
SQLError(
/*=====*/
/* out: SQL_SUCCESS or SQL_NO_DATA_FOUND */
HENV henv, /* in: SQL_NULL_HENV */
HDBC hdbc, /* in: SQL_NULL_HDBC */
HSTMT hstmt, /* in: statement handle */
UCHAR* szSqlState, /* in/out: SQLSTATE as a null-terminated string,
(currently, always == "S1000") */
SDWORD* pfNativeError, /* out: native error code */
UCHAR* szErrorMsg, /* in/out: buffer for an error message as a
null-terminated string */
SWORD cbErrorMsgMax, /* in: buffer size for szErrorMsg */
SWORD* pcbErrorMsg) /* out: error message length */
{
odbc_stat_t* stat;
ulint len;
ut_a(henv == SQL_NULL_HENV);
ut_a(hdbc == SQL_NULL_HDBC);
ut_a(hstmt);
ut_a(cbErrorMsgMax > 1);
stat = hstmt;
if (stat->error_msg == NULL) {
return(SQL_NO_DATA_FOUND);
}
*pfNativeError = 0;
ut_memcpy(szSqlState, (char *) "S1000", 6);
len = (ulint)cbErrorMsgMax - 1;
if (stat->error_msg_len < len) {
len = stat->error_msg_len;
}
ut_memcpy(szErrorMsg, stat->error_msg + SESS_SRV_MSG_DATA, len);
*(szErrorMsg + len) = '\0';
*pcbErrorMsg = (SWORD)len;
if (stat->error_msg) {
mem_free(stat->error_msg);
stat->error_msg = NULL;
}
return(SQL_SUCCESS);
}
/**************************************************************************
Makes the server to parse and optimize an SQL string. */
RETCODE
SQLPrepare(
/*=======*/
/* out: SQL_SUCCESS or SQL_ERROR */
HSTMT hstmt, /* in: statement handle */
UCHAR* szSqlStr, /* in: SQL string */
SDWORD cbSqlStr) /* in: SQL string length */
{
odbc_stat_t* stat;
odbc_conn_t* conn;
odbc_param_t* param;
ulint len;
byte* msg;
ulint i;
stat = hstmt;
conn = stat->conn;
if (stat->error_msg) {
mem_free(stat->error_msg);
stat->error_msg = NULL;
}
ut_memcpy(conn->out_datagram_buf + SESS_CLI_MSG_DATA, szSqlStr,
1 + (ulint)cbSqlStr);
sess_cli_msg_set_type(conn->out_datagram_buf, SESS_CLI_PREPARE);
/* The client message will be decoded in sess_receive_prepare */
/*------------------------------------------*/
odbc_send_cli_msg(conn, 1 + (ulint)cbSqlStr);
odbc_recv_srv_msg(conn, &len);
/*------------------------------------------*/
/* The server message was coded in sess_receive_prepare */
ut_a(len >= 8);
msg = conn->in_datagram_buf;
if (sess_srv_msg_get_type(msg) != SESS_SRV_SUCCESS) {
ut_a(sess_srv_msg_get_type(msg) == SESS_SRV_ERROR);
odbc_stat_store_error_msg(stat, msg, len);
return(SQL_ERROR);
}
stat->id = mach_read_from_4(msg + SESS_SRV_MSG_DATA);
stat->n_params = mach_read_from_4(msg + SESS_SRV_MSG_DATA + 4);
stat->n_params_bound = 0;
ut_a(len == 8 + stat->n_params);
if (stat->n_params > 0) {
stat->params = mem_alloc(stat->n_params
* sizeof(odbc_param_t));
for (i = 0; i < stat->n_params; i++) {
param = stat_get_nth_param(stat, i);
param->is_input = mach_read_from_1(
msg + SESS_SRV_MSG_DATA + 8 + i);
/* Set buf to NULL so that we know when the parameter
has been bound */
param->buf = NULL;
}
}
stat->state = ODBC_STAT_PREPARED;
return(SQL_SUCCESS);
}
/**************************************************************************
Binds a parameter in a prepared statement. */
RETCODE
SQLBindParameter(
/*=============*/
/* out: SQL_SUCCESS */
HSTMT hstmt, /* in: statement handle */
UWORD ipar, /* in: parameter index, starting from 1 */
SWORD fParamType, /* in: SQL_PARAM_INPUT or SQL_PARAM_OUTPUT */
SWORD fCType, /* in: SQL_C_CHAR, ... */
SWORD fSqlType, /* in: SQL_CHAR, ... */
UDWORD cbColDef, /* in: precision: ignored */
SWORD ibScale, /* in: scale: ignored */
PTR rgbValue, /* in: pointer to a buffer for the data */
SDWORD cbValueMax, /* in: buffer size */
SDWORD* pcbValue) /* in: pointer to a buffer for the data
length or SQL_NULL_DATA */
{
odbc_stat_t* stat;
odbc_param_t* param;
stat = hstmt;
ut_a(stat->state != ODBC_STAT_INITIAL);
ut_a(rgbValue);
ut_a(ipar <= stat->n_params);
ut_a(ipar > 0);
ut_a(cbValueMax >= 0);
ut_a(pcbValue);
UT_NOT_USED(ibScale);
UT_NOT_USED(fCType);
UT_NOT_USED(cbColDef);
if (stat->error_msg) {
mem_free(stat->error_msg);
stat->error_msg = NULL;
}
param = stat_get_nth_param(stat, ipar - 1);
if (param->buf == NULL) {
stat->n_params_bound++;
}
param->data_type = fSqlType;
ut_a((fParamType != SQL_PARAM_INPUT) || param->is_input);
ut_a((fParamType == SQL_PARAM_INPUT) || !param->is_input);
param->buf = rgbValue;
param->buf_len = cbValueMax;
param->data_len = pcbValue;
return(SQL_SUCCESS);
}
/**************************************************************************
Executes a prepared statement where all parameters have been bound. */
RETCODE
SQLExecute(
/*=======*/
/* out: SQL_SUCCESS or SQL_ERROR */
HSTMT hstmt) /* in: statement handle */
{
odbc_stat_t* stat;
odbc_conn_t* conn;
odbc_param_t* param;
lint len;
ulint msg_len;
byte* msg;
byte* ptr;
lint int_val;
ulint i;
stat = hstmt;
ut_a(stat->state != ODBC_STAT_INITIAL);
ut_a(stat->n_params == stat->n_params_bound);
if (stat->error_msg) {
mem_free(stat->error_msg);
stat->error_msg = NULL;
}
conn = stat->conn;
msg = conn->out_datagram_buf;
sess_cli_msg_set_type(msg, SESS_CLI_EXECUTE);
ptr = msg + SESS_CLI_MSG_DATA;
mach_write_to_4(ptr, stat->id);
ptr += 4;
for (i = 0; i < stat->n_params; i++) {
param = stat_get_nth_param(stat, i);
if (param->is_input) {
/* Copy its length and data to the message buffer */
len = *(param->data_len);
mach_write_to_4(ptr, (ulint)len);
ptr += 4;
if (len != SQL_NULL_DATA) {
if (param->data_type == SQL_INTEGER) {
ut_ad(len == 4);
int_val = *((lint*)(param->buf));
mach_write_to_4(ptr, (ulint)int_val);
} else {
ut_memcpy(ptr, param->buf, len);
}
ptr += len;
}
}
}
/* The client message will be decoded in sess_receive_command */
/*------------------------------------------*/
odbc_send_cli_msg(conn, ptr - (msg + SESS_CLI_MSG_DATA));
odbc_recv_srv_msg(conn, &msg_len);
/*------------------------------------------*/
/* The server message was coded in sess_command_completed_message */
msg = conn->in_datagram_buf;
if (sess_srv_msg_get_type(msg) != SESS_SRV_SUCCESS) {
ut_a(sess_srv_msg_get_type(msg) == SESS_SRV_ERROR);
odbc_stat_store_error_msg(stat, msg, msg_len);
return(SQL_ERROR);
}
ptr = msg + SESS_SRV_MSG_DATA;
for (i = 0; i < stat->n_params; i++) {
param = stat_get_nth_param(stat, i);
if (!param->is_input) {
/* Copy its length and data from the message buffer */
len = (lint)mach_read_from_4(ptr);
ptr += 4;
*(param->data_len) = len;
if (len != SQL_NULL_DATA) {
if (param->data_type == SQL_INTEGER) {
ut_ad(len == 4);
int_val = (lint)mach_read_from_4(ptr);
*((lint*)(param->buf)) = int_val;
} else {
ut_memcpy(param->buf, ptr, (ulint)len);
}
ptr += len;
}
}
}
ut_ad(msg + SESS_SRV_MSG_DATA + msg_len == ptr);
return(SQL_SUCCESS);
}
...@@ -515,83 +515,6 @@ os_mem_alloc_nocache( ...@@ -515,83 +515,6 @@ os_mem_alloc_nocache(
#endif #endif
} }
#ifdef notdefined
/********************************************************************
Creates a new process. */
ibool
os_process_create(
/*==============*/
char* name, /* in: name of the executable to start
or its full path name */
char* cmd, /* in: command line for the starting
process, or NULL if no command line
specified */
os_process_t* proc, /* out: handle to the process */
os_process_id_t* id) /* out: process id */
{
BOOL ret;
PROCESS_INFORMATION pinfo;
STARTUPINFO sinfo;
/* The following assignments are default for the startupinfo
structure */
sinfo.cb = sizeof(STARTUPINFO);
sinfo.lpReserved = NULL;
sinfo.lpDesktop = NULL;
sinfo.cbReserved2 = 0;
sinfo.lpReserved = NULL;
ret = CreateProcess(name,
cmd,
NULL, /* No security attributes */
NULL, /* No thread security attrs */
FALSE, /* Do not inherit handles */
0, /* No creation flags */
NULL, /* No environment */
NULL, /* Same current directory */
&sinfo,
&pinfo);
*proc = pinfo.hProcess;
*id = pinfo.dwProcessId;
return(ret);
}
/**************************************************************************
Exits a process. */
void
os_process_exit(
/*============*/
ulint code) /* in: exit code */
{
ExitProcess((UINT)code);
}
/**************************************************************************
Gets a process exit code. */
ibool
os_process_get_exit_code(
/*=====================*/
/* out: TRUE if succeed, FALSE if fail */
os_process_t proc, /* in: handle to the process */
ulint* code) /* out: exit code */
{
DWORD ex_code;
BOOL ret;
ret = GetExitCodeProcess(proc, &ex_code);
*code = (ulint)ex_code;
return(ret);
}
#endif /* notdedfined */
/******************************************************************** /********************************************************************
Sets the priority boost for threads released from waiting within the current Sets the priority boost for threads released from waiting within the current
process. */ process. */
......
/* Stores the old console mode when echo is turned off */
ulint os_old_console_mode;
/********************************************************************
Turns off echo from console input. */
void
os_console_echo_off(void)
/*=====================*/
{
GetConsoleMode(stdio, &os_old_console_mode);
SetConsoleMode(stdio, ENABLE_PROCESSED_INPUT);
}
/********************************************************************
Turns on echo in console input. */
void
os_console_echo_on(void)
/*====================*/
{
SetConsoleMode(stdio, &os_old_console_mode);
}
/********************************************************************
Reads a character from the console. */
char
os_read_console(void)
/*=================*/
{
char input_char;
ulint n_chars;
n_chars = 0;
while (n_chars == 0) {
ReadConsole(stdio, &input_char, 1, &n_chars, NULL);
}
return(input_char);
}
...@@ -19,9 +19,6 @@ Created 2/2/1994 Heikki Tuuri ...@@ -19,9 +19,6 @@ Created 2/2/1994 Heikki Tuuri
#include "btr0sea.h" #include "btr0sea.h"
#include "buf0buf.h" #include "buf0buf.h"
/* A cached template page used in page_create */
page_t* page_template = NULL;
/* THE INDEX PAGE /* THE INDEX PAGE
============== ==============
...@@ -321,20 +318,6 @@ page_create( ...@@ -321,20 +318,6 @@ page_create(
fil_page_set_type(page, FIL_PAGE_INDEX); fil_page_set_type(page, FIL_PAGE_INDEX);
/* If we have a page template, copy the page structure from there */
if (page_template) {
ut_memcpy(page + PAGE_HEADER,
page_template + PAGE_HEADER, PAGE_HEADER_PRIV_END);
ut_memcpy(page + PAGE_DATA,
page_template + PAGE_DATA,
PAGE_SUPREMUM_END - PAGE_DATA);
ut_memcpy(page + UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START,
page_template + UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START,
PAGE_EMPTY_DIR_START - PAGE_DIR);
return(frame);
}
heap = mem_heap_create(200); heap = mem_heap_create(200);
/* 3. CREATE THE INFIMUM AND SUPREMUM RECORDS */ /* 3. CREATE THE INFIMUM AND SUPREMUM RECORDS */
...@@ -409,17 +392,6 @@ page_create( ...@@ -409,17 +392,6 @@ page_create(
rec_set_next_offs(infimum_rec, (ulint)(supremum_rec - page)); rec_set_next_offs(infimum_rec, (ulint)(supremum_rec - page));
rec_set_next_offs(supremum_rec, 0); rec_set_next_offs(supremum_rec, 0);
#ifdef notdefined
/* Disable the use of page_template: there is a race condition here:
while one thread is creating page_template, another one can start
using it before the memcpy completes! */
if (page_template == NULL) {
page_template = mem_alloc(UNIV_PAGE_SIZE);
ut_memcpy(page_template, page, UNIV_PAGE_SIZE);
}
#endif
return(page); return(page);
} }
......
...@@ -73,37 +73,6 @@ void ...@@ -73,37 +73,6 @@ void
que_thr_move_to_run_state( que_thr_move_to_run_state(
/*======================*/ /*======================*/
que_thr_t* thr); /* in: an query thread */ que_thr_t* thr); /* in: an query thread */
/**************************************************************************
Tries to parallelize query if it is not parallel enough yet. */
static
que_thr_t*
que_try_parallelize(
/*================*/
/* out: next thread to execute */
que_thr_t* thr); /* in: query thread */
#ifdef notdefined
/********************************************************************
Adds info about the number of inserted rows etc. to the message to the
client. */
static
void
que_thr_add_update_info(
/*====================*/
que_thr_t* thr) /* in: query thread */
{
que_fork_t* graph;
graph = thr->graph;
mach_write_to_8(thr->msg_buf + SESS_SRV_MSG_N_INSERTS,
graph->n_inserts);
mach_write_to_8(thr->msg_buf + SESS_SRV_MSG_N_UPDATES,
graph->n_updates);
mach_write_to_8(thr->msg_buf + SESS_SRV_MSG_N_DELETES,
graph->n_deletes);
}
#endif
/*************************************************************************** /***************************************************************************
Adds a query graph to the session's list of graphs. */ Adds a query graph to the session's list of graphs. */
...@@ -711,22 +680,6 @@ que_thr_handle_error( ...@@ -711,22 +680,6 @@ que_thr_handle_error(
/* Does nothing */ /* Does nothing */
} }
/**************************************************************************
Tries to parallelize query if it is not parallel enough yet. */
static
que_thr_t*
que_try_parallelize(
/*================*/
/* out: next thread to execute */
que_thr_t* thr) /* in: query thread */
{
ut_ad(thr);
/* Does nothing yet */
return(thr);
}
/******************************************************************** /********************************************************************
Builds a command completed-message to the client. */ Builds a command completed-message to the client. */
static static
...@@ -1331,85 +1284,6 @@ que_thr_step( ...@@ -1331,85 +1284,6 @@ que_thr_step(
return(thr); return(thr);
} }
/***********************************************************************
Checks if there is a need for a query thread switch or stopping the current
thread. */
que_thr_t*
que_thr_check_if_switch(
/*====================*/
que_thr_t* thr, /* in: current query thread */
ulint* cumul_resource) /* in: amount of resources used
by the current call of que_run_threads
(resources used by the OS thread!) */
{
que_thr_t* next_thr;
ibool stopped;
if (que_thr_peek_stop(thr)) {
mutex_enter(&kernel_mutex);
stopped = que_thr_stop(thr);
mutex_exit(&kernel_mutex);
if (stopped) {
/* If a signal is processed, we may get a new query
thread next_thr to run */
next_thr = NULL;
que_thr_dec_refer_count(thr, &next_thr);
if (next_thr == NULL) {
return(NULL);
}
thr = next_thr;
}
}
if (thr->resource > QUE_PARALLELIZE_LIMIT) {
/* Try parallelization of the query thread */
thr = que_try_parallelize(thr);
thr->resource = 0;
}
(*cumul_resource)++;
if (*cumul_resource > QUE_ROUND_ROBIN_LIMIT) {
/* It is time to round-robin query threads in the
server task queue */
if (srv_get_thread_type() == SRV_COM) {
/* This OS thread is a SRV_COM thread: we put
the query thread to the task queue and return
to allow the OS thread to receive more
messages from clients */
ut_ad(thr->is_active);
srv_que_task_enqueue(thr);
return(NULL);
} else {
/* Change the query thread if there is another
in the server task queue */
thr = srv_que_round_robin(thr);
}
*cumul_resource = 0;
}
return(thr);
}
/************************************************************************** /**************************************************************************
Runs query threads. Note that the individual query thread which is run Runs query threads. Note that the individual query thread which is run
within this function may change if, e.g., the OS thread executing this within this function may change if, e.g., the OS thread executing this
...@@ -1433,27 +1307,6 @@ que_run_threads( ...@@ -1433,27 +1307,6 @@ que_run_threads(
loop_count = QUE_MAX_LOOPS_WITHOUT_CHECK; loop_count = QUE_MAX_LOOPS_WITHOUT_CHECK;
cumul_resource = 0; cumul_resource = 0;
loop: loop:
if (loop_count >= QUE_MAX_LOOPS_WITHOUT_CHECK) {
/* In MySQL this thread switch is never needed!
loop_count = 0;
next_thr = que_thr_check_if_switch(thr, &cumul_resource);
if (next_thr != thr) {
if (next_thr == NULL) {
return;
}
loop_count = QUE_MAX_LOOPS_WITHOUT_CHECK;
}
thr = next_thr;
*/
}
/* Check that there is enough space in the log to accommodate /* Check that there is enough space in the log to accommodate
possible log entries by this query step; if the operation can touch possible log entries by this query step; if the operation can touch
more than about 4 pages, checks must be made also within the query more than about 4 pages, checks must be made also within the query
......
...@@ -58,7 +58,7 @@ cmp_debug_dtuple_rec_with_match( ...@@ -58,7 +58,7 @@ cmp_debug_dtuple_rec_with_match(
This function is used to compare two data fields for which the data type This function is used to compare two data fields for which the data type
is such that we must use MySQL code to compare them. The prototype here is such that we must use MySQL code to compare them. The prototype here
must be a copy of the the one in ha_innobase.cc! */ must be a copy of the the one in ha_innobase.cc! */
extern
int int
innobase_mysql_cmp( innobase_mysql_cmp(
/*===============*/ /*===============*/
......
...@@ -38,7 +38,7 @@ This prototype is copied from /mysql/sql/ha_innodb.cc. ...@@ -38,7 +38,7 @@ This prototype is copied from /mysql/sql/ha_innodb.cc.
Invalidates the MySQL query cache for the table. Invalidates the MySQL query cache for the table.
NOTE that the exact prototype of this function has to be in NOTE that the exact prototype of this function has to be in
/innobase/row/row0ins.c! */ /innobase/row/row0ins.c! */
extern
void void
innobase_invalidate_query_cache( innobase_invalidate_query_cache(
/*============================*/ /*============================*/
...@@ -1349,58 +1349,6 @@ row_ins_check_foreign_constraints( ...@@ -1349,58 +1349,6 @@ row_ins_check_foreign_constraints(
return(DB_SUCCESS); return(DB_SUCCESS);
} }
/*************************************************************************
Reports a UNIQUE key error to dict_unique_err_buf so that SHOW INNODB
STATUS can print it. */
static
void
row_ins_unique_report_err(
/*======================*/
que_thr_t* thr, /* in: query thread */
rec_t* rec, /* in: a record in the index */
dtuple_t* entry, /* in: index entry to insert in the index */
dict_index_t* index) /* in: index */
{
UT_NOT_USED(thr);
UT_NOT_USED(rec);
UT_NOT_USED(entry);
UT_NOT_USED(index);
#ifdef notdefined
/* Disable reporting to test if the slowdown of REPLACE in 4.0.13 was
caused by this! */
char* buf = dict_unique_err_buf;
/* The foreign err mutex protects also dict_unique_err_buf */
mutex_enter(&dict_foreign_err_mutex);
ut_sprintf_timestamp(buf);
sprintf(buf + strlen(buf), " Transaction:\n");
trx_print(buf + strlen(buf), thr_get_trx(thr));
sprintf(buf + strlen(buf),
"Unique key constraint fails for table %.500s.\n", index->table_name);
sprintf(buf + strlen(buf),
"Trying to add in index %.500s (%lu fields unique) tuple:\n", index->name,
dict_index_get_n_unique(index));
dtuple_sprintf(buf + strlen(buf), 1000, entry);
sprintf(buf + strlen(buf),
"\nBut there is already a record:\n");
rec_sprintf(buf + strlen(buf), 1000, rec);
sprintf(buf + strlen(buf), "\n");
ut_a(strlen(buf) < DICT_FOREIGN_ERR_BUF_LEN);
mutex_exit(&dict_foreign_err_mutex);
#endif
}
/******************************************************************* /*******************************************************************
Checks if a unique key violation to rec would occur at the index entry Checks if a unique key violation to rec would occur at the index entry
insert. */ insert. */
...@@ -1531,8 +1479,6 @@ row_ins_scan_sec_index_for_duplicate( ...@@ -1531,8 +1479,6 @@ row_ins_scan_sec_index_for_duplicate(
if (cmp == 0) { if (cmp == 0) {
if (row_ins_dupl_error_with_rec(rec, entry, index)) { if (row_ins_dupl_error_with_rec(rec, entry, index)) {
row_ins_unique_report_err(thr, rec, entry,
index);
err = DB_DUPLICATE_KEY; err = DB_DUPLICATE_KEY;
thr_get_trx(thr)->error_info = index; thr_get_trx(thr)->error_info = index;
...@@ -1627,8 +1573,6 @@ row_ins_duplicate_error_in_clust( ...@@ -1627,8 +1573,6 @@ row_ins_duplicate_error_in_clust(
if (row_ins_dupl_error_with_rec(rec, entry, if (row_ins_dupl_error_with_rec(rec, entry,
cursor->index)) { cursor->index)) {
trx->error_info = cursor->index; trx->error_info = cursor->index;
row_ins_unique_report_err(thr, rec, entry,
cursor->index);
return(DB_DUPLICATE_KEY); return(DB_DUPLICATE_KEY);
} }
} }
...@@ -1651,9 +1595,6 @@ row_ins_duplicate_error_in_clust( ...@@ -1651,9 +1595,6 @@ row_ins_duplicate_error_in_clust(
if (row_ins_dupl_error_with_rec(rec, entry, if (row_ins_dupl_error_with_rec(rec, entry,
cursor->index)) { cursor->index)) {
trx->error_info = cursor->index; trx->error_info = cursor->index;
row_ins_unique_report_err(thr, rec, entry,
cursor->index);
return(DB_DUPLICATE_KEY); return(DB_DUPLICATE_KEY);
} }
} }
......
...@@ -1408,10 +1408,12 @@ row_create_table_for_mysql( ...@@ -1408,10 +1408,12 @@ row_create_table_for_mysql(
"UNIV_MEM_DEBUG defined in univ.i and the server must be\n" "UNIV_MEM_DEBUG defined in univ.i and the server must be\n"
"quiet because allocation from a mem heap is not protected\n" "quiet because allocation from a mem heap is not protected\n"
"by any semaphore.\n"); "by any semaphore.\n");
#ifdef UNIV_MEM_DEBUG
ut_a(mem_validate()); ut_a(mem_validate());
printf("Memory validated\n"); printf("Memory validated\n");
#else /* UNIV_MEM_DEBUG */
puts("Memory NOT validated (recompile with UNIV_MEM_DEBUG)");
#endif /* UNIV_MEM_DEBUG */
} }
heap = mem_heap_create(512); heap = mem_heap_create(512);
......
...@@ -236,61 +236,6 @@ row_build( ...@@ -236,61 +236,6 @@ row_build(
return(row); return(row);
} }
#ifdef notdefined
/***********************************************************************
An inverse function to dict_row_build_index_entry. Builds a row from a
record in a clustered index. */
void
row_build_to_tuple(
/*===============*/
dtuple_t* row, /* in/out: row built; see the NOTE below! */
dict_index_t* index, /* in: clustered index */
rec_t* rec) /* in: record in the clustered index;
NOTE: the data fields in the row will point
directly into this record, therefore,
the buffer page of this record must be
at least s-latched and the latch held
as long as the row dtuple is used!
NOTE 2: does not work with externally
stored fields! */
{
dict_table_t* table;
ulint n_fields;
ulint i;
dfield_t* dfield;
byte* field;
ulint len;
ulint row_len;
dict_col_t* col;
ut_ad(index && rec);
ut_ad(index->type & DICT_CLUSTERED);
table = index->table;
row_len = dict_table_get_n_cols(table);
dtuple_set_info_bits(row, rec_get_info_bits(rec));
n_fields = dict_index_get_n_fields(index);
ut_ad(n_fields == rec_get_n_fields(rec));
dict_table_copy_types(row, table);
for (i = 0; i < n_fields; i++) {
col = dict_field_get_col(dict_index_get_nth_field(index, i));
dfield = dtuple_get_nth_field(row, dict_col_get_no(col));
field = rec_get_nth_field(rec, i, &len);
dfield_set_data(dfield, field, len);
}
ut_ad(dtuple_check_typed(row));
}
#endif
/*********************************************************************** /***********************************************************************
Converts an index record to a typed data tuple. NOTE that externally Converts an index record to a typed data tuple. NOTE that externally
stored (often big) fields are NOT copied to heap. */ stored (often big) fields are NOT copied to heap. */
......
...@@ -741,249 +741,9 @@ srv_get_thread_type(void) ...@@ -741,249 +741,9 @@ srv_get_thread_type(void)
return(type); return(type);
} }
/***********************************************************************
Increments by 1 the count of active threads of the type given
and releases master thread if necessary. */
static
void
srv_inc_thread_count(
/*=================*/
ulint type) /* in: type of the thread */
{
mutex_enter(&kernel_mutex);
srv_activity_count++;
srv_n_threads_active[type]++;
if (srv_n_threads_active[SRV_MASTER] == 0) {
srv_release_threads(SRV_MASTER, 1);
}
mutex_exit(&kernel_mutex);
}
/***********************************************************************
Decrements by 1 the count of active threads of the type given. */
static
void
srv_dec_thread_count(
/*=================*/
ulint type) /* in: type of the thread */
{
mutex_enter(&kernel_mutex);
/* FIXME: the following assertion sometimes fails: */
if (srv_n_threads_active[type] == 0) {
printf("Error: thread type %lu\n", (ulong) type);
ut_ad(0);
}
srv_n_threads_active[type]--;
mutex_exit(&kernel_mutex);
}
/***********************************************************************
Calculates the number of allowed utility threads for a thread to decide if
it has to suspend itself in the thread table. */
static
ulint
srv_max_n_utilities(
/*================*/
/* out: maximum number of allowed utilities
of the type given */
ulint type) /* in: utility type */
{
ulint ret;
if (srv_n_threads_active[SRV_COM] == 0) {
if (srv_meter[type] > srv_meter_low_water[type]) {
return(srv_n_threads[type] / 2);
} else {
return(0);
}
} else {
if (srv_meter[type] < srv_meter_foreground[type]) {
return(0);
}
ret = 1 + ((srv_n_threads[type]
* (ulint)(srv_meter[type] - srv_meter_foreground[type]))
/ (ulint)(1000 - srv_meter_foreground[type]));
if (ret > srv_n_threads[type]) {
return(srv_n_threads[type]);
} else {
return(ret);
}
}
}
/***********************************************************************
Increments the utility meter by the value given and releases utility
threads if necessary. */
void
srv_increment_meter(
/*================*/
ulint type, /* in: utility type */
ulint n) /* in: value to add to meter */
{
ulint m;
mutex_enter(&kernel_mutex);
srv_meter[type] += n;
m = srv_max_n_utilities(type);
if (m > srv_n_threads_active[type]) {
srv_release_threads(type, m - srv_n_threads_active[type]);
}
mutex_exit(&kernel_mutex);
}
/***********************************************************************
Releases max number of utility threads if no queries are active and
the high-water mark for the utility is exceeded. */
void
srv_release_max_if_no_queries(void)
/*===============================*/
{
ulint m;
ulint type;
mutex_enter(&kernel_mutex);
if (srv_n_threads_active[SRV_COM] > 0) {
mutex_exit(&kernel_mutex);
return;
}
type = SRV_RECOVERY;
m = srv_n_threads[type] / 2;
if ((srv_meter[type] > srv_meter_high_water[type])
&& (srv_n_threads_active[type] < m)) {
srv_release_threads(type, m - srv_n_threads_active[type]);
printf("Releasing max background\n");
}
mutex_exit(&kernel_mutex);
}
/*************************************************************************
Creates the first communication endpoint for the server. This
first call also initializes the com0com.* module. */
void
srv_communication_init(
/*===================*/
char* endpoint) /* in: server address */
{
ulint ret;
ulint len;
srv_sys->endpoint = com_endpoint_create(COM_SHM);
ut_a(srv_sys->endpoint);
len = ODBC_DATAGRAM_SIZE;
ret = com_endpoint_set_option(srv_sys->endpoint,
COM_OPT_MAX_DGRAM_SIZE,
(byte*)&len, sizeof(ulint));
ut_a(ret == 0);
ret = com_bind(srv_sys->endpoint, endpoint, ut_strlen(endpoint));
ut_a(ret == 0);
}
/*************************************************************************
Creates the utility threads. */
void
srv_create_utility_threads(void)
/*============================*/
{
/* os_thread_t thread;
os_thread_id_t thr_id; */
ulint i;
mutex_enter(&kernel_mutex);
srv_n_threads[SRV_RECOVERY] = 1;
srv_n_threads_active[SRV_RECOVERY] = 1;
mutex_exit(&kernel_mutex);
for (i = 0; i < 1; i++) {
/* thread = os_thread_create(srv_recovery_thread, NULL, &thr_id); */
/* ut_a(thread); */
}
/* thread = os_thread_create(srv_purge_thread, NULL, &thr_id);
ut_a(thread); */
}
/*************************************************************************
Creates the communication threads. */
void
srv_create_com_threads(void)
/*========================*/
{
/* os_thread_t thread;
os_thread_id_t thr_id; */
ulint i;
srv_n_threads[SRV_COM] = srv_n_com_threads;
for (i = 0; i < srv_n_com_threads; i++) {
/* thread = os_thread_create(srv_com_thread, NULL, &thr_id); */
/* ut_a(thread); */
}
}
/*************************************************************************
Creates the worker threads. */
void
srv_create_worker_threads(void)
/*===========================*/
{
/* os_thread_t thread;
os_thread_id_t thr_id; */
ulint i;
srv_n_threads[SRV_WORKER] = srv_n_worker_threads;
srv_n_threads_active[SRV_WORKER] = srv_n_worker_threads;
for (i = 0; i < srv_n_worker_threads; i++) {
/* thread = os_thread_create(srv_worker_thread, NULL, &thr_id); */
/* ut_a(thread); */
}
}
/************************************************************************* /*************************************************************************
Initializes the server. */ Initializes the server. */
static
void void
srv_init(void) srv_init(void)
/*==========*/ /*==========*/
...@@ -1811,13 +1571,13 @@ srv_sprintf_innodb_monitor( ...@@ -1811,13 +1571,13 @@ srv_sprintf_innodb_monitor(
#ifdef UNIV_LINUX #ifdef UNIV_LINUX
buf += sprintf(buf, buf += sprintf(buf,
"Main thread process no. %lu, id %lu, state: %s\n", "Main thread process no. %lu, id %lu, state: %.29s\n",
(ulong) srv_main_thread_process_no, (ulong) srv_main_thread_process_no,
(ulong) srv_main_thread_id, (ulong) srv_main_thread_id,
srv_main_thread_op_info); srv_main_thread_op_info);
#else #else
buf += sprintf(buf, buf += sprintf(buf,
"Main thread id %lu, state: %s\n", "Main thread id %lu, state: %.29s\n",
(ulong) srv_main_thread_id, (ulong) srv_main_thread_id,
srv_main_thread_op_info); srv_main_thread_op_info);
#endif #endif
...@@ -2090,13 +1850,6 @@ loop: ...@@ -2090,13 +1850,6 @@ loop:
srv_refresh_innodb_monitor_stats(); srv_refresh_innodb_monitor_stats();
} }
/* mem_print_new_info();
if (cnt % 10 == 0) {
mem_print_info();
}
*/
sync_array_print_long_waits(); sync_array_print_long_waits();
/* Flush stdout and stderr so that a database user gets their output /* Flush stdout and stderr so that a database user gets their output
...@@ -2569,12 +2322,6 @@ flush_loop: ...@@ -2569,12 +2322,6 @@ flush_loop:
goto background_loop; goto background_loop;
} }
/* mem_print_new_info();
*/
#ifdef UNIV_SEARCH_PERF_STAT
/* btr_search_print_info(); */
#endif
/* There is no work for background operations either: suspend /* There is no work for background operations either: suspend
master thread to wait for more server activity */ master thread to wait for more server activity */
......
...@@ -903,80 +903,6 @@ skip_size_check: ...@@ -903,80 +903,6 @@ skip_size_check:
return(DB_SUCCESS); return(DB_SUCCESS);
} }
#ifdef notdefined
/*********************************************************************
This thread is used to measure contention of latches. */
static
ulint
test_measure_cont(
/*==============*/
void* arg)
{
ulint i, j;
ulint pcount, kcount, s_scount, s_xcount, s_mcount, lcount;
UT_NOT_USED(arg);
fprintf(stderr, "Starting contention measurement\n");
for (i = 0; i < 1000; i++) {
pcount = 0;
kcount = 0;
s_scount = 0;
s_xcount = 0;
s_mcount = 0;
lcount = 0;
for (j = 0; j < 100; j++) {
if (srv_measure_by_spin) {
ut_delay(ut_rnd_interval(0, 20000));
} else {
os_thread_sleep(20000);
}
if (kernel_mutex.lock_word) {
kcount++;
}
if (buf_pool->mutex.lock_word) {
pcount++;
}
if (log_sys->mutex.lock_word) {
lcount++;
}
if (btr_search_latch.reader_count) {
s_scount++;
}
if (btr_search_latch.writer != RW_LOCK_NOT_LOCKED) {
s_xcount++;
}
if (btr_search_latch.mutex.lock_word) {
s_mcount++;
}
}
fprintf(stderr,
"Mutex res. l %lu, p %lu, k %lu s x %lu s s %lu s mut %lu of %lu\n",
lcount, pcount, kcount, s_xcount, s_scount, s_mcount, j);
/* sync_print_wait_info(); */
fprintf(stderr,
"log i/o %lu n non sea %lu n succ %lu n h fail %lu\n",
log_sys->n_log_ios, btr_cur_n_non_sea,
btr_search_n_succ, btr_search_n_hash_fail);
}
return(0);
}
#endif
/******************************************************************** /********************************************************************
Starts InnoDB and creates a new database if database files Starts InnoDB and creates a new database if database files
are not found and the user wants. Server parameters are are not found and the user wants. Server parameters are
......
...@@ -167,46 +167,6 @@ struct sync_level_struct{ ...@@ -167,46 +167,6 @@ struct sync_level_struct{
ulint level; /* level of the latch in the latching order */ ulint level; /* level of the latch in the latching order */
}; };
#if defined(notdefined) && defined(__GNUC__) && defined(UNIV_INTEL_X86)
ulint
sync_gnuc_intelx86_test_and_set(
/* out: old value of the lock word */
ulint* lw) /* in: pointer to the lock word */
{
ulint res;
/* In assembly we use the so-called AT & T syntax where
the order of operands is inverted compared to the ordinary Intel
syntax. The 'l' after the mnemonics denotes a 32-bit operation.
The line after the code tells which values come out of the asm
code, and the second line tells the input to the asm code. */
asm volatile("movl $1, %%eax; xchgl (%%ecx), %%eax" :
"=eax" (res), "=m" (*lw) :
"ecx" (lw));
return(res);
}
void
sync_gnuc_intelx86_reset(
ulint* lw) /* in: pointer to the lock word */
{
/* In assembly we use the so-called AT & T syntax where
the order of operands is inverted compared to the ordinary Intel
syntax. The 'l' after the mnemonics denotes a 32-bit operation. */
asm volatile("movl $0, %%eax; xchgl (%%ecx), %%eax" :
"=m" (*lw) :
"ecx" (lw) :
"eax"); /* gcc does not seem to understand
that our asm code resets eax: tell it
explicitly that after the third ':' */
}
#endif
/********************************************************************** /**********************************************************************
Creates, or rather, initializes a mutex object in a specified memory Creates, or rather, initializes a mutex object in a specified memory
location (which must be appropriately aligned). The mutex is initialized location (which must be appropriately aligned). The mutex is initialized
......
...@@ -41,47 +41,6 @@ trx_undof_page_add_undo_rec_log( ...@@ -41,47 +41,6 @@ trx_undof_page_add_undo_rec_log(
byte* log_ptr; byte* log_ptr;
ulint len; ulint len;
#ifdef notdefined
ulint i;
byte* prev_rec_ptr;
byte* ptr;
ulint min_len;
ut_ad(new_free >= old_free + 4);
i = 0;
ptr = undo_page + old_free + 2;
if (old_free > mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
+ TRX_UNDO_PAGE_START)) {
prev_rec_ptr = undo_page + mach_read_from_2(ptr - 4) + 2;
min_len = ut_min(new_free - old_free - 4,
(undo_page + old_free - 2) - prev_rec_ptr);
for (;;) {
if (i >= min_len) {
break;
} else if ((*ptr == *prev_rec_ptr)
|| ((*ptr == *prev_rec_ptr + 1)
&& (ptr + 1 == suffix))) {
i++;
ptr++;
prev_rec_ptr++;
} else {
break;
}
}
}
mlog_write_initial_log_record(undo_page, MLOG_UNDO_INSERT, mtr);
mlog_catenate_ulint(mtr, old_free, MLOG_2BYTES);
mlog_catenate_ulint_compressed(mtr, i);
mlog_catenate_string(mtr, ptr, new_free - old_free - 2 - i);
#endif
log_ptr = mlog_open(mtr, 30 + MLOG_BUF_MARGIN); log_ptr = mlog_open(mtr, 30 + MLOG_BUF_MARGIN);
if (log_ptr == NULL) { if (log_ptr == NULL) {
......
...@@ -650,29 +650,6 @@ trx_commit_off_kernel( ...@@ -650,29 +650,6 @@ trx_commit_off_kernel(
if (undo) { if (undo) {
mutex_enter(&kernel_mutex); mutex_enter(&kernel_mutex);
#ifdef notdefined
/* !!!!!!!!! There is a bug here: purge and rollback
need the whole stack of old record versions even if no
consistent read would need them!! This is because they
decide on the basis of the old versions when we can
remove delete marked secondary index records! */
if (!undo->del_marks && (undo->size == 1)
&& (UT_LIST_GET_LEN(trx_sys->view_list) == 1)) {
/* There is no need to save the update undo
log: discard it; note that &mtr gets committed
while we must hold the kernel mutex and
therefore this optimization may add to the
contention of the kernel mutex. */
lsn = trx_undo_update_cleanup_by_discard(trx,
&mtr);
mutex_exit(&(rseg->mutex));
goto shortcut;
}
#endif
trx->no = trx_sys_get_new_trx_no(); trx->no = trx_sys_get_new_trx_no();
mutex_exit(&kernel_mutex); mutex_exit(&kernel_mutex);
......
...@@ -18,7 +18,6 @@ ibool ut_dbg_stop_threads = FALSE; ...@@ -18,7 +18,6 @@ ibool ut_dbg_stop_threads = FALSE;
/* Null pointer used to generate memory trap */ /* Null pointer used to generate memory trap */
ulint* ut_dbg_null_ptr = NULL; ulint* ut_dbg_null_ptr = NULL;
const char* ut_dbg_msg_assert_fail = const char* ut_dbg_msg_assert_fail =
"InnoDB: Assertion failure in thread %lu in file %s line %lu\n"; "InnoDB: Assertion failure in thread %lu in file %s line %lu\n";
const char* ut_dbg_msg_trap = const char* ut_dbg_msg_trap =
......
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
#include "ftdefs.h" #include "ftdefs.h"
#include <my_getopt.h> #include <my_getopt.h>
static void get_options(int *argc,char **argv[]);
static void usage(); static void usage();
static void complain(int val); static void complain(int val);
static my_bool get_one_option(int, const struct my_option *, char *);
static int count=0, stats=0, dump=0, lstats=0; static int count=0, stats=0, dump=0, lstats=0;
static my_bool verbose; static my_bool verbose;
...@@ -68,7 +68,8 @@ int main(int argc,char *argv[]) ...@@ -68,7 +68,8 @@ int main(int argc,char *argv[])
struct { MI_INFO *info; } aio0, *aio=&aio0; /* for GWS_IN_USE */ struct { MI_INFO *info; } aio0, *aio=&aio0; /* for GWS_IN_USE */
MY_INIT(argv[0]); MY_INIT(argv[0]);
get_options(&argc, &argv); if (error=handle_options(&argc, &argv, my_long_options, get_one_option))
exit(error);
if (count || dump) if (count || dump)
verbose=0; verbose=0;
if (!count && !dump && !lstats && !query) if (!count && !dump && !lstats && !query)
...@@ -80,12 +81,21 @@ int main(int argc,char *argv[]) ...@@ -80,12 +81,21 @@ int main(int argc,char *argv[])
if (argc < 2) if (argc < 2)
usage(); usage();
{
char *end;
inx= strtoll(argv[1], &end, 10);
if (*end)
usage();
}
init_key_cache(dflt_key_cache,MI_KEY_BLOCK_LENGTH,USE_BUFFER_INIT, 0, 0); init_key_cache(dflt_key_cache,MI_KEY_BLOCK_LENGTH,USE_BUFFER_INIT, 0, 0);
if (!(info=mi_open(argv[0],2,HA_OPEN_ABORT_IF_LOCKED))) if (!(info=mi_open(argv[0],2,HA_OPEN_ABORT_IF_LOCKED)))
{
error=my_errno;
goto err; goto err;
}
inx=atoi(argv[1]);
*buf2=0; *buf2=0;
aio->info=info; aio->info=info;
...@@ -96,6 +106,8 @@ int main(int argc,char *argv[]) ...@@ -96,6 +106,8 @@ int main(int argc,char *argv[])
goto err; goto err;
} }
mi_lock_database(info, F_EXTRA_LCK);
if (query) if (query)
{ {
#if 0 #if 0
...@@ -112,7 +124,7 @@ int main(int argc,char *argv[]) ...@@ -112,7 +124,7 @@ int main(int argc,char *argv[])
printf("%d rows matched\n",result->ndocs); printf("%d rows matched\n",result->ndocs);
for(i=0 ; i<result->ndocs ; i++) for(i=0 ; i<result->ndocs ; i++)
printf("%9qx %20.7f\n",result->doc[i].dpos,result->doc[i].weight); printf("%9lx %20.7f\n",(ulong)result->doc[i].dpos,result->doc[i].weight);
ft_nlq_close_search(result); ft_nlq_close_search(result);
#else #else
...@@ -179,6 +191,7 @@ int main(int argc,char *argv[]) ...@@ -179,6 +191,7 @@ int main(int argc,char *argv[])
if (verbose && (total%HOW_OFTEN_TO_WRITE)==0) if (verbose && (total%HOW_OFTEN_TO_WRITE)==0)
printf("%10ld\r",total); printf("%10ld\r",total);
} }
mi_lock_database(info, F_UNLCK);
if (stats) if (stats)
{ {
...@@ -252,15 +265,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -252,15 +265,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
} }
static void get_options(int *argc, char **argv[])
{
int ho_error;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
} /* get options */
static void usage() static void usage()
{ {
printf("Use: ft_dump <table_name> <index_no>\n"); printf("Use: ft_dump <table_name> <index_no>\n");
......
...@@ -373,6 +373,19 @@ where 0=1; ...@@ -373,6 +373,19 @@ where 0=1;
delete t1, t2 from t2,t1 delete t1, t2 from t2,t1
where t1.id1=t2.id2 and 0=1; where t1.id1=t2.id2 and 0=1;
drop table t1,t2; drop table t1,t2;
create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) type = innodb;
insert into `t1`values ( 1 ) ;
create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) type = innodb;
insert into `t2`values ( 1 ) ;
create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) type = innodb;
insert into `t3`values ( 1 ) ;
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
Cannot delete or update a parent row: a foreign key constraint fails
update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
Cannot delete or update a parent row: a foreign key constraint fails
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
Unknown table 't1' in where clause
drop table t3,t2,t1;
create table t1 ( a int not null, b int not null) ; create table t1 ( a int not null, b int not null) ;
alter table t1 add index i1(a); alter table t1 add index i1(a);
delete from t1 where a > 2000000; delete from t1 where a > 2000000;
......
...@@ -309,7 +309,19 @@ delete t1, t2 from t2,t1 ...@@ -309,7 +309,19 @@ delete t1, t2 from t2,t1
where t1.id1=t2.id2 and 0=1; where t1.id1=t2.id2 and 0=1;
drop table t1,t2; drop table t1,t2;
create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) type = innodb;
insert into `t1`values ( 1 ) ;
create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) type = innodb;
insert into `t2`values ( 1 ) ;
create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) type = innodb;
insert into `t3`values ( 1 ) ;
--error 1217
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
--error 1217
update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
--error 1109
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
drop table t3,t2,t1;
# #
# Test for bug #1820. # Test for bug #1820.
......
...@@ -34,11 +34,13 @@ bin_SCRIPTS = @server_scripts@ \ ...@@ -34,11 +34,13 @@ bin_SCRIPTS = @server_scripts@ \
mysql_tableinfo \ mysql_tableinfo \
mysqld_multi \ mysqld_multi \
make_win_src_distribution \ make_win_src_distribution \
make_win_binary_distribution \
mysql_create_system_tables mysql_create_system_tables
EXTRA_SCRIPTS = make_binary_distribution.sh \ EXTRA_SCRIPTS = make_binary_distribution.sh \
make_sharedlib_distribution.sh \ make_sharedlib_distribution.sh \
make_win_src_distribution.sh \ make_win_src_distribution.sh \
make_win_binary_distribution.sh \
msql2mysql.sh \ msql2mysql.sh \
mysql_config.sh \ mysql_config.sh \
mysql_fix_privilege_tables.sh \ mysql_fix_privilege_tables.sh \
......
#!/bin/sh
#
# Script to create a Windows binary package
#
# This is intended to be used under Cygwin, and will generate
# an archive named in the form mysql<suffix>-<version>-noinstall.zip
version=@VERSION@
DEBUG=0
SUFFIX=""
DIRNAME=""
EXTRA=""
#
# This script must run from MySQL top directory
#
if [ ! -f scripts/make_win_binary_distribution ]; then
echo "ERROR : You must run this script from the MySQL top-level directory"
exit 1
fi
#
# Debug print of the status
#
print_debug()
{
for statement
do
if [ "$DEBUG" = "1" ] ; then
echo $statement
fi
done
}
#
# Usage of the script
#
show_usage()
{
echo "MySQL utility script to create a Windows binary package"
echo ""
echo "This is intended to be used under Cygwin, and will generate"
echo "an archive named in the form mysql<suffix>-<version>-noinstall.zip"
echo "Takes the following arguments:"
echo ""
echo " --dirname Directory to use for copying files"
echo " --extra Directory to get extra files from"
echo " --suffix Name to append to 'mysql' for this binary"
echo " --help Show this help message"
exit 0
}
#
# Parse the input arguments
#
parse_arguments() {
for arg do
case "$arg" in
--debug) DEBUG=1;;
--extra=*) EXTRA=`echo "$arg" | sed -e "s;--extra=;;"` ;;
--suffix=*) SUFFIX=`echo "$arg" | sed -e "s;--suffix=;;"` ;;
--dirname=*) DIRNAME=`echo "$arg" | sed -e "s;--dirname=;;"` ;;
--help) show_usage ;;
*)
echo "Unknown argument '$arg'"
exit 1
;;
esac
done
}
parse_arguments "$@"
if [ -z "$DIRNAME" ]; then
$DIRNAME="dist"
fi
print_debug "Making directories"
mkdir $DIRNAME
$DIRNAME="$DIRNAME/mysql-$version"
mkdir $DIRNAME
for dir in bin lib lib/opt lib/debug Embedded Embedded/DLL Embedded/DLL/debug Embedded/DLL/release Embedded/static Embedded/static/release examples examples/libmysqltest
do
mkdir $DIRNAME/$dir
done
if [ $EXTRA ]; then
print_debug "Copying extra files"
cp -fr $EXTRA/* $DIRNAME
fi
# Dirs to be copied as-is
for dir in data Docs include scripts share
do
print_debug "Copying $dir to $DIRNAME/"
cp -fr $dir $DIRNAME
done
print_debug "Copying tests to $DIRNAME/examples/"
cp -fr tests $DIRNAME/examples
print_debug "Copying sql-bench to $DIRNAME/bench"
mkdir $DIRNAME/bench
cp -fr sql-bench/* $DIRNAME/bench
# Files for bin
for i in client_release/* client_debug/mysqld.exe lib_release/libmySQL.dll
do
print_debug "Copying $i to $DIRNAME/bin"
cp $i $DIRNAME/bin
done
# Files for include
for i in libmysql/libmysql.def libmysqld/libmysqld.def
do
print_debug "Copying $i to $DIRNAME/include"
cp $i $DIRNAME/include
done
# Windows users are used to having dbug.h
cp include/my_dbug.h $DIRNAME/include/dbug.h
# Libraries found in lib_release and lib_debug
for i in libmySQL.dll libmysql.lib zlib.lib mysqlclient.lib mysys.lib regex.lib strings.lib
do
print_debug "Copying lib_release/$i to $DIRNAME/lib/opt"
cp lib_release/$i $DIRNAME/lib/opt
print_debug "Copying lib_debug/$i to $DIRNAME/lib/debug"
cp lib_debug/$i $DIRNAME/lib/debug
done
print_debug "Copying lib_release/mysys-max.lib to $DIRNAME/lib/opt"
cp lib_release/mysys-max.lib $DIRNAME/lib/opt
# Embedded server
for i in libmysqld.dll libmysqld.lib libmysqld.exp
do
print_debug "Copying lib_release/$i to $DIRNAME/Embedded/DLL/release"
cp lib_release/$i $DIRNAME/Embedded/DLL/release
print_debug "Copying lib_debug/$i to $DIRNAME/Embedded/DLL/debug"
cp lib_debug/$i $DIRNAME/Embedded/DLL/debug
done
# Static embedded
print_debug "Copying lib_release/mysqlserver.lib to $DIRNAME/Embedded/static/release"
cp lib_release/mysqlserver.lib $DIRNAME/Embedded/static/release
# libmysqltest
for i in mytest.c mytest.dsp mytest.dsw mytest.exe
do
print_debug "Copying libmysqltest/release/$i to $DIRNAME/examples/libmysqltest"
cp libmysqltest/release/$i $DIRNAME/examples/libmysqltest
done
print_debug "Copying README.txt"
cp README.txt $DIRNAME
if [ -f MySQLEULA.txt ]; then
print_debug "Commercial version: copying MySQLEULA.txt"
cp MySQLEULA.txt $DIRNAME
rm $DIRNAME/Docs/COPYING
else
print_debug "GPL version: copying COPYING"
cp Docs/COPYING $DIRNAME
fi
print_debug "Invoking zip to package the binary"
zip -r mysql$SUFFIX-$version-win-noinstall.zip $DIRNAME
print_debug "Deleting intermediate directory"
rm -rf $DIRNAME
...@@ -84,20 +84,25 @@ port='@MYSQL_TCP_PORT@' ...@@ -84,20 +84,25 @@ port='@MYSQL_TCP_PORT@'
ldflags='@LDFLAGS@' ldflags='@LDFLAGS@'
client_libs='@CLIENT_LIBS@' client_libs='@CLIENT_LIBS@'
# Create options, without end space # Create options
libs="$ldflags -L$pkglibdir -lmysqlclient $client_libs" libs="$ldflags -L$pkglibdir -lmysqlclient $client_libs"
libs=`echo "$libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'` libs=`echo "$libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
libs_r="$ldflags -L$pkglibdir -lmysqlclient_r @LIBS@ @openssl_libs@" libs_r="$ldflags -L$pkglibdir -lmysqlclient_r @LIBS@ @openssl_libs@"
libs_r=`echo "$libs_r" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'` libs_r=`echo "$libs_r" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
cflags="-I$pkgincludedir @CFLAGS@" cflags="-I$pkgincludedir @CFLAGS@ " #note: end space!
include="-I$pkgincludedir" include="-I$pkgincludedir"
embedded_libs="$ldflags -L$pkglibdir -lmysqld @LIBS@ @WRAPLIBS@ @innodb_system_libs@" embedded_libs="$ldflags -L$pkglibdir -lmysqld @LIBS@ @WRAPLIBS@ @innodb_system_libs@"
embedded_libs=`echo "$embedded_libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'` embedded_libs=`echo "$embedded_libs" | sed -e 's; \+; ;g' | sed -e 's;^ *;;' | sed -e 's; *\$;;'`
# Remove some options that a client doesn't have to care about # Remove some options that a client doesn't have to care about
for remove in DDBUG_OFF DSAFEMALLOC USAFEMALLOC DSAFE_MUTEX \
cflags=`echo "$cflags " | sed -e 's;\(-DDBUG_OFF\|-DSAFEMALLOC\|-USAFEMALLOC\|-DSAFE_MUTEX\|-DPEDANTIC_SAFEMALLOC\|-DUNIV_MUST_NOT_INLINE\|-DFORCE_INIT_OF_VARS\|-DEXTRA_DEBUG\|-DHAVE_purify\|-O[0-9]\|-W[-A-Za-z]*\) *;;g' | sed -e 's; *\$;;'` DPEDANTIC_SAFEMALLOC DUNIV_MUST_NOT_INLINE DFORCE_INIT_OF_VARS \
DEXTRA_DEBUG DHAVE_purify 'O[0-9]' 'W[-A-Za-z]*'
do
cflags=`echo "$cflags"|sed -e "s/-$remove *//g"`
done
cflags=`echo "$cflags"|sed -e 's/ *\$//'`
usage () { usage () {
cat <<EOF cat <<EOF
......
...@@ -370,7 +370,7 @@ bool multi_delete::send_data(List<Item> &values) ...@@ -370,7 +370,7 @@ bool multi_delete::send_data(List<Item> &values)
table->status|= STATUS_DELETED; table->status|= STATUS_DELETED;
if (!(error=table->file->delete_row(table->record[0]))) if (!(error=table->file->delete_row(table->record[0])))
deleted++; deleted++;
else if (!table_being_deleted->next) else if (!table_being_deleted->next || table_being_deleted->table->file->has_transactions())
{ {
table->file->print_error(error,MYF(0)); table->file->print_error(error,MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
...@@ -473,6 +473,10 @@ int multi_delete::do_deletes(bool from_send_error) ...@@ -473,6 +473,10 @@ int multi_delete::do_deletes(bool from_send_error)
if ((local_error=table->file->delete_row(table->record[0]))) if ((local_error=table->file->delete_row(table->record[0])))
{ {
table->file->print_error(local_error,MYF(0)); table->file->print_error(local_error,MYF(0));
if (transactional_tables)
{
DBUG_RETURN(local_error);
}
break; break;
} }
deleted++; deleted++;
......
...@@ -4801,6 +4801,7 @@ keyword: ...@@ -4801,6 +4801,7 @@ keyword:
| MASTER_LOG_POS_SYM {} | MASTER_LOG_POS_SYM {}
| MASTER_USER_SYM {} | MASTER_USER_SYM {}
| MASTER_PASSWORD_SYM {} | MASTER_PASSWORD_SYM {}
| MASTER_SERVER_ID_SYM {}
| MASTER_CONNECT_RETRY_SYM {} | MASTER_CONNECT_RETRY_SYM {}
| MASTER_SSL_SYM {} | MASTER_SSL_SYM {}
| MASTER_SSL_CA_SYM {} | MASTER_SSL_CA_SYM {}
......
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