1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

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

into mashka.mysql.fi:/home/my/mysql-4.1
This commit is contained in:
monty@mashka.mysql.fi
2004-02-22 11:01:28 +02:00
173 changed files with 2737 additions and 52900 deletions

View File

@ -522,6 +522,7 @@ scripts/fill_help_tables
scripts/fill_help_tables.sql
scripts/make_binary_distribution
scripts/make_sharedlib_distribution
scripts/make_win_binary_distribution
scripts/make_win_src_distribution
scripts/msql2mysql
scripts/mysql_config

View File

@ -67,6 +67,7 @@ konstantin@mysql.com
kostja@oak.local
lenz@kallisto.mysql.com
lenz@mysql.com
marko@hundin.mysql.fi
miguel@hegel.(none)
miguel@hegel.br
miguel@hegel.local

View File

@ -3,12 +3,13 @@
use Getopt::Long;
$opt_help=0;
$opt_tarball=$opt_builddir="";
$opt_tarball=$opt_builddir=$opt_suffix="";
GetOptions(
"help",
"tarball=s",
"builddir=s",
"tarball=s",
"builddir=s",
"suffix=s"
) || print_help();
print_help() if ($opt_help);
@ -22,31 +23,61 @@ if (!$opt_builddir) {
$opt_tarball =~ /(mysql[^\/]*)-win-src\.tar/;
$mysqlver=$1;
$basedir = "$opt_builddir/$mysqlver";
$scriptdir = `pwd`;
# Make sure build dir exists
mkdir($opt_builddir);
# Clean out any previous build
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))
{
print "Do-win-build error: Could not change to $opt_builddir";
print "Do-win-build error: Could not change to $basedir";
exit 1;
}
mkdir("build");
chdir("build");
# Check whether this is a classic edition build
if ($opt_suffix =~ /-classic/)
{
# Blank out ha_innodb.cpp
chmod 0644, 'sql/ha_innodb.cpp';
open(OUT, '>', 'sql/ha_innodb.cpp');
close(OUT);
system("tar -zxvf ../tarball/$mysqlver-win-src.tar.gz");
chdir($mysqlver);
# 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;
}
}
# Perform compilation
system("\"$MSDEV\" mysql.dsw /MAKE \"ALL\" /OUT $mysqlver-build.log");
# Package binary
system("./scripts/make_win_binary_distribution --suffix=$opt_suffix");
# Copy log back to script directory
system("cp $mysqlver$suffix-build.log $scriptdir");
# Move binary package to script directory
system("mv *.zip $scriptdir");
#
# Print a help text message
#
@ -59,7 +90,11 @@ Unpacks a Windows source distribution on the local machine and
compiles it using VC++ 6.0.
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:
@ -73,6 +108,13 @@ be moved to <builddir>/mysql-<version>/tarball and extracted under
<builddir>/mysql-<version>/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>
Windows source tarball to use for this build. Must be of the form
mysql[com]-x.x.x-win-src.tar.gz (REQUIRED)

View File

@ -15,6 +15,7 @@ file7=C:\mysql\bin\mysqlc.exe
file8=C:\mysql\bin\mysqlcheck.exe
file9=C:\mysql\bin\mysqldump.exe
file20=C:\mysql\bin\winmysqladmin.exe
file21=C:\mysql\bin\myisam_ftdump.exe
file10=C:\mysql\bin\mysqlimport.exe
fulldirectory=
file11=C:\mysql\bin\mysqlshow.exe

View File

@ -219,6 +219,7 @@ file32=C:\mysql\scripts\mysqlbug.sh
file21=C:\mysql\scripts\mysql_setpermission
file10=C:\mysql\scripts\mysql_find_rows
fulldirectory=
file44=C:\mysql\scripts\mysql_fix_privilege_tables.sql
file33=C:\mysql\scripts\mysqld_multi
file22=C:\mysql\scripts\mysql_setpermission.pl
file11=C:\mysql\scripts\mysql_find_rows.pl

View File

@ -135,6 +135,7 @@ file1=C:\mysql\my-large.cnf
file2=C:\mysql\my-medium.cnf
file3=C:\mysql\my-small.cnf
file4=C:\mysql\MySQLEULA.txt
file5=C:\mysql\README.txt
SubDir0=bin
SubDir1=share
SubDir2=Embedded

View File

@ -0,0 +1,641 @@
////////////////////////////////////////////////////////////////////////////////
//
// IIIIIII SSSSSS
// II SS InstallShield (R)
// II SSSSSS (c) 1996-1997, InstallShield Software Corporation
// II SS (c) 1990-1996, InstallShield Corporation
// IIIIIII SSSSSS All Rights Reserved.
//
//
// This code is generated as a starting setup template. You should
// modify it to provide all necessary steps for your setup.
//
//
// File Name: Setup.rul
//
// Description: InstallShield script
//
// Comments: This template script performs a basic setup on a
// Windows 95 or Windows NT 4.0 platform. With minor
// modifications, this template can be adapted to create
// new, customized setups.
//
////////////////////////////////////////////////////////////////////////////////
// Include header file
#include "sdlang.h"
#include "sddialog.h"
////////////////////// string defines ////////////////////////////
#define UNINST_LOGFILE_NAME "Uninst.isu"
//////////////////// installation declarations ///////////////////
// ----- DLL prototypes -----
// your DLL prototypes
// ---- script prototypes -----
// generated
prototype ShowDialogs();
prototype MoveFileData();
prototype HandleMoveDataError( NUMBER );
prototype ProcessBeforeDataMove();
prototype ProcessAfterDataMove();
prototype SetupRegistry();
prototype SetupFolders();
prototype CleanUpInstall();
prototype SetupInstall();
prototype SetupScreen();
prototype CheckRequirements();
prototype DialogShowSdWelcome();
prototype DialogShowSdShowInfoList();
prototype DialogShowSdAskDestPath();
prototype DialogShowSdSetupType();
prototype DialogShowSdComponentDialog2();
prototype DialogShowSdFinishReboot();
// your prototypes
// ----- global variables ------
// generated
BOOL bWinNT, bIsShellExplorer, bInstallAborted, bIs32BitSetup;
STRING svDir;
STRING svName, svCompany, svSerial;
STRING szAppPath;
STRING svSetupType;
// your global variables
///////////////////////////////////////////////////////////////////////////////
//
// MAIN PROGRAM
//
// The setup begins here by hiding the visible setup
// window. This is done to allow all the titles, images, etc. to
// be established before showing the main window. The following
// logic then performs the setup in a series of steps.
//
///////////////////////////////////////////////////////////////////////////////
program
Disable( BACKGROUND );
CheckRequirements();
SetupInstall();
SetupScreen();
if (ShowDialogs()<0) goto end_install;
if (ProcessBeforeDataMove()<0) goto end_install;
if (MoveFileData()<0) goto end_install;
if (ProcessAfterDataMove()<0) goto end_install;
if (SetupRegistry()<0) goto end_install;
if (SetupFolders()<0) goto end_install;
end_install:
CleanUpInstall();
// If an unrecoverable error occurred, clean up the partial installation.
// Otherwise, exit normally.
if (bInstallAborted) then
abort;
endif;
endprogram
///////////////////////////////////////////////////////////////////////////////
// //
// Function: ShowDialogs //
// //
// Purpose: This function manages the display and navigation //
// the standard dialogs that exist in a setup. //
// //
///////////////////////////////////////////////////////////////////////////////
function ShowDialogs()
NUMBER nResult;
begin
Dlg_Start:
// beginning of dialogs label
Dlg_SdWelcome:
nResult = DialogShowSdWelcome();
if (nResult = BACK) goto Dlg_Start;
Dlg_SdShowInfoList:
nResult = DialogShowSdShowInfoList();
if (nResult = BACK) goto Dlg_SdWelcome;
Dlg_SdAskDestPath:
nResult = DialogShowSdAskDestPath();
if (nResult = BACK) goto Dlg_SdShowInfoList;
Dlg_SdSetupType:
nResult = DialogShowSdSetupType();
if (nResult = BACK) goto Dlg_SdAskDestPath;
Dlg_SdComponentDialog2:
if ((nResult = BACK) && (svSetupType != "Custom") && (svSetupType != "")) then
goto Dlg_SdSetupType;
endif;
nResult = DialogShowSdComponentDialog2();
if (nResult = BACK) goto Dlg_SdSetupType;
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: ProcessBeforeDataMove //
// //
// Purpose: This function performs any necessary operations prior to the //
// actual data move operation. //
// //
///////////////////////////////////////////////////////////////////////////////
function ProcessBeforeDataMove()
STRING svLogFile;
NUMBER nResult;
begin
InstallationInfo( @COMPANY_NAME, @PRODUCT_NAME, @PRODUCT_VERSION, @PRODUCT_KEY );
svLogFile = UNINST_LOGFILE_NAME;
nResult = DeinstallStart( svDir, svLogFile, @UNINST_KEY, 0 );
if (nResult < 0) then
MessageBox( @ERROR_UNINSTSETUP, WARNING );
endif;
szAppPath = TARGETDIR; // TODO : if your application .exe is in a subdir of TARGETDIR then add subdir
if ((bIs32BitSetup) && (bIsShellExplorer)) then
// RegDBSetItem( REGDB_APPPATH, szAppPath );
// RegDBSetItem( REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY );
RegDBSetItem( REGDB_UNINSTALL_NAME, @UNINST_DISPLAY_NAME );
endif;
// TODO : update any items you want to process before moving the data
//
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: MoveFileData //
// //
// Purpose: This function handles the data movement for //
// the setup. //
// //
///////////////////////////////////////////////////////////////////////////////
function MoveFileData()
NUMBER nResult, nDisk;
begin
nDisk = 1;
SetStatusWindow( 0, "" );
Disable( DIALOGCACHE );
Enable( STATUS );
StatusUpdate( ON, 100 );
nResult = ComponentMoveData( MEDIA, nDisk, 0 );
HandleMoveDataError( nResult );
Disable( STATUS );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: HandleMoveDataError //
// //
// Purpose: This function handles the error (if any) during the move data //
// operation. //
// //
///////////////////////////////////////////////////////////////////////////////
function HandleMoveDataError( nResult )
STRING szErrMsg, svComponent , svFileGroup , svFile;
begin
svComponent = "";
svFileGroup = "";
svFile = "";
switch (nResult)
case 0:
return 0;
default:
ComponentError ( MEDIA , svComponent , svFileGroup , svFile , nResult );
szErrMsg = @ERROR_MOVEDATA + "\n\n" +
@ERROR_COMPONENT + " " + svComponent + "\n" +
@ERROR_FILEGROUP + " " + svFileGroup + "\n" +
@ERROR_FILE + " " + svFile;
SprintfBox( SEVERE, @TITLE_CAPTIONBAR, szErrMsg, nResult );
bInstallAborted = TRUE;
return nResult;
endswitch;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: ProcessAfterDataMove //
// //
// Purpose: This function performs any necessary operations needed after //
// all data has been moved. //
// //
///////////////////////////////////////////////////////////////////////////////
function ProcessAfterDataMove()
begin
// TODO : update self-registered files and other processes that
// should be performed after the data has been moved.
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: SetupRegistry //
// //
// Purpose: This function makes the registry entries for this setup. //
// //
///////////////////////////////////////////////////////////////////////////////
function SetupRegistry()
NUMBER nResult;
begin
// TODO : Add all your registry entry keys here
//
//
// RegDBCreateKeyEx, RegDBSetKeyValueEx....
//
nResult = CreateRegistrySet( "" );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
//
// Function: SetupFolders
//
// Purpose: This function creates all the folders and shortcuts for the
// setup. This includes program groups and items for Windows 3.1.
//
///////////////////////////////////////////////////////////////////////////////
function SetupFolders()
NUMBER nResult;
begin
// TODO : Add all your folder (program group) along with shortcuts (program items)
//
//
// CreateProgramFolder, AddFolderIcon....
//
nResult = CreateShellObjects( "" );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: CleanUpInstall //
// //
// Purpose: This cleans up the setup. Anything that should //
// be released or deleted at the end of the setup should //
// be done here. //
// //
///////////////////////////////////////////////////////////////////////////////
function CleanUpInstall()
begin
if (bInstallAborted) then
return 0;
endif;
DialogShowSdFinishReboot();
if (BATCH_INSTALL) then // ensure locked files are properly written
CommitSharedFiles(0);
endif;
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: SetupInstall //
// //
// Purpose: This will setup the installation. Any general initialization //
// needed for the installation should be performed here. //
// //
///////////////////////////////////////////////////////////////////////////////
function SetupInstall()
begin
Enable( CORECOMPONENTHANDLING );
bInstallAborted = FALSE;
if (bIs32BitSetup) then
svDir = "C:\\mysql"; //PROGRAMFILES ^ @COMPANY_NAME ^ @PRODUCT_NAME;
else
svDir = "C:\\mysql"; //PROGRAMFILES ^ @COMPANY_NAME16 ^ @PRODUCT_NAME16; // use shorten names
endif;
TARGETDIR = svDir;
SdProductName( @PRODUCT_NAME );
Enable( DIALOGCACHE );
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: SetupScreen //
// //
// Purpose: This function establishes the screen look. This includes //
// colors, fonts, and text to be displayed. //
// //
///////////////////////////////////////////////////////////////////////////////
function SetupScreen()
begin
Enable( FULLWINDOWMODE );
Enable( INDVFILESTATUS );
SetTitle( @TITLE_MAIN, 24, WHITE );
SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION ); // Caption bar text.
Enable( BACKGROUND );
Delay( 1 );
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: CheckRequirements //
// //
// Purpose: This function checks all minimum requirements for the //
// application being installed. If any fail, then the user //
// is informed and the setup is terminated. //
// //
///////////////////////////////////////////////////////////////////////////////
function CheckRequirements()
NUMBER nvDx, nvDy, nvResult;
STRING svResult;
begin
bWinNT = FALSE;
bIsShellExplorer = FALSE;
// Check screen resolution.
GetExtents( nvDx, nvDy );
if (nvDy < 480) then
MessageBox( @ERROR_VGARESOLUTION, WARNING );
abort;
endif;
// set 'setup' operation mode
bIs32BitSetup = TRUE;
GetSystemInfo( ISTYPE, nvResult, svResult );
if (nvResult = 16) then
bIs32BitSetup = FALSE; // running 16-bit setup
return 0; // no additional information required
endif;
// --- 32-bit testing after this point ---
// Determine the target system's operating system.
GetSystemInfo( OS, nvResult, svResult );
if (nvResult = IS_WINDOWSNT) then
// Running Windows NT.
bWinNT = TRUE;
// Check to see if the shell being used is EXPLORER shell.
if (GetSystemInfo( OSMAJOR, nvResult, svResult ) = 0) then
if (nvResult >= 4) then
bIsShellExplorer = TRUE;
endif;
endif;
elseif (nvResult = IS_WINDOWS95 ) then
bIsShellExplorer = TRUE;
endif;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdWelcome //
// //
// Purpose: This function handles the standard welcome dialog. //
// //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdWelcome()
NUMBER nResult;
STRING szTitle, szMsg;
begin
szTitle = "";
szMsg = "";
nResult = SdWelcome( szTitle, szMsg );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdShowInfoList //
// //
// Purpose: This function displays the general information list dialog. //
// //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdShowInfoList()
NUMBER nResult;
LIST list;
STRING szTitle, szMsg, szFile;
begin
szFile = SUPPORTDIR ^ "infolist.txt";
list = ListCreate( STRINGLIST );
ListReadFromFile( list, szFile );
szTitle = "";
szMsg = " ";
nResult = SdShowInfoList( szTitle, szMsg, list );
ListDestroy( list );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdAskDestPath //
// //
// Purpose: This function asks the user for the destination directory. //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdAskDestPath()
NUMBER nResult;
STRING szTitle, szMsg;
begin
szTitle = "";
szMsg = "";
nResult = SdAskDestPath( szTitle, szMsg, svDir, 0 );
TARGETDIR = svDir;
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdSetupType //
// //
// Purpose: This function displays the standard setup type dialog. //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdSetupType()
NUMBER nResult, nType;
STRING szTitle, szMsg;
begin
switch (svSetupType)
case "Typical":
nType = TYPICAL;
case "Custom":
nType = CUSTOM;
case "Compact":
nType = COMPACT;
case "":
svSetupType = "Typical";
nType = TYPICAL;
endswitch;
szTitle = "";
szMsg = "";
nResult = SetupType( szTitle, szMsg, "", nType, 0 );
switch (nResult)
case COMPACT:
svSetupType = "Compact";
case TYPICAL:
svSetupType = "Typical";
case CUSTOM:
svSetupType = "Custom";
endswitch;
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdComponentDialog2 //
// //
// Purpose: This function displays the custom component dialog. //
// //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdComponentDialog2()
NUMBER nResult;
STRING szTitle, szMsg;
begin
if ((svSetupType != "Custom") && (svSetupType != "")) then
return 0;
endif;
szTitle = "";
szMsg = "";
nResult = SdComponentDialog2( szTitle, szMsg, svDir, "" );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdFinishReboot //
// //
// Purpose: This function will show the last dialog of the product. //
// It will allow the user to reboot and/or show some readme text. //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdFinishReboot()
NUMBER nResult, nDefOptions;
STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;
NUMBER bOpt1, bOpt2;
begin
if (!BATCH_INSTALL) then
bOpt1 = FALSE;
bOpt2 = FALSE;
szMsg1 = "";
szMsg2 = "";
szOption1 = "";
szOption2 = "";
nResult = SdFinish( szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2 );
return 0;
endif;
nDefOptions = SYS_BOOTMACHINE;
szTitle = "";
szMsg1 = "";
szMsg2 = "";
nResult = SdFinishReboot( szTitle, szMsg1, nDefOptions, szMsg2, 0 );
return nResult;
end;
// --- include script file section ---
#include "sddialog.rul"

View File

@ -15,6 +15,7 @@ file7=C:\mysql\bin\mysqlc.exe
file8=C:\mysql\bin\mysqlcheck.exe
file9=C:\mysql\bin\mysqldump.exe
file20=C:\mysql\bin\winmysqladmin.exe
file21=C:\mysql\bin\myisam_ftdump.exe
file10=C:\mysql\bin\mysqlimport.exe
fulldirectory=
file11=C:\mysql\bin\mysqlshow.exe

View File

@ -220,6 +220,7 @@ file32=C:\mysql\scripts\mysqlbug.sh
file21=C:\mysql\scripts\mysql_setpermission
file10=C:\mysql\scripts\mysql_find_rows
fulldirectory=
file44=C:\mysql\scripts\mysql_fix_privilege_tables.sql
file33=C:\mysql\scripts\mysqld_multi
file22=C:\mysql\scripts\mysql_setpermission.pl
file11=C:\mysql\scripts\mysql_find_rows.pl

View File

@ -132,12 +132,12 @@ file1=C:\mysql\share\greek\errmsg.txt
fulldirectory=
[TopDir]
file0=C:\mysql\Readme
file1=C:\mysql\mysqlbug.txt
file2=C:\mysql\my-huge.cnf
file3=C:\mysql\my-large.cnf
file4=C:\mysql\my-medium.cnf
file5=C:\mysql\my-small.cnf
file0=C:\mysql\mysqlbug.txt
file1=C:\mysql\my-huge.cnf
file2=C:\mysql\my-large.cnf
file3=C:\mysql\my-medium.cnf
file4=C:\mysql\my-small.cnf
file5=C:\mysql\README.txt
SubDir0=bin
SubDir1=share
SubDir2=Embedded

View File

@ -0,0 +1,641 @@
////////////////////////////////////////////////////////////////////////////////
//
// IIIIIII SSSSSS
// II SS InstallShield (R)
// II SSSSSS (c) 1996-1997, InstallShield Software Corporation
// II SS (c) 1990-1996, InstallShield Corporation
// IIIIIII SSSSSS All Rights Reserved.
//
//
// This code is generated as a starting setup template. You should
// modify it to provide all necessary steps for your setup.
//
//
// File Name: Setup.rul
//
// Description: InstallShield script
//
// Comments: This template script performs a basic setup on a
// Windows 95 or Windows NT 4.0 platform. With minor
// modifications, this template can be adapted to create
// new, customized setups.
//
////////////////////////////////////////////////////////////////////////////////
// Include header file
#include "sdlang.h"
#include "sddialog.h"
////////////////////// string defines ////////////////////////////
#define UNINST_LOGFILE_NAME "Uninst.isu"
//////////////////// installation declarations ///////////////////
// ----- DLL prototypes -----
// your DLL prototypes
// ---- script prototypes -----
// generated
prototype ShowDialogs();
prototype MoveFileData();
prototype HandleMoveDataError( NUMBER );
prototype ProcessBeforeDataMove();
prototype ProcessAfterDataMove();
prototype SetupRegistry();
prototype SetupFolders();
prototype CleanUpInstall();
prototype SetupInstall();
prototype SetupScreen();
prototype CheckRequirements();
prototype DialogShowSdWelcome();
prototype DialogShowSdShowInfoList();
prototype DialogShowSdAskDestPath();
prototype DialogShowSdSetupType();
prototype DialogShowSdComponentDialog2();
prototype DialogShowSdFinishReboot();
// your prototypes
// ----- global variables ------
// generated
BOOL bWinNT, bIsShellExplorer, bInstallAborted, bIs32BitSetup;
STRING svDir;
STRING svName, svCompany, svSerial;
STRING szAppPath;
STRING svSetupType;
// your global variables
///////////////////////////////////////////////////////////////////////////////
//
// MAIN PROGRAM
//
// The setup begins here by hiding the visible setup
// window. This is done to allow all the titles, images, etc. to
// be established before showing the main window. The following
// logic then performs the setup in a series of steps.
//
///////////////////////////////////////////////////////////////////////////////
program
Disable( BACKGROUND );
CheckRequirements();
SetupInstall();
SetupScreen();
if (ShowDialogs()<0) goto end_install;
if (ProcessBeforeDataMove()<0) goto end_install;
if (MoveFileData()<0) goto end_install;
if (ProcessAfterDataMove()<0) goto end_install;
if (SetupRegistry()<0) goto end_install;
if (SetupFolders()<0) goto end_install;
end_install:
CleanUpInstall();
// If an unrecoverable error occurred, clean up the partial installation.
// Otherwise, exit normally.
if (bInstallAborted) then
abort;
endif;
endprogram
///////////////////////////////////////////////////////////////////////////////
// //
// Function: ShowDialogs //
// //
// Purpose: This function manages the display and navigation //
// the standard dialogs that exist in a setup. //
// //
///////////////////////////////////////////////////////////////////////////////
function ShowDialogs()
NUMBER nResult;
begin
Dlg_Start:
// beginning of dialogs label
Dlg_SdWelcome:
nResult = DialogShowSdWelcome();
if (nResult = BACK) goto Dlg_Start;
Dlg_SdShowInfoList:
nResult = DialogShowSdShowInfoList();
if (nResult = BACK) goto Dlg_SdWelcome;
Dlg_SdAskDestPath:
nResult = DialogShowSdAskDestPath();
if (nResult = BACK) goto Dlg_SdShowInfoList;
Dlg_SdSetupType:
nResult = DialogShowSdSetupType();
if (nResult = BACK) goto Dlg_SdAskDestPath;
Dlg_SdComponentDialog2:
if ((nResult = BACK) && (svSetupType != "Custom") && (svSetupType != "")) then
goto Dlg_SdSetupType;
endif;
nResult = DialogShowSdComponentDialog2();
if (nResult = BACK) goto Dlg_SdSetupType;
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: ProcessBeforeDataMove //
// //
// Purpose: This function performs any necessary operations prior to the //
// actual data move operation. //
// //
///////////////////////////////////////////////////////////////////////////////
function ProcessBeforeDataMove()
STRING svLogFile;
NUMBER nResult;
begin
InstallationInfo( @COMPANY_NAME, @PRODUCT_NAME, @PRODUCT_VERSION, @PRODUCT_KEY );
svLogFile = UNINST_LOGFILE_NAME;
nResult = DeinstallStart( svDir, svLogFile, @UNINST_KEY, 0 );
if (nResult < 0) then
MessageBox( @ERROR_UNINSTSETUP, WARNING );
endif;
szAppPath = TARGETDIR; // TODO : if your application .exe is in a subdir of TARGETDIR then add subdir
if ((bIs32BitSetup) && (bIsShellExplorer)) then
// RegDBSetItem( REGDB_APPPATH, szAppPath );
// RegDBSetItem( REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY );
RegDBSetItem( REGDB_UNINSTALL_NAME, @UNINST_DISPLAY_NAME );
endif;
// TODO : update any items you want to process before moving the data
//
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: MoveFileData //
// //
// Purpose: This function handles the data movement for //
// the setup. //
// //
///////////////////////////////////////////////////////////////////////////////
function MoveFileData()
NUMBER nResult, nDisk;
begin
nDisk = 1;
SetStatusWindow( 0, "" );
Disable( DIALOGCACHE );
Enable( STATUS );
StatusUpdate( ON, 100 );
nResult = ComponentMoveData( MEDIA, nDisk, 0 );
HandleMoveDataError( nResult );
Disable( STATUS );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: HandleMoveDataError //
// //
// Purpose: This function handles the error (if any) during the move data //
// operation. //
// //
///////////////////////////////////////////////////////////////////////////////
function HandleMoveDataError( nResult )
STRING szErrMsg, svComponent , svFileGroup , svFile;
begin
svComponent = "";
svFileGroup = "";
svFile = "";
switch (nResult)
case 0:
return 0;
default:
ComponentError ( MEDIA , svComponent , svFileGroup , svFile , nResult );
szErrMsg = @ERROR_MOVEDATA + "\n\n" +
@ERROR_COMPONENT + " " + svComponent + "\n" +
@ERROR_FILEGROUP + " " + svFileGroup + "\n" +
@ERROR_FILE + " " + svFile;
SprintfBox( SEVERE, @TITLE_CAPTIONBAR, szErrMsg, nResult );
bInstallAborted = TRUE;
return nResult;
endswitch;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: ProcessAfterDataMove //
// //
// Purpose: This function performs any necessary operations needed after //
// all data has been moved. //
// //
///////////////////////////////////////////////////////////////////////////////
function ProcessAfterDataMove()
begin
// TODO : update self-registered files and other processes that
// should be performed after the data has been moved.
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: SetupRegistry //
// //
// Purpose: This function makes the registry entries for this setup. //
// //
///////////////////////////////////////////////////////////////////////////////
function SetupRegistry()
NUMBER nResult;
begin
// TODO : Add all your registry entry keys here
//
//
// RegDBCreateKeyEx, RegDBSetKeyValueEx....
//
nResult = CreateRegistrySet( "" );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
//
// Function: SetupFolders
//
// Purpose: This function creates all the folders and shortcuts for the
// setup. This includes program groups and items for Windows 3.1.
//
///////////////////////////////////////////////////////////////////////////////
function SetupFolders()
NUMBER nResult;
begin
// TODO : Add all your folder (program group) along with shortcuts (program items)
//
//
// CreateProgramFolder, AddFolderIcon....
//
nResult = CreateShellObjects( "" );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: CleanUpInstall //
// //
// Purpose: This cleans up the setup. Anything that should //
// be released or deleted at the end of the setup should //
// be done here. //
// //
///////////////////////////////////////////////////////////////////////////////
function CleanUpInstall()
begin
if (bInstallAborted) then
return 0;
endif;
DialogShowSdFinishReboot();
if (BATCH_INSTALL) then // ensure locked files are properly written
CommitSharedFiles(0);
endif;
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: SetupInstall //
// //
// Purpose: This will setup the installation. Any general initialization //
// needed for the installation should be performed here. //
// //
///////////////////////////////////////////////////////////////////////////////
function SetupInstall()
begin
Enable( CORECOMPONENTHANDLING );
bInstallAborted = FALSE;
if (bIs32BitSetup) then
svDir = "C:\\mysql"; //PROGRAMFILES ^ @COMPANY_NAME ^ @PRODUCT_NAME;
else
svDir = "C:\\mysql"; //PROGRAMFILES ^ @COMPANY_NAME16 ^ @PRODUCT_NAME16; // use shorten names
endif;
TARGETDIR = svDir;
SdProductName( @PRODUCT_NAME );
Enable( DIALOGCACHE );
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: SetupScreen //
// //
// Purpose: This function establishes the screen look. This includes //
// colors, fonts, and text to be displayed. //
// //
///////////////////////////////////////////////////////////////////////////////
function SetupScreen()
begin
Enable( FULLWINDOWMODE );
Enable( INDVFILESTATUS );
SetTitle( @TITLE_MAIN, 24, WHITE );
SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION ); // Caption bar text.
Enable( BACKGROUND );
Delay( 1 );
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: CheckRequirements //
// //
// Purpose: This function checks all minimum requirements for the //
// application being installed. If any fail, then the user //
// is informed and the setup is terminated. //
// //
///////////////////////////////////////////////////////////////////////////////
function CheckRequirements()
NUMBER nvDx, nvDy, nvResult;
STRING svResult;
begin
bWinNT = FALSE;
bIsShellExplorer = FALSE;
// Check screen resolution.
GetExtents( nvDx, nvDy );
if (nvDy < 480) then
MessageBox( @ERROR_VGARESOLUTION, WARNING );
abort;
endif;
// set 'setup' operation mode
bIs32BitSetup = TRUE;
GetSystemInfo( ISTYPE, nvResult, svResult );
if (nvResult = 16) then
bIs32BitSetup = FALSE; // running 16-bit setup
return 0; // no additional information required
endif;
// --- 32-bit testing after this point ---
// Determine the target system's operating system.
GetSystemInfo( OS, nvResult, svResult );
if (nvResult = IS_WINDOWSNT) then
// Running Windows NT.
bWinNT = TRUE;
// Check to see if the shell being used is EXPLORER shell.
if (GetSystemInfo( OSMAJOR, nvResult, svResult ) = 0) then
if (nvResult >= 4) then
bIsShellExplorer = TRUE;
endif;
endif;
elseif (nvResult = IS_WINDOWS95 ) then
bIsShellExplorer = TRUE;
endif;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdWelcome //
// //
// Purpose: This function handles the standard welcome dialog. //
// //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdWelcome()
NUMBER nResult;
STRING szTitle, szMsg;
begin
szTitle = "";
szMsg = "";
nResult = SdWelcome( szTitle, szMsg );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdShowInfoList //
// //
// Purpose: This function displays the general information list dialog. //
// //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdShowInfoList()
NUMBER nResult;
LIST list;
STRING szTitle, szMsg, szFile;
begin
szFile = SUPPORTDIR ^ "infolist.txt";
list = ListCreate( STRINGLIST );
ListReadFromFile( list, szFile );
szTitle = "";
szMsg = " ";
nResult = SdShowInfoList( szTitle, szMsg, list );
ListDestroy( list );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdAskDestPath //
// //
// Purpose: This function asks the user for the destination directory. //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdAskDestPath()
NUMBER nResult;
STRING szTitle, szMsg;
begin
szTitle = "";
szMsg = "";
nResult = SdAskDestPath( szTitle, szMsg, svDir, 0 );
TARGETDIR = svDir;
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdSetupType //
// //
// Purpose: This function displays the standard setup type dialog. //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdSetupType()
NUMBER nResult, nType;
STRING szTitle, szMsg;
begin
switch (svSetupType)
case "Typical":
nType = TYPICAL;
case "Custom":
nType = CUSTOM;
case "Compact":
nType = COMPACT;
case "":
svSetupType = "Typical";
nType = TYPICAL;
endswitch;
szTitle = "";
szMsg = "";
nResult = SetupType( szTitle, szMsg, "", nType, 0 );
switch (nResult)
case COMPACT:
svSetupType = "Compact";
case TYPICAL:
svSetupType = "Typical";
case CUSTOM:
svSetupType = "Custom";
endswitch;
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdComponentDialog2 //
// //
// Purpose: This function displays the custom component dialog. //
// //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdComponentDialog2()
NUMBER nResult;
STRING szTitle, szMsg;
begin
if ((svSetupType != "Custom") && (svSetupType != "")) then
return 0;
endif;
szTitle = "";
szMsg = "";
nResult = SdComponentDialog2( szTitle, szMsg, svDir, "" );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdFinishReboot //
// //
// Purpose: This function will show the last dialog of the product. //
// It will allow the user to reboot and/or show some readme text. //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdFinishReboot()
NUMBER nResult, nDefOptions;
STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;
NUMBER bOpt1, bOpt2;
begin
if (!BATCH_INSTALL) then
bOpt1 = FALSE;
bOpt2 = FALSE;
szMsg1 = "";
szMsg2 = "";
szOption1 = "";
szOption2 = "";
nResult = SdFinish( szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2 );
return 0;
endif;
nDefOptions = SYS_BOOTMACHINE;
szTitle = "";
szMsg1 = "";
szMsg2 = "";
nResult = SdFinishReboot( szTitle, szMsg1, nDefOptions, szMsg2, 0 );
return nResult;
end;
// --- include script file section ---
#include "sddialog.rul"

