summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-08-12 04:04:43 +0300
committerunknown <monty@hundin.mysql.fi>2002-08-12 04:04:43 +0300
commit514e60480d77236aedb1ab69c0e7754e060e495a (patch)
tree4ba65b7347df0448111dd1a3ab055bc2c8a1c6dc /innobase
parent9b1930152db6ecd30b8cbcc7200af2baf7f82295 (diff)
parent071994ba3665ce2284de5e77a4f06c0b6e93eeeb (diff)
downloadmariadb-git-514e60480d77236aedb1ab69c0e7754e060e495a.tar.gz
merge with 3.23.52
BitKeeper/deleted/.del-global.h~e80d28157acfdcb5: Auto merged Docs/manual.texi: Auto merged include/my_no_pthread.h: Auto merged innobase/include/univ.i: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/os/os0thread.c: Auto merged innobase/srv/srv0srv.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/ut/ut0ut.c: Auto merged mysql-test/r/bigint.result: Auto merged mysql-test/t/bigint.test: Auto merged mysys/my_init.c: Auto merged mysys/my_net.c: Auto merged mysys/mysys_priv.h: Auto merged mysys/thr_rwlock.c: Auto merged sql/ha_innodb.h: Auto merged sql/sql_insert.cc: Auto merged include/my_sys.h: merge with 3.23 libmysql/Makefile.shared: merge with 3.23 mysql-test/mysql-test-run.sh: merge with 3.23 mysql-test/r/func_if.result: merge with 3.23 mysys/Makefile.am: merge with 3.23 mysys/my_gethostbyname.c: merge with 3.23 sql/ha_innodb.cc: merge with 3.23 sql/item_cmpfunc.cc: merge with 3.23 sql/mysqld.cc: merge with 3.23 sql/sql_show.cc: merge with 3.23
Diffstat (limited to 'innobase')
-rw-r--r--innobase/include/os0thread.h4
-rw-r--r--innobase/include/trx0trx.h9
-rw-r--r--innobase/include/univ.i6
-rw-r--r--innobase/include/ut0ut.h12
-rw-r--r--innobase/lock/lock0lock.c6
-rw-r--r--innobase/os/os0thread.c11
-rw-r--r--innobase/srv/srv0srv.c13
-rw-r--r--innobase/trx/trx0trx.c13
-rw-r--r--innobase/ut/ut0ut.c25
9 files changed, 91 insertions, 8 deletions
diff --git a/innobase/include/os0thread.h b/innobase/include/os0thread.h
index 636cfd79e50..95a3a95fb74 100644
--- a/innobase/include/os0thread.h
+++ b/innobase/include/os0thread.h
@@ -70,7 +70,9 @@ os_thread_create(
void* arg, /* in: argument to start
function */
os_thread_id_t* thread_id); /* out: id of created
- thread */
+ thread; currently this is
+ identical to the handle to
+ the thread */
/*********************************************************************
A thread calling this function ends its execution. */
diff --git a/innobase/include/trx0trx.h b/innobase/include/trx0trx.h
index 6e98f22c34b..e1f65e9da0f 100644
--- a/innobase/include/trx0trx.h
+++ b/innobase/include/trx0trx.h
@@ -117,6 +117,13 @@ void
trx_start_if_not_started(
/*=====================*/
trx_t* trx); /* in: transaction */
+/*****************************************************************
+Starts the transaction if it is not yet started. */
+
+void
+trx_start_if_not_started_noninline(
+/*===============================*/
+ trx_t* trx); /* in: transaction */
/********************************************************************
Commits a transaction. */
@@ -262,7 +269,7 @@ void
trx_print(
/*======*/
char* buf, /* in/out: buffer where to print, must be at least
- 500 bytes */
+ 800 bytes */
trx_t* trx); /* in: transaction */
diff --git a/innobase/include/univ.i b/innobase/include/univ.i
index a4f29dc4cf3..f32161fed20 100644
--- a/innobase/include/univ.i
+++ b/innobase/include/univ.i
@@ -63,6 +63,12 @@ Microsoft Visual C++ */
#define HAVE_PWRITE
#endif
+/* Apparently in some old SCO Unixes the return type of sprintf is not
+an integer as it should be according to the modern Posix standard. Because
+of that we define sprintf inside InnoDB code as our own function ut_sprintf */
+#undef sprintf
+#define sprintf ut_sprintf
+
#endif
/* DEBUG VERSION CONTROL
diff --git a/innobase/include/ut0ut.h b/innobase/include/ut0ut.h
index 408788016c1..8ec23b23dcd 100644
--- a/innobase/include/ut0ut.h
+++ b/innobase/include/ut0ut.h
@@ -17,6 +17,18 @@ Created 1/20/1994 Heikki Tuuri
typedef time_t ib_time_t;
+
+/************************************************************
+Uses vsprintf to emulate sprintf so that the function always returns
+the printed length. Apparently in some old SCO Unixes sprintf did not
+return the printed length but a pointer to the end of the printed string. */
+
+ulint
+ut_sprintf(
+/*=======*/
+ char* buf, /* in/out: buffer where to print */
+ const char* format, /* in: format of prints */
+ ...); /* in: arguments to be printed */
/************************************************************
Gets the high 32 bits in a ulint. That is makes a shift >> 32,
but since there seem to be compiler bugs in both gcc and Visual C++,
diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c
index 0bc7e9b4166..7030dbf9130 100644
--- a/innobase/lock/lock0lock.c
+++ b/innobase/lock/lock0lock.c
@@ -2755,6 +2755,8 @@ lock_deadlock_occurs(
err_buf += sprintf(err_buf,
"*** WE ROLL BACK TRANSACTION (2)\n");
+ ut_a(strlen(lock_latest_err_buf) < 4100);
+
/*
sess_raise_error_low(trx, DB_DEADLOCK, lock->type_mode, table,
index, NULL, NULL, NULL);
@@ -3626,7 +3628,7 @@ lock_print_info(
trx = UT_LIST_GET_FIRST(trx_sys->mysql_trx_list);
while (trx) {
- if (buf_end - buf < 600) {
+ if (buf_end - buf < 900) {
return;
}
@@ -3663,7 +3665,7 @@ loop:
return;
}
- if (buf_end - buf < 600) {
+ if (buf_end - buf < 900) {
return;
}
diff --git a/innobase/os/os0thread.c b/innobase/os/os0thread.c
index a8b417f4f3a..cb1205c5a85 100644
--- a/innobase/os/os0thread.c
+++ b/innobase/os/os0thread.c
@@ -97,17 +97,20 @@ os_thread_create(
function */
os_thread_id_t* thread_id __attribute__((unused)))
/* out: id of created
- thread */
+ thread; currently this is
+ identical to the handle to
+ the thread */
{
#ifdef __WIN__
os_thread_t thread;
+ ulint win_thread_id;
thread = CreateThread(NULL, /* no security attributes */
0, /* default size stack */
(LPTHREAD_START_ROUTINE)start_f,
arg,
0, /* thread runs immediately */
- thread_id);
+ &win_thread_id);
if (srv_set_thread_priorities) {
@@ -118,6 +121,8 @@ os_thread_create(
ut_a(SetThreadPriority(thread, srv_query_thread_priority));
}
+ *thread_id = thread;
+
return(thread);
#else
int ret;
@@ -135,6 +140,8 @@ os_thread_create(
my_pthread_setprio(pthread, srv_query_thread_priority);
}
+ *thread_id = pthread;
+
return(pthread);
#endif
}
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index 3b16e9557fa..d0ac011e60f 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -2228,6 +2228,7 @@ srv_sprintf_innodb_monitor(
ut_sprintf_timestamp(buf);
buf = buf + strlen(buf);
+ ut_a(buf < buf_end + 1500);
buf += sprintf(buf, " INNODB MONITOR OUTPUT\n"
"=====================================\n");
@@ -2242,6 +2243,7 @@ srv_sprintf_innodb_monitor(
sync_print(buf, buf_end);
buf = buf + strlen(buf);
+ ut_a(buf < buf_end + 1500);
buf += sprintf(buf, "------------\n"
"TRANSACTIONS\n"
@@ -2254,15 +2256,18 @@ srv_sprintf_innodb_monitor(
"--------\n");
os_aio_print(buf, buf_end);
buf = buf + strlen(buf);
+ ut_a(buf < buf_end + 1500);
buf += sprintf(buf, "-------------------------------------\n"
"INSERT BUFFER AND ADAPTIVE HASH INDEX\n"
"-------------------------------------\n");
ibuf_print(buf, buf_end);
buf = buf + strlen(buf);
+ ut_a(buf < buf_end + 1500);
ha_print_info(buf, buf_end, btr_search_sys->hash_index);
buf = buf + strlen(buf);
+ ut_a(buf < buf_end + 1500);
buf += sprintf(buf,
"%.2f hash searches/s, %.2f non-hash searches/s\n",
@@ -2278,6 +2283,7 @@ srv_sprintf_innodb_monitor(
"---\n");
log_print(buf, buf_end);
buf = buf + strlen(buf);
+ ut_a(buf < buf_end + 1500);
buf += sprintf(buf, "----------------------\n"
"BUFFER POOL AND MEMORY\n"
@@ -2288,6 +2294,7 @@ srv_sprintf_innodb_monitor(
mem_pool_get_reserved(mem_comm_pool));
buf_print_io(buf, buf_end);
buf = buf + strlen(buf);
+ ut_a(buf < buf_end + 1500);
buf += sprintf(buf, "--------------\n"
"ROW OPERATIONS\n"
@@ -2321,6 +2328,8 @@ srv_sprintf_innodb_monitor(
buf += sprintf(buf, "----------------------------\n"
"END OF INNODB MONITOR OUTPUT\n"
"============================\n");
+ ut_a(buf < buf_end + 1900);
+
mutex_exit(&srv_innodb_monitor_mutex);
}
@@ -2378,7 +2387,9 @@ loop:
buf = mem_alloc(100000);
- srv_sprintf_innodb_monitor(buf, 100000);
+ srv_sprintf_innodb_monitor(buf, 90000);
+
+ ut_a(strlen(buf) < 99000);
printf("%s", buf);
diff --git a/innobase/trx/trx0trx.c b/innobase/trx/trx0trx.c
index ef17588a2bb..994a6777924 100644
--- a/innobase/trx/trx0trx.c
+++ b/innobase/trx/trx0trx.c
@@ -39,6 +39,17 @@ sess_t* trx_dummy_sess = NULL;
the kernel mutex */
ulint trx_n_mysql_transactions = 0;
+/*****************************************************************
+Starts the transaction if it is not yet started. */
+
+void
+trx_start_if_not_started_noninline(
+/*===============================*/
+ trx_t* trx) /* in: transaction */
+{
+ trx_start_if_not_started(trx);
+}
+
/********************************************************************
Retrieves the error_info field from a trx. */
@@ -1465,7 +1476,7 @@ void
trx_print(
/*======*/
char* buf, /* in/out: buffer where to print, must be at least
- 500 bytes */
+ 800 bytes */
trx_t* trx) /* in: transaction */
{
char* start_of_line;
diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c
index c164afa0573..c77cbe9cdcf 100644
--- a/innobase/ut/ut0ut.c
+++ b/innobase/ut/ut0ut.c
@@ -12,11 +12,36 @@ Created 5/11/1994 Heikki Tuuri
#include "ut0ut.ic"
#endif
+#include <stdarg.h>
+
#include "ut0sort.h"
ibool ut_always_false = FALSE;
/************************************************************
+Uses vsprintf to emulate sprintf so that the function always returns
+the printed length. Apparently in some old SCO Unixes sprintf did not
+return the printed length but a pointer to the end of the printed string. */
+
+ulint
+ut_sprintf(
+/*=======*/
+ char* buf, /* in/out: buffer where to print */
+ const char* format, /* in: format of prints */
+ ...) /* in: arguments to be printed */
+{
+ va_list args;
+
+ va_start(args, format);
+
+ vsprintf(buf, format, args);
+
+ va_end(args);
+
+ return((ulint)strlen(buf));
+}
+
+/************************************************************
Gets the high 32 bits in a ulint. That is makes a shift >> 32,
but since there seem to be compiler bugs in both gcc and Visual C++,
we do this by a special conversion. */