Commit c7810c2c authored by unknown's avatar unknown

Merge work.mysql.com:/home/bk/mysql

into tetra.spaceapes.com:/usr/home/jcole/bk/mysql
parents c02d8e2d 808bb002
This diff is collapsed.
...@@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script. ...@@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(sql/mysqld.cc) AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line! # The Docs Makefile.am parses this line!
AM_INIT_AUTOMAKE(mysql, 3.23.33) AM_INIT_AUTOMAKE(mysql, 3.23.34)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
...@@ -746,7 +746,7 @@ case $SYSTEM_TYPE in ...@@ -746,7 +746,7 @@ case $SYSTEM_TYPE in
;; ;;
*bsdi*) *bsdi*)
echo "Adding fix for BSDI" echo "Adding fix for BSDI"
CFLAGS="$CFLAGS -D__BSD__" CFLAGS="$CFLAGS -D__BSD__ -DHAVE_BROKEN_REALPATH"
AC_DEFINE_UNQUOTED(SOCKOPT_OPTLEN_TYPE, size_t) AC_DEFINE_UNQUOTED(SOCKOPT_OPTLEN_TYPE, size_t)
;; ;;
*sgi-irix6*) *sgi-irix6*)
......
...@@ -90,7 +90,8 @@ enum ha_extra_function { ...@@ -90,7 +90,8 @@ enum ha_extra_function {
HA_EXTRA_NO_ROWS, /* Don't write rows */ HA_EXTRA_NO_ROWS, /* Don't write rows */
HA_EXTRA_RESET_STATE, /* Reset positions */ HA_EXTRA_RESET_STATE, /* Reset positions */
HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/ HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/
HA_EXTRA_NO_IGNORE_DUP_KEY HA_EXTRA_NO_IGNORE_DUP_KEY,
HA_EXTRA_DONT_USE_CURSOR_TO_UPDATE /* Cursor will not be used for update */
}; };
/* The following is parameter to ha_panic() */ /* The following is parameter to ha_panic() */
......
...@@ -32,6 +32,7 @@ extern ulong locks_immediate,locks_waited ; ...@@ -32,6 +32,7 @@ extern ulong locks_immediate,locks_waited ;
enum thr_lock_type { TL_IGNORE=-1, enum thr_lock_type { TL_IGNORE=-1,
TL_UNLOCK, /* UNLOCK ANY LOCK */ TL_UNLOCK, /* UNLOCK ANY LOCK */
TL_READ, /* Read lock */ TL_READ, /* Read lock */
TL_READ_WITH_SHARED_LOCKS,
/* High prior. than TL_WRITE. Allow concurrent insert */ /* High prior. than TL_WRITE. Allow concurrent insert */
TL_READ_HIGH_PRIORITY, TL_READ_HIGH_PRIORITY,
/* READ, Don't allow concurrent insert */ /* READ, Don't allow concurrent insert */
......
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
# & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# Process this file with automake to create Makefile.in
AUTOMAKE_OPTIONS = foreign
TAR = gtar
SUBDIRS = os ut btr buf com data dict dyn eval fil fsp fut \
ha ibuf lock log mach mem mtr odbc page pars que \
read rem row srv sync thr trx usr
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
# & Innobase Oy
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
include ../include/Makefile.i
libs_LIBRARIES = libbtr.a
libbtr_a_SOURCES = btr0btr.c btr0cur.c btr0pcur.c btr0sea.c
EXTRA_PROGRAMS =
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
include ..\include\makefile.i
btr.lib: btr0cur.obj btr0btr.obj btr0pcur.obj btr0sea.obj
lib -out:..\libs\btr.lib btr0cur.obj btr0btr.obj btr0pcur.obj btr0sea.obj
btr0cur.obj: btr0cur.c
$(CCOM) $(CFL) -c btr0cur.c
btr0btr.obj: btr0btr.c
$(CCOM) $(CFL) -c btr0btr.c
btr0sea.obj: btr0sea.c
$(CCOM) $(CFL) -c btr0sea.c
btr0pcur.obj: btr0pcur.c
$(CCOM) $(CFL) -c btr0pcur.c
/************************************************************************
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");
}
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)
/************************************************************************
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(); */
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/************************************************************************
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);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
# Makefile included in Makefile.am in every subdirectory
libsdir = ../libs
INCLUDES = -I../../include -I../include
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment