summaryrefslogtreecommitdiff
path: root/innobase/include
diff options
context:
space:
mode:
authorheikki@hundin.mysql.fi <>2002-08-06 22:59:13 +0300
committerheikki@hundin.mysql.fi <>2002-08-06 22:59:13 +0300
commit042facc475a7a1d7610aba66526965e5b5ec5261 (patch)
tree0ed7a5d28436450a6e79787357c337dfae761d1d /innobase/include
parent5fadf19295e31a0332de4f1ed3362ba1ce51e4ab (diff)
downloadmariadb-git-042facc475a7a1d7610aba66526965e5b5ec5261.tar.gz
Many files:
Merge InnoDB-3.23.52d
Diffstat (limited to 'innobase/include')
-rw-r--r--innobase/include/buf0buf.h6
-rw-r--r--innobase/include/ha0ha.h8
-rw-r--r--innobase/include/ha0ha.ic10
-rw-r--r--innobase/include/log0log.h6
-rw-r--r--innobase/include/os0file.h6
-rw-r--r--innobase/include/os0sync.ic14
-rw-r--r--innobase/include/os0thread.h28
-rw-r--r--innobase/include/srv0start.h2
-rw-r--r--innobase/include/sync0rw.ic3
-rw-r--r--innobase/include/sync0sync.ic4
-rw-r--r--innobase/include/univ.i2
-rw-r--r--innobase/include/ut0dbg.h13
12 files changed, 75 insertions, 27 deletions
diff --git a/innobase/include/buf0buf.h b/innobase/include/buf0buf.h
index b80ed96f54c..591c0ec54ab 100644
--- a/innobase/include/buf0buf.h
+++ b/innobase/include/buf0buf.h
@@ -463,6 +463,12 @@ buf_print_io(
/*=========*/
char* buf, /* in/out: buffer where to print */
char* buf_end);/* in: buffer end */
+/**************************************************************************
+Refreshes the statistics used to print per-second averages. */
+
+void
+buf_refresh_io_stats(void);
+/*======================*/
/*************************************************************************
Checks that all file pages in the buffer are in a replaceable state. */
diff --git a/innobase/include/ha0ha.h b/innobase/include/ha0ha.h
index 945b1198a41..0beac928b7e 100644
--- a/innobase/include/ha0ha.h
+++ b/innobase/include/ha0ha.h
@@ -131,6 +131,14 @@ ha_print_info(
char* buf_end,/* in: buffer end */
hash_table_t* table); /* in: hash table */
+/* The hash table external chain node */
+
+typedef struct ha_node_struct ha_node_t;
+struct ha_node_struct {
+ ha_node_t* next; /* next chain node or NULL if none */
+ void* data; /* pointer to the data */
+ ulint fold; /* fold value for the data */
+};
#ifndef UNIV_NONINL
#include "ha0ha.ic"
diff --git a/innobase/include/ha0ha.ic b/innobase/include/ha0ha.ic
index 7b4c624c653..1aad7d5a36f 100644
--- a/innobase/include/ha0ha.ic
+++ b/innobase/include/ha0ha.ic
@@ -9,16 +9,6 @@ Created 8/18/1994 Heikki Tuuri
#include "ut0rnd.h"
#include "mem0mem.h"
-/* The hash table external chain node */
-
-typedef struct ha_node_struct ha_node_t;
-
-struct ha_node_struct {
- ha_node_t* next; /* next chain node or NULL if none */
- void* data; /* pointer to the data */
- ulint fold; /* fold value for the data */
-};
-
/***************************************************************
Deletes a hash node. */
diff --git a/innobase/include/log0log.h b/innobase/include/log0log.h
index 4358577c59c..f200371de9d 100644
--- a/innobase/include/log0log.h
+++ b/innobase/include/log0log.h
@@ -512,6 +512,12 @@ log_print(
/*======*/
char* buf, /* in/out: buffer where to print */
char* buf_end);/* in: buffer end */
+/**************************************************************************
+Refreshes the statistics used to print per-second averages. */
+
+void
+log_refresh_stats(void);
+/*===================*/
extern log_t* log_sys;
diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h
index b7911c5014a..d65c7fd47e3 100644
--- a/innobase/include/os0file.h
+++ b/innobase/include/os0file.h
@@ -408,6 +408,12 @@ os_aio_print(
char* buf, /* in/out: buffer where to print */
char* buf_end);/* in: buffer end */
/**************************************************************************
+Refreshes the statistics used to print per-second averages. */
+
+void
+os_aio_refresh_stats(void);
+/*======================*/
+/**************************************************************************
Checks that all slots in the system have been freed, that is, there are
no pending io operations. */
diff --git a/innobase/include/os0sync.ic b/innobase/include/os0sync.ic
index 6bff75d8ec6..10b85c435e3 100644
--- a/innobase/include/os0sync.ic
+++ b/innobase/include/os0sync.ic
@@ -27,7 +27,21 @@ os_fast_mutex_trylock(
return(0);
#else
+#if defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10)
+ /* Since the hot backup version is standalone, MySQL does not redefine
+ pthread_mutex_trylock for HP-UX-10.20, and consequently we must invert
+ the return value here */
+
+ return((ulint) (1 - pthread_mutex_trylock(fast_mutex)));
+#else
+ /* NOTE that the MySQL my_pthread.h redefines pthread_mutex_trylock
+ so that it returns 0 on success. In the operating system
+ libraries, HP-UX-10.20 follows the old Posix 1003.4a Draft 4 and
+ returns 1 on success (but MySQL remaps that to 0), while Linux,
+ FreeBSD, Solaris, AIX, Tru64 Unix, HP-UX-11.0 return 0 on success. */
+
return((ulint) pthread_mutex_trylock(fast_mutex));
#endif
+#endif
}
diff --git a/innobase/include/os0thread.h b/innobase/include/os0thread.h
index 0d6fa5a8f37..636cfd79e50 100644
--- a/innobase/include/os0thread.h
+++ b/innobase/include/os0thread.h
@@ -28,12 +28,30 @@ typedef void* os_thread_t;
#else
typedef pthread_t os_thread_t;
#endif
-typedef unsigned long int os_thread_id_t;
+
+#define os_thread_id_t os_thread_t
/* Define a function pointer type to use in a typecast */
typedef void* (*os_posix_f_t) (void*);
+/*******************************************************************
+Compares two threads or thread ids for equality */
+
+ibool
+os_thread_eq(
+/*=========*/
+ /* out: TRUE if equal */
+ os_thread_t a, /* in: OS thread or thread id */
+ os_thread_t b); /* in: OS thread or thread id */
+/********************************************************************
+Converts an OS thread or thread id to a ulint. It is NOT guaranteed that
+the ulint is unique for the thread though! */
+ulint
+os_thread_pf(
+/*=========*/
+ /* out: unsigned long int */
+ os_thread_t a); /* in: thread or thread id */
/********************************************************************
Creates a new thread of execution. The execution starts from
the function given. The start function takes a void* parameter
@@ -73,14 +91,6 @@ os_thread_t
os_thread_get_curr(void);
/*====================*/
/*********************************************************************
-Converts a thread id to a ulint. */
-
-ulint
-os_thread_conv_id_to_ulint(
-/*=======================*/
- /* out: converted to ulint */
- os_thread_id_t id); /* in: thread id */
-/*********************************************************************
Waits for a thread to terminate. */
void
diff --git a/innobase/include/srv0start.h b/innobase/include/srv0start.h
index 01ac063e1c9..646d2c1bb06 100644
--- a/innobase/include/srv0start.h
+++ b/innobase/include/srv0start.h
@@ -85,7 +85,7 @@ extern ibool srv_is_being_shut_down;
/* At a shutdown the value first climbs from 0 to SRV_SHUTDOWN_CLEANUP
and then to SRV_SHUTDOWN_LAST_PHASE */
-extern ulint srv_shutdown_state;
+extern ulint srv_shutdown_state;
#define SRV_SHUTDOWN_CLEANUP 1
#define SRV_SHUTDOWN_LAST_PHASE 2
diff --git a/innobase/include/sync0rw.ic b/innobase/include/sync0rw.ic
index af5c4576da6..7015ff34b99 100644
--- a/innobase/include/sync0rw.ic
+++ b/innobase/include/sync0rw.ic
@@ -311,7 +311,8 @@ rw_lock_x_lock_func_nowait(
&& ((rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED)
|| ((rw_lock_get_writer(lock) == RW_LOCK_EX)
&& (lock->pass == 0)
- && (lock->writer_thread == os_thread_get_curr_id())))) {
+ && os_thread_eq(lock->writer_thread,
+ os_thread_get_curr_id())))) {
rw_lock_set_writer(lock, RW_LOCK_EX);
lock->writer_thread = os_thread_get_curr_id();
diff --git a/innobase/include/sync0sync.ic b/innobase/include/sync0sync.ic
index 9014eb5fb54..c11cc0d196e 100644
--- a/innobase/include/sync0sync.ic
+++ b/innobase/include/sync0sync.ic
@@ -104,6 +104,10 @@ mutex_test_and_set(
ret = os_fast_mutex_trylock(&(mutex->os_fast_mutex));
if (ret == 0) {
+ /* We check that os_fast_mutex_trylock does not leak
+ and allow race conditions */
+ ut_a(mutex->lock_word == 0);
+
mutex->lock_word = 1;
}
diff --git a/innobase/include/univ.i b/innobase/include/univ.i
index 15a6115c37e..f5d083766bc 100644
--- a/innobase/include/univ.i
+++ b/innobase/include/univ.i
@@ -80,8 +80,8 @@ memory is read outside the allocated blocks. */
/*
#define UNIV_DEBUG
-#define UNIV_MEM_DEBUG
#define UNIV_SYNC_DEBUG
+#define UNIV_MEM_DEBUG
#define UNIV_IBUF_DEBUG
#define UNIV_SEARCH_DEBUG
diff --git a/innobase/include/ut0dbg.h b/innobase/include/ut0dbg.h
index fc5d493ca5e..3407483696c 100644
--- a/innobase/include/ut0dbg.h
+++ b/innobase/include/ut0dbg.h
@@ -26,9 +26,11 @@ extern ulint* ut_dbg_null_ptr;
ulint dbg_i;\
\
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
+ ut_print_timestamp(stderr);\
fprintf(stderr,\
- "InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\
- os_thread_get_curr_id(), IB__FILE__, (ulint)__LINE__);\
+ " InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\
+ os_thread_pf(os_thread_get_curr_id()), IB__FILE__,\
+ (ulint)__LINE__);\
fprintf(stderr,\
"InnoDB: We intentionally generate a memory trap.\n");\
fprintf(stderr,\
@@ -42,16 +44,17 @@ extern ulint* ut_dbg_null_ptr;
if (ut_dbg_stop_threads) {\
fprintf(stderr,\
"InnoDB: Thread %lu stopped in file %s line %lu\n",\
- os_thread_get_curr_id(), IB__FILE__, (ulint)__LINE__);\
+ os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
os_thread_sleep(1000000000);\
}\
}
#define ut_error {\
ulint dbg_i;\
+ ut_print_timestamp(stderr);\
fprintf(stderr,\
- "InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\
- os_thread_get_curr_id(), IB__FILE__, (ulint)__LINE__);\
+ " InnoDB: Assertion failure in thread %lu in file %s line %lu\n",\
+ os_thread_pf(os_thread_get_curr_id()), IB__FILE__, (ulint)__LINE__);\
fprintf(stderr,\
"InnoDB: We intentionally generate a memory trap.\n");\
fprintf(stderr,\