View File

@ -15,6 +15,7 @@ file7=C:\mysql\bin\mysqlc.exe
file8=C:\mysql\bin\mysqlcheck.exe
file9=C:\mysql\bin\mysqldump.exe
file20=C:\mysql\bin\winmysqladmin.exe
file21=C:\mysql\bin\myisam_ftdump.exe
file10=C:\mysql\bin\mysqlimport.exe
fulldirectory=
file11=C:\mysql\bin\mysqlshow.exe

View File

@ -219,6 +219,7 @@ file32=C:\mysql\scripts\mysqlbug.sh
file21=C:\mysql\scripts\mysql_setpermission
file10=C:\mysql\scripts\mysql_find_rows
fulldirectory=
file44=C:\mysql\scripts\mysql_fix_privilege_tables.sql
file33=C:\mysql\scripts\mysqld_multi
file22=C:\mysql\scripts\mysql_setpermission.pl
file11=C:\mysql\scripts\mysql_find_rows.pl

View File

@ -135,6 +135,7 @@ file1=C:\mysql\my-large.cnf
file2=C:\mysql\my-medium.cnf
file3=C:\mysql\my-small.cnf
file4=C:\mysql\MySQLEULA.txt
file5=C:\mysql\README.txt
SubDir0=bin
SubDir1=share
SubDir2=Embedded

View File

@ -0,0 +1,641 @@
////////////////////////////////////////////////////////////////////////////////
//
// IIIIIII SSSSSS
// II SS InstallShield (R)
// II SSSSSS (c) 1996-1997, InstallShield Software Corporation
// II SS (c) 1990-1996, InstallShield Corporation
// IIIIIII SSSSSS All Rights Reserved.
//
//
// This code is generated as a starting setup template. You should
// modify it to provide all necessary steps for your setup.
//
//
// File Name: Setup.rul
//
// Description: InstallShield script
//
// Comments: This template script performs a basic setup on a
// Windows 95 or Windows NT 4.0 platform. With minor
// modifications, this template can be adapted to create
// new, customized setups.
//
////////////////////////////////////////////////////////////////////////////////
// Include header file
#include "sdlang.h"
#include "sddialog.h"
////////////////////// string defines ////////////////////////////
#define UNINST_LOGFILE_NAME "Uninst.isu"
//////////////////// installation declarations ///////////////////
// ----- DLL prototypes -----
// your DLL prototypes
// ---- script prototypes -----
// generated
prototype ShowDialogs();
prototype MoveFileData();
prototype HandleMoveDataError( NUMBER );
prototype ProcessBeforeDataMove();
prototype ProcessAfterDataMove();
prototype SetupRegistry();
prototype SetupFolders();
prototype CleanUpInstall();
prototype SetupInstall();
prototype SetupScreen();
prototype CheckRequirements();
prototype DialogShowSdWelcome();
prototype DialogShowSdShowInfoList();
prototype DialogShowSdAskDestPath();
prototype DialogShowSdSetupType();
prototype DialogShowSdComponentDialog2();
prototype DialogShowSdFinishReboot();
// your prototypes
// ----- global variables ------
// generated
BOOL bWinNT, bIsShellExplorer, bInstallAborted, bIs32BitSetup;
STRING svDir;
STRING svName, svCompany, svSerial;
STRING szAppPath;
STRING svSetupType;
// your global variables
///////////////////////////////////////////////////////////////////////////////
//
// MAIN PROGRAM
//
// The setup begins here by hiding the visible setup
// window. This is done to allow all the titles, images, etc. to
// be established before showing the main window. The following
// logic then performs the setup in a series of steps.
//
///////////////////////////////////////////////////////////////////////////////
program
Disable( BACKGROUND );
CheckRequirements();
SetupInstall();
SetupScreen();
if (ShowDialogs()<0) goto end_install;
if (ProcessBeforeDataMove()<0) goto end_install;
if (MoveFileData()<0) goto end_install;
if (ProcessAfterDataMove()<0) goto end_install;
if (SetupRegistry()<0) goto end_install;
if (SetupFolders()<0) goto end_install;
end_install:
CleanUpInstall();
// If an unrecoverable error occurred, clean up the partial installation.
// Otherwise, exit normally.
if (bInstallAborted) then
abort;
endif;
endprogram
///////////////////////////////////////////////////////////////////////////////
// //
// Function: ShowDialogs //
// //
// Purpose: This function manages the display and navigation //
// the standard dialogs that exist in a setup. //
// //
///////////////////////////////////////////////////////////////////////////////
function ShowDialogs()
NUMBER nResult;
begin
Dlg_Start:
// beginning of dialogs label
Dlg_SdWelcome:
nResult = DialogShowSdWelcome();
if (nResult = BACK) goto Dlg_Start;
Dlg_SdShowInfoList:
nResult = DialogShowSdShowInfoList();
if (nResult = BACK) goto Dlg_SdWelcome;
Dlg_SdAskDestPath:
nResult = DialogShowSdAskDestPath();
if (nResult = BACK) goto Dlg_SdShowInfoList;
Dlg_SdSetupType:
nResult = DialogShowSdSetupType();
if (nResult = BACK) goto Dlg_SdAskDestPath;
Dlg_SdComponentDialog2:
if ((nResult = BACK) && (svSetupType != "Custom") && (svSetupType != "")) then
goto Dlg_SdSetupType;
endif;
nResult = DialogShowSdComponentDialog2();
if (nResult = BACK) goto Dlg_SdSetupType;
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: ProcessBeforeDataMove //
// //
// Purpose: This function performs any necessary operations prior to the //
// actual data move operation. //
// //
///////////////////////////////////////////////////////////////////////////////
function ProcessBeforeDataMove()
STRING svLogFile;
NUMBER nResult;
begin
InstallationInfo( @COMPANY_NAME, @PRODUCT_NAME, @PRODUCT_VERSION, @PRODUCT_KEY );
svLogFile = UNINST_LOGFILE_NAME;
nResult = DeinstallStart( svDir, svLogFile, @UNINST_KEY, 0 );
if (nResult < 0) then
MessageBox( @ERROR_UNINSTSETUP, WARNING );
endif;
szAppPath = TARGETDIR; // TODO : if your application .exe is in a subdir of TARGETDIR then add subdir
if ((bIs32BitSetup) && (bIsShellExplorer)) then
// RegDBSetItem( REGDB_APPPATH, szAppPath );
// RegDBSetItem( REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY );
RegDBSetItem( REGDB_UNINSTALL_NAME, @UNINST_DISPLAY_NAME );
endif;
// TODO : update any items you want to process before moving the data
//
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: MoveFileData //
// //
// Purpose: This function handles the data movement for //
// the setup. //
// //
///////////////////////////////////////////////////////////////////////////////
function MoveFileData()
NUMBER nResult, nDisk;
begin
nDisk = 1;
SetStatusWindow( 0, "" );
Disable( DIALOGCACHE );
Enable( STATUS );
StatusUpdate( ON, 100 );
nResult = ComponentMoveData( MEDIA, nDisk, 0 );
HandleMoveDataError( nResult );
Disable( STATUS );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: HandleMoveDataError //
// //
// Purpose: This function handles the error (if any) during the move data //
// operation. //
// //
///////////////////////////////////////////////////////////////////////////////
function HandleMoveDataError( nResult )
STRING szErrMsg, svComponent , svFileGroup , svFile;
begin
svComponent = "";
svFileGroup = "";
svFile = "";
switch (nResult)
case 0:
return 0;
default:
ComponentError ( MEDIA , svComponent , svFileGroup , svFile , nResult );
szErrMsg = @ERROR_MOVEDATA + "\n\n" +
@ERROR_COMPONENT + " " + svComponent + "\n" +
@ERROR_FILEGROUP + " " + svFileGroup + "\n" +
@ERROR_FILE + " " + svFile;
SprintfBox( SEVERE, @TITLE_CAPTIONBAR, szErrMsg, nResult );
bInstallAborted = TRUE;
return nResult;
endswitch;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: ProcessAfterDataMove //
// //
// Purpose: This function performs any necessary operations needed after //
// all data has been moved. //
// //
///////////////////////////////////////////////////////////////////////////////
function ProcessAfterDataMove()
begin
// TODO : update self-registered files and other processes that
// should be performed after the data has been moved.
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: SetupRegistry //
// //
// Purpose: This function makes the registry entries for this setup. //
// //
///////////////////////////////////////////////////////////////////////////////
function SetupRegistry()
NUMBER nResult;
begin
// TODO : Add all your registry entry keys here
//
//
// RegDBCreateKeyEx, RegDBSetKeyValueEx....
//
nResult = CreateRegistrySet( "" );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
//
// Function: SetupFolders
//
// Purpose: This function creates all the folders and shortcuts for the
// setup. This includes program groups and items for Windows 3.1.
//
///////////////////////////////////////////////////////////////////////////////
function SetupFolders()
NUMBER nResult;
begin
// TODO : Add all your folder (program group) along with shortcuts (program items)
//
//
// CreateProgramFolder, AddFolderIcon....
//
nResult = CreateShellObjects( "" );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: CleanUpInstall //
// //
// Purpose: This cleans up the setup. Anything that should //
// be released or deleted at the end of the setup should //
// be done here. //
// //
///////////////////////////////////////////////////////////////////////////////
function CleanUpInstall()
begin
if (bInstallAborted) then
return 0;
endif;
DialogShowSdFinishReboot();
if (BATCH_INSTALL) then // ensure locked files are properly written
CommitSharedFiles(0);
endif;
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: SetupInstall //
// //
// Purpose: This will setup the installation. Any general initialization //
// needed for the installation should be performed here. //
// //
///////////////////////////////////////////////////////////////////////////////
function SetupInstall()
begin
Enable( CORECOMPONENTHANDLING );
bInstallAborted = FALSE;
if (bIs32BitSetup) then
svDir = "C:\\mysql"; //PROGRAMFILES ^ @COMPANY_NAME ^ @PRODUCT_NAME;
else
svDir = "C:\\mysql"; //PROGRAMFILES ^ @COMPANY_NAME16 ^ @PRODUCT_NAME16; // use shorten names
endif;
TARGETDIR = svDir;
SdProductName( @PRODUCT_NAME );
Enable( DIALOGCACHE );
return 0;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: SetupScreen //
// //
// Purpose: This function establishes the screen look. This includes //
// colors, fonts, and text to be displayed. //
// //
///////////////////////////////////////////////////////////////////////////////
function SetupScreen()
begin
Enable( FULLWINDOWMODE );
Enable( INDVFILESTATUS );
SetTitle( @TITLE_MAIN, 24, WHITE );
SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION ); // Caption bar text.
Enable( BACKGROUND );
Delay( 1 );
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: CheckRequirements //
// //
// Purpose: This function checks all minimum requirements for the //
// application being installed. If any fail, then the user //
// is informed and the setup is terminated. //
// //
///////////////////////////////////////////////////////////////////////////////
function CheckRequirements()
NUMBER nvDx, nvDy, nvResult;
STRING svResult;
begin
bWinNT = FALSE;
bIsShellExplorer = FALSE;
// Check screen resolution.
GetExtents( nvDx, nvDy );
if (nvDy < 480) then
MessageBox( @ERROR_VGARESOLUTION, WARNING );
abort;
endif;
// set 'setup' operation mode
bIs32BitSetup = TRUE;
GetSystemInfo( ISTYPE, nvResult, svResult );
if (nvResult = 16) then
bIs32BitSetup = FALSE; // running 16-bit setup
return 0; // no additional information required
endif;
// --- 32-bit testing after this point ---
// Determine the target system's operating system.
GetSystemInfo( OS, nvResult, svResult );
if (nvResult = IS_WINDOWSNT) then
// Running Windows NT.
bWinNT = TRUE;
// Check to see if the shell being used is EXPLORER shell.
if (GetSystemInfo( OSMAJOR, nvResult, svResult ) = 0) then
if (nvResult >= 4) then
bIsShellExplorer = TRUE;
endif;
endif;
elseif (nvResult = IS_WINDOWS95 ) then
bIsShellExplorer = TRUE;
endif;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdWelcome //
// //
// Purpose: This function handles the standard welcome dialog. //
// //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdWelcome()
NUMBER nResult;
STRING szTitle, szMsg;
begin
szTitle = "";
szMsg = "";
nResult = SdWelcome( szTitle, szMsg );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdShowInfoList //
// //
// Purpose: This function displays the general information list dialog. //
// //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdShowInfoList()
NUMBER nResult;
LIST list;
STRING szTitle, szMsg, szFile;
begin
szFile = SUPPORTDIR ^ "infolist.txt";
list = ListCreate( STRINGLIST );
ListReadFromFile( list, szFile );
szTitle = "";
szMsg = " ";
nResult = SdShowInfoList( szTitle, szMsg, list );
ListDestroy( list );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdAskDestPath //
// //
// Purpose: This function asks the user for the destination directory. //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdAskDestPath()
NUMBER nResult;
STRING szTitle, szMsg;
begin
szTitle = "";
szMsg = "";
nResult = SdAskDestPath( szTitle, szMsg, svDir, 0 );
TARGETDIR = svDir;
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdSetupType //
// //
// Purpose: This function displays the standard setup type dialog. //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdSetupType()
NUMBER nResult, nType;
STRING szTitle, szMsg;
begin
switch (svSetupType)
case "Typical":
nType = TYPICAL;
case "Custom":
nType = CUSTOM;
case "Compact":
nType = COMPACT;
case "":
svSetupType = "Typical";
nType = TYPICAL;
endswitch;
szTitle = "";
szMsg = "";
nResult = SetupType( szTitle, szMsg, "", nType, 0 );
switch (nResult)
case COMPACT:
svSetupType = "Compact";
case TYPICAL:
svSetupType = "Typical";
case CUSTOM:
svSetupType = "Custom";
endswitch;
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdComponentDialog2 //
// //
// Purpose: This function displays the custom component dialog. //
// //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdComponentDialog2()
NUMBER nResult;
STRING szTitle, szMsg;
begin
if ((svSetupType != "Custom") && (svSetupType != "")) then
return 0;
endif;
szTitle = "";
szMsg = "";
nResult = SdComponentDialog2( szTitle, szMsg, svDir, "" );
return nResult;
end;
///////////////////////////////////////////////////////////////////////////////
// //
// Function: DialogShowSdFinishReboot //
// //
// Purpose: This function will show the last dialog of the product. //
// It will allow the user to reboot and/or show some readme text. //
// //
///////////////////////////////////////////////////////////////////////////////
function DialogShowSdFinishReboot()
NUMBER nResult, nDefOptions;
STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;
NUMBER bOpt1, bOpt2;
begin
if (!BATCH_INSTALL) then
bOpt1 = FALSE;
bOpt2 = FALSE;
szMsg1 = "";
szMsg2 = "";
szOption1 = "";
szOption2 = "";
nResult = SdFinish( szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2 );
return 0;
endif;
nDefOptions = SYS_BOOTMACHINE;
szTitle = "";
szMsg1 = "";
szMsg2 = "";
nResult = SdFinishReboot( szTitle, szMsg1, nDefOptions, szMsg2, 0 );
return nResult;
end;
// --- include script file section ---
#include "sddialog.rul"

View File

@ -358,6 +358,10 @@ SOURCE=..\mysys\my_open.c
# End Source File
# Begin Source File
SOURCE=..\mysys\my_file.c
# End Source File
# Begin Source File
SOURCE=..\mysys\my_pread.c
# End Source File
# Begin Source File

View File

@ -24,7 +24,7 @@ CFG=comp_err - Win32 Release
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=xicl6.exe
CPP=cl.exe
RSC=rc.exe
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
@ -45,9 +45,9 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE 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 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
# Name "comp_err - Win32 Release"

View File

@ -25,7 +25,7 @@ CFG=my_print_defaults - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=xicl6.exe
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "my_print_defaults - Win32 Release"
@ -39,6 +39,7 @@ RSC=rc.exe
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "release"
# PROP Intermediate_Dir "release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# 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
@ -47,9 +48,9 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE 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 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"
@ -71,9 +72,9 @@ LINK32=xilink6.exe
BSC32=bscmake.exe
# ADD BASE 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 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

View File

@ -0,0 +1,103 @@
# Microsoft Developer Studio Project File - Name="myisam_ftdump" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=myisam_ftdump - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "myisam_ftdump.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "myisam_ftdump.mak" CFG="myisam_ftdump - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "myisam_ftdump - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "myisam_ftdump - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "myisam_ftdump - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "release"
# PROP Intermediate_Dir "release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../myisam" /D "NDEBUG" /D "DBUG_OFF" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FR /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
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 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"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "debug"
# PROP Intermediate_Dir "debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../myisam" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_CONSOLE" /D "_MBCS" /D "_WINDOWS" /FD /c
# SUBTRACT CPP /Fr
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
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 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
# Begin Target
# Name "myisam_ftdump - Win32 Release"
# Name "myisam_ftdump - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=..\myisam\myisam_ftdump.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@ -51,7 +51,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
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 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"
@ -76,7 +76,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
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 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

View File

@ -231,6 +231,30 @@ Package=<4>
###############################################################################
Project: "myisam_ftdump"=".\myisam_ftdump\myisam_ftdump.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name dbug
End Project Dependency
Begin Project Dependency
Project_Dep_Name myisam
End Project Dependency
Begin Project Dependency
Project_Dep_Name mysys
End Project Dependency
Begin Project Dependency
Project_Dep_Name strings
End Project Dependency
}}}
###############################################################################
Project: "myisamchk"=".\myisamchk\myisamchk.dsp" - Package Owner=<4>
Package=<5>
@ -797,3 +821,4 @@ Package=<3>
}}}
###############################################################################

View File

@ -26,7 +26,7 @@ CFG=mysys - Win32 Debug
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=xicl6.exe
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "mysys - Win32 Release"
@ -42,14 +42,14 @@ RSC=rc.exe
# PROP Intermediate_Dir "release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_SYMLINK" /FD /c
# SUBTRACT CPP /WX /Fr /YX
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=xilink6.exe -lib
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib_release\mysys.lib"
@ -66,14 +66,14 @@ LIB32=xilink6.exe -lib
# PROP Intermediate_Dir "debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c
# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /I "../include" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /D "USE_SYMDIR" /D "USE_SYMLINK" /FD /c
# SUBTRACT CPP /Fr
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=xilink6.exe -lib
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\lib_debug\mysys.lib"
@ -91,14 +91,14 @@ LIB32=xilink6.exe -lib
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G6 /MT /W3 /O2 /I "../include" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_SYMDIR" /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /I "../include" /I "../zlib" /D "NDEBUG" /D "DBUG_OFF" /D "_WINDOWS" /D "USE_SYMDIR" /D "USE_SYMLINK" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=xilink6.exe -lib
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo /out:"..\lib_release\mysys.lib"
# ADD LIB32 /nologo /out:"..\lib_release\mysys-max.lib"
@ -390,6 +390,10 @@ SOURCE=.\my_open.c
# End Source File
# Begin Source File
SOURCE=.\my_file.c
# End Source File
# Begin Source File
SOURCE=.\my_pread.c
# End Source File
# Begin Source File

View File

@ -28,7 +28,7 @@ CFG=mysqld - Win32 Release
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=xicl6.exe
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "mysqld - Win32 Release"
@ -52,7 +52,7 @@ RSC=rc.exe
BSC32=bscmake.exe
# ADD BASE 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 /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 Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"../client_release/mysqld-opt.exe"
# SUBTRACT LINK32 /debug
@ -78,7 +78,7 @@ LINK32=xilink6.exe
BSC32=bscmake.exe
# ADD BASE 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 /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 Wsock32.lib ..\lib_debug\dbug.lib ..\lib_debug\vio.lib ..\lib_debug\isam.lib ..\lib_debug\merge.lib ..\lib_debug\mysys.lib ..\lib_debug\strings.lib ..\lib_debug\regex.lib ..\lib_debug\heap.lib ..\lib_debug\bdb.lib ..\lib_debug\innodb.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"../client_debug/mysqld.exe" /pdbtype:sept
@ -105,7 +105,7 @@ LINK32=xilink6.exe
BSC32=bscmake.exe
# ADD BASE 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 Wsock32.lib ..\lib_release\dbug.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /debug /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 Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\zlib.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-nt.exe"
# SUBTRACT LINK32 /pdb:none /debug
@ -133,7 +133,7 @@ LINK32=xilink6.exe
BSC32=bscmake.exe
# ADD BASE 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 Wsock32.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\zlib.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-nt.exe"
# SUBTRACT BASE LINK32 /pdb:none /debug
# 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 Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys-max.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\zlib.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib /nologo /subsystem:console /map /machine:I386 /out:"../client_release/mysqld-max-nt.exe"
@ -162,7 +162,7 @@ LINK32=xilink6.exe
BSC32=bscmake.exe
# ADD BASE 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 Wsock32.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\mysys.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /out:"../client_release/mysqld-opt.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 Wsock32.lib ..\lib_release\vio.lib ..\lib_release\isam.lib ..\lib_release\merge.lib ..\lib_release\myisam.lib ..\lib_release\myisammrg.lib ..\lib_release\mysys-max.lib ..\lib_release\strings.lib ..\lib_release\regex.lib ..\lib_release\heap.lib ..\lib_release\innodb.lib ..\lib_release\bdb.lib ..\lib_release\zlib.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"../client_release/mysqld-max.exe"
# SUBTRACT LINK32 /debug

View File

@ -1252,7 +1252,6 @@ dnl Some libs are listed several times, in order for gcc to sort out
dnl circular references.
innodb_libs="\
\$(top_builddir)/innobase/usr/libusr.a\
\$(top_builddir)/innobase/odbc/libodbc.a\
\$(top_builddir)/innobase/srv/libsrv.a\
\$(top_builddir)/innobase/dict/libdict.a\
\$(top_builddir)/innobase/que/libque.a\

View File

@ -1029,6 +1029,15 @@ case $SYSTEM_TYPE in
MAX_C_OPTIMIZE="-O"
fi
;;
*darwin7*)
if test "$ac_cv_prog_gcc" = "yes"
then
FLAGS="-DHAVE_DARWIN_THREADS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DFN_NO_CASE_SENCE"
CFLAGS="$CFLAGS $FLAGS"
CXXFLAGS="$CXXFLAGS $FLAGS"
MAX_C_OPTIMIZE="-O"
fi
;;
*freebsd*)
echo "Adding fix for interrupted reads"
OSVERSION=`sysctl -a | grep osreldate | awk '{ print $2 }'`

View File

@ -23,7 +23,7 @@ TAR = gtar
noinst_HEADERS = ib_config.h
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
# Don't update the files from bitkeeper

View File

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

View File

@ -1,312 +0,0 @@
/************************************************************************
Test for the client: interactive SQL
(c) 1996-1997 Innobase Oy
Created 2/16/1996 Heikki Tuuri
*************************************************************************/
#include "univ.i"
#include "ib_odbc.h"
#include "mem0mem.h"
#include "sync0sync.h"
#include "os0thread.h"
#include "os0proc.h"
#include "os0sync.h"
#include "srv0srv.h"
ulint n_exited = 0;
char cli_srv_endpoint_name[100];
char cli_user_name[100];
ulint n_warehouses = ULINT_MAX;
ulint n_customers_d = ULINT_MAX;
bool is_tpc_d = FALSE;
ulint n_rounds = ULINT_MAX;
ulint n_users = ULINT_MAX;
ulint startdate = 0;
ulint enddate = 0;
bool own_warehouse = FALSE;
ulint mem_pool_size = ULINT_MAX;
/*************************************************************************
Reads a keywords and a values from an initfile. In case of an error, exits
from the process. */
static
void
cli_read_initfile(
/*==============*/
FILE* initfile) /* in: file pointer */
{
char str_buf[10000];
ulint ulint_val;
srv_read_init_val(initfile, FALSE, "SRV_ENDPOINT_NAME", str_buf,
&ulint_val);
ut_a(ut_strlen(str_buf) < COM_MAX_ADDR_LEN);
ut_memcpy(cli_srv_endpoint_name, str_buf, COM_MAX_ADDR_LEN);
srv_read_init_val(initfile, FALSE, "USER_NAME", str_buf,
&ulint_val);
ut_a(ut_strlen(str_buf) < COM_MAX_ADDR_LEN);
ut_memcpy(cli_user_name, str_buf, COM_MAX_ADDR_LEN);
srv_read_init_val(initfile, TRUE, "MEM_POOL_SIZE", str_buf,
&mem_pool_size);
srv_read_init_val(initfile, TRUE, "N_WAREHOUSES", str_buf,
&n_warehouses);
srv_read_init_val(initfile, TRUE, "N_CUSTOMERS_D", str_buf,
&n_customers_d);
srv_read_init_val(initfile, TRUE, "IS_TPC_D", str_buf,
&is_tpc_d);
srv_read_init_val(initfile, TRUE, "N_ROUNDS", str_buf,
&n_rounds);
srv_read_init_val(initfile, TRUE, "N_USERS", str_buf,
&n_users);
srv_read_init_val(initfile, TRUE, "STARTDATE", str_buf,
&startdate);
srv_read_init_val(initfile, TRUE, "ENDDATE", str_buf,
&enddate);
srv_read_init_val(initfile, TRUE, "OWN_WAREHOUSE", str_buf,
&own_warehouse);
}
/*************************************************************************
Reads configuration info for the client. */
static
void
cli_boot(
/*=====*/
char* name) /* in: the initialization file name */
{
FILE* initfile;
initfile = fopen(name, "r");
if (initfile == NULL) {
printf(
"Error in client booting: could not open initfile whose name is %s!\n",
name);
os_process_exit(1);
}
cli_read_initfile(initfile);
fclose(initfile);
}
/*********************************************************************
Interactive SQL loop. */
static
void
isql(
/*=*/
FILE* inputfile) /* in: input file containing SQL strings,
or stdin */
{
HENV env;
HDBC conn;
RETCODE ret;
HSTMT sql_query;
ulint tm, oldtm;
char buf[1000];
char* str;
ulint count;
ulint n_begins;
ulint len;
ulint n;
ulint i;
ulint n_lines;
ret = SQLAllocEnv(&env);
ut_a(ret == SQL_SUCCESS);
ret = SQLAllocConnect(env, &conn);
ut_a(ret == SQL_SUCCESS);
ret = SQLConnect(conn, (UCHAR*)cli_srv_endpoint_name,
(SWORD)ut_strlen(cli_srv_endpoint_name),
cli_user_name,
(SWORD)ut_strlen(cli_user_name),
(UCHAR*)"password", 8);
ut_a(ret == SQL_SUCCESS);
printf("Connection established\n");
printf("Interactive SQL performs queries by first making a stored\n");
printf("procedure from them, and then calling the procedure.\n");
printf("Put a semicolon after each statement and\n");
printf("end your query with two <enter>s.\n\n");
printf("You can also give a single input file\n");
printf("as a command line argument to isql.\n\n");
printf("In the file separate SQL queries and procedure bodies\n");
printf("by a single empty line. Do not write the final END; into\n");
printf("a procedure body.\n\n");
count = 0;
loop:
count++;
n = 0;
n_lines = 0;
sprintf(buf, "PROCEDURE P%s%lu () IS\nBEGIN ", cli_user_name,
count);
for (;;) {
len = ut_strlen(buf + n) - 1;
n += len;
if (len == 0) {
break;
} else {
sprintf(buf + n, "\n");
n++;
n_lines++;
}
str = fgets(buf + n, 1000, inputfile);
if ((str == NULL) && (inputfile != stdin)) {
/* Reached end-of-file: switch to input from
keyboard */
inputfile = stdin;
break;
}
ut_a(str);
}
if (n_lines == 1) {
/* Empty procedure */
goto loop;
}
/* If the statement is actually the body of a procedure,
erase the first BEGIN from the string: */
n_begins = 0;
for (i = 0; i < n - 5; i++) {
if (ut_memcmp(buf + i, "BEGIN", 5) == 0) {
n_begins++;
}
}
if (n_begins > 1) {
for (i = 0; i < n - 5; i++) {
if (ut_memcmp(buf + i, "BEGIN", 5) == 0) {
/* Erase the first BEGIN: */
ut_memcpy(buf + i, " ", 5);
break;
}
}
}
sprintf(buf + n, "END;\n");
printf("SQL procedure to execute:\n%s\n", buf);
ret = SQLAllocStmt(conn, &sql_query);
ut_a(ret == SQL_SUCCESS);
ret = SQLPrepare(sql_query, (UCHAR*)buf, ut_strlen(buf));
ut_a(ret == SQL_SUCCESS);
ret = SQLExecute(sql_query);
ut_a(ret == SQL_SUCCESS);
sprintf(buf, "{P%s%lu ()}", cli_user_name, count);
ret = SQLAllocStmt(conn, &sql_query);
ut_a(ret == SQL_SUCCESS);
ret = SQLPrepare(sql_query, (UCHAR*)buf, ut_strlen(buf));
ut_a(ret == SQL_SUCCESS);
printf("Starting to execute the query\n");
oldtm = ut_clock();
ret = SQLExecute(sql_query);
tm = ut_clock();
printf("Wall time for query %lu milliseconds\n\n", tm - oldtm);
ut_a(ret == SQL_SUCCESS);
goto loop;
}
/********************************************************************
Main test function. */
void
main(int argc, char* argv[])
/*========================*/
{
ulint tm, oldtm;
FILE* inputfile;
if (argc > 2) {
printf("Only one input file allowed\n");
os_process_exit(1);
} else if (argc == 2) {
inputfile = fopen(argv[1], "r");
if (inputfile == NULL) {
printf(
"Error: could not open the inputfile whose name is %s!\n",
argv[1]);
os_process_exit(1);
}
} else {
inputfile = stdin;
}
cli_boot("cli_init");
sync_init();
mem_init(mem_pool_size);
oldtm = ut_clock();
isql(inputfile);
tm = ut_clock();
printf("Wall time for test %lu milliseconds\n", tm - oldtm);
printf("TESTS COMPLETED SUCCESSFULLY!\n");
}

View File

@ -1,16 +0,0 @@
include ..\..\makefile.i
doall: tssrv tscli isql
tssrv: ..\btr.lib tssrv.c
$(CCOM) $(CFL) -I.. -I..\.. ..\btr.lib ..\..\eval.lib ..\..\ibuf.lib ..\..\trx.lib ..\..\pars.lib ..\..\que.lib ..\..\lock.lib ..\..\row.lib ..\..\read.lib ..\..\srv.lib ..\..\com.lib ..\..\usr.lib ..\..\thr.lib ..\..\fut.lib ..\..\fsp.lib ..\..\page.lib ..\..\dyn.lib ..\..\mtr.lib ..\..\log.lib ..\..\rem.lib ..\..\fil.lib ..\..\buf.lib ..\..\dict.lib ..\..\data.lib ..\..\mach.lib ..\..\ha.lib ..\..\ut.lib ..\..\sync.lib ..\..\mem.lib ..\..\os.lib tssrv.c $(LFL)
tscli: ..\btr.lib tscli.c
$(CCOM) $(CFL) -I.. -I..\.. ..\btr.lib ..\..\ib_odbc.lib ..\..\eval.lib ..\..\ibuf.lib ..\..\trx.lib ..\..\pars.lib ..\..\que.lib ..\..\lock.lib ..\..\row.lib ..\..\read.lib ..\..\srv.lib ..\..\com.lib ..\..\usr.lib ..\..\thr.lib ..\..\fut.lib ..\..\fsp.lib ..\..\page.lib ..\..\dyn.lib ..\..\mtr.lib ..\..\log.lib ..\..\rem.lib ..\..\fil.lib ..\..\buf.lib ..\..\dict.lib ..\..\data.lib ..\..\mach.lib ..\..\ha.lib ..\..\ut.lib ..\..\sync.lib ..\..\mem.lib ..\..\os.lib tscli.c $(LFL)
isql: ..\btr.lib isql.c
$(CCOM) $(CFL) -I.. -I..\.. ..\btr.lib ..\..\ib_odbc.lib ..\..\eval.lib ..\..\ibuf.lib ..\..\trx.lib ..\..\pars.lib ..\..\que.lib ..\..\lock.lib ..\..\row.lib ..\..\read.lib ..\..\srv.lib ..\..\com.lib ..\..\usr.lib ..\..\thr.lib ..\..\fut.lib ..\..\fsp.lib ..\..\page.lib ..\..\dyn.lib ..\..\mtr.lib ..\..\log.lib ..\..\rem.lib ..\..\fil.lib ..\..\buf.lib ..\..\dict.lib ..\..\data.lib ..\..\mach.lib ..\..\ha.lib ..\..\ut.lib ..\..\sync.lib ..\..\mem.lib ..\..\os.lib isql.c $(LFL)
tsrecv: ..\btr.lib tsrecv.c
$(CCOM) $(CFL) -I.. -I..\.. ..\btr.lib ..\..\ibuf.lib ..\..\trx.lib ..\..\pars.lib ..\..\que.lib ..\..\lock.lib ..\..\row.lib ..\..\read.lib ..\..\srv.lib ..\..\com.lib ..\..\usr.lib ..\..\thr.lib ..\..\fut.lib ..\..\fsp.lib ..\..\page.lib ..\..\dyn.lib ..\..\mtr.lib ..\..\log.lib ..\..\rem.lib ..\..\fil.lib ..\..\buf.lib ..\..\dict.lib ..\..\data.lib ..\..\mach.lib ..\..\ha.lib ..\..\ut.lib ..\..\sync.lib ..\..\mem.lib ..\..\os.lib tsrecv.c $(LFL)

View File

@ -1,483 +0,0 @@
/************************************************************************
The test module for the record manager of MVB.
(c) 1994 Heikki Tuuri
Created 1/25/1994 Heikki Tuuri
*************************************************************************/
#include "rm0phr.h"
#include "rm0lgr.h"
#include "ut0ut.h"
#include "buf0mem.h"
#include "rm0ipg.h"
#include "../it0it.h"
#include "../it0hi.h"
#include "../it0ads.h"
byte buf[100];
byte buf2[100];
lint lintbuf[2048];
byte numbuf[6000];
byte numlogrecbuf[100];
phr_record_t* qs_table[100000];
lint qs_comp = 0;
extern
void
test1(void);
#ifdef NOT_DEFINED
void
q_sort(lint low, lint up)
{
phr_record_t* temp, *pivot;
lint i, j;
pivot = qs_table[(low + up) / 2];
i = low;
j = up;
while (i < j) {
qs_comp++;
if (cmp_phr_compare(qs_table[i], pivot)<= 0) {
i++;
} else {
j--;
temp = qs_table[i];
qs_table[i] = qs_table[j];
qs_table[j] = temp;
}
}
if (j == up) {
temp = qs_table[(low + up) / 2];
qs_table[(low + up) / 2] = qs_table[up - 1];
qs_table[up - 1] = temp;
j--;
}
if (j - low <= 1) {
/* do nothing */
} else if (j - low == 2) {
qs_comp++;
if (cmp_phr_compare(qs_table[low],
qs_table[low + 1])
<= 0) {
/* do nothing */
} else {
temp = qs_table[low];
qs_table[low] = qs_table[low + 1];
qs_table[low + 1] = temp;
}
} else {
q_sort(low, j);
}
if (up - j <= 1) {
/* do nothing */
} else if (up - j == 2) {
qs_comp++;
if (cmp_phr_compare(qs_table[j],
qs_table[j + 1])
<= 0) {
/* do nothing */
} else {
temp = qs_table[j];
qs_table[j] = qs_table[j + 1];
qs_table[j + 1] = temp;
}
} else {
q_sort(j, up);
}
}
#endif
extern
void
test1(void)
{
phr_record_t* physrec;
phr_record_t* rec1;
phr_record_t* rec2;
lgr_record_t* logrec;
lgrf_field_t* logfield;
lint len;
byte* str;
lint len2;
lint tm;
lint oldtm;
lint i, j, k, l, m;
bool b;
it_cur_cursor_t cursor;
ipg_cur_cursor_t* page_cursor;
ipg_page_t* page;
byte c4, c3, c2, c1, c0;
lint rand, rnd1, rnd2;
byte* nb;
lgr_record_t* numlogrec;
byte* pgbuf;
mem_stream_t* stream;
lint tree1, tree2, tree3;
lint dummy1, dummy2;
pgbuf = (byte*)lintbuf;
stream = mem_stream_create(0);
printf("-------------------------------------------\n");
printf("TEST 1. Speed and basic tests.\n");
logrec = lgr_create_logical_record(stream, 2);
nb = numbuf;
c4 = '0';
c3 = '0';
for (c2 = '0'; c2 <= '9'; c2++) {
for (c1 = '0'; c1 <= '9'; c1++) {
for (c0 = '0'; c0 <= '9'; c0++) {
*nb = c4; nb++;
*nb = c3; nb++;
*nb = c2; nb++;
*nb = c1; nb++;
*nb = c0; nb++;
*nb = '\0'; nb++;
}
}
}
numlogrec = lgr_create_logical_record(stream, 2);
tree1 = it_create_index_tree();
oldtm = ut_clock();
rand = 99900;
rnd1 = 67;
for (j = 0; j < 1; j++) {
for (i = 0 ; i < 100000; i++) {
rand = (rand + 1) % 100000;
logfield = lgr_get_nth_field(numlogrec, 0);
lgrf_set_data(logfield, numbuf + 6 * (rand / 300));
lgrf_set_len(logfield, 6);
logfield = lgr_get_nth_field(numlogrec, 1);
lgrf_set_data(logfield, numbuf + 6 * (rand % 300));
lgrf_set_len(logfield, 6);
/*
it_insert(tree1, numlogrec);
*/
it_cur_search_tree_to_nth_level(tree1, 1, numlogrec,
IPG_SE_L_GE, &cursor, &dummy1, &dummy2);
/*
it_cur_set_to_first(tree1, &cursor);
*/
it_cur_insert_record(&cursor, numlogrec);
}
}
tm = ut_clock();
printf("Time for inserting %ld recs = %ld \n", i* j, tm - oldtm);
/* it_print_tree(tree1, 10);*/
hi_print_info();
ads_print_info();
/*
oldtm = ut_clock();
rand = 11113;
for (i = 0; i < 5000; i++) {
rand = (rand + 57123) % 100000;
logfield = lgr_get_nth_field(numlogrec, 0);
lgrf_set_data(logfield, numbuf + 6 * (rand / 300));
lgrf_set_len(logfield, 6);
logfield = lgr_get_nth_field(numlogrec, 1);
lgrf_set_data(logfield, numbuf + 6 * (rand % 300));
lgrf_set_len(logfield, 6);
it_cur_search_tree_to_nth_level(tree1, 1, numlogrec,
IPG_SE_L_GE, &cursor, &dummy1, &dummy2);
}
tm = ut_clock();
printf("Time for searching %ld recs = %ld \n", i, tm - oldtm);
*/
it_cur_set_to_first(tree1, &cursor);
rec1 = ipg_cur_get_record(it_cur_get_page_cursor(&cursor));
for (i = 0;; i++) {
it_cur_move_to_next(&cursor);
if (it_cur_end_of_level(&cursor)) {
break;
}
rec2 = ipg_cur_get_record(it_cur_get_page_cursor(&cursor));
ut_a(cmp_phr_compare(rec1, rec2) == -1);
rec1 = rec2;
}
printf("tree1 checked for right sorted order!\n");
#ifdef not_defined
oldtm = ut_clock();
for (j = 0; j < 1; j++) {
rand = 11113;
for (i = 0; i < 3000; i++) {
rand = (rand + 57123) % 100000;
logfield = lgr_get_nth_field(numlogrec, 0);
lgrf_set_data(logfield, numbuf + 6 * (rand / 300));
lgrf_set_len(logfield, 6);
logfield = lgr_get_nth_field(numlogrec, 1);
lgrf_set_data(logfield, numbuf + 6 * (rand % 300));
lgrf_set_len(logfield, 6);
physrec = hi_search(numlogrec);
ut_a(physrec);
}
}
ut_a(physrec);
tm = ut_clock();
printf("Time for hi_search %ld recs = %ld \n", i * j,
tm - oldtm);
oldtm = ut_clock();
for (i = 0; i < 100000; i++) {
/* j += lgr_fold(numlogrec, -1, -1);*/
/* b += phr_lgr_equal(physrec, numlogrec, -1);*/
k += ut_hash_lint(j, HI_TABLE_SIZE);
}
/* ut_a(b);*/
tm = ut_clock();
printf("Time for fold + equal %ld recs %s = %ld \n", i, physrec,
tm - oldtm);
printf("%ld %ld %ld\n", j, b, k);
hi_print_info();
tree2 = it_create_index_tree();
rand = 90000;
for (i = 0; i < 300; i++) {
rand = (rand + 1) % 100000;
logfield = lgr_get_nth_field(numlogrec, 0);
lgrf_set_data(logfield, numbuf + 6 * (rand / 300));
lgrf_set_len(logfield, 6);
logfield = lgr_get_nth_field(numlogrec, 1);
lgrf_set_data(logfield, numbuf + 6 * (rand % 300));
lgrf_set_len(logfield, 6);
it_cur_search_tree_to_nth_level(tree2, 1, numlogrec,
IPG_SE_L_GE, &cursor);
it_cur_insert_record(&cursor, numlogrec);
}
oldtm = ut_clock();
rand = 10000;
for (i = 0; i < 3000; i++) {
rand = (rand + 1) % 100000;
logfield = lgr_get_nth_field(numlogrec, 0);
lgrf_set_data(logfield, numbuf + 6 * (rand / 300));
lgrf_set_len(logfield, 6);
logfield = lgr_get_nth_field(numlogrec, 1);
lgrf_set_data(logfield, numbuf + 6 * (rand % 300));
lgrf_set_len(logfield, 6);
it_cur_search_tree_to_nth_level(tree2, 1, numlogrec,
IPG_SE_L_GE, &cursor);
it_cur_insert_record(&cursor, numlogrec);
}
tm = ut_clock();
printf("Time for inserting sequentially %ld recs = %ld \n",
i, tm - oldtm);
/* it_print_tree(tree2, 10); */
tree3 = it_create_index_tree();
rand = 0;
for (i = 0; i < 300; i++) {
rand = (rand + 1) % 100000;
logfield = lgr_get_nth_field(numlogrec, 0);
lgrf_set_data(logfield, numbuf + 6 * (rand / 300));
lgrf_set_len(logfield, 6);
logfield = lgr_get_nth_field(numlogrec, 1);
lgrf_set_data(logfield, numbuf + 6 * (rand % 300));
lgrf_set_len(logfield, 6);
it_cur_search_tree_to_nth_level(tree3, 1, numlogrec,
IPG_SE_L_GE, &cursor);
it_cur_insert_record(&cursor, numlogrec);
}
oldtm = ut_clock();
rand = 100000;
for (i = 0; i < 3000; i++) {
rand = (rand - 1) % 100000;
logfield = lgr_get_nth_field(numlogrec, 0);
lgrf_set_data(logfield, numbuf + 6 * (rand / 300));
lgrf_set_len(logfield, 6);
logfield = lgr_get_nth_field(numlogrec, 1);
lgrf_set_data(logfield, numbuf + 6 * (rand % 300));
lgrf_set_len(logfield, 6);
it_cur_search_tree_to_nth_level(tree3, 1, numlogrec,
IPG_SE_L_GE, &cursor);
it_cur_insert_record(&cursor, numlogrec);
}
tm = ut_clock();
printf("Time for inserting sequentially downw. %ld recs = %ld \n",
i, tm - oldtm);
/* it_print_tree(tree3, 10); */
#endif
}
#ifdef NOT_DEFINED
/* Test of quicksort */
void
test2(void)
{
mem_stream_t* stream;
byte* stbuf;
lgrf_field_t* logfield;
lint tm;
lint oldtm;
lint i, j, k, l, m;
lint rand;
lgr_record_t* numlogrec;
phr_record_t* ph_rec;
stream = mem_stream_create(1000);
numlogrec = lgr_create_logical_record(stream, 2);
oldtm = ut_clock();
rand = 11113;
for (i = 0; i < 50000; i++) {
stbuf = mem_stream_alloc(stream, 30);
rand = (rand + 57123) % 100000;
logfield = lgr_get_nth_field(numlogrec, 0);
lgrf_set_data(logfield, numbuf + 6 * (rand / 300));
lgrf_set_len(logfield, 6);
logfield = lgr_get_nth_field(numlogrec, 1);
lgrf_set_data(logfield, numbuf + 6 * (rand % 300));
lgrf_set_len(logfield, 6);
ph_rec = phr_create_physical_record(stbuf, 30, numlogrec);
qs_table[i] = ph_rec;
}
tm = ut_clock();
printf("Time for inserting %ld recs to mem stream = %ld \n",
i, tm - oldtm);
oldtm = ut_clock();
q_sort(0, 50000);
tm = ut_clock();
printf("Time for quicksort of %ld recs = %ld, comps: %ld \n",
i, tm - oldtm, qs_comp);
for (i = 1; i < 49999; i++) {
ut_a(-1 ==
cmp_phr_compare(qs_table[i], qs_table[i+1]
));
}
tm = ut_clock();
oldtm = ut_clock();
for (i = 1; i < 50000; i++) {
k += cmp_phr_compare(qs_table[i & 0xF],
qs_table[5]);
}
tm = ut_clock();
printf("%ld\n", k);
printf("Time for cmp of %ld ph_recs = %ld \n",
i, tm - oldtm);
mem_stream_free(stream);
}
#endif
void
main(void)
{
test1();
/* test2(); */
}

View File

@ -1,798 +0,0 @@
/************************************************************************
The test for the index tree
(c) 1994-1996 Innobase Oy
Created 2/16/1996 Heikki Tuuri
*************************************************************************/
#include "sync0sync.h"
#include "ut0mem.h"
#include "mem0mem.h"
#include "data0data.h"
#include "data0type.h"
#include "dict0dict.h"
#include "buf0buf.h"
#include "os0file.h"
#include "fil0fil.h"
#include "fsp0fsp.h"
#include "rem0rec.h"
#include "rem0cmp.h"
#include "mtr0mtr.h"
#include "log0log.h"
#include "page0page.h"
#include "page0cur.h"
#include "..\btr0btr.h"
#include "..\btr0cur.h"
#include "..\btr0pcur.h"
os_file_t files[1000];
mutex_t ios_mutex;
ulint ios;
ulint n[10];
mutex_t incs_mutex;
ulint incs;
byte bigbuf[1000000];
#define N_SPACES 1
#define N_FILES 2
#define FILE_SIZE 1000 /* must be > 512 */
#define POOL_SIZE 1000
#define COUNTER_OFFSET 1500
#define LOOP_SIZE 150
#define N_THREADS 5
ulint zero = 0;
buf_block_t* bl_arr[POOL_SIZE];
/************************************************************************
Io-handler thread function. */
ulint
handler_thread(
/*===========*/
void* arg)
{
ulint segment;
void* mess;
ulint i;
bool ret;
segment = *((ulint*)arg);
printf("Io handler thread %lu starts\n", segment);
for (i = 0;; i++) {
ret = fil_aio_wait(segment, &mess);
ut_a(ret);
buf_page_io_complete((buf_block_t*)mess);
mutex_enter(&ios_mutex);
ios++;
mutex_exit(&ios_mutex);
}
return(0);
}
/*************************************************************************
Creates the files for the file system test and inserts them to
the file system. */
void
create_files(void)
/*==============*/
{
bool ret;
ulint i, k;
char name[20];
os_thread_t thr[5];
os_thread_id_t id[5];
printf("--------------------------------------------------------\n");
printf("Create or open database files\n");
strcpy(name, "j:\\tsfile00");
for (k = 0; k < N_SPACES; k++) {
for (i = 0; i < N_FILES; i++) {
name[9] = (char)((ulint)'0' + k);
name[10] = (char)((ulint)'0' + i);
files[i] = os_file_create(name, OS_FILE_CREATE,
OS_FILE_TABLESPACE, &ret);
if (ret == FALSE) {
ut_a(os_file_get_last_error() ==
OS_FILE_ALREADY_EXISTS);
files[i] = os_file_create(
name, OS_FILE_OPEN,
OS_FILE_TABLESPACE, &ret);
ut_a(ret);
}
ret = os_file_close(files[i]);
ut_a(ret);
if (i == 0) {
fil_space_create(name, k, OS_FILE_TABLESPACE);
}
ut_a(fil_validate());
fil_node_create(name, FILE_SIZE, k);
}
}
ios = 0;
mutex_create(&ios_mutex);
for (i = 0; i < 5; i++) {
n[i] = i;
thr[i] = os_thread_create(handler_thread, n + i, id + i);
}
}
/************************************************************************
Inits space header of space 0. */
void
init_space(void)
/*============*/
{
mtr_t mtr;
printf("Init space header\n");
mtr_start(&mtr);
fsp_header_init(0, FILE_SIZE * N_FILES, &mtr);
mtr_commit(&mtr);
}
/*********************************************************************
Test for index page. */
void
test1(void)
/*=======*/
{
dtuple_t* tuple;
mem_heap_t* heap;
ulint rnd = 0;
dict_index_t* index;
dict_table_t* table;
dict_tree_t* tree;
mtr_t mtr;
byte buf[8];
ulint i;
ulint tm, oldtm;
btr_pcur_t cursor;
printf("-------------------------------------------------\n");
printf("TEST 1. Basic test\n");
heap = mem_heap_create(0);
table = dict_mem_table_create("TS_TABLE1", 2);
dict_mem_table_add_col(table, "COL1", DATA_VARCHAR, DATA_ENGLISH, 10, 0);
dict_mem_table_add_col(table, "COL2", DATA_VARCHAR, DATA_ENGLISH, 10, 0);
dict_table_add_to_cache(table);
index = dict_mem_index_create("TS_TABLE1", "IND1", 0, 2, 0);
dict_mem_index_add_field(index, "COL1", 0);
dict_mem_index_add_field(index, "COL2", 0);
dict_index_add_to_cache(index);
index = dict_index_get("TS_TABLE1", "IND1");
ut_a(index);
tree = dict_index_get_tree(index);
tuple = dtuple_create(heap, 3);
mtr_start(&mtr);
btr_root_create(tree, 0, &mtr);
mtr_commit(&mtr);
mtr_start(&mtr);
dtuple_gen_test_tuple3(tuple, 0, buf);
btr_insert(tree, tuple, &mtr);
mtr_commit(&mtr);
rnd = 90000;
oldtm = ut_clock();
for (i = 0; i < 1000 * UNIV_DBC * UNIV_DBC; i++) {
mtr_start(&mtr);
if (i == 77000) {
rnd = rnd % 200000;
}
rnd = (rnd + 15675751) % 200000;
dtuple_gen_test_tuple3(tuple, rnd, buf);
btr_insert(tree, tuple, &mtr);
mtr_commit(&mtr);
}
tm = ut_clock();
printf("Wall time for test %lu milliseconds\n", tm - oldtm);
rnd = 90000;
oldtm = ut_clock();
for (i = 0; i < 1000 * UNIV_DBC * UNIV_DBC; i++) {
mtr_start(&mtr);
if (i == 50000) {
rnd = rnd % 200000;
}
rnd = (rnd + 595659561) % 200000;
dtuple_gen_test_tuple3(tuple, rnd, buf);
btr_pcur_open(tree, tuple, PAGE_CUR_GE,
BTR_SEARCH_LEAF, &cursor, &mtr);
mtr_commit(&mtr);
}
tm = ut_clock();
printf("Wall time for test %lu milliseconds\n", tm - oldtm);
rnd = 0;
oldtm = ut_clock();
for (i = 0; i < 1000 * UNIV_DBC * UNIV_DBC; i++) {
mtr_start(&mtr);
rnd = (rnd + 35608971) % 200000 + 1;
dtuple_gen_test_tuple3(tuple, rnd, buf);
mtr_commit(&mtr);
}
tm = ut_clock();
printf("Wall time for test %lu milliseconds\n", tm - oldtm);
/* btr_print_tree(tree, 3); */
mem_heap_free(heap);
}
#ifdef notdefined
mtr_start(&mtr);
block = buf_page_create(0, 5, &mtr);
buf_page_x_lock(block, &mtr);
frame = buf_block_get_frame(block);
page = page_create(frame, &mtr);
for (i = 0; i < 512; i++) {
rnd = (rnd + 534671) % 512;
if (i % 27 == 0) {
ut_a(page_validate(page, index));
}
dtuple_gen_test_tuple(tuple, rnd);
/* dtuple_print(tuple);*/
page_cur_search(page, tuple, PAGE_CUR_G, &cursor);
rec = page_cur_insert_rec(&cursor, tuple, NULL, &mtr);
ut_a(rec);
rec_validate(rec);
/* page_print_list(page, 151); */
}
/* page_print_list(page, 151); */
ut_a(page_validate(page, index));
ut_a(page_get_n_recs(page) == 512);
for (i = 0; i < 512; i++) {
rnd = (rnd + 7771) % 512;
if (i % 27 == 0) {
ut_a(page_validate(page, index));
}
dtuple_gen_test_tuple(tuple, rnd);
/* dtuple_print(tuple);*/
page_cur_search(page, tuple, PAGE_CUR_G, &cursor);
page_cur_delete_rec(&cursor, &mtr);
ut_a(rec);
rec_validate(rec);
/* page_print_list(page, 151); */
}
ut_a(page_get_n_recs(page) == 0);
ut_a(page_validate(page, index));
page = page_create(frame, &mtr);
rnd = 311;
for (i = 0; i < 512; i++) {
rnd = (rnd + 1) % 512;
if (i % 27 == 0) {
ut_a(page_validate(page, index));
}
dtuple_gen_test_tuple(tuple, rnd);
/* dtuple_print(tuple);*/
page_cur_search(page, tuple, PAGE_CUR_G, &cursor);
rec = page_cur_insert_rec(&cursor, tuple, NULL, &mtr);
ut_a(rec);
rec_validate(rec);
/* page_print_list(page, 151); */
}
ut_a(page_validate(page, index));
ut_a(page_get_n_recs(page) == 512);
rnd = 217;
for (i = 0; i < 512; i++) {
rnd = (rnd + 1) % 512;
if (i % 27 == 0) {
ut_a(page_validate(page, index));
}
dtuple_gen_test_tuple(tuple, rnd);
/* dtuple_print(tuple);*/
page_cur_search(page, tuple, PAGE_CUR_G, &cursor);
page_cur_delete_rec(&cursor, &mtr);
ut_a(rec);
rec_validate(rec);
/* page_print_list(page, 151); */
}
ut_a(page_validate(page, index));
ut_a(page_get_n_recs(page) == 0);
page = page_create(frame, &mtr);
rnd = 291;
for (i = 0; i < 512; i++) {
rnd = (rnd - 1) % 512;
if (i % 27 == 0) {
ut_a(page_validate(page, index));
}
dtuple_gen_test_tuple(tuple, rnd);
/* dtuple_print(tuple);*/
page_cur_search(page, tuple, PAGE_CUR_G, &cursor);
rec = page_cur_insert_rec(&cursor, tuple, NULL, &mtr);
ut_a(rec);
rec_validate(rec);
/* page_print_list(page, 151); */
}
ut_a(page_validate(page, index));
ut_a(page_get_n_recs(page) == 512);
rnd = 277;
for (i = 0; i < 512; i++) {
rnd = (rnd - 1) % 512;
if (i % 27 == 0) {
ut_a(page_validate(page, index));
}
dtuple_gen_test_tuple(tuple, rnd);
/* dtuple_print(tuple);*/
page_cur_search(page, tuple, PAGE_CUR_G, &cursor);
page_cur_delete_rec(&cursor, &mtr);
ut_a(rec);
rec_validate(rec);
/* page_print_list(page, 151); */
}
ut_a(page_validate(page, index));
ut_a(page_get_n_recs(page) == 0);
mtr_commit(&mtr);
mem_heap_free(heap);
}
/*********************************************************************
Test for index page. */
void
test2(void)
/*=======*/
{
page_t* page;
dtuple_t* tuple;
mem_heap_t* heap;
ulint i, j;
ulint rnd = 0;
rec_t* rec;
page_cur_t cursor;
dict_index_t* index;
dict_table_t* table;
buf_block_t* block;
buf_frame_t* frame;
ulint tm, oldtm;
byte buf[8];
mtr_t mtr;
printf("-------------------------------------------------\n");
printf("TEST 2. Speed test\n");
oldtm = ut_clock();
for (i = 0; i < 1000 * UNIV_DBC * UNIV_DBC; i++) {
ut_memcpy(bigbuf, bigbuf + 800, 800);
}
tm = ut_clock();
printf("Wall time for %lu mem copys of 800 bytes %lu millisecs\n",
i, tm - oldtm);
oldtm = ut_clock();
rnd = 0;
for (i = 0; i < 1000 * UNIV_DBC * UNIV_DBC; i++) {
ut_memcpy(bigbuf + rnd, bigbuf + rnd + 800, 800);
rnd += 1600;
if (rnd > 995000) {
rnd = 0;
}
}
tm = ut_clock();
printf("Wall time for %lu mem copys of 800 bytes %lu millisecs\n",
i, tm - oldtm);
heap = mem_heap_create(0);
table = dict_table_create("TS_TABLE2", 2);
dict_table_add_col(table, "COL1", DATA_VARCHAR, DATA_ENGLISH, 10, 0);
dict_table_add_col(table, "COL2", DATA_VARCHAR, DATA_ENGLISH, 10, 0);
ut_a(0 == dict_table_publish(table));
index = dict_index_create("TS_TABLE2", "IND2", 0, 2, 0);
dict_index_add_field(index, "COL1", 0);
dict_index_add_field(index, "COL2", 0);
ut_a(0 == dict_index_publish(index));
index = dict_index_get("TS_TABLE2", "IND2");
ut_a(index);
tuple = dtuple_create(heap, 2);
oldtm = ut_clock();
rnd = 677;
for (i = 0; i < 4 * UNIV_DBC * UNIV_DBC; i++) {
mtr_start(&mtr);
block = buf_page_create(0, 5, &mtr);
buf_page_x_lock(block, &mtr);
frame = buf_block_get_frame(block);
page = page_create(frame, &mtr);
for (j = 0; j < 250; j++) {
rnd = (rnd + 54841) % 1000;
dtuple_gen_test_tuple2(tuple, rnd, buf);
page_cur_search(page, tuple, PAGE_CUR_G, &cursor);
rec = page_cur_insert_rec(&cursor, tuple, NULL, &mtr);
ut_a(rec);
}
mtr_commit(&mtr);
}
tm = ut_clock();
printf("Wall time for insertion of %lu recs %lu milliseconds\n",
i * j, tm - oldtm);
mtr_start(&mtr);
block = buf_page_get(0, 5, &mtr);
buf_page_s_lock(block, &mtr);
page = buf_block_get_frame(block);
ut_a(page_validate(page, index));
mtr_commit(&mtr);
oldtm = ut_clock();
rnd = 677;
for (i = 0; i < 4 * UNIV_DBC * UNIV_DBC; i++) {
mtr_start(&mtr);
block = buf_page_create(0, 5, &mtr);
buf_page_x_lock(block, &mtr);
frame = buf_block_get_frame(block);
page = page_create(frame, &mtr);
for (j = 0; j < 250; j++) {
rnd = (rnd + 54841) % 1000;
dtuple_gen_test_tuple2(tuple, rnd, buf);
}
mtr_commit(&mtr);
}
tm = ut_clock();
printf(
"Wall time for %lu empty loops with page create %lu milliseconds\n",
i * j, tm - oldtm);
oldtm = ut_clock();
for (i = 0; i < 4 * UNIV_DBC * UNIV_DBC; i++) {
mtr_start(&mtr);
block = buf_page_create(0, 5, &mtr);
buf_page_x_lock(block, &mtr);
frame = buf_block_get_frame(block);
page = page_create(frame, &mtr);
rnd = 100;
for (j = 0; j < 250; j++) {
rnd = (rnd + 1) % 1000;
dtuple_gen_test_tuple2(tuple, rnd, buf);
page_cur_search(page, tuple, PAGE_CUR_G, &cursor);
rec = page_cur_insert_rec(&cursor, tuple, NULL, &mtr);
ut_a(rec);
}
mtr_commit(&mtr);
}
tm = ut_clock();
printf(
"Wall time for sequential insertion of %lu recs %lu milliseconds\n",
i * j, tm - oldtm);
oldtm = ut_clock();
for (i = 0; i < 4 * UNIV_DBC * UNIV_DBC; i++) {
mtr_start(&mtr);
block = buf_page_create(0, 5, &mtr);
buf_page_x_lock(block, &mtr);
frame = buf_block_get_frame(block);
page = page_create(frame, &mtr);
rnd = 500;
for (j = 0; j < 250; j++) {
rnd = (rnd - 1) % 1000;
dtuple_gen_test_tuple2(tuple, rnd, buf);
page_cur_search(page, tuple, PAGE_CUR_G, &cursor);
rec = page_cur_insert_rec(&cursor, tuple, NULL, &mtr);
ut_a(rec);
}
mtr_commit(&mtr);
}
tm = ut_clock();
printf(
"Wall time for descend. seq. insertion of %lu recs %lu milliseconds\n",
i * j, tm - oldtm);
oldtm = ut_clock();
for (i = 0; i < 4 * UNIV_DBC * UNIV_DBC; i++) {
mtr_start(&mtr);
block = buf_page_create(0, 5, &mtr);
buf_page_x_lock(block, &mtr);
frame = buf_block_get_frame(block);
page = page_create(frame, &mtr);
rnd = 677;
for (j = 0; j < 250; j++) {
rnd = (rnd + 54841) % 1000;
dtuple_gen_test_tuple2(tuple, rnd, buf);
page_cur_search(page, tuple, PAGE_CUR_G, &cursor);
rec = page_cur_insert_rec(&cursor, tuple, NULL, &mtr);
ut_a(rec);
}
rnd = 677;
for (j = 0; j < 250; j++) {
rnd = (rnd + 54841) % 1000;
dtuple_gen_test_tuple2(tuple, rnd, buf);
page_cur_search(page, tuple, PAGE_CUR_G, &cursor);
page_cur_delete_rec(&cursor, &mtr);
}
ut_a(page_get_n_recs(page) == 0);
mtr_commit(&mtr);
}
tm = ut_clock();
printf("Wall time for insert and delete of %lu recs %lu milliseconds\n",
i * j, tm - oldtm);
mtr_start(&mtr);
block = buf_page_create(0, 5, &mtr);
buf_page_x_lock(block, &mtr);
frame = buf_block_get_frame(block);
page = page_create(frame, &mtr);
rnd = 677;
for (j = 0; j < 250; j++) {
rnd = (rnd + 54841) % 1000;
dtuple_gen_test_tuple2(tuple, rnd, buf);
page_cur_search(page, tuple, PAGE_CUR_G, &cursor);
rec = page_cur_insert_rec(&cursor, tuple, NULL, &mtr);
ut_a(rec);
}
ut_a(page_validate(page, index));
mtr_print(&mtr);
oldtm = ut_clock();
for (i = 0; i < 4 * UNIV_DBC * UNIV_DBC; i++) {
rnd = 677;
for (j = 0; j < 250; j++) {
rnd = (rnd + 54841) % 1000;
dtuple_gen_test_tuple2(tuple, rnd, buf);
page_cur_search(page, tuple, PAGE_CUR_G, &cursor);
}
}
tm = ut_clock();
printf("Wall time for search of %lu recs %lu milliseconds\n",
i * j, tm - oldtm);
oldtm = ut_clock();
for (i = 0; i < 4 * UNIV_DBC * UNIV_DBC; i++) {
rnd = 677;
for (j = 0; j < 250; j++) {
rnd = (rnd + 54841) % 1000;
dtuple_gen_test_tuple2(tuple, rnd, buf);
}
}
tm = ut_clock();
printf("Wall time for %lu empty loops %lu milliseconds\n",
i * j, tm - oldtm);
mtr_commit(&mtr);
}
#endif
/********************************************************************
Main test function. */
void
main(void)
/*======*/
{
ulint tm, oldtm;
sync_init();
mem_init();
os_aio_init(160, 5);
fil_init(25);
buf_pool_init(POOL_SIZE, POOL_SIZE);
dict_init();
fsp_init();
log_init();
create_files();
init_space();
oldtm = ut_clock();
ut_rnd_set_seed(19);
test1();
/* mem_print_info(); */
tm = ut_clock();
printf("Wall time for test %lu milliseconds\n", tm - oldtm);
printf("TESTS COMPLETED SUCCESSFULLY!\n");
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,802 +0,0 @@
/************************************************************************
Test for the B-tree
(c) 1994-1997 Innobase Oy
Created 2/16/1996 Heikki Tuuri
*************************************************************************/
#include "os0proc.h"
#include "sync0sync.h"
#include "ut0mem.h"
#include "mem0mem.h"
#include "mem0pool.h"
#include "data0data.h"
#include "data0type.h"
#include "dict0dict.h"
#include "buf0buf.h"
#include "os0file.h"
#include "os0thread.h"
#include "fil0fil.h"
#include "fsp0fsp.h"
#include "rem0rec.h"
#include "rem0cmp.h"
#include "mtr0mtr.h"
#include "log0log.h"
#include "page0page.h"
#include "page0cur.h"
#include "trx0trx.h"
#include "dict0boot.h"
#include "trx0sys.h"
#include "dict0crea.h"
#include "btr0btr.h"
#include "btr0pcur.h"
#include "btr0cur.h"
#include "btr0sea.h"
#include "rem0rec.h"
#include "srv0srv.h"
#include "que0que.h"
#include "com0com.h"
#include "usr0sess.h"
#include "lock0lock.h"
#include "trx0roll.h"
#include "trx0purge.h"
#include "row0ins.h"
#include "row0upd.h"
#include "row0row.h"
#include "row0del.h"
#include "lock0lock.h"
#include "ibuf0ibuf.h"
os_file_t files[1000];
mutex_t ios_mutex;
ulint ios;
ulint n[10];
mutex_t incs_mutex;
ulint incs;
#define N_SPACES 2 /* must be >= 2 */
#define N_FILES 1
#define FILE_SIZE 8096 /* must be > 512 */
#define POOL_SIZE 1024
#define IBUF_SIZE 200
#define COUNTER_OFFSET 1500
#define LOOP_SIZE 150
#define N_THREADS 5
#define COUNT 1
ulint zero = 0;
buf_block_t* bl_arr[POOL_SIZE];
ulint dummy = 0;
byte test_buf[8000];
/************************************************************************
Io-handler thread function. */
ulint
handler_thread(
/*===========*/
void* arg)
{
ulint segment;
void* mess;
ulint i;
bool ret;
segment = *((ulint*)arg);
printf("Io handler thread %lu starts\n", segment);
for (i = 0;; i++) {
ret = fil_aio_wait(segment, &mess);
ut_a(ret);
buf_page_io_complete((buf_block_t*)mess);
mutex_enter(&ios_mutex);
ios++;
mutex_exit(&ios_mutex);
}
return(0);
}
/*************************************************************************
Creates the files for the file system test and inserts them to the file
system. */
void
create_files(void)
/*==============*/
{
bool ret;
ulint i, k;
char name[20];
os_thread_t thr[10];
os_thread_id_t id[10];
printf("--------------------------------------------------------\n");
printf("Create or open database files\n");
strcpy(name, "tsfile00");
for (k = 0; k < N_SPACES; k++) {
for (i = 0; i < N_FILES; i++) {
name[6] = (char)((ulint)'0' + k);
name[7] = (char)((ulint)'0' + i);
files[i] = os_file_create(name, OS_FILE_CREATE,
OS_FILE_TABLESPACE, &ret);
if (ret == FALSE) {
ut_a(os_file_get_last_error() ==
OS_FILE_ALREADY_EXISTS);
files[i] = os_file_create(
name, OS_FILE_OPEN,
OS_FILE_TABLESPACE, &ret);
ut_a(ret);
} else {
if (k == 1) {
ut_a(os_file_set_size(files[i],
8192 * IBUF_SIZE, 0));
} else {
ut_a(os_file_set_size(files[i],
8192 * FILE_SIZE, 0));
}
}
ret = os_file_close(files[i]);
ut_a(ret);
if (i == 0) {
fil_space_create(name, k, OS_FILE_TABLESPACE);
}
ut_a(fil_validate());
fil_node_create(name, FILE_SIZE, k);
}
}
ios = 0;
mutex_create(&ios_mutex);
mutex_set_level(&ios_mutex, SYNC_NO_ORDER_CHECK);
for (i = 0; i < 9; i++) {
n[i] = i;
thr[i] = os_thread_create(handler_thread, n + i, id + i);
}
}
/************************************************************************
Inits space headers of spaces 0 and 1. */
void
init_spaces(void)
/*=============*/
{
mtr_t mtr;
mtr_start(&mtr);
fsp_header_init(0, FILE_SIZE * N_FILES, &mtr);
fsp_header_init(1, IBUF_SIZE, &mtr);
mtr_commit(&mtr);
}
/*********************************************************************
Test for table creation. */
ulint
test1(
/*==*/
void* arg)
{
sess_t* sess;
com_endpoint_t* com_endpoint;
mem_heap_t* heap;
dict_index_t* index;
dict_table_t* table;
que_fork_t* fork;
que_thr_t* thr;
trx_t* trx;
UT_NOT_USED(arg);
printf("-------------------------------------------------\n");
printf("TEST 1. CREATE TABLE WITH 3 COLUMNS AND WITH 3 INDEXES\n");
heap = mem_heap_create(512);
com_endpoint = (com_endpoint_t*)heap; /* This is a dummy non-NULL
value */
mutex_enter(&kernel_mutex);
sess = sess_open(ut_dulint_zero, com_endpoint, (byte*)"user1", 6);
trx = sess->trx;
mutex_exit(&kernel_mutex);
ut_a(trx_start(trx, ULINT_UNDEFINED));
table = dict_mem_table_create("TS_TABLE1", 0, 3);
dict_mem_table_add_col(table, "COL1", DATA_VARCHAR,
DATA_ENGLISH, 10, 0);
dict_mem_table_add_col(table, "COL2", DATA_VARCHAR,
DATA_ENGLISH, 10, 0);
dict_mem_table_add_col(table, "COL3", DATA_VARCHAR,
DATA_ENGLISH, 100, 0);
/*------------------------------------*/
/* CREATE TABLE */
fork = que_fork_create(NULL, NULL, QUE_FORK_EXECUTE, heap);
fork->trx = trx;
thr = que_thr_create(fork, fork, heap);
thr->child = tab_create_graph_create(fork, thr, table, heap);
mutex_enter(&kernel_mutex);
que_graph_publish(fork, trx->sess);
trx->graph = fork;
ut_a(thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
mutex_exit(&kernel_mutex);
que_run_threads(thr);
/* dict_table_print_by_name("SYS_TABLES");
dict_table_print_by_name("SYS_COLUMNS"); */
/*-------------------------------------*/
/* CREATE CLUSTERED INDEX */
index = dict_mem_index_create("TS_TABLE1", "IND1", 0,
DICT_UNIQUE | DICT_CLUSTERED, 1);
dict_mem_index_add_field(index, "COL1", 0);
ut_a(mem_heap_validate(index->heap));
fork = que_fork_create(NULL, NULL, QUE_FORK_EXECUTE, heap);
fork->trx = trx;
thr = que_thr_create(fork, fork, heap);
thr->child = ind_create_graph_create(fork, thr, index, heap);
mutex_enter(&kernel_mutex);
que_graph_publish(fork, trx->sess);
trx->graph = fork;
ut_a(thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
mutex_exit(&kernel_mutex);
que_run_threads(thr);
/* dict_table_print_by_name("SYS_INDEXES");
dict_table_print_by_name("SYS_FIELDS"); */
/*-------------------------------------*/
/* CREATE SECONDARY INDEX */
index = dict_mem_index_create("TS_TABLE1", "IND2", 0, 0, 1);
dict_mem_index_add_field(index, "COL2", 0);
ut_a(mem_heap_validate(index->heap));
fork = que_fork_create(NULL, NULL, QUE_FORK_EXECUTE, heap);
fork->trx = trx;
thr = que_thr_create(fork, fork, heap);
thr->child = ind_create_graph_create(fork, thr, index, heap);
mutex_enter(&kernel_mutex);
que_graph_publish(fork, trx->sess);
trx->graph = fork;
ut_a(thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
mutex_exit(&kernel_mutex);
que_run_threads(thr);
/* dict_table_print_by_name("SYS_INDEXES");
dict_table_print_by_name("SYS_FIELDS"); */
/*-------------------------------------*/
/* CREATE ANOTHER SECONDARY INDEX */
index = dict_mem_index_create("TS_TABLE1", "IND3", 0, 0, 1);
dict_mem_index_add_field(index, "COL2", 0);
ut_a(mem_heap_validate(index->heap));
fork = que_fork_create(NULL, NULL, QUE_FORK_EXECUTE, heap);
fork->trx = trx;
thr = que_thr_create(fork, fork, heap);
thr->child = ind_create_graph_create(fork, thr, index, heap);
mutex_enter(&kernel_mutex);
que_graph_publish(fork, trx->sess);
trx->graph = fork;
ut_a(thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
mutex_exit(&kernel_mutex);
que_run_threads(thr);
#ifdef notdefined
/*-------------------------------------*/
/* CREATE YET ANOTHER SECONDARY INDEX */
index = dict_mem_index_create("TS_TABLE1", "IND4", 0, 0, 1);
dict_mem_index_add_field(index, "COL2", 0);
ut_a(mem_heap_validate(index->heap));
fork = que_fork_create(NULL, NULL, QUE_FORK_EXECUTE, heap);
fork->trx = trx;
thr = que_thr_create(fork, fork, heap);
thr->child = ind_create_graph_create(fork, thr, index, heap);
mutex_enter(&kernel_mutex);
que_graph_publish(fork, trx->sess);
trx->graph = fork;
ut_a(thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
mutex_exit(&kernel_mutex);
que_run_threads(thr);
#endif
/* dict_table_print_by_name("SYS_INDEXES");
dict_table_print_by_name("SYS_FIELDS"); */
return(0);
}
/*********************************************************************
Another test for inserts. */
ulint
test2_1(
/*====*/
void* arg)
{
ulint tm, oldtm;
sess_t* sess;
com_endpoint_t* com_endpoint;
mem_heap_t* heap;
que_fork_t* fork;
dict_table_t* table;
que_thr_t* thr;
trx_t* trx;
ulint i;
byte buf[100];
ins_node_t* node;
ulint count = 0;
ulint rnd;
dtuple_t* row;
dict_index_t* index;
/* dict_tree_t* tree;
dtuple_t* entry;
btr_pcur_t pcur;
mtr_t mtr; */
printf("-------------------------------------------------\n");
printf("TEST 2.1. MASSIVE ASCENDING INSERT\n");
heap = mem_heap_create(512);
com_endpoint = (com_endpoint_t*)heap; /* This is a dummy non-NULL
value */
mutex_enter(&kernel_mutex);
sess = sess_open(ut_dulint_zero, com_endpoint, (byte*)"user1", 6);
trx = sess->trx;
mutex_exit(&kernel_mutex);
loop:
ut_a(trx_start(trx, ULINT_UNDEFINED));
/*-------------------------------------*/
/* MASSIVE INSERT */
fork = que_fork_create(NULL, NULL, QUE_FORK_INSERT, heap);
fork->trx = trx;
thr = que_thr_create(fork, fork, heap);
table = dict_table_get("TS_TABLE1", trx);
row = dtuple_create(heap, 3 + DATA_N_SYS_COLS);
dict_table_copy_types(row, table);
node = ins_node_create(fork, thr, row, table, heap);
thr->child = node;
row_ins_init_sys_fields_at_sql_compile(node->row, node->table, heap);
row_ins_init_sys_fields_at_sql_prepare(node->row, node->table, trx);
node->init_all_sys_fields = FALSE;
mutex_enter(&kernel_mutex);
que_graph_publish(fork, trx->sess);
trx->graph = fork;
mutex_exit(&kernel_mutex);
rnd = 0;
log_print();
oldtm = ut_clock();
for (i = 0; i < *((ulint*)arg); i++) {
dtuple_gen_test_tuple3(row, rnd, DTUPLE_TEST_FIXED30, buf);
mutex_enter(&kernel_mutex);
ut_a(
thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
mutex_exit(&kernel_mutex);
que_run_threads(thr);
if (i % 5000 == 0) {
/* ibuf_print(); */
/* buf_print(); */
/* buf_print_io(); */
/*
tm = ut_clock();
printf("Wall time for %lu inserts %lu milliseconds\n",
i, tm - oldtm); */
}
rnd = rnd + 1;
}
tm = ut_clock();
printf("Wall time for %lu inserts %lu milliseconds\n", i, tm - oldtm);
log_print();
/* dict_table_print_by_name("TS_TABLE1"); */
/* ibuf_print(); */
index = index;
index = dict_table_get_first_index(table);
if (zero) {
btr_search_index_print_info(index);
}
btr_validate_tree(dict_index_get_tree(index));
#ifdef notdefined
index = dict_table_get_next_index(index);
if (zero) {
btr_search_index_print_info(index);
}
btr_validate_tree(dict_index_get_tree(index));
index = dict_table_get_next_index(index);
/* btr_search_index_print_info(index); */
btr_validate_tree(dict_index_get_tree(index));
/* dict_table_print_by_name("TS_TABLE1"); */
/* Check inserted entries */
btr_search_print_info();
entry = dtuple_create(heap, 1);
dtuple_gen_search_tuple3(entry, 0, buf);
mtr_start(&mtr);
index = dict_table_get_first_index(table);
tree = dict_index_get_tree(index);
btr_pcur_open(index, entry, PAGE_CUR_L, BTR_SEARCH_LEAF, &pcur, &mtr);
ut_a(btr_pcur_is_before_first_in_tree(&pcur, &mtr));
for (i = 0; i < *((ulint*)arg); i++) {
ut_a(btr_pcur_move_to_next(&pcur, &mtr));
dtuple_gen_search_tuple3(entry, i, buf);
ut_a(0 == cmp_dtuple_rec(entry, btr_pcur_get_rec(&pcur)));
}
ut_a(!btr_pcur_move_to_next(&pcur, &mtr));
ut_a(btr_pcur_is_after_last_in_tree(&pcur, &mtr));
btr_pcur_close(&pcur);
mtr_commit(&mtr);
printf("Validating tree\n");
btr_validate_tree(tree);
printf("Validated\n");
#endif
/*-------------------------------------*/
/* ROLLBACK */
#ifdef notdefined
/* btr_validate_tree(tree); */
fork = que_fork_create(NULL, NULL, QUE_FORK_EXECUTE, heap);
fork->trx = trx;
thr = que_thr_create(fork, fork, heap);
thr->child = roll_node_create(fork, thr, heap);
mutex_enter(&kernel_mutex);
que_graph_publish(fork, trx->sess);
trx->graph = fork;
ut_a(thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
mutex_exit(&kernel_mutex);
oldtm = ut_clock();
que_run_threads(thr);
tm = ut_clock();
printf("Wall time for rollback of %lu inserts %lu milliseconds\n",
i, tm - oldtm);
os_thread_sleep(1000000);
/* dict_table_print_by_name("TS_TABLE1"); */
dtuple_gen_search_tuple3(entry, 0, buf);
mtr_start(&mtr);
btr_pcur_open(index, entry, PAGE_CUR_L, BTR_SEARCH_LEAF, &pcur, &mtr);
ut_a(btr_pcur_is_before_first_in_tree(&pcur, &mtr));
ut_a(!btr_pcur_move_to_next(&pcur, &mtr));
ut_a(btr_pcur_is_after_last_in_tree(&pcur, &mtr));
btr_pcur_close(&pcur);
mtr_commit(&mtr);
btr_search_print_info();
#endif
/*-------------------------------------*/
/* COMMIT */
fork = que_fork_create(NULL, NULL, QUE_FORK_EXECUTE, heap);
fork->trx = trx;
thr = que_thr_create(fork, fork, heap);
thr->child = commit_node_create(fork, thr, heap);
mutex_enter(&kernel_mutex);
que_graph_publish(fork, trx->sess);
trx->graph = fork;
ut_a(thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
mutex_exit(&kernel_mutex);
oldtm = ut_clock();
que_run_threads(thr);
tm = ut_clock();
printf("Wall time for commit %lu milliseconds\n", tm - oldtm);
/*-------------------------------------*/
count++;
/* btr_validate_tree(tree); */
if (count < 1) {
goto loop;
}
mem_heap_free(heap);
return(0);
}
/********************************************************************
Main test function. */
void
main(void)
/*======*/
{
ulint tm, oldtm;
os_thread_id_t id[10];
ulint n1000[10];
ulint i;
ulint n5000 = 500;
ulint n2;
/* buf_debug_prints = TRUE; */
log_do_write = TRUE;
srv_boot("initfile");
os_aio_init(576, 9, 100);
fil_init(25);
buf_pool_init(POOL_SIZE, POOL_SIZE);
fsp_init();
log_init();
lock_sys_create(1024);
create_files();
init_spaces();
sess_sys_init_at_db_start();
trx_sys_create();
dict_create();
/* os_thread_sleep(500000); */
oldtm = ut_clock();
ut_rnd_set_seed(19);
test1(NULL);
/* for (i = 0; i < 2; i++) {
n1000[i] = i;
id[i] = id[i];
os_thread_create(test10mt, n1000 + i, id + i);
}
*/
i = 4;
n1000[i] = i;
id[i] = id[i];
/* os_thread_create(test10_4, n1000 + i, id + i); */
i = 5;
/* test10mt(&i);
i = 6;
test10mt(&i);
trx_purge();
printf("%lu pages purged\n", purge_sys->n_pages_handled);
dict_table_print_by_name("TS_TABLE1"); */
/* os_thread_create(test_measure_cont, &n3, id + 0); */
/* mem_print_info(); */
/* dict_table_print_by_name("TS_TABLE1"); */
log_flush_up_to(ut_dulint_zero);
os_thread_sleep(500000);
n2 = 10000;
test2_1(&n2);
/* test9A(&n2);
test9(&n2); */
/* test6(&n2); */
/* test2(&n2); */
/* test2_2(&n2); */
/* mem_print_info(); */
for (i = 0; i < 2; i++) {
n1000[i] = 1000 + 10 * i;
id[i] = id[i];
/* os_thread_create(test2mt, n1000 + i, id + i);
os_thread_create(test2_1mt, n1000 + i, id + i);
os_thread_create(test2_2mt, n1000 + i, id + i); */
}
n2 = 2000;
/* test2mt(&n2); */
/* buf_print();
ibuf_print();
rw_lock_list_print_info();
mutex_list_print_info();
dict_table_print_by_name("TS_TABLE1"); */
/* mem_print_info(); */
n2 = 1000;
/* test4_1();
test4_2();
for (i = 0; i < 2; i++) {
n1000[i] = i;
id[i] = id[i];
os_thread_create(test4mt, n1000 + i, id + i);
}
n2 = 4;
test4mt(&n2);
test4mt(&n2);
test4_2();
lock_print_info(); */
/* test7(&n2); */
/* os_thread_sleep(25000000); */
tm = ut_clock();
printf("Wall time for test %lu milliseconds\n", tm - oldtm);
printf("TESTS COMPLETED SUCCESSFULLY!\n");
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,397 +0,0 @@
/************************************************************************
Test for the server
(c) 1996-1997 Innobase Oy
Created 2/16/1996 Heikki Tuuri
*************************************************************************/
#include "os0proc.h"
#include "sync0sync.h"
#include "ut0mem.h"
#include "mem0mem.h"
#include "mem0pool.h"
#include "data0data.h"
#include "data0type.h"
#include "dict0dict.h"
#include "buf0buf.h"
#include "buf0flu.h"
#include "os0file.h"
#include "os0thread.h"
#include "fil0fil.h"
#include "fsp0fsp.h"
#include "rem0rec.h"
#include "rem0cmp.h"
#include "mtr0mtr.h"
#include "log0log.h"
#include "log0recv.h"
#include "page0page.h"
#include "page0cur.h"
#include "trx0trx.h"
#include "dict0boot.h"
#include "trx0sys.h"
#include "dict0crea.h"
#include "btr0btr.h"
#include "btr0pcur.h"
#include "btr0cur.h"
#include "btr0sea.h"
#include "rem0rec.h"
#include "srv0srv.h"
#include "que0que.h"
#include "com0com.h"
#include "usr0sess.h"
#include "lock0lock.h"
#include "trx0roll.h"
#include "trx0purge.h"
#include "row0ins.h"
#include "row0sel.h"
#include "row0upd.h"
#include "row0row.h"
#include "lock0lock.h"
#include "ibuf0ibuf.h"
#include "pars0pars.h"
#include "btr0sea.h"
bool measure_cont = FALSE;
os_file_t files[1000];
mutex_t ios_mutex;
ulint ios;
ulint n[10];
mutex_t incs_mutex;
ulint incs;
byte rnd_buf[67000];
/************************************************************************
Io-handler thread function. */
ulint
handler_thread(
/*===========*/
void* arg)
{
ulint segment;
ulint i;
segment = *((ulint*)arg);
printf("Io handler thread %lu starts\n", segment);
for (i = 0;; i++) {
fil_aio_wait(segment);
mutex_enter(&ios_mutex);
ios++;
mutex_exit(&ios_mutex);
}
return(0);
}
/*************************************************************************
Creates or opens the log files. */
void
create_log_files(void)
/*==================*/
{
bool ret;
ulint i, k;
char name[20];
printf("--------------------------------------------------------\n");
printf("Create or open log files\n");
strcpy(name, "logfile00");
for (k = 0; k < srv_n_log_groups; k++) {
for (i = 0; i < srv_n_log_files; i++) {
name[6] = (char)((ulint)'0' + k);
name[7] = (char)((ulint)'0' + i);
files[i] = os_file_create(name, OS_FILE_CREATE, OS_FILE_AIO,
&ret);
if (ret == FALSE) {
ut_a(os_file_get_last_error() ==
OS_FILE_ALREADY_EXISTS);
files[i] = os_file_create(
name, OS_FILE_OPEN, OS_FILE_AIO, &ret);
ut_a(ret);
} else {
ut_a(os_file_set_size(files[i],
8192 * srv_log_file_size, 0));
}
ret = os_file_close(files[i]);
ut_a(ret);
if (i == 0) {
fil_space_create(name, k + 100, FIL_LOG);
}
ut_a(fil_validate());
fil_node_create(name, srv_log_file_size, k + 100);
}
fil_space_create(name, k + 200, FIL_LOG);
log_group_init(k, srv_n_log_files,
srv_log_file_size * UNIV_PAGE_SIZE,
k + 100, k + 200);
}
}
/*************************************************************************
Creates the files for the file system test and inserts them to the file
system. */
void
create_files(void)
/*==============*/
{
bool ret;
ulint i, k;
char name[20];
os_thread_t thr[10];
os_thread_id_t id[10];
printf("--------------------------------------------------------\n");
printf("Create or open database files\n");
strcpy(name, "tsfile00");
for (k = 0; k < 2 * srv_n_spaces; k += 2) {
for (i = 0; i < srv_n_files; i++) {
name[6] = (char)((ulint)'0' + k);
name[7] = (char)((ulint)'0' + i);
files[i] = os_file_create(name, OS_FILE_CREATE,
OS_FILE_NORMAL, &ret);
if (ret == FALSE) {
ut_a(os_file_get_last_error() ==
OS_FILE_ALREADY_EXISTS);
files[i] = os_file_create(
name, OS_FILE_OPEN, OS_FILE_NORMAL, &ret);
ut_a(ret);
} else {
ut_a(os_file_set_size(files[i],
UNIV_PAGE_SIZE * srv_file_size, 0));
/* Initialize the file contents to a random value */
/*
for (j = 0; j < srv_file_size; j++) {
for (c = 0; c < UNIV_PAGE_SIZE; c++) {
rnd_buf[c] = 0xFF;
}
os_file_write(files[i], rnd_buf,
UNIV_PAGE_SIZE * j, 0,
UNIV_PAGE_SIZE);
}
*/
}
ret = os_file_close(files[i]);
ut_a(ret);
if (i == 0) {
fil_space_create(name, k, FIL_TABLESPACE);
}
ut_a(fil_validate());
fil_node_create(name, srv_file_size, k);
}
}
ios = 0;
mutex_create(&ios_mutex);
mutex_set_level(&ios_mutex, SYNC_NO_ORDER_CHECK);
/* Create i/o-handler threads: */
for (i = 0; i < 9; i++) {
n[i] = i;
thr[i] = os_thread_create(handler_thread, n + i, id + i);
}
}
/************************************************************************
Inits space header of space. */
void
init_spaces(void)
/*=============*/
{
mtr_t mtr;
mtr_start(&mtr);
fsp_header_init(0, srv_file_size * srv_n_files, &mtr);
mtr_commit(&mtr);
}
/*********************************************************************
This thread is used to measure contention of latches. */
ulint
test_measure_cont(
/*==============*/
void* arg)
{
ulint i, j, k;
ulint count[8];
ulint lcount[8];
ulint lscount;
ulint lkcount;
ulint pcount, kcount, scount;
UT_NOT_USED(arg);
printf("Starting contention measurement\n");
for (i = 0; i < 1000; i++) {
for (k = 0; k < 8; k++) {
count[k] = 0;
lcount[k] = 0;
}
pcount = 0;
kcount = 0;
scount = 0;
lscount = 0;
lkcount = 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 (lock_kernel_reserved) {
lkcount++;
}
if (buf_pool->mutex.lock_word) {
pcount++;
}
if (btr_search_mutex.lock_word) {
scount++;
}
for (k = 0; k < 8; k++) {
if (btr_search_sys->
hash_index->mutexes[k].lock_word) {
count[k]++;
}
}
for (k = 0; k < 2; k++) {
if (lock_sys->rec_hash->mutexes[k].lock_word) {
lcount[k]++;
}
}
if (kernel_mutex.lock_word
|| lock_sys->rec_hash->mutexes[0].lock_word
|| lock_sys->rec_hash->mutexes[1].lock_word) {
lscount++;
}
}
printf(
"Mutex res. p %lu, k %lu %lu, %lu %lu %lu s %lu, %lu %lu %lu %lu %lu %lu %lu %lu of %lu\n",
pcount, kcount, lkcount, lcount[0], lcount[1], lscount, scount,
count[0], count[1], count[2], count[3],
count[4], count[5], count[6], count[7], j);
sync_print_wait_info();
printf("N log i/os %lu, n non sea %lu, n sea succ %lu\n",
log_sys->n_log_ios, btr_cur_n_non_sea,
btr_search_n_succ);
}
return(0);
}
/********************************************************************
Main test function. */
void
main(void)
/*======*/
{
os_thread_id_t thread_id;
log_do_write = TRUE;
/* yydebug = TRUE; */
srv_boot("srv_init");
os_aio_init(576, 9, 100);
fil_init(25);
buf_pool_init(srv_pool_size, srv_pool_size);
fsp_init();
log_init();
lock_sys_create(srv_lock_table_size);
create_files();
create_log_files();
init_spaces();
sess_sys_init_at_db_start();
trx_sys_create();
dict_create();
log_make_checkpoint_at(ut_dulint_max);
if (srv_measure_contention) {
os_thread_create(&test_measure_cont, NULL, &thread_id);
}
if (!srv_log_archive_on) {
ut_a(DB_SUCCESS == log_archive_noarchivelog());
}
srv_master_thread();
printf("TESTS COMPLETED SUCCESSFULLY!\n");
os_process_exit(0);
}

View File

@ -1,535 +0,0 @@
/************************************************************************
Test for the server
(c) 1996-1997 Innobase Oy
Created 2/16/1996 Heikki Tuuri
*************************************************************************/
#include "os0proc.h"
#include "sync0sync.h"
#include "ut0mem.h"
#include "mem0mem.h"
#include "mem0pool.h"
#include "data0data.h"
#include "data0type.h"
#include "dict0dict.h"
#include "buf0buf.h"
#include "buf0flu.h"
#include "os0file.h"
#include "os0thread.h"
#include "fil0fil.h"
#include "fsp0fsp.h"
#include "rem0rec.h"
#include "rem0cmp.h"
#include "mtr0mtr.h"
#include "log0log.h"
#include "log0recv.h"
#include "page0page.h"
#include "page0cur.h"
#include "trx0trx.h"
#include "dict0boot.h"
#include "trx0sys.h"
#include "dict0crea.h"
#include "btr0btr.h"
#include "btr0pcur.h"
#include "btr0cur.h"
#include "btr0sea.h"
#include "rem0rec.h"
#include "srv0srv.h"
#include "que0que.h"
#include "com0com.h"
#include "usr0sess.h"
#include "lock0lock.h"
#include "trx0roll.h"
#include "trx0purge.h"
#include "row0ins.h"
#include "row0sel.h"
#include "row0upd.h"
#include "row0row.h"
#include "lock0lock.h"
#include "ibuf0ibuf.h"
#include "pars0pars.h"
#include "btr0sea.h"
bool measure_cont = FALSE;
os_file_t files[1000];
mutex_t ios_mutex;
ulint ios;
ulint n[10];
mutex_t incs_mutex;
ulint incs;
byte rnd_buf[67000];
ulint glob_var1 = 0;
ulint glob_var2 = 0;
mutex_t mutex2;
mutex_t test_mutex1;
mutex_t test_mutex2;
mutex_t* volatile mutexes;
bool always_false = FALSE;
ulint* test_array;
/************************************************************************
Io-handler thread function. */
ulint
handler_thread(
/*===========*/
void* arg)
{
ulint segment;
ulint i;
segment = *((ulint*)arg);
printf("Io handler thread %lu starts\n", segment);
for (i = 0;; i++) {
fil_aio_wait(segment);
mutex_enter(&ios_mutex);
ios++;
mutex_exit(&ios_mutex);
}
return(0);
}
/*************************************************************************
Creates or opens the log files. */
void
create_log_files(void)
/*==================*/
{
bool ret;
ulint i, k;
char name[20];
printf("--------------------------------------------------------\n");
printf("Create or open log files\n");
strcpy(name, "logfile00");
for (k = 0; k < srv_n_log_groups; k++) {
for (i = 0; i < srv_n_log_files; i++) {
name[6] = (char)((ulint)'0' + k);
name[7] = (char)((ulint)'0' + i);
files[i] = os_file_create(name, OS_FILE_CREATE, OS_FILE_AIO,
&ret);
if (ret == FALSE) {
ut_a(os_file_get_last_error() ==
OS_FILE_ALREADY_EXISTS);
files[i] = os_file_create(
name, OS_FILE_OPEN, OS_FILE_AIO, &ret);
ut_a(ret);
} else {
ut_a(os_file_set_size(files[i],
8192 * srv_log_file_size, 0));
}
ret = os_file_close(files[i]);
ut_a(ret);
if (i == 0) {
fil_space_create(name, k + 100, FIL_LOG);
}
ut_a(fil_validate());
fil_node_create(name, srv_log_file_size, k + 100);
}
fil_space_create(name, k + 200, FIL_LOG);
log_group_init(k, srv_n_log_files,
srv_log_file_size * UNIV_PAGE_SIZE,
k + 100, k + 200);
}
}
/*************************************************************************
Creates the files for the file system test and inserts them to the file
system. */
void
create_files(void)
/*==============*/
{
bool ret;
ulint i, k;
char name[20];
os_thread_t thr[10];
os_thread_id_t id[10];
printf("--------------------------------------------------------\n");
printf("Create or open database files\n");
strcpy(name, "tsfile00");
for (k = 0; k < 2 * srv_n_spaces; k += 2) {
for (i = 0; i < srv_n_files; i++) {
name[6] = (char)((ulint)'0' + k);
name[7] = (char)((ulint)'0' + i);
files[i] = os_file_create(name, OS_FILE_CREATE,
OS_FILE_NORMAL, &ret);
if (ret == FALSE) {
ut_a(os_file_get_last_error() ==
OS_FILE_ALREADY_EXISTS);
files[i] = os_file_create(
name, OS_FILE_OPEN, OS_FILE_NORMAL, &ret);
ut_a(ret);
} else {
ut_a(os_file_set_size(files[i],
UNIV_PAGE_SIZE * srv_file_size, 0));
/* Initialize the file contents to a random value */
/*
for (j = 0; j < srv_file_size; j++) {
for (c = 0; c < UNIV_PAGE_SIZE; c++) {
rnd_buf[c] = 0xFF;
}
os_file_write(files[i], rnd_buf,
UNIV_PAGE_SIZE * j, 0,
UNIV_PAGE_SIZE);
}
*/
}
ret = os_file_close(files[i]);
ut_a(ret);
if (i == 0) {
fil_space_create(name, k, FIL_TABLESPACE);
}
ut_a(fil_validate());
fil_node_create(name, srv_file_size, k);
}
}
ios = 0;
mutex_create(&ios_mutex);
mutex_set_level(&ios_mutex, SYNC_NO_ORDER_CHECK);
/* Create i/o-handler threads: */
for (i = 0; i < 9; i++) {
n[i] = i;
thr[i] = os_thread_create(handler_thread, n + i, id + i);
}
}
/************************************************************************
Inits space header of space. */
void
init_spaces(void)
/*=============*/
{
mtr_t mtr;
mtr_start(&mtr);
fsp_header_init(0, srv_file_size * srv_n_files, &mtr);
mtr_commit(&mtr);
}
/*********************************************************************
This thread is used to measure contention of latches. */
ulint
test_measure_cont(
/*==============*/
void* arg)
{
ulint i, j;
ulint pcount, kcount, s_scount, s_xcount, s_mcount, lcount;
ulint t1count;
ulint t2count;
UT_NOT_USED(arg);
printf("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;
t1count = 0;
t2count = 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++;
}
if (test_mutex1.lock_word) {
t1count++;
}
if (test_mutex2.lock_word) {
t2count++;
}
}
printf(
"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();
printf(
"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);
}
/*********************************************************************
This thread is used to test contention of latches. */
ulint
test_sync(
/*======*/
void* arg)
{
ulint tm, oldtm;
ulint i, j;
ulint sum;
ulint rnd = ut_rnd_gen_ulint();
ulint mut_ind;
byte* ptr;
UT_NOT_USED(arg);
printf("Starting mutex reservation test\n");
oldtm = ut_clock();
sum = 0;
rnd = 87354941;
for (i = 0; i < srv_test_n_loops; i++) {
for (j = 0; j < srv_test_n_free_rnds; j++) {
rnd += 423087123;
sum += test_array[rnd % (256 * srv_test_array_size)];
}
rnd += 43605677;
mut_ind = rnd % srv_test_n_mutexes;
mutex_enter(mutexes + mut_ind);
for (j = 0; j < srv_test_n_reserved_rnds; j++) {
rnd += 423087121;
sum += test_array[rnd % (256 * srv_test_array_size)];
}
mutex_exit(mutexes + mut_ind);
if (srv_test_cache_evict) {
ptr = (byte*)(mutexes + mut_ind);
for (j = 0; j < 4; j++) {
ptr += 256 * 1024;
sum += *((ulint*)ptr);
}
}
}
if (always_false) {
printf("%lu", sum);
}
tm = ut_clock();
printf("Wall time for res. test %lu milliseconds\n", tm - oldtm);
return(0);
}
/********************************************************************
Main test function. */
void
main(void)
/*======*/
{
os_thread_id_t thread_ids[1000];
ulint tm, oldtm;
ulint rnd;
ulint i, sum;
byte* ptr;
/* mutex_t mutex; */
log_do_write = TRUE;
/* yydebug = TRUE; */
srv_boot("srv_init");
os_aio_init(576, 9, 100);
fil_init(25);
buf_pool_init(srv_pool_size, srv_pool_size);
fsp_init();
log_init();
lock_sys_create(srv_lock_table_size);
create_files();
create_log_files();
init_spaces();
sess_sys_init_at_db_start();
trx_sys_create();
dict_create();
log_make_checkpoint_at(ut_dulint_max);
printf("Hotspot semaphore addresses k %lx, p %lx, l %lx, s %lx\n",
&kernel_mutex, &(buf_pool->mutex),
&(log_sys->mutex), &btr_search_latch);
if (srv_measure_contention) {
os_thread_create(&test_measure_cont, NULL, thread_ids + 999);
}
if (!srv_log_archive_on) {
ut_a(DB_SUCCESS == log_archive_noarchivelog());
}
/*
mutex_create(&mutex);
oldtm = ut_clock();
for (i = 0; i < 2000000; i++) {
mutex_enter(&mutex);
mutex_exit(&mutex);
}
tm = ut_clock();
printf("Wall clock time for %lu mutex enter %lu milliseconds\n",
i, tm - oldtm);
*/
if (srv_test_sync) {
if (srv_test_nocache) {
mutexes = os_mem_alloc_nocache(srv_test_n_mutexes
* sizeof(mutex_t));
} else {
mutexes = mem_alloc(srv_test_n_mutexes
* sizeof(mutex_t));
}
sum = 0;
rnd = 492314896;
oldtm = ut_clock();
for (i = 0; i < 4000000; i++) {
rnd += 85967944;
ptr = ((byte*)(mutexes)) + (rnd % (srv_test_n_mutexes
* sizeof(mutex_t)));
sum += *((ulint*)ptr);
}
tm = ut_clock();
printf(
"Wall clock time for %lu random access %lu milliseconds\n",
i, tm - oldtm);
if (always_false) {
printf("%lu", sum);
}
test_array = mem_alloc(4 * 256 * srv_test_array_size);
for (i = 0; i < srv_test_n_mutexes; i++) {
mutex_create(mutexes + i);
}
for (i = 0; i < srv_test_n_threads; i++) {
os_thread_create(&test_sync, NULL, thread_ids + i);
}
}
srv_master_thread(NULL);
printf("TESTS COMPLETED SUCCESSFULLY!\n");
os_process_exit(0);
}

View File

@ -1106,13 +1106,13 @@ loop:
buf_read_page(space, offset);
#ifdef UNIV_DEBUG
#ifdef UNIV_DEBUG
buf_dbg_counter++;
if (buf_dbg_counter % 37 == 0) {
ut_ad(buf_validate());
}
#endif
#endif
goto loop;
}
@ -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",
(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
to the 4 first bytes of the page end lsn field */

View File

@ -1,20 +0,0 @@
include ..\..\makefile.i
doall: tsbuf
tsbuf: ..\buf.lib tsbuf.c
$(CCOM) $(CFL) -I.. -I..\.. ..\buf.lib ..\..\btr.lib ..\..\trx.lib ..\..\pars.lib ..\..\que.lib ..\..\lock.lib ..\..\row.lib ..\..\read.lib ..\..\srv.lib ..\..\com.lib ..\..\usr.lib ..\..\thr.lib ..\..\fut.lib ..\..\fsp.lib ..\..\page.lib ..\..\dyn.lib ..\..\mtr.lib ..\..\log.lib ..\..\rem.lib ..\..\fil.lib ..\..\dict.lib ..\..\data.lib ..\..\mach.lib ..\..\ha.lib ..\..\ut.lib ..\..\sync.lib ..\..\mem.lib ..\..\os.lib tsbuf.c $(LFL)
tsos: ..\buf.lib tsos.c
$(CCOM) $(CFL) -I.. -I..\.. ..\buf.lib ..\..\mach.lib ..\..\fil.lib ..\..\ha.lib ..\..\ut.lib ..\..\sync.lib ..\..\mem.lib ..\..\os.lib tsos.c $(LFL)

View File

@ -1,885 +0,0 @@
/************************************************************************
The test module for the file system and buffer manager
(c) 1995 Innobase Oy
Created 11/16/1995 Heikki Tuuri
*************************************************************************/
#include "string.h"
#include "os0thread.h"
#include "os0file.h"
#include "ut0ut.h"
#include "ut0byte.h"
#include "sync0sync.h"
#include "mem0mem.h"
#include "fil0fil.h"
#include "mtr0mtr.h"
#include "mtr0log.h"
#include "log0log.h"
#include "mach0data.h"
#include "..\buf0buf.h"
#include "..\buf0flu.h"
#include "..\buf0lru.h"
os_file_t files[1000];
mutex_t ios_mutex;
ulint ios;
ulint n[10];
mutex_t incs_mutex;
ulint incs;
#define N_SPACES 1
#define N_FILES 1
#define FILE_SIZE 4000
#define POOL_SIZE 1000
#define COUNTER_OFFSET 1500
#define LOOP_SIZE 150
#define N_THREADS 5
ulint zero = 0;
buf_frame_t* bl_arr[POOL_SIZE];
/************************************************************************
Io-handler thread function. */
ulint
handler_thread(
/*===========*/
void* arg)
{
ulint segment;
void* mess;
ulint i;
bool ret;
segment = *((ulint*)arg);
printf("Io handler thread %lu starts\n", segment);
for (i = 0;; i++) {
ret = fil_aio_wait(segment, &mess);
ut_a(ret);
buf_page_io_complete((buf_block_t*)mess);
mutex_enter(&ios_mutex);
ios++;
mutex_exit(&ios_mutex);
}
return(0);
}
/*************************************************************************
This thread reports the status of sync system. */
ulint
info_thread(
/*========*/
void* arg)
{
ulint segment;
segment = *((ulint*)arg);
for (;;) {
sync_print();
os_aio_print();
printf("Debug stop threads == %lu\n", ut_dbg_stop_threads);
os_thread_sleep(30000000);
}
return(0);
}
/*************************************************************************
Creates the files for the file system test and inserts them to
the file system. */
void
create_files(void)
/*==============*/
{
bool ret;
ulint i, k;
char name[20];
os_thread_t thr[5];
os_thread_id_t id[5];
ulint err;
printf("--------------------------------------------------------\n");
printf("Create or open database files\n");
strcpy(name, "tsfile00");
for (k = 0; k < N_SPACES; k++) {
for (i = 0; i < N_FILES; i++) {
name[9] = (char)((ulint)'0' + k);
name[10] = (char)((ulint)'0' + i);
files[i] = os_file_create(name, OS_FILE_CREATE,
OS_FILE_TABLESPACE, &ret);
if (ret == FALSE) {
err = os_file_get_last_error();
if (err != OS_FILE_ALREADY_EXISTS) {
printf("OS error %lu in file creation\n", err);
ut_error;
}
files[i] = os_file_create(
name, OS_FILE_OPEN,
OS_FILE_TABLESPACE, &ret);
ut_a(ret);
}
ret = os_file_close(files[i]);
ut_a(ret);
if (i == 0) {
fil_space_create(name, k, OS_FILE_TABLESPACE);
}
ut_a(fil_validate());
fil_node_create(name, FILE_SIZE, k);
}
}
ios = 0;
mutex_create(&ios_mutex);
for (i = 0; i < 5; i++) {
n[i] = i;
thr[i] = os_thread_create(handler_thread, n + i, id + i);
}
/*
n[9] = 9;
os_thread_create(info_thread, n + 9, id);
*/
}
/************************************************************************
Creates the test database files. */
void
create_db(void)
/*===========*/
{
ulint i;
byte* frame;
ulint j;
ulint tm, oldtm;
mtr_t mtr;
printf("--------------------------------------------------------\n");
printf("Write database pages\n");
oldtm = ut_clock();
for (i = 0; i < N_SPACES; i++) {
for (j = 0; j < FILE_SIZE * N_FILES; j++) {
mtr_start(&mtr);
mtr_set_log_mode(&mtr, MTR_LOG_NONE);
frame = buf_page_create(i, j, &mtr);
buf_page_get(i, j, RW_X_LATCH, &mtr);
if (j > FILE_SIZE * N_FILES - 64 * 2 - 1) {
mlog_write_ulint(frame + FIL_PAGE_PREV, j - 5,
MLOG_4BYTES, &mtr);
mlog_write_ulint(frame + FIL_PAGE_NEXT, j - 7,
MLOG_4BYTES, &mtr);
} else {
mlog_write_ulint(frame + FIL_PAGE_PREV, j - 1,
MLOG_4BYTES, &mtr);
mlog_write_ulint(frame + FIL_PAGE_NEXT, j + 1,
MLOG_4BYTES, &mtr);
}
mlog_write_ulint(frame + FIL_PAGE_OFFSET, j,
MLOG_4BYTES, &mtr);
mlog_write_ulint(frame + FIL_PAGE_SPACE, i,
MLOG_4BYTES, &mtr);
mlog_write_ulint(frame + COUNTER_OFFSET, 0,
MLOG_4BYTES, &mtr);
mtr_commit(&mtr);
}
}
tm = ut_clock();
printf("Wall clock time for test %lu milliseconds\n", tm - oldtm);
printf("--------------------------------------------------------\n");
printf("TEST 1 A. Test of page creation when page resides in buffer\n");
for (i = 0; i < N_SPACES; i++) {
for (j = FILE_SIZE * N_FILES - 200;
j < FILE_SIZE * N_FILES; j++) {
mtr_start(&mtr);
mtr_set_log_mode(&mtr, MTR_LOG_NONE);
frame = buf_page_create(i, j, &mtr);
buf_page_get(i, j, RW_X_LATCH, &mtr);
mlog_write_ulint(frame + FIL_PAGE_PREV,
j - 1, MLOG_4BYTES, &mtr);
mlog_write_ulint(frame + FIL_PAGE_NEXT,
j + 1, MLOG_4BYTES, &mtr);
mlog_write_ulint(frame + FIL_PAGE_OFFSET, j,
MLOG_4BYTES, &mtr);
mlog_write_ulint(frame + FIL_PAGE_SPACE, i,
MLOG_4BYTES, &mtr);
mtr_commit(&mtr);
}
}
printf("--------------------------------------------------------\n");
printf("TEST 1 B. Flush pages\n");
buf_flush_batch(BUF_FLUSH_LIST, POOL_SIZE / 2);
buf_validate();
printf("--------------------------------------------------------\n");
printf("TEST 1 C. Allocate POOL_SIZE blocks to flush pages\n");
buf_validate();
/* Flush the pool of dirty pages */
for (i = 0; i < POOL_SIZE; i++) {
bl_arr[i] = buf_frame_alloc();
}
buf_validate();
buf_LRU_print();
for (i = 0; i < POOL_SIZE; i++) {
buf_frame_free(bl_arr[i]);
}
buf_validate();
ut_a(buf_all_freed());
mtr_start(&mtr);
frame = buf_page_get(0, 313, RW_S_LATCH, &mtr);
#ifdef UNIV_ASYNC_IO
ut_a(buf_page_io_query(buf_block_align(frame)) == TRUE);
#endif
mtr_commit(&mtr);
}
/************************************************************************
Reads the test database files. */
void
test1(void)
/*=======*/
{
ulint i, j, k, c;
byte* frame;
ulint tm, oldtm;
mtr_t mtr;
printf("--------------------------------------------------------\n");
printf("TEST 1 D. Read linearly database files\n");
oldtm = ut_clock();
for (k = 0; k < 1; k++) {
for (i = 0; i < N_SPACES; i++) {
for (j = 0; j < N_FILES * FILE_SIZE; j++) {
mtr_start(&mtr);
frame = buf_page_get(i, j, RW_S_LATCH, &mtr);
ut_a(mtr_read_ulint(frame + FIL_PAGE_OFFSET,
MLOG_4BYTES, &mtr)
== j);
ut_a(mtr_read_ulint(frame + FIL_PAGE_SPACE,
MLOG_4BYTES, &mtr)
== i);
mtr_commit(&mtr);
}
}
}
tm = ut_clock();
printf("Wall clock time for %lu pages %lu milliseconds\n",
k * i * j, tm - oldtm);
buf_validate();
printf("--------------------------------------------------------\n");
printf("TEST 1 E. Read linearly downward database files\n");
oldtm = ut_clock();
c = 0;
for (k = 0; k < 1; k++) {
for (i = 0; i < N_SPACES; i++) {
for (j = ut_min(1000, FILE_SIZE - 1); j > 0; j--) {
mtr_start(&mtr);
frame = buf_page_get(i, j, RW_S_LATCH, &mtr);
c++;
ut_a(mtr_read_ulint(frame + FIL_PAGE_OFFSET,
MLOG_4BYTES, &mtr)
== j);
ut_a(mtr_read_ulint(frame + FIL_PAGE_SPACE,
MLOG_4BYTES, &mtr)
== i);
ut_a(buf_page_io_query(buf_block_align(frame))
== FALSE);
mtr_commit(&mtr);
}
}
}
tm = ut_clock();
printf("Wall clock time for %lu pages %lu milliseconds\n",
c, tm - oldtm);
buf_validate();
}
/************************************************************************
Reads the test database files. */
void
test2(void)
/*=======*/
{
ulint i, j, k;
byte* frame;
ulint tm, oldtm;
mtr_t mtr;
printf("--------------------------------------------------------\n");
printf("TEST 2. Read randomly database files\n");
oldtm = ut_clock();
for (k = 0; k < 100; k++) {
i = ut_rnd_gen_ulint() % N_SPACES;
j = ut_rnd_gen_ulint() % (N_FILES * FILE_SIZE);
mtr_start(&mtr);
frame = buf_page_get(i, j, RW_S_LATCH, &mtr);
ut_a(mtr_read_ulint(frame + FIL_PAGE_OFFSET,
MLOG_4BYTES, &mtr)
== j);
ut_a(mtr_read_ulint(frame + FIL_PAGE_SPACE,
MLOG_4BYTES, &mtr)
== i);
mtr_commit(&mtr);
}
tm = ut_clock();
printf("Wall clock time for random %lu read %lu milliseconds\n",
k, tm - oldtm);
}
/************************************************************************
Reads the test database files. */
void
test3(void)
/*=======*/
{
ulint i, j, k;
byte* frame;
ulint tm, oldtm;
ulint rnd;
mtr_t mtr;
if (FILE_SIZE < POOL_SIZE + 3050 + ut_dbg_zero) {
return;
}
printf("Flush the pool of high-offset pages\n");
/* Flush the pool of high-offset pages */
for (i = 0; i < POOL_SIZE; i++) {
mtr_start(&mtr);
frame = buf_page_get(0, i, RW_S_LATCH, &mtr);
mtr_commit(&mtr);
}
buf_validate();
printf("--------------------------------------------------------\n");
printf("TEST 3. Read randomly database pages, no read-ahead\n");
oldtm = ut_clock();
rnd = 123;
for (k = 0; k < 400; k++) {
rnd += 23477;
i = 0;
j = POOL_SIZE + 10 + rnd % 3000;
mtr_start(&mtr);
frame = buf_page_get(i, j, RW_S_LATCH, &mtr);
ut_a(mtr_read_ulint(frame + FIL_PAGE_OFFSET,
MLOG_4BYTES, &mtr)
== j);
ut_a(mtr_read_ulint(frame + FIL_PAGE_SPACE,
MLOG_4BYTES, &mtr)
== i);
mtr_commit(&mtr);
}
tm = ut_clock();
printf(
"Wall clock time for %lu random no read-ahead %lu milliseconds\n",
k, tm - oldtm);
buf_validate();
printf("Flush the pool of high-offset pages\n");
/* Flush the pool of high-offset pages */
for (i = 0; i < POOL_SIZE; i++) {
mtr_start(&mtr);
frame = buf_page_get(0, i, RW_S_LATCH, &mtr);
mtr_commit(&mtr);
}
buf_validate();
printf("--------------------------------------------------------\n");
printf("TEST 3 B. Read randomly database pages, random read-ahead\n");
oldtm = ut_clock();
rnd = 123;
for (k = 0; k < 400; k++) {
rnd += 23477;
i = 0;
j = POOL_SIZE + 10 + rnd % 400;
mtr_start(&mtr);
frame = buf_page_get(i, j, RW_S_LATCH, &mtr);
ut_a(mtr_read_ulint(frame + FIL_PAGE_OFFSET,
MLOG_4BYTES, &mtr)
== j);
ut_a(mtr_read_ulint(frame + FIL_PAGE_SPACE,
MLOG_4BYTES, &mtr)
== i);
mtr_commit(&mtr);
}
tm = ut_clock();
printf(
"Wall clock time for %lu random read-ahead %lu milliseconds\n",
k, tm - oldtm);
}
/************************************************************************
Tests speed of CPU algorithms. */
void
test4(void)
/*=======*/
{
ulint i, j;
ulint tm, oldtm;
mtr_t mtr;
buf_frame_t* frame;
os_thread_sleep(2000000);
printf("--------------------------------------------------------\n");
printf("TEST 4. Speed of CPU algorithms\n");
oldtm = ut_clock();
for (j = 0; j < 1000; j++) {
mtr_start(&mtr);
for (i = 0; i < 20; i++) {
frame = buf_page_get(0, i, RW_S_LATCH, &mtr);
}
mtr_commit(&mtr);
}
tm = ut_clock();
printf("Wall clock time for %lu page get-release %lu milliseconds\n",
i * j, tm - oldtm);
buf_validate();
oldtm = ut_clock();
for (i = 0; i < 10000; i++) {
frame = buf_frame_alloc();
buf_frame_free(frame);
}
tm = ut_clock();
printf("Wall clock time for %lu block alloc-free %lu milliseconds\n",
i, tm - oldtm);
ha_print_info(buf_pool->page_hash);
buf_print();
}
/************************************************************************
Tests various points of code. */
void
test5(void)
/*=======*/
{
buf_frame_t* frame;
fil_addr_t addr;
ulint space;
mtr_t mtr;
printf("--------------------------------------------------------\n");
printf("TEST 5. Various tests \n");
mtr_start(&mtr);
frame = buf_page_get(0, 313, RW_S_LATCH, &mtr);
ut_a(buf_frame_get_space_id(frame) == 0);
ut_a(buf_frame_get_page_no(frame) == 313);
ut_a(buf_frame_align(frame + UNIV_PAGE_SIZE - 1) == frame);
ut_a(buf_frame_align(frame) == frame);
ut_a(buf_block_align(frame + UNIV_PAGE_SIZE - 1) ==
buf_block_align(frame));
buf_ptr_get_fsp_addr(frame + UNIV_PAGE_SIZE - 1, &space, &addr);
ut_a(addr.page == 313)
ut_a(addr.boffset == UNIV_PAGE_SIZE - 1);
ut_a(space == 0);
mtr_commit(&mtr);
}
/************************************************************************
Random test thread function. */
ulint
random_thread(
/*===========*/
void* arg)
{
ulint n;
ulint i, j, r, t, p, sp, count;
ulint s;
buf_frame_t* arr[POOL_SIZE / N_THREADS];
buf_frame_t* frame;
mtr_t mtr;
mtr_t mtr2;
n = *((ulint*)arg);
printf("Random test thread %lu starts\n", os_thread_get_curr_id());
for (i = 0; i < 30; i++) {
t = ut_rnd_gen_ulint() % 10;
r = ut_rnd_gen_ulint() % 100;
s = ut_rnd_gen_ulint() % (POOL_SIZE / N_THREADS);
p = ut_rnd_gen_ulint();
sp = ut_rnd_gen_ulint() % N_SPACES;
if (i % 100 == 0) {
printf("Thr %lu tst %lu starts\n", os_thread_get_curr_id(), t);
}
ut_a(buf_validate());
mtr_start(&mtr);
if (t == 6) {
/* Allocate free blocks */
for (j = 0; j < s; j++) {
arr[j] = buf_frame_alloc();
ut_a(arr[j]);
}
for (j = 0; j < s; j++) {
buf_frame_free(arr[j]);
}
} else if (t == 9) {
/* buf_flush_batch(BUF_FLUSH_LIST, 30); */
} else if (t == 7) {
/* x-lock many blocks */
for (j = 0; j < s; j++) {
arr[j] = buf_page_get(sp, (p + j)
% (N_FILES * FILE_SIZE),
RW_X_LATCH,
&mtr);
ut_a(arr[j]);
if (j > 0) {
ut_a(arr[j] != arr[j - 1]);
}
}
ut_a(buf_validate());
} else if (t == 8) {
/* s-lock many blocks */
for (j = 0; j < s; j++) {
arr[j] = buf_page_get(sp, (p + j)
% (N_FILES * FILE_SIZE),
RW_S_LATCH,
&mtr);
ut_a(arr[j]);
if (j > 0) {
ut_a(arr[j] != arr[j - 1]);
}
}
} else if (t <= 2) {
for (j = 0; j < r; j++) {
/* Read pages */
mtr_start(&mtr2);
frame = buf_page_get(sp,
p % (N_FILES * FILE_SIZE),
RW_S_LATCH, &mtr2);
ut_a(mtr_read_ulint(frame + FIL_PAGE_OFFSET,
MLOG_4BYTES, &mtr2)
== p % (N_FILES * FILE_SIZE));
ut_a(mtr_read_ulint(frame + FIL_PAGE_SPACE,
MLOG_4BYTES, &mtr2)
== sp);
mtr_commit(&mtr2);
if (t == 0) {
p++; /* upward */
} else if (t == 1) {
p--; /* downward */
} else if (t == 2) {
p = ut_rnd_gen_ulint(); /* randomly */
}
}
} else if (t <= 5) {
for (j = 0; j < r; j++) {
/* Write pages */
mtr_start(&mtr2);
frame = buf_page_get(sp, p % (N_FILES * FILE_SIZE),
RW_X_LATCH, &mtr2);
count = 1 + mtr_read_ulint(frame + COUNTER_OFFSET,
MLOG_4BYTES, &mtr2);
mutex_enter(&incs_mutex);
incs++;
mutex_exit(&incs_mutex);
mlog_write_ulint(frame + COUNTER_OFFSET, count,
MLOG_4BYTES, &mtr2);
mtr_commit(&mtr2);
if (t == 3) {
p++; /* upward */
} else if (t == 4) {
p--; /* downward */
} else if (t == 5) {
p = ut_rnd_gen_ulint(); /* randomly */
}
}
} /* if t = */
mtr_commit(&mtr);
/* printf("Thr %lu tst %lu ends ", os_thread_get_curr_id(), t); */
ut_a(buf_validate());
} /* for i */
printf("\nRandom test thread %lu exits\n", os_thread_get_curr_id());
return(0);
}
/************************************************************************
Random test thread function which reports the rw-lock list. */
ulint
rw_list_thread(
/*===========*/
void* arg)
{
ulint n;
ulint i;
n = *((ulint*)arg);
printf("\nRw list test thread %lu starts\n", os_thread_get_curr_id());
for (i = 0; i < 10; i++) {
os_thread_sleep(3000000);
rw_lock_list_print_info();
buf_validate();
}
return(0);
}
/*************************************************************************
Performs random operations on the buffer with several threads. */
void
test6(void)
/*=======*/
{
ulint i, j;
os_thread_t thr[N_THREADS + 1];
os_thread_id_t id[N_THREADS + 1];
ulint n[N_THREADS + 1];
ulint count = 0;
buf_frame_t* frame;
mtr_t mtr;
printf("--------------------------------------------------------\n");
printf("TEST 6. Random multi-thread test on the buffer \n");
incs = 0;
mutex_create(&incs_mutex);
for (i = 0; i < N_THREADS; i++) {
n[i] = i;
thr[i] = os_thread_create(random_thread, n + i, id + i);
}
/*
n[N_THREADS] = N_THREADS;
thr[N_THREADS] = os_thread_create(rw_list_thread, n + N_THREADS,
id + N_THREADS);
*/
for (i = 0; i < N_THREADS; i++) {
os_thread_wait(thr[i]);
}
/* os_thread_wait(thr[N_THREADS]); */
for (i = 0; i < N_SPACES; i++) {
for (j = 0; j < N_FILES * FILE_SIZE; j++) {
mtr_start(&mtr);
frame = buf_page_get(i, j, RW_S_LATCH, &mtr);
ut_a(mtr_read_ulint(frame + FIL_PAGE_OFFSET,
MLOG_4BYTES, &mtr)
== j);
ut_a(mtr_read_ulint(frame + FIL_PAGE_SPACE,
MLOG_4BYTES, &mtr)
== i);
count += mtr_read_ulint(frame + COUNTER_OFFSET,
MLOG_4BYTES, &mtr);
mtr_commit(&mtr);
}
}
printf("Count %lu incs %lu\n", count, incs);
ut_a(count == incs);
}
/************************************************************************
Frees the spaces in the file system. */
void
free_system(void)
/*=============*/
{
ulint i;
for (i = 0; i < N_SPACES; i++) {
fil_space_free(i);
}
}
/************************************************************************
Main test function. */
void
main(void)
/*======*/
{
ulint tm, oldtm;
/* buf_debug_prints = TRUE; */
oldtm = ut_clock();
os_aio_init(160, 5);
sync_init();
mem_init(1500000);
fil_init(26); /* Allow 25 open files at a time */
buf_pool_init(POOL_SIZE, POOL_SIZE);
log_init();
buf_validate();
ut_a(fil_validate());
create_files();
create_db();
buf_validate();
test1();
buf_validate();
test2();
buf_validate();
test3();
buf_validate();
test4();
test5();
buf_validate();
test6();
buf_validate();
buf_print();
buf_flush_batch(BUF_FLUSH_LIST, POOL_SIZE + 1);
buf_print();
buf_validate();
os_thread_sleep(1000000);
buf_print();
buf_all_freed();
free_system();
tm = ut_clock();
printf("Wall clock time for test %lu milliseconds\n", tm - oldtm);
printf("TESTS COMPLETED SUCCESSFULLY!\n");
}

View File

@ -1,185 +0,0 @@
/************************************************************************
The test module for the operating system interface
(c) 1995 Innobase Oy
Created 9/27/1995 Heikki Tuuri
*************************************************************************/
#include "../os0thread.h"
#include "../os0shm.h"
#include "../os0proc.h"
#include "../os0sync.h"
#include "../os0file.h"
#include "ut0ut.h"
#include "sync0sync.h"
#include "mem0mem.h"
ulint last_thr = 1;
byte global_buf[1000000];
os_file_t file;
os_file_t file2;
os_event_t gl_ready;
mutex_t ios_mutex;
ulint ios;
/************************************************************************
Io-handler thread function. */
ulint
handler_thread(
/*===========*/
void* arg)
{
ulint segment;
void* mess;
ulint i;
bool ret;
segment = *((ulint*)arg);
printf("Thread %lu starts\n", segment);
for (i = 0;; i++) {
ret = os_aio_wait(segment, &mess);
mutex_enter(&ios_mutex);
ios++;
mutex_exit(&ios_mutex);
ut_a(ret);
/* printf("Message for thread %lu %lu\n", segment,
(ulint)mess); */
if ((ulint)mess == 3333) {
os_event_set(gl_ready);
}
}
return(0);
}
/************************************************************************
Test of io-handler threads */
void
test4(void)
/*=======*/
{
ulint i;
bool ret;
void* buf;
ulint rnd;
ulint tm, oldtm;
os_thread_t thr[5];
os_thread_id_t id[5];
ulint n[5];
printf("-------------------------------------------\n");
printf("OS-TEST 4. Test of asynchronous file io\n");
/* Align the buffer for file io */
buf = (void*)(((ulint)global_buf + 6300) & (~0xFFF));
gl_ready = os_event_create(NULL);
ios = 0;
sync_init();
mem_init();
mutex_create(&ios_mutex);
for (i = 0; i < 5; i++) {
n[i] = i;
thr[i] = os_thread_create(handler_thread, n + i, id + i);
}
rnd = 0;
oldtm = ut_clock();
for (i = 0; i < 4096; i++) {
ret = os_aio_read(file, (byte*)buf + 8192 * (rnd % 100),
8192 * (rnd % 4096), 0,
8192, (void*)i);
ut_a(ret);
rnd += 1;
}
ret = os_aio_read(file, buf, 8192 * (rnd % 1024), 0, 8192,
(void*)3333);
ut_a(ret);
ut_a(!os_aio_all_slots_free());
tm = ut_clock();
printf("All ios queued! N ios: %lu\n", ios);
printf("Wall clock time for test %lu milliseconds\n", tm - oldtm);
os_event_wait(gl_ready);
tm = ut_clock();
printf("N ios: %lu\n", ios);
printf("Wall clock time for test %lu milliseconds\n", tm - oldtm);
os_thread_sleep(2000000);
printf("N ios: %lu\n", ios);
ut_a(os_aio_all_slots_free());
}
/*************************************************************************
Initializes the asyncronous io system for tests. */
void
init_aio(void)
/*==========*/
{
bool ret;
void* buf;
buf = (void*)(((ulint)global_buf + 6300) & (~0xFFF));
os_aio_init(160, 5);
file = os_file_create("j:\\tsfile4", OS_FILE_CREATE, OS_FILE_TABLESPACE,
&ret);
if (ret == FALSE) {
ut_a(os_file_get_last_error() == OS_FILE_ALREADY_EXISTS);
file = os_file_create("j:\\tsfile4", OS_FILE_OPEN,
OS_FILE_TABLESPACE, &ret);
ut_a(ret);
}
}
/************************************************************************
Main test function. */
void
main(void)
/*======*/
{
ulint tm, oldtm;
oldtm = ut_clock();
init_aio();
test4();
tm = ut_clock();
printf("Wall clock time for test %lu milliseconds\n", tm - oldtm);
printf("TESTS COMPLETED SUCCESSFULLY!\n");
}

View File

@ -964,19 +964,6 @@ loop:
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);
if (!com_shm_get_not_empty(map)) {
@ -1131,33 +1118,13 @@ loop:
ut_memcpy(com_shm_get_addr(map), com_shm_endpoint_get_addr(ep),
sender_len);
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_exit(ep2);
/* Signal the event */
os_event_set(com_shm_endpoint_get_not_empty(ep2));
return(0);
#ifdef notdefined
}
com_shm_system_call_count++;
com_shm_exit(ep2);
/* Signal the event */
os_event_set(com_shm_endpoint_get_not_empty(ep2));
return(0);
#endif
}

View File

@ -1,19 +0,0 @@
include ..\..\makefile.i
doall: tscom tscli
tscom: ..\com.lib tscom.c makefile
$(CCOM) $(CFL) -I.. -I..\.. ..\com.lib ..\..\ut.lib ..\..\mem.lib ..\..\sync.lib ..\..\os.lib tscom.c $(LFL)
tscli: ..\com.lib tscli.c makefile
$(CCOM) $(CFL) -I.. -I..\.. ..\com.lib ..\..\ut.lib ..\..\mem.lib ..\..\sync.lib ..\..\os.lib tscli.c $(LFL)

View File

@ -1,96 +0,0 @@
/************************************************************************
The test module for communication
(c) 1995 Innobase Oy
Created 9/26/1995 Heikki Tuuri
*************************************************************************/
#include "../com0com.h"
#include "../com0shm.h"
#include "ut0ut.h"
#include "mem0mem.h"
#include "os0thread.h"
#include "sync0ipm.h"
#include "sync0sync.h"
byte buf[10000];
char addr[150];
void
test1(void)
/*=======*/
{
com_endpoint_t* ep;
ulint ret;
ulint size;
ulint len;
ulint addr_len;
ulint i;
ep = com_endpoint_create(COM_SHM);
ut_a(ep);
size = 8192;
ret = com_endpoint_set_option(ep, COM_OPT_MAX_DGRAM_SIZE,
(byte*)&size, 0);
ut_a(ret == 0);
ret = com_bind(ep, "CLI", 3);
ut_a(ret == 0);
printf("Client endpoint created!\n");
for (i = 0; i < 10000; i++) {
ret = com_sendto(ep, (byte*)"Hello from client!\n", 18, "SRV", 3);
ut_a(ret == 0);
ret = com_recvfrom(ep, buf, 10000, &len, addr, 150, &addr_len);
ut_a(ret == 0);
buf[len] = '\0';
addr[addr_len] = '\0';
/*
printf(
"Message of len %lu\n%s \nreceived from address %s of len %lu\n",
len, buf, addr, addr_len);
*/
}
ret = com_endpoint_free(ep);
ut_ad(ret == 0);
printf("Count of extra system calls in com_shm %lu\n",
com_shm_system_call_count);
printf("Count of extra system calls in ip_mutex %lu\n",
ip_mutex_system_call_count);
}
void
main(void)
/*======*/
{
ulint tm, oldtm;
sync_init();
mem_init();
oldtm = ut_clock();
test1();
ut_ad(mem_all_freed());
tm = ut_clock();
printf("Wall clock time for test %ld milliseconds\n", tm - oldtm);
printf("TESTS COMPLETED SUCCESSFULLY!\n");
}

View File

@ -1,94 +0,0 @@
/************************************************************************
The test module for communication
(c) 1995 Innobase Oy
Created 9/26/1995 Heikki Tuuri
*************************************************************************/
#include "../com0com.h"
#include "../com0shm.h"
#include "ut0ut.h"
#include "mem0mem.h"
#include "os0thread.h"
#include "sync0ipm.h"
#include "sync0sync.h"
byte buf[10000];
char addr[150];
void
test1(void)
/*=======*/
{
com_endpoint_t* ep;
ulint ret;
ulint size;
ulint len;
ulint addr_len;
ulint i;
ep = com_endpoint_create(COM_SHM);
ut_a(ep);
size = 8192;
ret = com_endpoint_set_option(ep, COM_OPT_MAX_DGRAM_SIZE,
(byte*)&size, 0);
ut_a(ret == 0);
ret = com_bind(ep, "SRV", 3);
ut_a(ret == 0);
printf("Server endpoint created!\n");
for (i = 0; i < 50000; i++) {
ret = com_recvfrom(ep, buf, 10000, &len, addr, 150, &addr_len);
ut_a(ret == 0);
buf[len] = '\0';
addr[addr_len] = '\0';
/*
printf(
"Message of len %lu\n%s \nreceived from address %s of len %lu\n",
len, buf, addr, addr_len);
*/
ret = com_sendto(ep, (byte*)"Hello from server!\n", 18, "CLI", 3);
ut_a(ret == 0);
}
ret = com_endpoint_free(ep);
ut_ad(ret == 0);
printf("Count of extra system calls in com_shm %lu\n",
com_shm_system_call_count);
printf("Count of extra system calls in ip_mutex %lu\n",
ip_mutex_system_call_count);
}
void
main(void)
/*======*/
{
ulint tm, oldtm;
sync_init();
mem_init();
oldtm = ut_clock();
test1();
ut_ad(mem_all_freed());
tm = ut_clock();
printf("Wall clock time for test %ld milliseconds\n", tm - oldtm);
printf("TESTS COMPLETED SUCCESSFULLY!\n");
}

View File

@ -727,416 +727,3 @@ dtuple_big_rec_free(
{
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 */

View File

@ -25,6 +25,11 @@ Created 1/8/1996 Heikki Tuuri
#include "trx0roll.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
in the SYS_TABLES system table. */
@ -344,33 +349,6 @@ dict_build_col_def_step(
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
in the SYS_INDEXES system table. */
@ -767,26 +745,6 @@ dict_drop_index_tree(
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. */
@ -1237,6 +1195,7 @@ dict_create_add_foreigns_to_dictionary(
que_t* graph;
ulint number = start_id + 1;
ulint len;
ulint namelen;
ulint error;
char* ebuf = dict_foreign_err_buf;
ulint i;
@ -1267,15 +1226,21 @@ loop:
"PROCEDURE ADD_FOREIGN_DEFS_PROC () IS\n"
"BEGIN\n");
namelen = strlen(table->name);
ut_a(namelen < MAX_TABLE_NAME_LEN);
if (foreign->id == NULL) {
/* Generate a new constraint id */
foreign->id = mem_heap_alloc(foreign->heap,
ut_strlen(table->name)
+ 20);
foreign->id = mem_heap_alloc(foreign->heap, namelen + 20);
/* no overflow if number < 1e13 */
sprintf(foreign->id, "%s_ibfk_%lu", table->name, (ulong) 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,
"INSERT INTO SYS_FOREIGN VALUES('%s', '%s', '%s', %lu);\n",
foreign->id,
@ -1285,6 +1250,9 @@ loop:
+ (foreign->type << 24)));
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,
"INSERT INTO SYS_FOREIGN_COLS VALUES('%s', %lu, '%s', '%s');\n",
@ -1294,6 +1262,7 @@ loop:
foreign->referenced_col_names[i]);
}
ut_a(len < (sizeof buf) - 19)
len += sprintf(buf + len,"COMMIT WORK;\nEND;\n");
graph = pars_sql(buf);
@ -1316,14 +1285,14 @@ loop:
if (error == DB_DUPLICATE_KEY) {
mutex_enter(&dict_foreign_err_mutex);
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),
" Error in foreign key constraint creation for table %.500s.\n"
"A foreign key constraint of name %.500s\n"
" Error in foreign key constraint creation for table %s.\n"
"A foreign key constraint of name %s\n"
"already exists (note that internally InnoDB adds 'databasename/'\n"
"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);
return(error);
@ -1336,8 +1305,10 @@ loop:
mutex_enter(&dict_foreign_err_mutex);
ut_sprintf_timestamp(ebuf);
ut_a(strlen(ebuf) < DICT_FOREIGN_ERR_BUF_LEN
- MAX_TABLE_NAME_LEN - 124);
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);
mutex_exit(&dict_foreign_err_mutex);

View File

@ -1,16 +0,0 @@
include ..\..\makefile.i
tsdict: ..\dict.lib tsdict.c
$(CCOM) $(CFL) -I.. -I..\.. ..\dict.lib ..\..\data.lib ..\..\buf.lib ..\..\mach.lib ..\..\fil.lib ..\..\ha.lib ..\..\ut.lib ..\..\sync.lib ..\..\mem.lib ..\..\os.lib tsdict.c $(LFL)

View File

@ -1,73 +0,0 @@
/************************************************************************
The test module for the data dictionary
(c) 1996 Innobase Oy
Created 1/13/1996 Heikki Tuuri
*************************************************************************/
#include "sync0sync.h"
#include "mem0mem.h"
#include "buf0buf.h"
#include "data0type.h"
#include "..\dict0dict.h"
/************************************************************************
Basic test of data dictionary. */
void
test1(void)
/*=======*/
{
dict_table_t* table;
dict_index_t* index;
table = dict_table_create("TS_TABLE1", 3);
dict_table_add_col(table, "COL1", DATA_INT, 3, 4, 5);
dict_table_add_col(table, "COL2", DATA_INT, 3, 4, 5);
dict_table_add_col(table, "COL3", DATA_INT, 3, 4, 5);
ut_a(0 == dict_table_publish(table));
index = dict_index_create("TS_TABLE1", "IND1",
DICT_UNIQUE | DICT_CLUSTERED | DICT_MIX, 2, 1);
dict_index_add_field(index, "COL2", DICT_DESCEND);
dict_index_add_field(index, "COL1", 0);
ut_a(0 == dict_index_publish(index));
dict_table_print(table);
dict_table_free(table);
ut_a(dict_all_freed());
dict_free_all();
ut_a(dict_all_freed());
}
/************************************************************************
Main test function. */
void
main(void)
/*======*/
{
ulint tm, oldtm;
oldtm = ut_clock();
sync_init();
mem_init();
buf_pool_init(100, 100);
dict_init();
test1();
tm = ut_clock();
printf("Wall clock time for test %lu milliseconds\n", tm - oldtm);
printf("TESTS COMPLETED SUCCESSFULLY!\n");
}

View File

@ -1,12 +0,0 @@
include ..\..\makefile.i
tsdyn: ..\dyn.lib tsdyn.c makefile
$(CCOM) $(CFL) -I.. -I..\.. ..\dyn.lib ..\..\mem.lib ..\..\ut.lib ..\..\mach.lib ..\..\sync.lib ..\..\os.lib tsdyn.c $(LFL)

View File

@ -1,57 +0,0 @@
/************************************************************************
The test module for dynamic array
(c) 1996 Innobase Oy
Created 2/5/1996 Heikki Tuuri
*************************************************************************/
#include "../dyn0dyn.h"
#include "sync0sync.h"
#include "mem0mem.h"
/****************************************************************
Basic test. */
void
test1(void)
/*=======*/
{
dyn_array_t dyn;
ulint i;
ulint* ulint_ptr;
printf("-------------------------------------------\n");
printf("TEST 1. Basic test\n");
dyn_array_create(&dyn);
for (i = 0; i < 1000; i++) {
ulint_ptr = dyn_array_push(&dyn, sizeof(ulint));
*ulint_ptr = i;
}
ut_a(dyn_array_get_n_elements(&dyn) == 1000);
for (i = 0; i < 1000; i++) {
ulint_ptr = dyn_array_get_nth_element(&dyn, i, sizeof(ulint));
ut_a(*ulint_ptr == i);
}
dyn_array_free(&dyn);
}
void
main(void)
{
sync_init();
mem_init();
test1();
ut_ad(sync_all_freed());
ut_ad(mem_all_freed());
printf("TEST SUCCESSFULLY COMPLETED!\n");
}

View File

@ -1,15 +0,0 @@
include ..\..\makefile.i
tsfil: ..\fil.lib tsfil.c
$(CCOM) $(CFL) -I.. -I..\.. ..\fil.lib ..\..\ha.lib ..\..\ut.lib ..\..\sync.lib ..\..\mem.lib ..\..\os.lib tsfil.c $(LFL)

View File

@ -1,329 +0,0 @@
/************************************************************************
The test module for the file system
(c) 1995 Innobase Oy
Created 10/29/1995 Heikki Tuuri
*************************************************************************/
#include "os0thread.h"
#include "os0file.h"
#include "ut0ut.h"
#include "sync0sync.h"
#include "mem0mem.h"
#include "..\fil0fil.h"
ulint last_thr = 1;
byte global_buf[10000000];
byte global_buf2[20000];
os_file_t files[1000];
os_event_t gl_ready;
mutex_t ios_mutex;
ulint ios;
/*********************************************************************
Test for synchronous file io. */
void
test1(void)
/*=======*/
{
ulint i, j;
void* mess;
bool ret;
void* buf;
ulint rnd, rnd3;
ulint tm, oldtm;
printf("-------------------------------------------\n");
printf("FIL-TEST 1. Test of synchronous file io\n");
/* Align the buffer for file io */
buf = (void*)(((ulint)global_buf + 6300) & (~0xFFF));
rnd = ut_time();
rnd3 = ut_time();
rnd = rnd * 3416133;
rnd3 = rnd3 * 6576681;
oldtm = ut_clock();
for (j = 0; j < 300; j++) {
for (i = 0; i < (rnd3 % 15); i++) {
fil_read((rnd % 1000) / 100, rnd % 100, 0, 8192, buf, NULL);
ut_a(fil_validate());
ret = fil_aio_wait(0, &mess);
ut_a(ret);
ut_a(fil_validate());
ut_a(*((ulint*)buf) == rnd % 1000);
rnd += 1;
}
rnd = rnd + 3416133;
rnd3 = rnd3 + 6576681;
}
tm = ut_clock();
printf("Wall clock time for synchr. io %lu milliseconds\n",
tm - oldtm);
}
/************************************************************************
Io-handler thread function. */
ulint
handler_thread(
/*===========*/
void* arg)
{
ulint segment;
void* mess;
void* buf;
ulint i;
bool ret;
segment = *((ulint*)arg);
buf = (void*)(((ulint)global_buf + 6300) & (~0xFFF));
printf("Thread %lu starts\n", segment);
for (i = 0;; i++) {
ret = fil_aio_wait(segment, &mess);
ut_a(ret);
if ((ulint)mess == 3333) {
os_event_set(gl_ready);
} else {
ut_a((ulint)mess ==
*((ulint*)((byte*)buf + 8192 * (ulint)mess)));
}
mutex_enter(&ios_mutex);
ios++;
mutex_exit(&ios_mutex);
ut_a(ret);
/* printf("Message for thread %lu %lu\n", segment,
(ulint)mess); */
}
return(0);
}
/************************************************************************
Test of io-handler threads */
void
test2(void)
/*=======*/
{
ulint i;
ulint j;
void* buf;
ulint rnd, rnd3;
ulint tm, oldtm;
os_thread_t thr[5];
os_thread_id_t id[5];
ulint n[5];
/* Align the buffer for file io */
buf = (void*)(((ulint)global_buf + 6300) & (~0xFFF));
gl_ready = os_event_create(NULL);
ios = 0;
mutex_create(&ios_mutex);
for (i = 0; i < 5; i++) {
n[i] = i;
thr[i] = os_thread_create(handler_thread, n + i, id + i);
}
printf("-------------------------------------------\n");
printf("FIL-TEST 2. Test of asynchronous file io\n");
rnd = ut_time();
rnd3 = ut_time();
rnd = rnd * 3416133;
rnd3 = rnd3 * 6576681;
oldtm = ut_clock();
for (j = 0; j < 300; j++) {
for (i = 0; i < (rnd3 % 15); i++) {
fil_read((rnd % 1000) / 100, rnd % 100, 0, 8192,
(void*)((byte*)buf + 8192 * (rnd % 1000)),
(void*)(rnd % 1000));
rnd += 1;
}
ut_a(fil_validate());
rnd = rnd + 3416133;
rnd3 = rnd3 + 6576681;
}
ut_a(!os_aio_all_slots_free());
tm = ut_clock();
printf("Wall clock time for asynchr. io %lu milliseconds\n",
tm - oldtm);
fil_read(5, 25, 0, 8192,
(void*)((byte*)buf + 8192 * 1000),
(void*)3333);
tm = ut_clock();
ut_a(fil_validate());
printf("All ios queued! N ios: %lu\n", ios);
printf("Wall clock time for test %lu milliseconds\n", tm - oldtm);
os_event_wait(gl_ready);
tm = ut_clock();
printf("N ios: %lu\n", ios);
printf("Wall clock time for test %lu milliseconds\n", tm - oldtm);
os_thread_sleep(2000000);
printf("N ios: %lu\n", ios);
ut_a(fil_validate());
ut_a(os_aio_all_slots_free());
}
/*************************************************************************
Creates the files for the file system test and inserts them to
the file system. */
void
create_files(void)
/*==============*/
{
bool ret;
ulint i, j, k, n;
void* buf;
void* mess;
char name[10];
buf = (void*)(((ulint)global_buf2 + 6300) & (~0xFFF));
name[0] = 't';
name[1] = 's';
name[2] = 'f';
name[3] = 'i';
name[4] = 'l';
name[5] = 'e';
name[8] = '\0';
for (k = 0; k < 10; k++) {
for (i = 0; i < 20; i++) {
name[6] = (char)(k + (ulint)'a');
name[7] = (char)(i + (ulint)'a');
files[i] = os_file_create(name, OS_FILE_CREATE,
OS_FILE_TABLESPACE, &ret);
if (ret == FALSE) {
ut_a(os_file_get_last_error() ==
OS_FILE_ALREADY_EXISTS);
files[i] = os_file_create(name, OS_FILE_OPEN,
OS_FILE_TABLESPACE, &ret);
ut_a(ret);
} else {
for (j = 0; j < 5; j++) {
for (n = 0; n < 8192 / sizeof(ulint); n++) {
*((ulint*)buf + n) =
k * 100 + i * 5 + j;
}
ret = os_aio_write(files[i], buf, 8192 * j,
0, 8192, NULL);
ut_a(ret);
ret = os_aio_wait(0, &mess);
ut_a(ret);
ut_a(mess == NULL);
}
}
ret = os_file_close(files[i]);
ut_a(ret);
if (i == 0) {
fil_space_create("noname", k, OS_FILE_TABLESPACE);
}
ut_a(fil_validate());
fil_node_create(name, 5, k);
}
}
}
/************************************************************************
Frees the spaces in the file system. */
void
free_system(void)
/*=============*/
{
ulint i;
for (i = 0; i < 10; i++) {
fil_space_free(i);
}
}
/************************************************************************
Main test function. */
void
main(void)
/*======*/
{
ulint tm, oldtm;
oldtm = ut_clock();
os_aio_init(160, 5);
sync_init();
mem_init();
fil_init(2); /* Allow only 2 open files at a time */
ut_a(fil_validate());
create_files();
test1();
test2();
free_system();
tm = ut_clock();
printf("Wall clock time for test %lu milliseconds\n", tm - oldtm);
printf("TESTS COMPLETED SUCCESSFULLY!\n");
}

View File

@ -790,19 +790,12 @@ fsp_init_file_page_low(
byte* ptr) /* in: pointer to a page */
{
page_t* page;
#ifdef UNIV_BASIC_LOG_DEBUG
ulint i;
#endif
page = buf_frame_align(ptr);
buf_block_align(page)->check_index_page_at_flush = FALSE;
#ifdef UNIV_BASIC_LOG_DEBUG
/* printf("In log debug version: Erase the contents of the file page\n");
*/
for (i = 0; i < UNIV_PAGE_SIZE; i++) {
page[i] = (byte)0xFF;
}
memset(page, 0xff, UNIV_PAGE_SIZE);
#endif
mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
ut_dulint_zero);
@ -812,6 +805,7 @@ fsp_init_file_page_low(
/***************************************************************
Inits a file page whose prior contents should be ignored. */
static
void
fsp_init_file_page(
/*===============*/

File diff suppressed because it is too large Load Diff

View File

@ -1,891 +0,0 @@
/************************************************************************
The test module for the file system and buffer manager
(c) 1995 Innobase Oy
Created 11/16/1995 Heikki Tuuri
*************************************************************************/
#include "string.h"
#include "os0thread.h"
#include "os0file.h"
#include "ut0ut.h"
#include "ut0byte.h"
#include "sync0sync.h"
#include "mem0mem.h"
#include "fil0fil.h"
#include "..\buf0buf.h"
#include "..\buf0buf.h1"
#include "..\buf0buf.h2"
#include "..\buf0flu.h"
#include "..\buf0lru.h"
#include "mtr0buf.h"
#include "mtr0log.h"
#include "fsp0fsp.h"
#include "log0log.h"
os_file_t files[1000];
mutex_t ios_mutex;
ulint ios;
ulint n[5];
/************************************************************************
Io-handler thread function. */
ulint
handler_thread(
/*===========*/
void* arg)
{
ulint segment;
void* mess;
ulint i;
bool ret;
segment = *((ulint*)arg);
printf("Thread %lu starts\n", segment);
for (i = 0;; i++) {
ret = fil_aio_wait(segment, &mess);
ut_a(ret);
buf_page_io_complete((buf_block_t*)mess);
mutex_enter(&ios_mutex);
ios++;
mutex_exit(&ios_mutex);
}
return(0);
}
/************************************************************************
Creates the test database files. */
void
create_db(void)
/*===========*/
{
ulint i;
buf_block_t* block;
byte* frame;
ulint j;
ulint tm, oldtm;
mtr_t mtr;
oldtm = ut_clock();
for (i = 0; i < 1; i++) {
for (j = 0; j < 4096; j++) {
mtr_start(&mtr);
if (j == 0) {
fsp_header_init(i, 4096, &mtr);
block = mtr_page_get(i, j, NULL, &mtr);
} else {
block = mtr_page_create(i, j, &mtr);
}
frame = buf_block_get_frame(block);
mtr_page_x_lock(block, &mtr);
mlog_write_ulint(frame + FIL_PAGE_PREV,
j - 1, MLOG_4BYTES, &mtr);
mlog_write_ulint(frame + FIL_PAGE_NEXT,
j + 1, MLOG_4BYTES, &mtr);
mlog_write_ulint(frame + FIL_PAGE_OFFSET,
j, MLOG_4BYTES, &mtr);
mtr_commit(&mtr);
}
}
tm = ut_clock();
printf("Wall clock time for test %lu milliseconds\n", tm - oldtm);
/* Flush the pool of dirty pages by reading low-offset pages */
for (i = 0; i < 1000; i++) {
mtr_start(&mtr);
block = mtr_page_get(0, i, NULL, &mtr);
frame = buf_block_get_frame(block);
mtr_page_s_lock(block, &mtr);
ut_a(mtr_read_ulint(frame + FIL_PAGE_OFFSET, MLOG_4BYTES,
&mtr) == i);
mtr_commit(&mtr);
}
os_thread_sleep(1000000);
ut_a(buf_all_freed());
}
/*************************************************************************
Creates the files for the file system test and inserts them to
the file system. */
void
create_files(void)
/*==============*/
{
bool ret;
ulint i, k;
char name[20];
os_thread_t thr[5];
os_thread_id_t id[5];
strcpy(name, "j:\\tsfile1");
for (k = 0; k < 1; k++) {
for (i = 0; i < 4; i++) {
name[9] = (char)((ulint)'0' + i);
files[i] = os_file_create(name, OS_FILE_CREATE,
OS_FILE_TABLESPACE, &ret);
if (ret == FALSE) {
ut_a(os_file_get_last_error() ==
OS_FILE_ALREADY_EXISTS);
files[i] = os_file_create(
name, OS_FILE_OPEN,
OS_FILE_TABLESPACE, &ret);
ut_a(ret);
}
ret = os_file_set_size(files[i], 4096 * 8192, 0);
ut_a(ret);
ret = os_file_close(files[i]);
ut_a(ret);
if (i == 0) {
fil_space_create("noname", k, OS_FILE_TABLESPACE);
}
ut_a(fil_validate());
fil_node_create(name, 4096, k);
}
}
ios = 0;
mutex_create(&ios_mutex);
for (i = 0; i < 5; i++) {
n[i] = i;
thr[i] = os_thread_create(handler_thread, n + i, id + i);
}
}
/************************************************************************
Reads the test database files. */
void
test1(void)
/*=======*/
{
ulint i, j, k;
buf_block_t* block;
byte* frame;
ulint tm, oldtm;
buf_flush_batch(BUF_FLUSH_LIST, 1000);
os_thread_sleep(1000000);
buf_all_freed();
oldtm = ut_clock();
for (k = 0; k < 1; k++) {
for (i = 0; i < 1; i++) {
for (j = 0; j < 409; j++) {
block = buf_page_get(i, j, NULL);
frame = buf_block_get_frame(block);
buf_page_s_lock(block);
ut_a(*((ulint*)(frame + 16)) == j);
buf_page_s_unlock(block);
buf_page_release(block);
}
}
}
tm = ut_clock();
printf("Wall clock time for test %lu milliseconds\n", tm - oldtm);
}
/************************************************************************
Reads the test database files. */
void
test2(void)
/*=======*/
{
ulint i, j, k, rnd;
buf_block_t* block;
byte* frame;
ulint tm, oldtm;
oldtm = ut_clock();
rnd = 123;
for (k = 0; k < 100; k++) {
rnd += 23651;
rnd = rnd % 4096;
i = rnd / 4096;
j = rnd % 2048;
block = buf_page_get(i, j, NULL);
frame = buf_block_get_frame(block);
buf_page_s_lock(block);
ut_a(*((ulint*)(frame + 16)) == j);
buf_page_s_unlock(block);
buf_page_release(block);
}
tm = ut_clock();
printf("Wall clock time for random read %lu milliseconds\n",
tm - oldtm);
}
/************************************************************************
Reads the test database files. */
void
test4(void)
/*=======*/
{
ulint i, j, k, rnd;
buf_block_t* block;
byte* frame;
ulint tm, oldtm;
/* Flush the pool of high-offset pages */
for (i = 0; i < 1000; i++) {
block = buf_page_get(0, i, NULL);
frame = buf_block_get_frame(block);
buf_page_s_lock(block);
ut_a(*((ulint*)(frame + 16)) == i);
buf_page_s_unlock(block);
buf_page_release(block);
}
printf("Test starts\n");
oldtm = ut_clock();
rnd = 123;
for (k = 0; k < 400; k++) {
rnd += 4357;
i = 0;
j = 1001 + rnd % 3000;
block = buf_page_get(i, j, NULL);
frame = buf_block_get_frame(block);
buf_page_s_lock(block);
ut_a(*((ulint*)(frame + 16)) == j);
buf_page_s_unlock(block);
buf_page_release(block);
}
tm = ut_clock();
printf(
"Wall clock time for %lu random no read-ahead %lu milliseconds\n",
k, tm - oldtm);
/* Flush the pool of high-offset pages */
for (i = 0; i < 1000; i++) {
block = buf_page_get(0, i, NULL);
frame = buf_block_get_frame(block);
buf_page_s_lock(block);
ut_a(*((ulint*)(frame + 16)) == i);
buf_page_s_unlock(block);
buf_page_release(block);
}
printf("Test starts\n");
oldtm = ut_clock();
rnd = 123;
for (k = 0; k < 400; k++) {
rnd += 4357;
i = 0;
j = 1001 + rnd % 400;
block = buf_page_get(i, j, NULL);
frame = buf_block_get_frame(block);
buf_page_s_lock(block);
ut_a(*((ulint*)(frame + 16)) == j);
buf_page_s_unlock(block);
buf_page_release(block);
}
tm = ut_clock();
printf(
"Wall clock time for %lu random read-ahead %lu milliseconds\n",
k, tm - oldtm);
}
/************************************************************************
Tests speed of CPU algorithms. */
void
test3(void)
/*=======*/
{
ulint i, j;
buf_block_t* block;
ulint tm, oldtm;
for (i = 0; i < 400; i++) {
block = buf_page_get(0, i, NULL);
buf_page_release(block);
}
os_thread_sleep(2000000);
oldtm = ut_clock();
for (j = 0; j < 500; j++) {
for (i = 0; i < 200; i++) {
block = buf_page_get(0, i, NULL);
/*
buf_page_s_lock(block);
buf_page_s_unlock(block);
*/
buf_page_release(block);
}
}
tm = ut_clock();
printf("Wall clock time for %lu page get-release %lu milliseconds\n",
i * j, tm - oldtm);
oldtm = ut_clock();
for (j = 0; j < 500; j++) {
for (i = 0; i < 200; i++) {
buf_page_get(0, i, NULL);
/*
buf_page_s_lock(block);
buf_page_s_unlock(block);
*/
buf_page_release(block);
}
}
tm = ut_clock();
printf("Wall clock time for %lu block get-release %lu milliseconds\n",
i * j, tm - oldtm);
oldtm = ut_clock();
for (i = 0; i < 100000; i++) {
block = buf_block_alloc();
buf_block_free(block);
}
tm = ut_clock();
printf("Wall clock time for %lu block alloc-free %lu milliseconds\n",
i, tm - oldtm);
ha_print_info(buf_pool->page_hash);
}
/************************************************************************
Frees the spaces in the file system. */
void
free_system(void)
/*=============*/
{
ulint i;
for (i = 0; i < 1; i++) {
fil_space_free(i);
}
}
/************************************************************************
Test for file space management. */
void
test5(void)
/*=======*/
{
mtr_t mtr;
ulint seg_page;
ulint new_page;
ulint seg_page2;
ulint new_page2;
buf_block_t* block;
bool finished;
ulint i;
ulint reserved;
ulint used;
ulint tm, oldtm;
os_thread_sleep(1000000);
buf_validate();
buf_print();
mtr_start(&mtr);
seg_page = fseg_create(0, 0, 1000, 555, &mtr);
mtr_commit(&mtr);
os_thread_sleep(1000000);
buf_validate();
printf("Segment created: header page %lu\n", seg_page);
mtr_start(&mtr);
block = mtr_page_get(0, seg_page, NULL, &mtr);
new_page = fseg_alloc_free_page(buf_block_get_frame(block) + 1000,
2, FSP_UP, &mtr);
mtr_commit(&mtr);
buf_validate();
buf_print();
printf("Segment page allocated %lu\n", new_page);
finished = FALSE;
while (!finished) {
mtr_start(&mtr);
block = mtr_page_get(0, seg_page, NULL, &mtr);
finished = fseg_free_step(
buf_block_get_frame(block) + 1000, &mtr);
mtr_commit(&mtr);
}
/***********************************************/
os_thread_sleep(1000000);
buf_validate();
buf_print();
mtr_start(&mtr);
seg_page = fseg_create(0, 0, 1000, 557, &mtr);
mtr_commit(&mtr);
ut_a(seg_page == 1);
printf("Segment created: header page %lu\n", seg_page);
new_page = seg_page;
for (i = 0; i < 1023; i++) {
mtr_start(&mtr);
block = mtr_page_get(0, seg_page, NULL, &mtr);
new_page = fseg_alloc_free_page(
buf_block_get_frame(block) + 1000,
new_page + 1, FSP_UP, &mtr);
if (i < FSP_EXTENT_SIZE - 1) {
ut_a(new_page == 2 + i);
} else {
ut_a(new_page == i + FSP_EXTENT_SIZE + 1);
}
printf("%lu %lu; ", i, new_page);
if (i % 10 == 0) {
printf("\n");
}
mtr_commit(&mtr);
}
buf_print();
buf_validate();
mtr_start(&mtr);
block = mtr_page_get(0, seg_page, NULL, &mtr);
mtr_page_s_lock(block, &mtr);
reserved = fseg_n_reserved_pages(buf_block_get_frame(block) + 1000,
&used, &mtr);
ut_a(used == 1024);
ut_a(reserved >= 1024);
printf("Pages used in segment %lu reserved by segment %lu \n",
used, reserved);
mtr_commit(&mtr);
finished = FALSE;
while (!finished) {
mtr_start(&mtr);
block = mtr_page_get(0, seg_page, NULL, &mtr);
finished = fseg_free_step(
buf_block_get_frame(block) + 1000, &mtr);
mtr_commit(&mtr);
}
buf_print();
buf_validate();
/***********************************************/
mtr_start(&mtr);
seg_page = fseg_create(0, 0, 1000, 557, &mtr);
mtr_commit(&mtr);
ut_a(seg_page == 1);
mtr_start(&mtr);
seg_page2 = fseg_create(0, 0, 1000, 558, &mtr);
mtr_commit(&mtr);
ut_a(seg_page2 == 2);
new_page = seg_page;
new_page2 = seg_page2;
for (;;) {
mtr_start(&mtr);
block = mtr_page_get(0, seg_page, NULL, &mtr);
new_page = fseg_alloc_free_page(
buf_block_get_frame(block) + 1000,
new_page + 1, FSP_UP, &mtr);
printf("1:%lu %lu; ", i, new_page);
if (i % 10 == 0) {
printf("\n");
}
new_page = fseg_alloc_free_page(
buf_block_get_frame(block) + 1000,
new_page + 1, FSP_UP, &mtr);
printf("1:%lu %lu; ", i, new_page);
if (i % 10 == 0) {
printf("\n");
}
mtr_commit(&mtr);
mtr_start(&mtr);
block = mtr_page_get(0, seg_page2, NULL, &mtr);
new_page2 = fseg_alloc_free_page(
buf_block_get_frame(block) + 1000,
new_page2 + 1, FSP_UP, &mtr);
printf("2:%lu %lu; ", i, new_page2);
if (i % 10 == 0) {
printf("\n");
}
mtr_commit(&mtr);
if (new_page2 == FIL_NULL) {
break;
}
}
mtr_start(&mtr);
block = mtr_page_get(0, seg_page, NULL, &mtr);
mtr_page_s_lock(block, &mtr);
reserved = fseg_n_reserved_pages(buf_block_get_frame(block) + 1000,
&used, &mtr);
printf("Pages used in segment 1 %lu, reserved by segment %lu \n",
used, reserved);
mtr_commit(&mtr);
mtr_start(&mtr);
block = mtr_page_get(0, seg_page2, NULL, &mtr);
mtr_page_s_lock(block, &mtr);
reserved = fseg_n_reserved_pages(buf_block_get_frame(block) + 1000,
&used, &mtr);
printf("Pages used in segment 2 %lu, reserved by segment %lu \n",
used, reserved);
mtr_commit(&mtr);
for (;;) {
mtr_start(&mtr);
block = mtr_page_get(0, seg_page, NULL, &mtr);
fseg_free_step(
buf_block_get_frame(block) + 1000, &mtr);
block = mtr_page_get(0, seg_page2, NULL, &mtr);
finished = fseg_free_step(
buf_block_get_frame(block) + 1000, &mtr);
mtr_commit(&mtr);
if (finished) {
break;
}
}
mtr_start(&mtr);
seg_page2 = fseg_create(0, 0, 1000, 558, &mtr);
mtr_commit(&mtr);
i = 0;
for (;;) {
mtr_start(&mtr);
block = mtr_page_get(0, seg_page2, NULL, &mtr);
new_page2 = fseg_alloc_free_page(
buf_block_get_frame(block) + 1000,
557, FSP_DOWN, &mtr);
printf("%lu %lu; ", i, new_page2);
mtr_commit(&mtr);
if (new_page2 == FIL_NULL) {
break;
}
i++;
}
for (;;) {
mtr_start(&mtr);
block = mtr_page_get(0, seg_page, NULL, &mtr);
finished = fseg_free_step(
buf_block_get_frame(block) + 1000, &mtr);
mtr_commit(&mtr);
if (finished) {
break;
}
}
for (;;) {
mtr_start(&mtr);
block = mtr_page_get(0, seg_page2, NULL, &mtr);
finished = fseg_free_step(
buf_block_get_frame(block) + 1000, &mtr);
mtr_commit(&mtr);
if (finished) {
break;
}
}
/***************************************/
oldtm = ut_clock();
for (i = 0; i < 1000; i++) {
mtr_start(&mtr);
seg_page = fseg_create(0, 0, 1000, 555, &mtr);
mtr_commit(&mtr);
mtr_start(&mtr);
block = mtr_page_get(0, seg_page, NULL, &mtr);
new_page = fseg_alloc_free_page(buf_block_get_frame(block) + 1000,
2, FSP_UP, &mtr);
mtr_commit(&mtr);
finished = FALSE;
while (!finished) {
mtr_start(&mtr);
block = mtr_page_get(0, seg_page, NULL, &mtr);
finished = fseg_free_step(
buf_block_get_frame(block) + 1000, &mtr);
mtr_commit(&mtr);
}
}
tm = ut_clock();
printf("Wall clock time for %lu seg crea+free %lu millisecs\n",
i, tm - oldtm);
buf_validate();
buf_flush_batch(BUF_FLUSH_LIST, 500);
os_thread_sleep(1000000);
buf_all_freed();
}
/************************************************************************
Main test function. */
void
main(void)
/*======*/
{
ulint tm, oldtm;
ulint n;
oldtm = ut_clock();
os_aio_init(160, 5);
sync_init();
mem_init();
fil_init(26); /* Allow 25 open files at a time */
buf_pool_init(1000, 1000);
log_init();
buf_validate();
ut_a(fil_validate());
create_files();
create_db();
buf_validate();
test5();
/*
test1();
test3();
test4();
test2();
*/
buf_validate();
n = buf_flush_batch(BUF_FLUSH_LIST, 500);
os_thread_sleep(1000000);
buf_all_freed();
free_system();
tm = ut_clock();
printf("Wall clock time for test %lu milliseconds\n", tm - oldtm);
printf("TESTS COMPLETED SUCCESSFULLY!\n");
}

View File

@ -1,16 +0,0 @@
include ..\..\makefile.i
tsfsp: ..\fsp.lib tsfsp.c
$(CCOM) $(CFL) -I.. -I..\.. ..\..\btr.lib ..\..\trx.lib ..\..\pars.lib ..\..\que.lib ..\..\lock.lib ..\..\row.lib ..\..\read.lib ..\..\srv.lib ..\..\com.lib ..\..\usr.lib ..\..\thr.lib ..\..\fut.lib ..\fsp.lib ..\..\page.lib ..\..\dyn.lib ..\..\mtr.lib ..\..\log.lib ..\..\rem.lib ..\..\fil.lib ..\..\buf.lib ..\..\dict.lib ..\..\data.lib ..\..\mach.lib ..\..\ha.lib ..\..\ut.lib ..\..\sync.lib ..\..\mem.lib ..\..\os.lib tsfsp.c $(LFL)

File diff suppressed because it is too large Load Diff

View File

@ -65,33 +65,6 @@ ha_create(
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
is found, its node is updated to point to the new data, and no new node

View File

@ -1,12 +0,0 @@
include ..\..\makefile.i
tsha: ..\ha.lib tsha.c makefile
$(CCOM) $(CFL) -I.. -I..\.. ..\..\btr.lib ..\..\trx.lib ..\..\pars.lib ..\..\que.lib ..\..\lock.lib ..\..\row.lib ..\..\read.lib ..\..\srv.lib ..\..\com.lib ..\..\usr.lib ..\..\thr.lib ..\..\fut.lib ..\..\fsp.lib ..\..\page.lib ..\..\dyn.lib ..\..\mtr.lib ..\..\log.lib ..\..\rem.lib ..\..\fil.lib ..\..\buf.lib ..\..\dict.lib ..\..\data.lib ..\..\mach.lib ..\ha.lib ..\..\ut.lib ..\..\sync.lib ..\..\mem.lib ..\..\os.lib tsha.c $(LFL)

View File

@ -1,120 +0,0 @@
/************************************************************************
The test module for hash table
(c) 1994, 1995 Innobase Oy
Created 1/25/1994 Heikki Tuuri
*************************************************************************/
#include "ut0ut.h"
#include "ha0ha.h"
#include "mem0mem.h"
#include "sync0sync.h"
ulint ulint_array[200000];
void
test1(void)
{
hash_table_t* table1;
ulint i;
ulint n313 = 313;
ulint n414 = 414;
printf("------------------------------------------------\n");
printf("TEST 1. BASIC TEST\n");
table1 = ha_create(50000);
ha_insert_for_fold(table1, 313, &n313);
ha_insert_for_fold(table1, 313, &n414);
ut_a(ha_validate(table1));
ha_delete(table1, 313, &n313);
ha_delete(table1, 313, &n414);
ut_a(ha_validate(table1));
printf("------------------------------------------------\n");
printf("TEST 2. TEST OF MASSIVE INSERTS AND DELETES\n");
table1 = ha_create(10000);
for (i = 0; i < 200000; i++) {
ulint_array[i] = i;
}
for (i = 0; i < 50000; i++) {
ha_insert_for_fold(table1, i * 7, ulint_array + i);
}
ut_a(ha_validate(table1));
for (i = 0; i < 50000; i++) {
ha_delete(table1, i * 7, ulint_array + i);
}
ut_a(ha_validate(table1));
}
void
test2(void)
{
hash_table_t* table1;
ulint i;
ulint oldtm, tm;
ha_node_t* node;
printf("------------------------------------------------\n");
printf("TEST 3. SPEED TEST\n");
table1 = ha_create(300000);
oldtm = ut_clock();
for (i = 0; i < 200000; i++) {
ha_insert_for_fold(table1, i * 27877, ulint_array + i);
}
tm = ut_clock();
printf("Wall clock time for %lu inserts %lu millisecs\n",
i, tm - oldtm);
oldtm = ut_clock();
for (i = 0; i < 200000; i++) {
node = ha_search(table1, i * 27877);
}
tm = ut_clock();
printf("Wall clock time for %lu searches %lu millisecs\n",
i, tm - oldtm);
oldtm = ut_clock();
for (i = 0; i < 200000; i++) {
ha_delete(table1, i * 27877, ulint_array + i);
}
tm = ut_clock();
printf("Wall clock time for %lu deletes %lu millisecs\n",
i, tm - oldtm);
}
void
main(void)
{
sync_init();
mem_init(1000000);
test1();
test2();
printf("TESTS COMPLETED SUCCESSFULLY!\n");
}

View File

@ -50,7 +50,7 @@ noinst_HEADERS = btr0btr.h btr0btr.ic btr0cur.h btr0cur.ic \
thr0loc.h thr0loc.ic trx0purge.h trx0purge.ic trx0rec.h \
trx0rec.ic trx0roll.h trx0roll.ic trx0rseg.h trx0rseg.ic \
trx0sys.h trx0sys.ic trx0trx.h trx0trx.ic trx0types.h \
trx0undo.h trx0undo.ic univ.i univold.i univoldmysql.i \
trx0undo.h trx0undo.ic univ.i \
usr0sess.h usr0sess.ic usr0types.h ut0byte.h ut0byte.ic \
ut0dbg.h ut0lst.h ut0mem.h ut0mem.ic ut0rnd.h ut0rnd.ic \
ut0sort.h ut0ut.h ut0ut.ic

View File

@ -365,17 +365,6 @@ btr_cur_parse_update_in_place(
byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */
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
index record. */

View File

@ -49,21 +49,6 @@ btr_search_info_update(
dict_index_t* index, /* in: index of the cursor */
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
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
@ -140,26 +125,6 @@ btr_search_update_hash_on_delete(
record to delete using btr_cur_search_...,
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. */
ibool

View File

@ -496,6 +496,7 @@ buf_frame_get_modify_clock(
return(block->modify_clock);
}
#ifdef UNIV_SYNC_DEBUG
/***********************************************************************
Increments the bufferfix count. */
UNIV_INLINE
@ -515,7 +516,7 @@ buf_block_buf_fix_inc_debug(
#endif
block->buf_fix_count++;
}
#else /* UNIV_SYNC_DEBUG */
/***********************************************************************
Increments the bufferfix count. */
UNIV_INLINE
@ -526,7 +527,7 @@ buf_block_buf_fix_inc(
{
block->buf_fix_count++;
}
#endif /* UNIV_SYNC_DEBUG */
/**********************************************************************
Returns the control block of a file page, NULL if not found. */
UNIV_INLINE

View File

@ -375,84 +375,6 @@ dtuple_big_rec_free(
/*================*/
big_rec_t* vector); /* in, own: big rec vector; it is
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
/*######################################################################*/

View File

@ -16,15 +16,6 @@ Created 1/8/1996 Heikki Tuuri
#include "row0types.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. */

View File

@ -677,13 +677,6 @@ dict_index_get_tree(
/* out: index tree */
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. */
UNIV_INLINE
ulint

View File

@ -177,15 +177,6 @@ ibuf_page_low(
mtr_t* mtr); /* in: mtr which will contain an x-latch to the
bitmap page if the page is not one of the fixed
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
thread calls fsp services to allocate a new file segment, or a new page to a

View File

@ -442,14 +442,6 @@ lock_rec_hash(
ulint space, /* in: space */
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. */
ibool

View File

@ -60,6 +60,7 @@ mem_heap_validate_or_print(
ulint* n_blocks); /* out: number of blocks in the heap,
if a NULL pointer is passed as this
argument, it is ignored */
#ifdef UNIV_MEM_DEBUG
/******************************************************************
Prints the contents of a memory heap. */
@ -67,6 +68,7 @@ void
mem_heap_print(
/*===========*/
mem_heap_t* heap); /* in: memory heap */
#endif /* UNIV_MEM_DEBUG */
/******************************************************************
Checks that an object is a memory heap (or a block of it) */
@ -83,20 +85,7 @@ mem_heap_validate(
/*==============*/
/* out: TRUE if ok */
mem_heap_t* heap); /* in: memory heap */
/*********************************************************************
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);
/*====================*/
#ifdef UNIV_MEM_DEBUG
/*********************************************************************
TRUE if no memory is currently allocated. */
@ -118,6 +107,7 @@ ibool
mem_validate(void);
/*===============*/
/* out: TRUE if ok */
#endif /* UNIV_MEM_DEBUG */
/****************************************************************
Tries to find neigboring memory allocation blocks and dumps to stderr
the neighborhood of a given pointer. */

View File

@ -162,7 +162,7 @@ mem_heap_alloc(
mem_block_set_free(block, free + MEM_SPACE_NEEDED(n));
#ifdef UNIV_MEM_DEBUG
#ifdef UNIV_MEM_DEBUG
/* In the debug version write debugging info to the field */
mem_field_init((byte*)buf, n);
@ -171,7 +171,7 @@ mem_heap_alloc(
caller */
buf = (byte*)buf + MEM_FIELD_HEADER_SIZE;
#endif
#endif
#ifdef UNIV_SET_MEM_TO_ZERO
memset(buf, '\0', n);
#endif
@ -212,15 +212,15 @@ mem_heap_free_heap_top(
{
mem_block_t* block;
mem_block_t* prev_block;
#ifdef UNIV_MEM_DEBUG
#ifdef UNIV_MEM_DEBUG
ibool error;
ulint total_size;
ulint size;
#endif
#endif
ut_ad(mem_heap_check(heap));
#ifdef UNIV_MEM_DEBUG
#ifdef UNIV_MEM_DEBUG
/* Validate the heap and get its total allocated size */
mem_heap_validate_or_print(heap, NULL, FALSE, &error, &total_size,
@ -232,7 +232,7 @@ mem_heap_free_heap_top(
NULL);
ut_a(!error);
#endif
#endif
block = UT_LIST_GET_LAST(heap->base);
@ -259,7 +259,7 @@ mem_heap_free_heap_top(
/* Set the free field of block */
mem_block_set_free(block, old_top - (byte*)block);
#ifdef UNIV_MEM_DEBUG
#ifdef UNIV_MEM_DEBUG
ut_ad(mem_block_get_start(block) <= mem_block_get_free(block));
/* In the debug version erase block from top up */
@ -271,7 +271,7 @@ mem_heap_free_heap_top(
mem_current_allocated_memory -= (total_size - size);
mutex_exit(&mem_hash_mutex);
#endif
#endif
/* If free == start, we may free the block if it is not the first
one */
@ -317,7 +317,7 @@ mem_heap_get_top(
buf = (byte*)block + mem_block_get_free(block) - MEM_SPACE_NEEDED(n);
#ifdef UNIV_MEM_DEBUG
#ifdef UNIV_MEM_DEBUG
ut_ad(mem_block_get_start(block) <=(ulint)((byte*)buf - (byte*)block));
/* In the debug version, advance buf to point at the storage which
@ -327,7 +327,7 @@ mem_heap_get_top(
/* Check that the field lengths agree */
ut_ad(n == (ulint)mem_field_header_get_len(buf));
#endif
#endif
return(buf);
}
@ -351,13 +351,13 @@ mem_heap_free_top(
/* Subtract the free field of block */
mem_block_set_free(block, mem_block_get_free(block)
- MEM_SPACE_NEEDED(n));
#ifdef UNIV_MEM_DEBUG
#ifdef UNIV_MEM_DEBUG
ut_ad(mem_block_get_start(block) <= mem_block_get_free(block));
/* In the debug version check the consistency, and erase field */
mem_field_erase((byte*)block + mem_block_get_free(block), n);
#endif
#endif
/* If free == start, we may free the block if it is not the first
one */
@ -417,7 +417,7 @@ mem_heap_create_func(
/* Add the created block itself as the first block in the list */
UT_LIST_ADD_FIRST(list, block->base, block);
#ifdef UNIV_MEM_DEBUG
#ifdef UNIV_MEM_DEBUG
if (block == NULL) {
@ -426,7 +426,7 @@ mem_heap_create_func(
mem_hash_insert(block, file_name, line);
#endif
#endif
return(block);
}
@ -452,14 +452,14 @@ mem_heap_free_func(
block = UT_LIST_GET_LAST(heap->base);
#ifdef UNIV_MEM_DEBUG
#ifdef UNIV_MEM_DEBUG
/* In the debug version remove the heap from the hash table of heaps
and check its consistency */
mem_hash_remove(heap, file_name, line);
#endif
#endif
if (heap->free_block) {
mem_heap_free_block_free(heap);
@ -493,18 +493,6 @@ mem_alloc_func(
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;
void* buf;
@ -525,8 +513,6 @@ mem_alloc_func(
ut_a((byte*)heap == (byte*)buf - MEM_BLOCK_HEADER_SIZE
- MEM_FIELD_HEADER_SIZE);
return(buf);
#endif
}
/*******************************************************************
@ -542,17 +528,11 @@ mem_free_func(
ulint line /* in: line where created */
)
{
#ifdef notdefined
mem_area_free(ptr, mem_comm_pool);
#else
mem_heap_t* heap;
heap = (mem_heap_t*)((byte*)ptr - MEM_BLOCK_HEADER_SIZE
- MEM_FIELD_HEADER_SIZE);
mem_heap_free_func(heap, file_name, line);
#endif
}
/*********************************************************************

View File

@ -133,15 +133,6 @@ mlog_write_initial_log_record_fast(
byte type, /* in: log item type: MLOG_1BYTE, ... */
byte* log_ptr,/* in: pointer to mtr log which has been opened */
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. */

View File

@ -132,16 +132,6 @@ void
mtr_commit(
/*=======*/
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. */
UNIV_INLINE

View File

@ -102,37 +102,6 @@ os_mem_alloc_nocache(
/*=================*/
/* out: allocated memory */
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
process. */

View File

@ -99,13 +99,6 @@ os_thread_t
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. */
void

View File

@ -6,24 +6,6 @@ Comparison services for records
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
data type. */

View File

@ -68,16 +68,6 @@ row_build_index_entry(
dict_index_t* index, /* in: index on the table */
mem_heap_t* heap); /* in: memory heap from which the memory for
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
record in a clustered index. */
@ -103,21 +93,6 @@ row_build(
mem_heap_t* heap); /* in: memory heap from which the memory
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. */
dtuple_t*

View File

@ -216,13 +216,7 @@ srv_boot(void);
/*==========*/
/* out: DB_SUCCESS or error code */
/*************************************************************************
Initializes the server. */
void
srv_init(void);
/*==========*/
/*************************************************************************
Frees the OS fast mutex created in srv_init(). */
Frees the OS fast mutex created in srv_boot(). */
void
srv_free(void);
@ -272,23 +266,6 @@ srv_master_thread(
/* out: a dummy parameter */
void* arg); /* in: a dummy parameter required by
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
and wakes up the master thread if it is suspended (not sleeping). Used

View File

@ -21,16 +21,6 @@ srv_normalize_path_for_win(
/*=======================*/
char* str); /* in/out: null-terminated character string */
/*************************************************************************
Adds a slash or a backslash to the end of a string if it is missing
and the string is not empty. */
char*
srv_add_path_separator_if_needed(
/*=============================*/
/* out, own: string which has the separator if the
string is not empty */
char* str); /* in: null-terminated character string */
/*************************************************************************
Reads the data files and their sizes from a character string given in
the .cnf file. */

View File

@ -140,10 +140,10 @@ rw_lock_s_lock_low(
/* Set the shared lock by incrementing the reader count */
lock->reader_count++;
#ifdef UNIV_SYNC_DEBUG
#ifdef UNIV_SYNC_DEBUG
rw_lock_add_debug_info(lock, pass, RW_LOCK_SHARED, file_name,
line);
#endif
#endif
lock->last_s_file_name = file_name;
lock->last_s_line = line;
@ -175,9 +175,9 @@ rw_lock_s_lock_direct(
lock->last_s_file_name = file_name;
lock->last_s_line = line;
#ifdef UNIV_SYNC_DEBUG
#ifdef UNIV_SYNC_DEBUG
rw_lock_add_debug_info(lock, 0, RW_LOCK_SHARED, file_name, line);
#endif
#endif
}
/**********************************************************************
@ -204,9 +204,9 @@ rw_lock_x_lock_direct(
lock->last_x_file_name = file_name;
lock->last_x_line = line;
#ifdef UNIV_SYNC_DEBUG
#ifdef UNIV_SYNC_DEBUG
rw_lock_add_debug_info(lock, 0, RW_LOCK_EX, file_name, line);
#endif
#endif
}
/**********************************************************************
@ -275,10 +275,10 @@ rw_lock_s_lock_func_nowait(
/* Set the shared lock by incrementing the reader count */
lock->reader_count++;
#ifdef UNIV_SYNC_DEBUG
#ifdef UNIV_SYNC_DEBUG
rw_lock_add_debug_info(lock, 0, RW_LOCK_SHARED, file_name,
line);
#endif
#endif
lock->last_s_file_name = file_name;
lock->last_s_line = line;
@ -320,9 +320,9 @@ rw_lock_x_lock_func_nowait(
lock->writer_count++;
lock->pass = 0;
#ifdef UNIV_SYNC_DEBUG
#ifdef UNIV_SYNC_DEBUG
rw_lock_add_debug_info(lock, 0, RW_LOCK_EX, file_name, line);
#endif
#endif
lock->last_x_file_name = file_name;
lock->last_x_line = line;
@ -361,9 +361,9 @@ rw_lock_s_unlock_func(
ut_a(lock->reader_count > 0);
lock->reader_count--;
#ifdef UNIV_SYNC_DEBUG
#ifdef UNIV_SYNC_DEBUG
rw_lock_remove_debug_info(lock, pass, RW_LOCK_SHARED);
#endif
#endif
/* If there may be waiters and this was the last s-lock,
signal the object */
@ -402,9 +402,9 @@ rw_lock_s_unlock_direct(
lock->reader_count--;
#ifdef UNIV_SYNC_DEBUG
#ifdef UNIV_SYNC_DEBUG
rw_lock_remove_debug_info(lock, 0, RW_LOCK_SHARED);
#endif
#endif
ut_ad(!lock->waiters);
ut_ad(rw_lock_validate(lock));
@ -442,9 +442,9 @@ rw_lock_x_unlock_func(
rw_lock_set_writer(lock, RW_LOCK_NOT_LOCKED);
}
#ifdef UNIV_SYNC_DEBUG
#ifdef UNIV_SYNC_DEBUG
rw_lock_remove_debug_info(lock, pass, RW_LOCK_EX);
#endif
#endif
/* If there may be waiters, signal the lock */
if (lock->waiters && (lock->writer_count == 0)) {
@ -486,9 +486,9 @@ rw_lock_x_unlock_direct(
rw_lock_set_writer(lock, RW_LOCK_NOT_LOCKED);
}
#ifdef UNIV_SYNC_DEBUG
#ifdef UNIV_SYNC_DEBUG
rw_lock_remove_debug_info(lock, 0, RW_LOCK_EX);
#endif
#endif
ut_ad(!lock->waiters);
ut_ad(rw_lock_validate(lock));

View File

@ -234,15 +234,6 @@ mutex_get_waiters(
/*==============*/
/* out: value to set */
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

View File

@ -250,9 +250,9 @@ mutex_enter_func(
if (!mutex_test_and_set(mutex)) {
#ifdef UNIV_SYNC_DEBUG
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif
#endif
mutex->file_name = file_name;
mutex->line = line;

View File

@ -1,164 +0,0 @@
/***************************************************************************
Version control for database, common definitions, and include files
(c) 1994 - 2000 Innobase Oy
Created 1/20/1994 Heikki Tuuri
****************************************************************************/
#ifndef univ_i
#define univ_i
#define UNIV_INTEL
#define UNIV_PENTIUM
/* If UNIV_WINNT is not defined, we assume Windows 95 */
#define UNIV_WINNT
#define UNIV_WINNT4
#define __NT__
#define UNIV_VISUALC
#define __WIN__
#define _WIN32_WINNT 0x0400
/* DEBUG VERSION CONTROL
===================== */
/* Make a non-inline debug version */
/*
#define UNIV_DEBUG
#define UNIV_MEM_DEBUG
#define UNIV_SYNC_DEBUG
#define UNIV_SEARCH_DEBUG
#define UNIV_IBUF_DEBUG
#define UNIV_SEARCH_PERF_STAT
#define UNIV_SYNC_PERF_STAT
*/
#define UNIV_LIGHT_MEM_DEBUG
#define YYDEBUG 1
/*
#define UNIV_SQL_DEBUG
#define UNIV_LOG_DEBUG
*/
/* the above option prevents forcing of log to disk
at a buffer page write: it should be tested with this
option off; also some ibuf tests are suppressed */
/*
#define UNIV_BASIC_LOG_DEBUG
*/
/* the above option enables basic recovery debugging:
new allocated file pages are reset */
/* The debug version is slower, thus we may change the length of test loops
depending on the UNIV_DBC parameter */
#ifdef UNIV_DEBUG
#define UNIV_DBC 1
#else
#define UNIV_DBC 100
#endif
#ifndef UNIV_DEBUG
/* Definition for inline version */
#ifdef UNIV_VISUALC
#define UNIV_INLINE __inline
#elif defined(UNIV_GNUC)
#define UNIV_INLINE extern __inline__
#endif
#else
/* If we want to compile a noninlined version we use the following macro
definitions: */
#define UNIV_NONINL
#define UNIV_INLINE
#endif /* UNIV_DEBUG */
/* If the compiler does not know inline specifier, we use: */
/*
#define UNIV_INLINE static
*/
/*
MACHINE VERSION CONTROL
=======================
*/
#ifdef UNIV_PENTIUM
/* In a 32-bit computer word size is 4 */
#define UNIV_WORD_SIZE 4
/* The following alignment is used in memory allocations in memory heap
management to ensure correct alignment for doubles etc. */
#define UNIV_MEM_ALIGNMENT 8
/* The following alignment is used in aligning lints etc. */
#define UNIV_WORD_ALIGNMENT UNIV_WORD_SIZE
#endif
/*
DATABASE VERSION CONTROL
========================
*/
/* The universal page size of the database */
#define UNIV_PAGE_SIZE (2 * 8192)/* NOTE! Currently, this has to be a
power of 2 and divisible by
UNIV_MEM_ALIGNMENT */
/* Do non-buffered io in buffer pool read/write operations */
#define UNIV_NON_BUFFERED_IO
/* Maximum number of parallel threads in a parallelized operation */
#define UNIV_MAX_PARALLELISM 32
/*
UNIVERSAL TYPE DEFINITIONS
==========================
*/
typedef unsigned char byte;
/* An other basic type we use is unsigned long integer which is intended to be
equal to the word size of the machine. */
typedef unsigned long int ulint;
typedef long int lint;
/* The following type should be at least a 64-bit floating point number */
typedef double utfloat;
/* The 'undefined' value for a ulint */
#define ULINT_UNDEFINED ((ulint)(-1))
/* The undefined 32-bit unsigned integer */
#define ULINT32_UNDEFINED 0xFFFFFFFF
/* Maximum value for a ulint */
#define ULINT_MAX ((ulint)(-2))
/* Definition of the boolean type */
typedef ulint bool;
#define TRUE 1
#define FALSE 0
/* The following number as the length of a logical field means that the field
has the SQL NULL as its value. */
#define UNIV_SQL_NULL ULINT_UNDEFINED
#include <stdio.h>
#include "ut0dbg.h"
#include "ut0ut.h"
#include "db0err.h"
#endif

View File

@ -1,181 +0,0 @@
/***************************************************************************
Version control for database, common definitions, and include files
(c) 1994 - 1996 Innobase Oy
Created 1/20/1994 Heikki Tuuri
****************************************************************************/
#ifndef univ_i
#define univ_i
#define UNIV_INTEL
#define UNIV_PENTIUM
/* If UNIV_WINNT is not defined, we assume Windows 95 */
#define UNIV_WINNT
#define UNIV_WINNT4
#define UNIV_VISUALC
/* DEBUG VERSION CONTROL
===================== */
/* Make a profiler version where mutex_fence does not use CPUID and therefore
is not totally safe. The sync-library must be recompiled before profiling. */
/*
#define UNIV_PROFILE
*/
/* When the following flag is defined, also mutex lock word reset to 0
in mutex_exit is performed using a serializing instruction, which does not
allow speculative reads be performed before memory writes */
/*
#define SYNC_SERIALIZE_MUTEX_RESET
*/
/* Make a non-inline debug version */
#define UNIV_DEBUG
#define UNIV_MEM_DEBUG
#define UNIV_SYNC_DEBUG
#define UNIV_SEARCH_DEBUG
#define UNIV_IBUF_DEBUG
#define UNIV_SEARCH_PERF_STAT
#define UNIV_SYNC_PERF_STAT
#define UNIV_LIGHT_MEM_DEBUG
#define YYDEBUG 1
/*
#define UNIV_SQL_DEBUG
#define UNIV_LOG_DEBUG
*/
/* the above option prevents forcing of log to disk
at a buffer page write: it should be tested with this
option off; also some ibuf tests are suppressed */
/*
#define UNIV_BASIC_LOG_DEBUG
*/
/* the above option enables basic recovery debugging:
new allocated file pages are reset */
/* The debug version is slower, thus we may change the length of test loops
depending on the UNIV_DBC parameter */
#ifdef UNIV_DEBUG
#define UNIV_DBC 1
#else
#define UNIV_DBC 100
#endif
#ifndef UNIV_DEBUG
/* Definition for inline version */
#ifdef UNIV_VISUALC
#define UNIV_INLINE __inline
#elif defined(UNIV_GNUC)
#define UNIV_INLINE extern __inline__
#endif
#else
/* If we want to compile a noninlined version we use the following macro
definitions: */
#define UNIV_NONINL
#define UNIV_INLINE
#endif /* UNIV_DEBUG */
/* If the compiler does not know inline specifier, we use: */
/*
#define UNIV_INLINE static
*/
/*
MACHINE VERSION CONTROL
=======================
*/
#ifdef UNIV_PENTIUM
/* In a 32-bit computer word size is 4 */
#define UNIV_WORD_SIZE 4
/* The following alignment is used in memory allocations in memory heap
management to ensure correct alignment for doubles etc. */
#define UNIV_MEM_ALIGNMENT 8
/* The following alignment is used in aligning lints etc. */
#define UNIV_WORD_ALIGNMENT UNIV_WORD_SIZE
#endif
/*
DATABASE VERSION CONTROL
========================
*/
/* The universal page size of the database */
#define UNIV_PAGE_SIZE 8192 /* NOTE! Currently, this has to be a
power of 2 and divisible by
UNIV_MEM_ALIGNMENT */
/* 2-based logarithm of UNIV_PAGE_SIZE */
#define UNIV_PAGE_SIZE_SHIFT 13
/* Do asynchronous io in buffer pool read/write operations */
#ifdef UNIV_WINNT
#define UNIV_ASYNC_IO
#endif
/* Do non-buffered io in buffer pool read/write operations */
#define UNIV_NON_BUFFERED_IO
/* Maximum number of parallel threads in a parallelized operation */
#define UNIV_MAX_PARALLELISM 32
/*
UNIVERSAL TYPE DEFINITIONS
==========================
*/
/*
typedef unsigned char byte;
*/
/* An other basic type we use is unsigned long integer which is intended to be
equal to the word size of the machine. */
typedef unsigned long int ulint;
typedef long int lint;
/* The following type should be at least a 64-bit floating point number */
typedef double utfloat;
/* The 'undefined' value for a ulint */
#define ULINT_UNDEFINED ((ulint)(-1))
/* The undefined 32-bit unsigned integer */
#define ULINT32_UNDEFINED 0xFFFFFFFF
/* Maximum value for a ulint */
#define ULINT_MAX ((ulint)(-2))
/* Definition of the boolean type */
#ifndef bool
typedef ulint bool;
#endif
#define TRUE 1
#define FALSE 0
/* The following number as the length of a logical field means that the field
has the SQL NULL as its value. */
#define UNIV_SQL_NULL ULINT_UNDEFINED
#include <stdio.h>
#include "ut0dbg.h"
#include "ut0ut.h"
#include "db0err.h"
#endif

View File

@ -66,28 +66,6 @@ sess_open(
byte* addr_buf, /* in: client address */
ulint addr_len); /* in: client address length */
/*************************************************************************
Closes a session, freeing the memory occupied by it. */
void
sess_close(
/*=======*/
sess_t* sess); /* in, own: session object */
/*************************************************************************
Raises an SQL error. */
void
sess_raise_error_low(
/*=================*/
trx_t* trx, /* in: transaction */
ulint err_no, /* in: error number */
ulint type, /* in: more info of the error, or 0 */
dict_table_t* table, /* in: dictionary table or NULL */
dict_index_t* index, /* in: table index or NULL */
dtuple_t* tuple, /* in: tuple to insert or NULL */
rec_t* rec, /* in: record or NULL */
char* err_str);/* in: arbitrary null-terminated error string,
or NULL */
/*************************************************************************
Closes a session, freeing the memory occupied by it, if it is in a state
where it should be closed. */
@ -117,16 +95,6 @@ sess_srv_msg_send_simple(
ulint rel_kernel); /* in: SESS_RELEASE_KERNEL or
SESS_NOT_RELEASE_KERNEL */
/***************************************************************************
Processes a message from a client. NOTE: May release the kernel mutex
temporarily. */
void
sess_receive_msg_rel_kernel(
/*========================*/
sess_t* sess, /* in: session */
byte* str, /* in: message string */
ulint len); /* in: message length */
/***************************************************************************
When a command has been completed, this function sends the message about it
to the client. */
@ -136,17 +104,6 @@ sess_command_completed_message(
sess_t* sess, /* in: session */
byte* msg, /* in: message buffer */
ulint len); /* in: message data length */
/***********************************************************************
Starts a new connection and a session, or starts a query based on a client
message. This is called by a SRV_COM thread. */
void
sess_process_cli_msg(
/*=================*/
byte* str, /* in: message string */
ulint len, /* in: string length */
byte* addr, /* in: address string */
ulint alen); /* in: address length */
/* The session handle. All fields are protected by the kernel mutex */

View File

@ -176,19 +176,19 @@ ut_fold_string(
/* out: folded value */
char* str) /* in: null-terminated string */
{
#ifdef UNIV_DEBUG
#ifdef UNIV_DEBUG
ulint i = 0;
#endif
#endif
ulint fold = 0;
ut_ad(str);
while (*str != '\0') {
#ifdef UNIV_DEBUG
#ifdef UNIV_DEBUG
i++;
ut_a(i < 100);
#endif
#endif
fold = ut_fold_ulint_pair(fold, (ulint)(*str));
str++;

View File

@ -343,179 +343,6 @@ lock_deadlock_recursive(
#define lock_mutex_enter_kernel() mutex_enter(&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. */
@ -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
explicit locks. This function sets a normal next-key lock, or in the case
of a page supremum record, a gap type lock. */
static
ulint
lock_rec_lock(
/*==========*/
@ -2105,7 +1932,7 @@ lock_rec_has_to_wait_in_queue(
/*****************************************************************
Grants a lock to a waiting lock request and releases the waiting
transaction. */
static
void
lock_grant(
/*=======*/
@ -2172,7 +1999,7 @@ lock_rec_cancel(
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
to a lock. NOTE: all record locks contained in in_lock are removed. */
static
void
lock_rec_dequeue_from_page(
/*=======================*/
@ -2343,7 +2170,7 @@ lock_rec_inherit_to_gap(
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
other record. Also waiting lock requests are inherited as GRANTED gap locks. */
static
void
lock_rec_inherit_to_gap_if_gap_lock(
/*================================*/
@ -3064,11 +2891,6 @@ retry:
ut_a(strlen(lock_latest_err_buf) < 4100);
/*
sess_raise_error_low(trx, DB_DEADLOCK, lock->type_mode, table,
index, NULL, NULL, NULL);
*/
return(TRUE);
}
@ -3588,7 +3410,7 @@ lock_table_has_to_wait_in_queue(
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
lock. */
static
void
lock_table_dequeue(
/*===============*/

View File

@ -181,9 +181,10 @@ recv_sys_empty_hash(void)
recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 256);
}
#ifndef UNIV_LOG_DEBUG
/************************************************************
Frees the recovery system. */
static
void
recv_sys_free(void)
/*===============*/
@ -200,6 +201,7 @@ recv_sys_free(void)
mutex_exit(&(recv_sys->mutex));
}
#endif /* !UNIV_LOG_DEBUG */
/************************************************************
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
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
memory structs to up-to-date values. */
static
void
recv_synchronize_groups(
/*====================*/
@ -1803,10 +1805,11 @@ recv_calc_lsn_on_data_add(
return(ut_dulint_add(lsn, lsn_len));
}
#ifdef UNIV_LOG_DEBUG
/***********************************************************
Checks that the parser recognizes incomplete initial segments of a log
record as incomplete. */
static
void
recv_check_incomplete_log_recs(
/*===========================*/
@ -1824,6 +1827,7 @@ recv_check_incomplete_log_recs(
&page_no, &body));
}
}
#endif /* UNIV_LOG_DEBUG */
/***********************************************************
Prints diagnostic info of corrupt log. */

View File

@ -1,648 +0,0 @@
/******************************************************
Recovery
(c) 1997 Innobase Oy
Created 9/20/1997 Heikki Tuuri
*******************************************************/
#include "log0recv.h"
#ifdef UNIV_NONINL
#include "log0recv.ic"
#endif
#include "mem0mem.h"
#include "buf0buf.h"
#include "buf0flu.h"
#include "srv0srv.h"
/* Size of block reads when the log groups are scanned forward to do
roll-forward */
#define RECV_SCAN_SIZE (4 * UNIV_PAGE_SIZE)
/* Size of block reads when the log groups are scanned backwards to synchronize
them */
#define RECV_BACK_SCAN_SIZE (4 * UNIV_PAGE_SIZE)
recv_sys_t* recv_sys = NULL;
recv_recover_page(block->frame, block->space, block->offset);
/************************************************************
Creates the recovery system. */
void
recv_sys_create(void)
/*=================*/
{
ut_a(recv_sys == NULL);
recv_sys = mem_alloc(sizeof(recv_t));
mutex_create(&(recv_sys->mutex));
recv_sys->hash = NULL;
recv_sys->heap = NULL;
}
/************************************************************
Inits the recovery system for a recovery operation. */
void
recv_sys_init(void)
/*===============*/
{
recv_sys->hash = hash_create(buf_pool_get_curr_size() / 64);
recv_sys->heap = mem_heap_create_in_buffer(256);
}
/************************************************************
Empties the recovery system. */
void
recv_sys_empty(void)
/*================*/
{
mutex_enter(&(recv_sys->mutex));
hash_free(recv_sys->hash);
mem_heap_free(recv_sys->heap);
recv_sys->hash = NULL;
recv_sys->heap = NULL;
mutex_exit(&(recv_sys->mutex));
}
/***********************************************************
For recovery purposes copies the log buffer to a group to synchronize log
data. */
static
void
recv_log_buf_flush(
/*===============*/
log_group_t* group, /* in: log group */
dulint start_lsn, /* in: start lsn of the log data in
the log buffer; must be divisible by
OS_FILE_LOG_BLOCK_SIZE */
dulint end_lsn) /* in: end lsn of the log data in the
log buffer; must be divisible by
OS_FILE_LOG_BLOCK_SIZE */
{
ulint len;
ut_ad(mutex_own(&(log_sys->mutex)));
len = ut_dulint_minus(end_lsn, start_lsn);
log_group_write_buf(LOG_RECOVER, group, log_sys->buf, len, start_lsn,
0);
}
/***********************************************************
Compares two buffers containing log segments and determines the highest lsn
where they match, if any. */
static
dulint
recv_log_bufs_cmp(
/*==============*/
/* out: if no match found, ut_dulint_zero or
if start_lsn == LOG_START_LSN, returns
LOG_START_LSN; otherwise the highest matching
lsn */
byte* recv_buf, /* in: buffer containing valid log data */
byte* buf, /* in: buffer of data from a possibly
incompletely written log group */
dulint start_lsn, /* in: buffer start lsn, must be divisible
by OS_FILE_LOG_BLOCK_SIZE and must be >=
LOG_START_LSN */
dulint end_lsn, /* in: buffer end lsn, must be divisible
by OS_FILE_LOG_BLOCK_SIZE */
dulint recovered_lsn) /* in: recovery succeeded up to this lsn */
{
ulint len;
ulint offset;
byte* log_block1;
byte* log_block2;
ulint no;
ulint data_len;
ut_ad(ut_dulint_cmp(start_lsn, LOG_START_LSN) >= 0);
if (ut_dulint_cmp(end_lsn, recovered_lsn) > 0) {
end_lsn = ut_dulint_align_up(recovered_lsn,
OS_FILE_LOG_BLOCK_SIZE);
}
len = ut_dulint_minus(end_lsn, start_lsn);
if (len == 0) {
goto no_match;
}
ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0);
log_block1 = recv_buf + len;
log_block2 = buf + len;
for (;;) {
log_block1 -= OS_FILE_LOG_BLOCK_SIZE;
log_block2 -= OS_FILE_LOG_BLOCK_SIZE;
no = log_block_get_hdr_no(log_block1);
ut_a(no == log_block_get_trl_no(log_block1));
if ((no == log_block_get_hdr_no(log_block2))
&& (no == log_block_get_trl_no(log_block2))) {
/* Match found if the block is not corrupted */
data_len = log_block_get_data_len(log_block2);
if (0 == ut_memcmp(log_block1 + LOG_BLOCK_DATA,
log_block2 + LOG_BLOCK_DATA,
data_len - LOG_BLOCK_DATA)) {
/* Match found */
return(ut_dulint_add(start_lsn,
log_block2 - buf + data_len));
}
}
if (log_block1 == recv_buf) {
/* No match found */
break;
}
}
no_match:
if (ut_dulint_cmp(start_lsn, LOG_START_LSN) == 0) {
return(LOG_START_LSN);
}
return(ut_dulint_zero);
}
/************************************************************
Copies a log segment from the most up-to-date log group to the other log
group, so that it contains the latest log data. */
static
void
recv_copy_group(
/*============*/
log_group_t* up_to_date_group, /* in: the most up-to-date
log group */
log_group_t* group, /* in: copy to this log group */
dulint_lsn recovered_lsn) /* in: recovery succeeded up
to this lsn */
{
dulint start_lsn;
dulint end_lsn;
dulint match;
byte* buf;
byte* buf1;
ut_ad(mutex_own(&(log_sys->mutex)));
if (0 == ut_dulint_cmp(LOG_START_LSN, recovered_lsn)) {
return;
}
ut_ad(RECV_BACK_SCAN_SIZE <= log_sys->buf_size);
buf1 = mem_alloc(2 * RECV_BACK_SCAN_SIZE);
buf = ut_align(buf, RECV_BACK_SCAN_SIZE););
end_lsn = ut_dulint_align_up(recovered_lsn, RECV_BACK_SCAN_SIZE);
match = ut_dulint_zero;
for (;;) {
if (ut_dulint_cmp(ut_dulint_add(LOG_START_LSN,
RECV_BACK_SCAN_SIZE), end_lsn) >= 0) {
start_lsn = LOG_START_LSN;
} else {
start_lsn = ut_dulint_subtract(end_lsn,
RECV_BACK_SCAN_SIZE);
}
log_group_read_log_seg(LOG_RECOVER, buf, group, start_lsn,
end_lsn);
log_group_read_log_seg(LOG_RECOVER, log_sys->buf,
up_to_date_group, start_lsn, end_lsn);
match = recv_log_bufs_cmp(log_sys->buf, buf, start_lsn,
end_lsn, recovered_lsn);
if (ut_dulint_cmp(match, recovered_lsn) != 0) {
recv_log_buf_flush(group, start_lsn, end_lsn);
}
if (!ut_dulint_zero(match)) {
mem_free(buf1);
return;
}
end_lsn = start_lsn;
}
}
/************************************************************
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
about the latest checkpoint to the groups, and inits the fields in the group
memory structs to up-to-date values. */
void
recv_synchronize_groups(
/*====================*/
log_group_t* up_to_date_group, /* in: the most up-to-date
log group */
dulint_lsn recovered_lsn, /* in: recovery succeeded up
to this lsn */
log_group_t* max_checkpoint_group) /* in: the group with the most
recent checkpoint info */
{
log_group_t* group;
ut_ad(mutex_own(&(log_sys->mutex)));
group = UT_LIST_GET_FIRST(log_sys->log_groups);
while (group) {
if (group != up_to_date_group) {
/* Copy log data */
recv_copy_group(group, up_to_date_group,
recovered_lsn);
}
if (group != max_checkpoint_group) {
/* Copy the checkpoint info to the group */
log_group_checkpoint(group);
mutex_exit(&(log_sys->mutex));
/* Wait for the checkpoint write to complete */
rw_lock_s_lock(&(log_sys->checkpoint_lock));
rw_lock_s_unlock(&(log_sys->checkpoint_lock));
mutex_enter(&(log_sys->mutex));
}
/* Update the fields in the group struct to correspond to
recovered_lsn */
log_group_set_fields(group, recovered_lsn);
group = UT_LIST_GET_NEXT(log_groups, group);
}
}
/************************************************************
Looks for the maximum consistent checkpoint from the log groups. */
static
ulint
recv_find_max_checkpoint(
/*=====================*/
/* out: error code or DB_SUCCESS */
log_group_t** max_group, /* out: max group */
ulint* max_field) /* out: LOG_CHECKPOINT_1 or
LOG_CHECKPOINT_2 */
{
log_group_t* group;
dulint max_no;
dulint cp_no;
ulint field;
ulint fold;
byte* buf;
ut_ad(mutex_own(&(log_sys->mutex)));
/* Look for the latest checkpoint from the log groups */
group = UT_LIST_GET_FIRST(log_sys->log_groups);
checkpoint_no = ut_dulint_zero;
checkpoint_lsn = ut_dulint_zero;
*max_group = NULL;
buf = log_sys->checkpoint_buf;
while (group) {
group->state = LOG_GROUP_CORRUPTED;
for (field = LOG_CHECKPOINT_1; field <= LOG_CHECKPOINT_2;
field += LOG_CHECKPOINT_2 - LOG_CHECKPOINT_1) {
log_group_read_checkpoint_info(group, field);
/* Check the consistency of the checkpoint info */
fold = ut_fold_binary(buf, LOG_CHECKPOINT_CHECKSUM_1);
if (fold != mach_read_from_4(buf
+ LOG_CHECKPOINT_CHECKSUM_1)) {
goto not_consistent;
}
fold = ut_fold_binary(buf + LOG_CHECKPOINT_LSN,
LOG_CHECKPOINT_CHECKSUM_2
- LOG_CHECKPOINT_LSN);
if (fold != mach_read_from_4(buf
+ LOG_CHECKPOINT_CHECKSUM_2)) {
goto not_consistent;
}
group->state = LOG_GROUP_OK;
group->lsn = mach_read_from_8(buf
+ LOG_CHECKPOINT_LSN);
group->lsn_offset = mach_read_from_4(buf
+ LOG_CHECKPOINT_OFFSET);
group->lsn_file_count = mach_read_from_4(
buf + LOG_CHECKPOINT_FILE_COUNT);
cp_no = mach_read_from_8(buf + LOG_CHECKPOINT_NO);
if (ut_dulint_cmp(cp_no, max_no) >= 0) {
*max_group = group;
*max_field = field;
max_no = cp_no;
}
not_consistent:
}
group = UT_LIST_GET_NEXT(log_groups, group);
}
if (*max_group == NULL) {
return(DB_ERROR);
}
return(DB_SUCCESS);
}
/***********************************************************
Parses log records from a buffer and stores them to a hash table to wait
merging to file pages. If the hash table becomes too big, merges automatically
it to file pages. */
static
bool
recv_parse_and_hash_log_recs(
/*=========================*/
/* out: TRUE if limit_lsn has been reached */
byte* buf, /* in: buffer containing a log segment or
garbage */
ulint len, /* in: buffer length */
dulint start_lsn, /* in: buffer start lsn */
dulint limit_lsn, /* in: recover at least to this lsn */
dulint* recovered_lsn) /* out: was able to parse up to this lsn */
{
}
/************************************************************
Recovers from a checkpoint. When this function returns, the database is able
to start processing new user transactions, but the function
recv_recovery_from_checkpoint_finish should be called later to complete
the recovery and free the resources used in it. */
ulint
recv_recovery_from_checkpoint_start(
/*================================*/
/* out: error code or DB_SUCCESS */
dulint limit_lsn) /* in: recover up to this lsn if possible */
{
log_group_t* max_cp_group;
log_group_t* up_to_date_group;
ulint max_cp_field;
byte* buf;
ulint err;
dulint checkpoint_lsn;
dulint checkpoint_no;
dulint recovered_lsn;
dulint old_lsn;
dulint end_lsn;
dulint start_lsn;
bool finished;
dulint flush_start_lsn;
mutex_enter(&(log_sys->mutex));
/* Look for the latest checkpoint from any of the log groups */
err = recv_find_max_checkpoint(&max_cp_group, &max_cp_field);
if (err != DB_SUCCESS) {
mutex_exit(&(log_sys->mutex));
return(err);
}
log_group_read_checkpoint_info(max_cp_group, max_cp_field);
buf = log_sys->checkpoint_buf;
checkpoint_lsn = mach_read_from_8(buf + LOG_CHECKPOINT_LSN);
checkpoint_no = mach_read_from_8(buf + LOG_CHECKPOINT_NO);
if (ut_dulint_cmp(limit_lsn, checkpoint_lsn) < 0) {
mutex_exit(&(log_sys->mutex));
return(DB_ERROR);
}
/* Start reading the log groups from the checkpoint lsn up. The
variable flush_start_lsn tells a lsn up to which the log is known
to be contiguously written in all log groups. */
recovered_lsn = checkpoint_lsn;
flush_start_lsn = ut_dulint_align_down(checkpoint_lsn,
OS_FILE_LOG_BLOCK_SIZE);
up_to_date_group = max_cp_group;
ut_ad(RECV_SCAN_SIZE <= log_sys->buf_size);
group = UT_LIST_GET_FIRST(log_sys->log_groups);
while (group) {
finished = FALSE;
if (group->state == LOG_GROUP_CORRUPTED) {
finished = TRUE;
}
start_lsn = flush_start_lsn;
while (!finished) {
end_lsn = ut_dulint_add(start_lsn, RECV_SCAN_SIZE);
log_group_read_log_seg(LOG_RECOVER, log_sys->buf,
group, start_lsn, end_lsn);
old_lsn = recovered_lsn;
finished = recv_parse_and_hash_log_recs(log_sys->buf,
RECV_SCAN_SIZE, start_lsn,
limit_lsn, &flush_start_lsn,
&recovered_lsn);
if (ut_dulint_cmp(recovered_lsn, old_lsn) > 0) {
/* We found a more up-to-date group */
up_to_date_group = group;
}
start_lsn = end_lsn;
}
group = UT_LIST_GET_NEXT(log_groups, group);
}
/* Delete possible corrupted or extra log records from all log
groups */
recv_truncate_groups(recovered_lsn);
/* Synchronize the uncorrupted log groups to the most up-to-date log
group; we may also have to copy checkpoint info to groups */
log_sys->next_checkpoint_lsn = checkpoint_lsn;
log_sys->next_checkpoint_no = checkpoint_no;
recv_synchronize_groups(up_to_date_group, _lsn, max_cp_group);
log_sys->next_checkpoint_no = ut_dulint_add(checkpoint_no, 1);
/* The database is now ready to start almost normal processing of user
transactions */
return(DB_SUCCESS);
}
/************************************************************
Completes recovery from a checkpoint. */
void
recv_recovery_from_checkpoint_finish(void)
/*======================================*/
{
/* Rollback the uncommitted transactions which have no user session */
trx_rollback_all_without_sess();
/* Merge the hashed log records */
recv_merge_hashed_log_recs();
/* Free the resources of the recovery system */
recv_sys_empty();
}
/****************************************************************
Writes to the log a record about incrementing the row id counter. */
UNIV_INLINE
void
log_write_row_id_incr_rec(void)
/*===========================*/
{
log_t* log = log_sys;
ulint data_len;
mutex_enter(&(log->mutex));
data_len = (log->buf_free % OS_FILE_LOG_BLOCK_SIZE) + 1;
if (data_len >= OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE) {
/* The string does not fit within the current log block
or the the block would become full */
mutex_exit(&(log->mutex));
log_write_row_id_incr_rec_slow();
return;
}
*(log->buf + log->buf_free) = MLOG_INCR_ROW_ID | MLOG_SINGLE_REC_FLAG;
log_block_set_data_len(ut_align_down(log->buf + log->buf_free,
OS_FILE_LOG_BLOCK_SIZE),
data_len);
#ifdef UNIV_LOG_DEBUG
log->old_buf_free = log->buf_free;
log->old_lsn = log->lsn;
log_check_log_recs(log->buf + log->buf_free, 1, log->lsn);
#endif
log->buf_free++;
ut_ad(log->buf_free <= log->buf_size);
UT_DULINT_INC(log->lsn);
mutex_exit(&(log->mutex));
}
/****************************************************************
Writes to the log a record about incrementing the row id counter. */
static
void
log_write_row_id_incr_rec_slow(void)
/*================================*/
{
byte type;
log_reserve_and_open(1);
type = MLOG_INCR_ROW_ID | MLOG_SINGLE_REC_FLAG;
log_write_low(&type, 1);
log_close();
log_release();
}
/**************************************************************************
Parses and applies a log record MLOG_SET_ROW_ID. */
byte*
dict_hdr_parse_set_row_id(
/*======================*/
/* out: end of log record or NULL */
byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */
page_t* page) /* in: page or NULL */
{
dulint dval;
ptr = mach_dulint_parse_compressed(ptr, end_ptr, &dval);
if (ptr == NULL) {
return(NULL);
}
if (!page) {
return(ptr);
}
mach_write_to_8(page + DICT_HDR + DICT_HDR_ROW_ID, dval);
return(ptr);
}

View File

@ -1,12 +0,0 @@
include ..\..\makefile.i
tsmach: ..\mach.lib tsmach.c
$(CCOM) $(CFL) -I.. -I..\.. ..\mach.lib ..\..\ut.lib ..\..\os.lib tsmach.c $(LFL)

View File

@ -1,158 +0,0 @@
/************************************************************************
The test module for the machine-dependent utilities
(c) 1995 Innobase Oy
Created 11/28/1995 Heikki Tuuri
*************************************************************************/
#include "../mach0data.h"
byte arr[4000000];
/*********************************************************************
Test for ulint write and read. */
void
test1(void)
/*=======*/
{
ulint a, i, j;
ulint tm, oldtm;
printf("-------------------------------------------\n");
printf("TEST 1. Speed test of ulint read and write \n");
a = 0;
oldtm = ut_clock();
for (j = 0; j < 100; j++) {
for (i = 0; i < 10000; i++) {
a += mach_read_from_4(arr + i * 4);
}
}
tm = ut_clock();
printf("Wall clock time for read of %lu ulints %lu millisecs\n",
j * i, tm - oldtm);
oldtm = ut_clock();
for (j = 0; j < 100; j++) {
for (i = 0; i < 10000; i++) {
a += mach_read(arr + i * 4);
}
}
tm = ut_clock();
printf("Wall clock time for read of %lu ulints %lu millisecs\n",
j * i, tm - oldtm);
oldtm = ut_clock();
for (j = 0; j < 100; j++) {
for (i = 0; i < 10000; i++) {
a += mach_read_from_4(arr + i * 4 + 1);
}
}
tm = ut_clock();
printf("Wall clock time for read of %lu ulints %lu millisecs\n",
j * i, tm - oldtm);
oldtm = ut_clock();
for (j = 0; j < 100; j++) {
for (i = 0; i < 10000; i++) {
a += mach_read(arr + i * 4 + 1);
}
}
tm = ut_clock();
printf("Wall clock time for read of %lu ulints %lu millisecs\n",
j * i, tm - oldtm);
oldtm = ut_clock();
for (i = 0; i < 1000000; i++) {
a += mach_read_from_4(arr + i * 4);
}
tm = ut_clock();
printf("Wall clock time for read of %lu ulints %lu millisecs\n",
i, tm - oldtm);
oldtm = ut_clock();
for (i = 0; i < 1000000; i++) {
a += mach_read(arr + i * 4);
}
tm = ut_clock();
printf("Wall clock time for read of %lu ulints %lu millisecs\n",
i, tm - oldtm);
oldtm = ut_clock();
for (j = 0; j < 100; j++) {
for (i = 0; i < 10000; i++) {
a += mach_read_from_2(arr + i * 2);
}
}
tm = ut_clock();
printf("Wall clock time for read of %lu 16-bit ints %lu millisecs\n",
j * i, tm - oldtm);
}
/*********************************************************************
Test for ulint write and read. */
void
test2(void)
/*=======*/
{
ulint a[2];
printf("-------------------------------------------\n");
printf("TEST 2. Correctness test of ulint read and write \n");
mach_write_to_4((byte*)&a, 737237727);
ut_a(737237727 == mach_read_from_4((byte*)&a));
mach_write_to_2((byte*)&a, 7372);
ut_a(7372 == mach_read_from_2((byte*)&a));
mach_write_to_1((byte*)&a, 27);
ut_a(27 == mach_read_from_1((byte*)&a));
mach_write((byte*)&a, 737237727);
ut_a(737237727 == mach_read((byte*)&a));
}
void
main(void)
{
test1();
test2();
printf("TEST SUCCESSFULLY COMPLETED!\n");
}

View File

@ -408,12 +408,12 @@ mem_heap_validate_or_print(
ulint total_len = 0;
ulint block_count = 0;
ulint phys_len = 0;
#ifdef UNIV_MEM_DEBUG
#ifdef UNIV_MEM_DEBUG
ulint len;
byte* field;
byte* user_field;
ulint check_field;
#endif
#endif
/* Pessimistically, we set the parameters to error values */
if (us_size != NULL) {
@ -451,7 +451,7 @@ mem_heap_validate_or_print(
return;
}
#ifdef UNIV_MEM_DEBUG
#ifdef UNIV_MEM_DEBUG
/* We can trace the fields of the block only in the debug
version */
if (print) {
@ -518,7 +518,7 @@ mem_heap_validate_or_print(
return;
}
#endif
#endif
block = UT_LIST_GET_NEXT(list, block);
block_count++;
@ -603,130 +603,7 @@ mem_heap_validate(
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
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. */
@ -735,8 +612,6 @@ mem_all_freed(void)
/*===============*/
/* out: TRUE if no heaps exist */
{
#ifdef UNIV_MEM_DEBUG
mem_hash_node_t* node;
ulint heap_count = 0;
ulint i;
@ -764,15 +639,6 @@ mem_all_freed(void)
} else {
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)
/*========================*/
/* out: TRUE if error */
{
#ifdef UNIV_MEM_DEBUG
mem_hash_node_t* node;
ulint n_heaps = 0;
ulint allocated_mem;
@ -843,14 +707,6 @@ mem_validate_no_assert(void)
mutex_exit(&mem_hash_mutex);
return(error);
#else
printf("Sorry, non-debug version cannot validate dynamic memory\n");
return(FALSE);
#endif
}
/****************************************************************
@ -865,6 +721,7 @@ mem_validate(void)
return(TRUE);
}
#endif /* UNIV_MEM_DEBUG */
/****************************************************************
Tries to find neigboring memory allocation blocks and dumps to stderr

View File

@ -294,13 +294,13 @@ mem_heap_block_free(
init_block = block->init_block;
block->magic_n = MEM_FREED_BLOCK_MAGIC_N;
#ifdef UNIV_MEM_DEBUG
#ifdef UNIV_MEM_DEBUG
/* In the debug version we set the memory to a random combination
of hex 0xDE and 0xAD. */
mem_erase_buf((byte*)block, len);
#endif
#endif
if (init_block) {
/* Do not have to free: do nothing */

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