2005-10-27 07:29:40 +00:00
|
|
|
/******************************************************
|
|
|
|
Mutex, the basic synchronization primitive
|
|
|
|
|
|
|
|
(c) 1995 Innobase Oy
|
|
|
|
|
|
|
|
Created 9/5/1995 Heikki Tuuri
|
|
|
|
*******************************************************/
|
branches/innodb+: Merge revisions 4072:4150 from branches/zip:
------------------------------------------------------------------------
r4074 | vasil | 2009-01-31 08:05:24 +0200 (Sat, 31 Jan 2009) | 4 lines
branches/zip:
Adjust the failing patch patches/information_schema.diff.
------------------------------------------------------------------------
r4076 | vasil | 2009-02-02 09:32:04 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip:
Add ChangeLog entry for the change in r4072.
------------------------------------------------------------------------
r4077 | marko | 2009-02-02 10:48:05 +0200 (Mon, 02 Feb 2009) | 2 lines
branches/zip: innobase_start_or_create_for_mysql(): Remove a factual error
in the function comment. Parameters are not read from a file "srv_init".
------------------------------------------------------------------------
r4081 | marko | 2009-02-02 14:28:17 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip: Enclose some backup functions in #ifdef UNIV_HOTBACKUP.
recv_read_cp_info_for_backup(), recv_scan_log_seg_for_backup():
These functions are only called by InnoDB Hot Backup.
------------------------------------------------------------------------
r4082 | vasil | 2009-02-02 18:24:08 +0200 (Mon, 02 Feb 2009) | 10 lines
branches/zip:
Fix a mysql-test failure in innodb-zip:
main.innodb-zip [ fail ]
Test ended at 2009-02-02 18:13:25
CURRENT_TEST: main.innodb-zip
mysqltest: At line 160: Found line beginning with -- that didn't contain a valid mysqltest command, check your syntax or use # if you intended to write a comment
------------------------------------------------------------------------
r4083 | vasil | 2009-02-02 18:33:20 +0200 (Mon, 02 Feb 2009) | 6 lines
branches/zip:
Fix the failing innodb-zip test to restore the environment as it was before
the test execution because a newly added feature in the mysql-test framework
does check for this.
------------------------------------------------------------------------
r4088 | calvin | 2009-02-03 02:35:56 +0200 (Tue, 03 Feb 2009) | 8 lines
branches/zip: fix a compiler error and a warning
Both are minor changes:
1) Compiler error introduced in r4072: double ';' at the end.
2) Warning introduced in r3613: \mem\mem0pool.c(481) :
warning C4098: 'mem_area_free' : 'void' function returning a value
Approved by: Sunny (IM)
------------------------------------------------------------------------
r4098 | marko | 2009-02-03 09:52:45 +0200 (Tue, 03 Feb 2009) | 4 lines
branches/zip: mem_area_free(): Correct a bug that was introduced in r4088.
free() is not the same as ut_free(). ut_free() pairs with ut_malloc(),
not malloc(). free() pairs with malloc() and some other functions.
------------------------------------------------------------------------
r4114 | marko | 2009-02-04 16:09:24 +0200 (Wed, 04 Feb 2009) | 2 lines
branches/zip: buf_block_align(): Fix a bogus debug assertion
that was introduced in r4036, to address Issue #161.
------------------------------------------------------------------------
r4139 | vasil | 2009-02-09 13:47:16 +0200 (Mon, 09 Feb 2009) | 5 lines
branches/zip:
Remove mysql-test/patches/bug35261.diff because that bug has been fixed
in the MySQL repository.
------------------------------------------------------------------------
r4141 | marko | 2009-02-09 15:35:50 +0200 (Mon, 09 Feb 2009) | 1 line
branches/zip: fil_write_lsn_and_arch_no_to_file(): Plug a memory leak.
------------------------------------------------------------------------
r4144 | inaam | 2009-02-10 01:36:25 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip rb://30
This patch changes the innodb mutexes and rw_locks implementation.
On supported platforms it uses GCC builtin atomics. These changes
are based on the patch sent by Mark Callaghan of Google under BSD
license. More technical discussion can be found at rb://30
Approved by: Heikki
------------------------------------------------------------------------
r4145 | vasil | 2009-02-10 07:34:43 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip:
Non-functional change: Fix a compilation warning introduced in r4144:
gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -I../../regex -I../../storage/innobase/include -I../../sql -I. -Werror -Wall -g -MT libinnobase_a-sync0arr.o -MD -MP -MF .deps/libinnobase_a-sync0arr.Tpo -c -o libinnobase_a-sync0arr.o `test -f 'sync/sync0arr.c' || echo './'`sync/sync0arr.c
cc1: warnings being treated as errors
sync/sync0arr.c: In function 'sync_array_object_signalled':
sync/sync0arr.c:869: warning: pointer targets in passing argument 1 of 'os_atomic_increment' differ in signedness
------------------------------------------------------------------------
r4148 | marko | 2009-02-10 10:38:41 +0200 (Tue, 10 Feb 2009) | 12 lines
branches/zip: Map ut_malloc(), ut_realloc(), ut_free() to
malloc(), realloc(), free() when innodb_use_sys_malloc is set.
ut_free_all_mem(): If innodb_use_sys_malloc is set, do nothing,
because then ut_mem_block_list_inited will never be set.
log_init(): Use mem_alloc() instead of ut_malloc(), so that the
memory will be freed. (Tested with Valgrind, although it is not
clear why the memory would be freed.)
rb://86 approved by Heikki Tuuri and Ken Jacobs. This addresses Issue #168.
------------------------------------------------------------------------
r4149 | marko | 2009-02-10 11:09:15 +0200 (Tue, 10 Feb 2009) | 1 line
branches/zip: ChangeLog: Document recent changes.
------------------------------------------------------------------------
r4150 | marko | 2009-02-10 11:51:43 +0200 (Tue, 10 Feb 2009) | 6 lines
branches/zip: get_share(), free_share(): Make table locking case sensitive.
If lower_case_table_names=1, MySQL will pass the table names in lower case.
Thus, we can use a binary comparison (strcmp) in the hash table.
rb://87 approved by Heikki Tuuri, to address Bug #41676 and Issue #167.
------------------------------------------------------------------------
2009-02-10 10:03:42 +00:00
|
|
|
/***********************************************************************
|
|
|
|
# Copyright (c) 2008, Google Inc.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
# * Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# * Redistributions in binary form must reproduce the above
|
|
|
|
# copyright notice, this list of conditions and the following
|
|
|
|
# disclaimer in the documentation and/or other materials
|
|
|
|
# provided with the distribution.
|
|
|
|
# * Neither the name of the Google Inc. nor the names of its
|
|
|
|
# contributors may be used to endorse or promote products
|
|
|
|
# derived from this software without specific prior written
|
|
|
|
# permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
#
|
|
|
|
# Note, the BSD license applies to the new code. The old code is GPL.
|
|
|
|
***********************************************************************/
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
#ifndef sync0sync_h
|
|
|
|
#define sync0sync_h
|
|
|
|
|
|
|
|
#include "univ.i"
|
|
|
|
#include "sync0types.h"
|
|
|
|
#include "ut0lst.h"
|
|
|
|
#include "ut0mem.h"
|
|
|
|
#include "os0thread.h"
|
|
|
|
#include "os0sync.h"
|
|
|
|
#include "sync0arr.h"
|
|
|
|
|
|
|
|
#ifndef UNIV_HOTBACKUP
|
2006-02-23 19:25:29 +00:00
|
|
|
extern my_bool timed_mutexes;
|
2005-10-27 07:29:40 +00:00
|
|
|
#endif /* UNIV_HOTBACKUP */
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
Initializes the synchronization data structures. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
sync_init(void);
|
|
|
|
/*===========*/
|
|
|
|
/**********************************************************************
|
|
|
|
Frees the resources in synchronization data structures. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
sync_close(void);
|
|
|
|
/*===========*/
|
|
|
|
/**********************************************************************
|
|
|
|
Creates, or rather, initializes a mutex object to a specified memory
|
|
|
|
location (which must be appropriately aligned). The mutex is initialized
|
|
|
|
in the reset state. Explicit freeing of the mutex with mutex_free is
|
|
|
|
necessary only if the memory block containing it is freed. */
|
|
|
|
|
2006-11-21 10:09:14 +00:00
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
# ifdef UNIV_SYNC_DEBUG
|
|
|
|
# define mutex_create(M, level) \
|
|
|
|
mutex_create_func((M), #M, (level), __FILE__, __LINE__)
|
|
|
|
# else
|
|
|
|
# define mutex_create(M, level) \
|
|
|
|
mutex_create_func((M), #M, __FILE__, __LINE__)
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# define mutex_create(M, level) \
|
|
|
|
mutex_create_func((M), __FILE__, __LINE__)
|
|
|
|
#endif
|
2006-08-29 09:30:31 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/**********************************************************************
|
|
|
|
Creates, or rather, initializes a mutex object in a specified memory
|
|
|
|
location (which must be appropriately aligned). The mutex is initialized
|
|
|
|
in the reset state. Explicit freeing of the mutex with mutex_free is
|
|
|
|
necessary only if the memory block containing it is freed. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
mutex_create_func(
|
|
|
|
/*==============*/
|
|
|
|
mutex_t* mutex, /* in: pointer to memory */
|
2006-11-21 10:09:14 +00:00
|
|
|
#ifdef UNIV_DEBUG
|
|
|
|
const char* cmutex_name, /* in: mutex name */
|
|
|
|
# ifdef UNIV_SYNC_DEBUG
|
2006-05-08 06:18:59 +00:00
|
|
|
ulint level, /* in: level */
|
2006-11-21 10:09:14 +00:00
|
|
|
# endif /* UNIV_SYNC_DEBUG */
|
|
|
|
#endif /* UNIV_DEBUG */
|
2005-10-27 07:29:40 +00:00
|
|
|
const char* cfile_name, /* in: file name where created */
|
2006-11-21 10:09:14 +00:00
|
|
|
ulint cline); /* in: file line where created */
|
2008-02-18 18:38:33 +00:00
|
|
|
|
|
|
|
#undef mutex_free /* Fix for MacOS X */
|
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
/**********************************************************************
|
|
|
|
Calling this function is obligatory only if the memory buffer containing
|
|
|
|
the mutex is freed. Removes a mutex object from the mutex list. The mutex
|
|
|
|
is checked to be in the reset state. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
mutex_free(
|
|
|
|
/*=======*/
|
|
|
|
mutex_t* mutex); /* in: mutex */
|
|
|
|
/******************************************************************
|
|
|
|
NOTE! The following macro should be used in mutex locking, not the
|
|
|
|
corresponding function. */
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
#define mutex_enter(M) mutex_enter_func((M), __FILE__, __LINE__)
|
2005-10-27 07:29:40 +00:00
|
|
|
/******************************************************************
|
|
|
|
NOTE! The following macro should be used in mutex locking, not the
|
|
|
|
corresponding function. */
|
|
|
|
|
|
|
|
/* NOTE! currently same as mutex_enter! */
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
#define mutex_enter_fast(M) mutex_enter_func((M), __FILE__, __LINE__)
|
2005-10-27 07:29:40 +00:00
|
|
|
/**********************************************************************
|
|
|
|
NOTE! Use the corresponding macro in the header file, not this function
|
|
|
|
directly. Locks a mutex for the current thread. If the mutex is reserved
|
|
|
|
the function spins a preset time (controlled by SYNC_SPIN_ROUNDS) waiting
|
|
|
|
for the mutex before suspending the thread. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
mutex_enter_func(
|
|
|
|
/*=============*/
|
|
|
|
mutex_t* mutex, /* in: pointer to mutex */
|
2006-02-23 19:25:29 +00:00
|
|
|
const char* file_name, /* in: file name where locked */
|
2005-10-27 07:29:40 +00:00
|
|
|
ulint line); /* in: line where locked */
|
2007-02-02 11:31:29 +00:00
|
|
|
/******************************************************************
|
|
|
|
NOTE! The following macro should be used in mutex locking, not the
|
|
|
|
corresponding function. */
|
|
|
|
|
|
|
|
#define mutex_enter_nowait(M) \
|
|
|
|
mutex_enter_nowait_func((M), __FILE__, __LINE__)
|
2005-10-27 07:29:40 +00:00
|
|
|
/************************************************************************
|
2007-02-02 11:31:29 +00:00
|
|
|
NOTE! Use the corresponding macro in the header file, not this function
|
|
|
|
directly. Tries to lock the mutex for the current thread. If the lock is not
|
|
|
|
acquired immediately, returns with return value 1. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
ulint
|
2007-02-02 11:31:29 +00:00
|
|
|
mutex_enter_nowait_func(
|
|
|
|
/*====================*/
|
2005-10-27 07:29:40 +00:00
|
|
|
/* out: 0 if succeed, 1 if not */
|
|
|
|
mutex_t* mutex, /* in: pointer to mutex */
|
|
|
|
const char* file_name, /* in: file name where mutex
|
|
|
|
requested */
|
|
|
|
ulint line); /* in: line where requested */
|
|
|
|
/**********************************************************************
|
|
|
|
Unlocks a mutex owned by the current thread. */
|
|
|
|
UNIV_INLINE
|
|
|
|
void
|
|
|
|
mutex_exit(
|
|
|
|
/*=======*/
|
|
|
|
mutex_t* mutex); /* in: pointer to mutex */
|
|
|
|
/**********************************************************************
|
|
|
|
Returns TRUE if no mutex or rw-lock is currently locked.
|
|
|
|
Works only in the debug version. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
ibool
|
|
|
|
sync_all_freed(void);
|
|
|
|
/*================*/
|
|
|
|
/*#####################################################################
|
|
|
|
FUNCTION PROTOTYPES FOR DEBUGGING */
|
|
|
|
/***********************************************************************
|
|
|
|
Prints wait info of the sync system. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
sync_print_wait_info(
|
|
|
|
/*=================*/
|
|
|
|
FILE* file); /* in: file where to print */
|
|
|
|
/***********************************************************************
|
|
|
|
Prints info of the sync system. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
sync_print(
|
|
|
|
/*=======*/
|
|
|
|
FILE* file); /* in: file where to print */
|
2006-10-30 09:25:08 +00:00
|
|
|
#ifdef UNIV_DEBUG
|
2005-10-27 07:29:40 +00:00
|
|
|
/**********************************************************************
|
|
|
|
Checks that the mutex has been initialized. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
ibool
|
|
|
|
mutex_validate(
|
|
|
|
/*===========*/
|
2007-01-18 18:29:12 +00:00
|
|
|
const mutex_t* mutex);
|
|
|
|
/**********************************************************************
|
|
|
|
Checks that the current thread owns the mutex. Works only
|
|
|
|
in the debug version. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2007-01-18 18:29:12 +00:00
|
|
|
ibool
|
|
|
|
mutex_own(
|
|
|
|
/*======*/
|
|
|
|
/* out: TRUE if owns */
|
|
|
|
const mutex_t* mutex); /* in: mutex */
|
2006-10-30 09:25:08 +00:00
|
|
|
#endif /* UNIV_DEBUG */
|
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2005-10-27 07:29:40 +00:00
|
|
|
/**********************************************************************
|
|
|
|
Adds a latch and its level in the thread level array. Allocates the memory
|
|
|
|
for the array if called first time for this OS thread. Makes the checks
|
|
|
|
against other latch levels stored in the array for this thread. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
sync_thread_add_level(
|
|
|
|
/*==================*/
|
|
|
|
void* latch, /* in: pointer to a mutex or an rw-lock */
|
2006-05-08 06:18:59 +00:00
|
|
|
ulint level); /* in: level in the latching order; if
|
|
|
|
SYNC_LEVEL_VARYING, nothing is done */
|
2005-10-27 07:29:40 +00:00
|
|
|
/**********************************************************************
|
|
|
|
Removes a latch from the thread level array if it is found there. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
ibool
|
|
|
|
sync_thread_reset_level(
|
|
|
|
/*====================*/
|
|
|
|
/* out: TRUE if found from the array; it is no error
|
|
|
|
if the latch is not found, as we presently are not
|
|
|
|
able to determine the level for every latch
|
|
|
|
reservation the program does */
|
|
|
|
void* latch); /* in: pointer to a mutex or an rw-lock */
|
|
|
|
/**********************************************************************
|
|
|
|
Checks that the level array for the current thread is empty. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
ibool
|
|
|
|
sync_thread_levels_empty(void);
|
|
|
|
/*==========================*/
|
|
|
|
/* out: TRUE if empty */
|
|
|
|
/**********************************************************************
|
|
|
|
Checks that the level array for the current thread is empty. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
ibool
|
|
|
|
sync_thread_levels_empty_gen(
|
|
|
|
/*=========================*/
|
|
|
|
/* out: TRUE if empty except the
|
|
|
|
exceptions specified below */
|
|
|
|
ibool dict_mutex_allowed); /* in: TRUE if dictionary mutex is
|
|
|
|
allowed to be owned by the thread,
|
|
|
|
also purge_is_running mutex is
|
|
|
|
allowed */
|
|
|
|
/**********************************************************************
|
|
|
|
Gets the debug information for a reserved mutex. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
void
|
|
|
|
mutex_get_debug_info(
|
|
|
|
/*=================*/
|
|
|
|
mutex_t* mutex, /* in: mutex */
|
|
|
|
const char** file_name, /* out: file where requested */
|
|
|
|
ulint* line, /* out: line where requested */
|
|
|
|
os_thread_id_t* thread_id); /* out: id of the thread which owns
|
|
|
|
the mutex */
|
|
|
|
/**********************************************************************
|
|
|
|
Counts currently reserved mutexes. Works only in the debug version. */
|
2008-02-18 18:38:33 +00:00
|
|
|
UNIV_INTERN
|
2005-10-27 07:29:40 +00:00
|
|
|
ulint
|
|
|
|
mutex_n_reserved(void);
|
|
|
|
/*==================*/
|
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
|
|
|
/**********************************************************************
|
|
|
|
NOT to be used outside this module except in debugging! Gets the value
|
|
|
|
of the lock word. */
|
|
|
|
UNIV_INLINE
|
branches/innodb+: Merge revisions 4072:4150 from branches/zip:
------------------------------------------------------------------------
r4074 | vasil | 2009-01-31 08:05:24 +0200 (Sat, 31 Jan 2009) | 4 lines
branches/zip:
Adjust the failing patch patches/information_schema.diff.
------------------------------------------------------------------------
r4076 | vasil | 2009-02-02 09:32:04 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip:
Add ChangeLog entry for the change in r4072.
------------------------------------------------------------------------
r4077 | marko | 2009-02-02 10:48:05 +0200 (Mon, 02 Feb 2009) | 2 lines
branches/zip: innobase_start_or_create_for_mysql(): Remove a factual error
in the function comment. Parameters are not read from a file "srv_init".
------------------------------------------------------------------------
r4081 | marko | 2009-02-02 14:28:17 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip: Enclose some backup functions in #ifdef UNIV_HOTBACKUP.
recv_read_cp_info_for_backup(), recv_scan_log_seg_for_backup():
These functions are only called by InnoDB Hot Backup.
------------------------------------------------------------------------
r4082 | vasil | 2009-02-02 18:24:08 +0200 (Mon, 02 Feb 2009) | 10 lines
branches/zip:
Fix a mysql-test failure in innodb-zip:
main.innodb-zip [ fail ]
Test ended at 2009-02-02 18:13:25
CURRENT_TEST: main.innodb-zip
mysqltest: At line 160: Found line beginning with -- that didn't contain a valid mysqltest command, check your syntax or use # if you intended to write a comment
------------------------------------------------------------------------
r4083 | vasil | 2009-02-02 18:33:20 +0200 (Mon, 02 Feb 2009) | 6 lines
branches/zip:
Fix the failing innodb-zip test to restore the environment as it was before
the test execution because a newly added feature in the mysql-test framework
does check for this.
------------------------------------------------------------------------
r4088 | calvin | 2009-02-03 02:35:56 +0200 (Tue, 03 Feb 2009) | 8 lines
branches/zip: fix a compiler error and a warning
Both are minor changes:
1) Compiler error introduced in r4072: double ';' at the end.
2) Warning introduced in r3613: \mem\mem0pool.c(481) :
warning C4098: 'mem_area_free' : 'void' function returning a value
Approved by: Sunny (IM)
------------------------------------------------------------------------
r4098 | marko | 2009-02-03 09:52:45 +0200 (Tue, 03 Feb 2009) | 4 lines
branches/zip: mem_area_free(): Correct a bug that was introduced in r4088.
free() is not the same as ut_free(). ut_free() pairs with ut_malloc(),
not malloc(). free() pairs with malloc() and some other functions.
------------------------------------------------------------------------
r4114 | marko | 2009-02-04 16:09:24 +0200 (Wed, 04 Feb 2009) | 2 lines
branches/zip: buf_block_align(): Fix a bogus debug assertion
that was introduced in r4036, to address Issue #161.
------------------------------------------------------------------------
r4139 | vasil | 2009-02-09 13:47:16 +0200 (Mon, 09 Feb 2009) | 5 lines
branches/zip:
Remove mysql-test/patches/bug35261.diff because that bug has been fixed
in the MySQL repository.
------------------------------------------------------------------------
r4141 | marko | 2009-02-09 15:35:50 +0200 (Mon, 09 Feb 2009) | 1 line
branches/zip: fil_write_lsn_and_arch_no_to_file(): Plug a memory leak.
------------------------------------------------------------------------
r4144 | inaam | 2009-02-10 01:36:25 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip rb://30
This patch changes the innodb mutexes and rw_locks implementation.
On supported platforms it uses GCC builtin atomics. These changes
are based on the patch sent by Mark Callaghan of Google under BSD
license. More technical discussion can be found at rb://30
Approved by: Heikki
------------------------------------------------------------------------
r4145 | vasil | 2009-02-10 07:34:43 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip:
Non-functional change: Fix a compilation warning introduced in r4144:
gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -I../../regex -I../../storage/innobase/include -I../../sql -I. -Werror -Wall -g -MT libinnobase_a-sync0arr.o -MD -MP -MF .deps/libinnobase_a-sync0arr.Tpo -c -o libinnobase_a-sync0arr.o `test -f 'sync/sync0arr.c' || echo './'`sync/sync0arr.c
cc1: warnings being treated as errors
sync/sync0arr.c: In function 'sync_array_object_signalled':
sync/sync0arr.c:869: warning: pointer targets in passing argument 1 of 'os_atomic_increment' differ in signedness
------------------------------------------------------------------------
r4148 | marko | 2009-02-10 10:38:41 +0200 (Tue, 10 Feb 2009) | 12 lines
branches/zip: Map ut_malloc(), ut_realloc(), ut_free() to
malloc(), realloc(), free() when innodb_use_sys_malloc is set.
ut_free_all_mem(): If innodb_use_sys_malloc is set, do nothing,
because then ut_mem_block_list_inited will never be set.
log_init(): Use mem_alloc() instead of ut_malloc(), so that the
memory will be freed. (Tested with Valgrind, although it is not
clear why the memory would be freed.)
rb://86 approved by Heikki Tuuri and Ken Jacobs. This addresses Issue #168.
------------------------------------------------------------------------
r4149 | marko | 2009-02-10 11:09:15 +0200 (Tue, 10 Feb 2009) | 1 line
branches/zip: ChangeLog: Document recent changes.
------------------------------------------------------------------------
r4150 | marko | 2009-02-10 11:51:43 +0200 (Tue, 10 Feb 2009) | 6 lines
branches/zip: get_share(), free_share(): Make table locking case sensitive.
If lower_case_table_names=1, MySQL will pass the table names in lower case.
Thus, we can use a binary comparison (strcmp) in the hash table.
rb://87 approved by Heikki Tuuri, to address Bug #41676 and Issue #167.
------------------------------------------------------------------------
2009-02-10 10:03:42 +00:00
|
|
|
byte
|
2005-10-27 07:29:40 +00:00
|
|
|
mutex_get_lock_word(
|
|
|
|
/*================*/
|
2007-01-18 18:29:12 +00:00
|
|
|
const mutex_t* mutex); /* in: mutex */
|
2005-10-27 07:29:40 +00:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
|
|
/**********************************************************************
|
|
|
|
NOT to be used outside this module except in debugging! Gets the waiters
|
|
|
|
field in a mutex. */
|
|
|
|
UNIV_INLINE
|
|
|
|
ulint
|
|
|
|
mutex_get_waiters(
|
|
|
|
/*==============*/
|
2006-02-23 19:25:29 +00:00
|
|
|
/* out: value to set */
|
2007-01-18 18:29:12 +00:00
|
|
|
const mutex_t* mutex); /* in: mutex */
|
2005-10-27 07:29:40 +00:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
|
|
|
|
|
|
|
/*
|
|
|
|
LATCHING ORDER WITHIN THE DATABASE
|
|
|
|
==================================
|
|
|
|
|
|
|
|
The mutex or latch in the central memory object, for instance, a rollback
|
|
|
|
segment object, must be acquired before acquiring the latch or latches to
|
|
|
|
the corresponding file data structure. In the latching order below, these
|
|
|
|
file page object latches are placed immediately below the corresponding
|
|
|
|
central memory object latch or mutex.
|
|
|
|
|
|
|
|
Synchronization object Notes
|
|
|
|
---------------------- -----
|
2006-02-23 19:25:29 +00:00
|
|
|
|
2005-10-27 07:29:40 +00:00
|
|
|
Dictionary mutex If we have a pointer to a dictionary
|
|
|
|
| object, e.g., a table, it can be
|
|
|
|
| accessed without reserving the
|
|
|
|
| dictionary mutex. We must have a
|
|
|
|
| reservation, a memoryfix, to the
|
|
|
|
| appropriate table object in this case,
|
|
|
|
| and the table must be explicitly
|
|
|
|
| released later.
|
|
|
|
V
|
|
|
|
Dictionary header
|
|
|
|
|
|
2006-02-23 19:25:29 +00:00
|
|
|
V
|
2005-10-27 07:29:40 +00:00
|
|
|
Secondary index tree latch The tree latch protects also all
|
|
|
|
| the B-tree non-leaf pages. These
|
|
|
|
V can be read with the page only
|
|
|
|
Secondary index non-leaf bufferfixed to save CPU time,
|
|
|
|
| no s-latch is needed on the page.
|
|
|
|
| Modification of a page requires an
|
|
|
|
| x-latch on the page, however. If a
|
|
|
|
| thread owns an x-latch to the tree,
|
|
|
|
| it is allowed to latch non-leaf pages
|
|
|
|
| even after it has acquired the fsp
|
|
|
|
| latch.
|
2006-02-23 19:25:29 +00:00
|
|
|
V
|
2005-10-27 07:29:40 +00:00
|
|
|
Secondary index leaf The latch on the secondary index leaf
|
|
|
|
| can be kept while accessing the
|
|
|
|
| clustered index, to save CPU time.
|
|
|
|
V
|
|
|
|
Clustered index tree latch To increase concurrency, the tree
|
|
|
|
| latch is usually released when the
|
|
|
|
| leaf page latch has been acquired.
|
2006-02-23 19:25:29 +00:00
|
|
|
V
|
2005-10-27 07:29:40 +00:00
|
|
|
Clustered index non-leaf
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Clustered index leaf
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Transaction system header
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Transaction undo mutex The undo log entry must be written
|
|
|
|
| before any index page is modified.
|
|
|
|
| Transaction undo mutex is for the undo
|
|
|
|
| logs the analogue of the tree latch
|
|
|
|
| for a B-tree. If a thread has the
|
|
|
|
| trx undo mutex reserved, it is allowed
|
|
|
|
| to latch the undo log pages in any
|
|
|
|
| order, and also after it has acquired
|
2006-02-23 19:25:29 +00:00
|
|
|
| the fsp latch.
|
2005-10-27 07:29:40 +00:00
|
|
|
V
|
|
|
|
Rollback segment mutex The rollback segment mutex must be
|
|
|
|
| reserved, if, e.g., a new page must
|
|
|
|
| be added to an undo log. The rollback
|
|
|
|
| segment and the undo logs in its
|
|
|
|
| history list can be seen as an
|
|
|
|
| analogue of a B-tree, and the latches
|
|
|
|
| reserved similarly, using a version of
|
|
|
|
| lock-coupling. If an undo log must be
|
|
|
|
| extended by a page when inserting an
|
|
|
|
| undo log record, this corresponds to
|
|
|
|
| a pessimistic insert in a B-tree.
|
|
|
|
V
|
|
|
|
Rollback segment header
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Purge system latch
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Undo log pages If a thread owns the trx undo mutex,
|
|
|
|
| or for a log in the history list, the
|
|
|
|
| rseg mutex, it is allowed to latch
|
|
|
|
| undo log pages in any order, and even
|
|
|
|
| after it has acquired the fsp latch.
|
|
|
|
| If a thread does not have the
|
|
|
|
| appropriate mutex, it is allowed to
|
|
|
|
| latch only a single undo log page in
|
|
|
|
| a mini-transaction.
|
|
|
|
V
|
|
|
|
File space management latch If a mini-transaction must allocate
|
|
|
|
| several file pages, it can do that,
|
|
|
|
| because it keeps the x-latch to the
|
|
|
|
| file space management in its memo.
|
|
|
|
V
|
|
|
|
File system pages
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Kernel mutex If a kernel operation needs a file
|
|
|
|
| page allocation, it must reserve the
|
|
|
|
| fsp x-latch before acquiring the kernel
|
|
|
|
| mutex.
|
|
|
|
V
|
|
|
|
Search system mutex
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Buffer pool mutex
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Log mutex
|
|
|
|
|
|
|
|
|
Any other latch
|
|
|
|
|
|
|
|
|
V
|
|
|
|
Memory pool mutex */
|
|
|
|
|
|
|
|
/* Latching order levels */
|
|
|
|
|
|
|
|
/* User transaction locks are higher than any of the latch levels below:
|
|
|
|
no latches are allowed when a thread goes to wait for a normal table
|
|
|
|
or row lock! */
|
|
|
|
#define SYNC_USER_TRX_LOCK 9999
|
|
|
|
#define SYNC_NO_ORDER_CHECK 3000 /* this can be used to suppress
|
|
|
|
latching order checking */
|
2006-05-08 06:18:59 +00:00
|
|
|
#define SYNC_LEVEL_VARYING 2000 /* Level is varying. Only used with
|
|
|
|
buffer pool page locks, which do not
|
|
|
|
have a fixed level, but instead have
|
|
|
|
their level set after the page is
|
|
|
|
locked; see e.g.
|
|
|
|
ibuf_bitmap_get_map_page(). */
|
2007-10-12 11:20:13 +00:00
|
|
|
#define SYNC_TRX_I_S_RWLOCK 1910 /* Used for
|
|
|
|
trx_i_s_cache_t::rw_lock */
|
|
|
|
#define SYNC_TRX_I_S_LAST_READ 1900 /* Used for
|
|
|
|
trx_i_s_cache_t::last_read_mutex */
|
2008-05-14 15:43:19 +00:00
|
|
|
#define SYNC_FILE_FORMAT_TAG 1200 /* Used to serialize access to the
|
|
|
|
file format tag */
|
2005-10-27 07:29:40 +00:00
|
|
|
#define SYNC_DICT_OPERATION 1001 /* table create, drop, etc. reserve
|
|
|
|
this in X-mode, implicit or backround
|
|
|
|
operations purge, rollback, foreign
|
|
|
|
key checks reserve this in S-mode */
|
|
|
|
#define SYNC_DICT 1000
|
|
|
|
#define SYNC_DICT_AUTOINC_MUTEX 999
|
|
|
|
#define SYNC_DICT_HEADER 995
|
|
|
|
#define SYNC_IBUF_HEADER 914
|
|
|
|
#define SYNC_IBUF_PESS_INSERT_MUTEX 912
|
|
|
|
#define SYNC_IBUF_MUTEX 910 /* ibuf mutex is really below
|
|
|
|
SYNC_FSP_PAGE: we assign a value this
|
|
|
|
high only to make the program to pass
|
|
|
|
the debug checks */
|
|
|
|
/*-------------------------------*/
|
|
|
|
#define SYNC_INDEX_TREE 900
|
|
|
|
#define SYNC_TREE_NODE_NEW 892
|
|
|
|
#define SYNC_TREE_NODE_FROM_HASH 891
|
|
|
|
#define SYNC_TREE_NODE 890
|
|
|
|
#define SYNC_PURGE_SYS 810
|
|
|
|
#define SYNC_PURGE_LATCH 800
|
|
|
|
#define SYNC_TRX_UNDO 700
|
|
|
|
#define SYNC_RSEG 600
|
|
|
|
#define SYNC_RSEG_HEADER_NEW 591
|
|
|
|
#define SYNC_RSEG_HEADER 590
|
|
|
|
#define SYNC_TRX_UNDO_PAGE 570
|
|
|
|
#define SYNC_EXTERN_STORAGE 500
|
|
|
|
#define SYNC_FSP 400
|
|
|
|
#define SYNC_FSP_PAGE 395
|
2006-02-23 19:25:29 +00:00
|
|
|
/*------------------------------------- Insert buffer headers */
|
2005-10-27 07:29:40 +00:00
|
|
|
/*------------------------------------- ibuf_mutex */
|
|
|
|
/*------------------------------------- Insert buffer tree */
|
|
|
|
#define SYNC_IBUF_BITMAP_MUTEX 351
|
|
|
|
#define SYNC_IBUF_BITMAP 350
|
|
|
|
/*------------------------------------- MySQL query cache mutex */
|
|
|
|
/*------------------------------------- MySQL binlog mutex */
|
|
|
|
/*-------------------------------*/
|
|
|
|
#define SYNC_KERNEL 300
|
|
|
|
#define SYNC_REC_LOCK 299
|
|
|
|
#define SYNC_TRX_LOCK_HEAP 298
|
|
|
|
#define SYNC_TRX_SYS_HEADER 290
|
|
|
|
#define SYNC_LOG 170
|
|
|
|
#define SYNC_RECV 168
|
branches/innodb+: Merge revisions 4070:4072 from branches/zip:
------------------------------------------------------------------------
r4072 | marko | 2009-01-30 23:30:29 +0200 (Fri, 30 Jan 2009) | 32 lines
branches/zip: Make innodb_adaptive_hash_index settable.
btr_search_disabled: Rename to btr_search_enabled and change the type
to char, so that it can be directly linked to the MySQL parameters.
Note that the variable is protected by btr_search_latch and
btr_search_enabled_mutex, a new mutex introduced in this patch.
btr_search_enabled_mutex: A new mutex, to protect btr_search_enabled
together with btr_search_latch.
buf_pool_drop_hash_index(): New function, to be called from
btr_search_disable().
btr_search_disable(), btr_search_enable(): Fix bugs. These functions
were previously unused.
btr_search_guess_on_hash(), btr_search_build_page_hash_index():
Check btr_search_enabled once more, while holding btr_search_latch.
btr_cur_search_to_nth_level(): Note that the reads of btr_search_enabled
may be dirty and explain why it should not be a problem.
innobase_adaptive_hash_index: Remove. The variable btr_search_enabled will be used directly instead.
innodb_adaptive_hash_index_update(): New function, an update callback for
innodb_adaptive_hash_index. This will call either btr_search_disable()
or btr_search_enable() when the value is assigned. The functions will
be called even if the value does not appear to be changed, e.g., when
setting from TRUE to TRUE or FALSE to FALSE.
rb://85 approved by Heikki Tuuri. This addresses Issue #163.
------------------------------------------------------------------------
2009-01-30 21:45:02 +00:00
|
|
|
#define SYNC_WORK_QUEUE 162
|
|
|
|
#define SYNC_SEARCH_SYS_CONF 161 /* for assigning btr_search_enabled */
|
2005-10-27 07:29:40 +00:00
|
|
|
#define SYNC_SEARCH_SYS 160 /* NOTE that if we have a memory
|
|
|
|
heap that can be extended to the
|
|
|
|
buffer pool, its logical level is
|
|
|
|
SYNC_SEARCH_SYS, as memory allocation
|
|
|
|
can call routines there! Otherwise
|
|
|
|
the level is SYNC_MEM_HASH. */
|
|
|
|
#define SYNC_BUF_POOL 150
|
|
|
|
#define SYNC_BUF_BLOCK 149
|
|
|
|
#define SYNC_DOUBLEWRITE 140
|
|
|
|
#define SYNC_ANY_LATCH 135
|
|
|
|
#define SYNC_THR_LOCAL 133
|
|
|
|
#define SYNC_MEM_HASH 131
|
|
|
|
#define SYNC_MEM_POOL 130
|
|
|
|
|
|
|
|
/* Codes used to designate lock operations */
|
2006-02-23 19:25:29 +00:00
|
|
|
#define RW_LOCK_NOT_LOCKED 350
|
2005-10-27 07:29:40 +00:00
|
|
|
#define RW_LOCK_EX 351
|
|
|
|
#define RW_LOCK_EXCLUSIVE 351
|
|
|
|
#define RW_LOCK_SHARED 352
|
|
|
|
#define RW_LOCK_WAIT_EX 353
|
|
|
|
#define SYNC_MUTEX 354
|
|
|
|
|
|
|
|
/* NOTE! The structure appears here only for the compiler to know its size.
|
|
|
|
Do not use its fields directly! The structure used in the spin lock
|
|
|
|
implementation of a mutual exclusion semaphore. */
|
|
|
|
|
|
|
|
struct mutex_struct {
|
2008-02-18 20:09:03 +00:00
|
|
|
os_event_t event; /* Used by sync0arr.c for the wait queue */
|
branches/innodb+: Merge revisions 4072:4150 from branches/zip:
------------------------------------------------------------------------
r4074 | vasil | 2009-01-31 08:05:24 +0200 (Sat, 31 Jan 2009) | 4 lines
branches/zip:
Adjust the failing patch patches/information_schema.diff.
------------------------------------------------------------------------
r4076 | vasil | 2009-02-02 09:32:04 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip:
Add ChangeLog entry for the change in r4072.
------------------------------------------------------------------------
r4077 | marko | 2009-02-02 10:48:05 +0200 (Mon, 02 Feb 2009) | 2 lines
branches/zip: innobase_start_or_create_for_mysql(): Remove a factual error
in the function comment. Parameters are not read from a file "srv_init".
------------------------------------------------------------------------
r4081 | marko | 2009-02-02 14:28:17 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip: Enclose some backup functions in #ifdef UNIV_HOTBACKUP.
recv_read_cp_info_for_backup(), recv_scan_log_seg_for_backup():
These functions are only called by InnoDB Hot Backup.
------------------------------------------------------------------------
r4082 | vasil | 2009-02-02 18:24:08 +0200 (Mon, 02 Feb 2009) | 10 lines
branches/zip:
Fix a mysql-test failure in innodb-zip:
main.innodb-zip [ fail ]
Test ended at 2009-02-02 18:13:25
CURRENT_TEST: main.innodb-zip
mysqltest: At line 160: Found line beginning with -- that didn't contain a valid mysqltest command, check your syntax or use # if you intended to write a comment
------------------------------------------------------------------------
r4083 | vasil | 2009-02-02 18:33:20 +0200 (Mon, 02 Feb 2009) | 6 lines
branches/zip:
Fix the failing innodb-zip test to restore the environment as it was before
the test execution because a newly added feature in the mysql-test framework
does check for this.
------------------------------------------------------------------------
r4088 | calvin | 2009-02-03 02:35:56 +0200 (Tue, 03 Feb 2009) | 8 lines
branches/zip: fix a compiler error and a warning
Both are minor changes:
1) Compiler error introduced in r4072: double ';' at the end.
2) Warning introduced in r3613: \mem\mem0pool.c(481) :
warning C4098: 'mem_area_free' : 'void' function returning a value
Approved by: Sunny (IM)
------------------------------------------------------------------------
r4098 | marko | 2009-02-03 09:52:45 +0200 (Tue, 03 Feb 2009) | 4 lines
branches/zip: mem_area_free(): Correct a bug that was introduced in r4088.
free() is not the same as ut_free(). ut_free() pairs with ut_malloc(),
not malloc(). free() pairs with malloc() and some other functions.
------------------------------------------------------------------------
r4114 | marko | 2009-02-04 16:09:24 +0200 (Wed, 04 Feb 2009) | 2 lines
branches/zip: buf_block_align(): Fix a bogus debug assertion
that was introduced in r4036, to address Issue #161.
------------------------------------------------------------------------
r4139 | vasil | 2009-02-09 13:47:16 +0200 (Mon, 09 Feb 2009) | 5 lines
branches/zip:
Remove mysql-test/patches/bug35261.diff because that bug has been fixed
in the MySQL repository.
------------------------------------------------------------------------
r4141 | marko | 2009-02-09 15:35:50 +0200 (Mon, 09 Feb 2009) | 1 line
branches/zip: fil_write_lsn_and_arch_no_to_file(): Plug a memory leak.
------------------------------------------------------------------------
r4144 | inaam | 2009-02-10 01:36:25 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip rb://30
This patch changes the innodb mutexes and rw_locks implementation.
On supported platforms it uses GCC builtin atomics. These changes
are based on the patch sent by Mark Callaghan of Google under BSD
license. More technical discussion can be found at rb://30
Approved by: Heikki
------------------------------------------------------------------------
r4145 | vasil | 2009-02-10 07:34:43 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip:
Non-functional change: Fix a compilation warning introduced in r4144:
gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -I../../regex -I../../storage/innobase/include -I../../sql -I. -Werror -Wall -g -MT libinnobase_a-sync0arr.o -MD -MP -MF .deps/libinnobase_a-sync0arr.Tpo -c -o libinnobase_a-sync0arr.o `test -f 'sync/sync0arr.c' || echo './'`sync/sync0arr.c
cc1: warnings being treated as errors
sync/sync0arr.c: In function 'sync_array_object_signalled':
sync/sync0arr.c:869: warning: pointer targets in passing argument 1 of 'os_atomic_increment' differ in signedness
------------------------------------------------------------------------
r4148 | marko | 2009-02-10 10:38:41 +0200 (Tue, 10 Feb 2009) | 12 lines
branches/zip: Map ut_malloc(), ut_realloc(), ut_free() to
malloc(), realloc(), free() when innodb_use_sys_malloc is set.
ut_free_all_mem(): If innodb_use_sys_malloc is set, do nothing,
because then ut_mem_block_list_inited will never be set.
log_init(): Use mem_alloc() instead of ut_malloc(), so that the
memory will be freed. (Tested with Valgrind, although it is not
clear why the memory would be freed.)
rb://86 approved by Heikki Tuuri and Ken Jacobs. This addresses Issue #168.
------------------------------------------------------------------------
r4149 | marko | 2009-02-10 11:09:15 +0200 (Tue, 10 Feb 2009) | 1 line
branches/zip: ChangeLog: Document recent changes.
------------------------------------------------------------------------
r4150 | marko | 2009-02-10 11:51:43 +0200 (Tue, 10 Feb 2009) | 6 lines
branches/zip: get_share(), free_share(): Make table locking case sensitive.
If lower_case_table_names=1, MySQL will pass the table names in lower case.
Thus, we can use a binary comparison (strcmp) in the hash table.
rb://87 approved by Heikki Tuuri, to address Bug #41676 and Issue #167.
------------------------------------------------------------------------
2009-02-10 10:03:42 +00:00
|
|
|
byte lock_word; /* This byte is the target of the atomic
|
|
|
|
test-and-set instruction in Win32 and
|
|
|
|
x86 32/64 with GCC 4.1.0 or later version */
|
|
|
|
#if defined(_WIN32) && defined(UNIV_CAN_USE_X86_ASSEMBLER)
|
|
|
|
#elif defined(HAVE_GCC_ATOMIC_BUILTINS)
|
2006-11-21 10:09:14 +00:00
|
|
|
#else
|
2005-10-27 07:29:40 +00:00
|
|
|
os_fast_mutex_t
|
|
|
|
os_fast_mutex; /* In other systems we use this OS mutex
|
|
|
|
in place of lock_word */
|
|
|
|
#endif
|
|
|
|
ulint waiters; /* This ulint is set to 1 if there are (or
|
|
|
|
may be) threads waiting in the global wait
|
|
|
|
array for this mutex to be released.
|
|
|
|
Otherwise, this is 0. */
|
|
|
|
UT_LIST_NODE_T(mutex_t) list; /* All allocated mutexes are put into
|
|
|
|
a list. Pointers to the next and prev. */
|
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
|
|
|
const char* file_name; /* File where the mutex was locked */
|
|
|
|
ulint line; /* Line where the mutex was locked */
|
2006-05-08 06:18:59 +00:00
|
|
|
ulint level; /* Level in the global latching order */
|
2006-11-21 10:09:14 +00:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2005-10-27 07:29:40 +00:00
|
|
|
const char* cfile_name;/* File name where mutex created */
|
2006-11-21 10:09:14 +00:00
|
|
|
ulint cline; /* Line where created */
|
|
|
|
#ifdef UNIV_DEBUG
|
2007-01-18 18:29:12 +00:00
|
|
|
os_thread_id_t thread_id; /* The thread id of the thread
|
|
|
|
which locked the mutex. */
|
2006-11-21 10:09:14 +00:00
|
|
|
ulint magic_n;
|
|
|
|
# define MUTEX_MAGIC_N (ulint)979585
|
|
|
|
#endif /* UNIV_DEBUG */
|
2005-10-27 07:29:40 +00:00
|
|
|
#ifndef UNIV_HOTBACKUP
|
2006-11-21 10:09:14 +00:00
|
|
|
ulong count_os_wait; /* count of os_wait */
|
|
|
|
# ifdef UNIV_DEBUG
|
|
|
|
ulong count_using; /* count of times mutex used */
|
|
|
|
ulong count_spin_loop; /* count of spin loops */
|
|
|
|
ulong count_spin_rounds; /* count of spin rounds */
|
|
|
|
ulong count_os_yield; /* count of os_wait */
|
|
|
|
ulonglong lspent_time; /* mutex os_wait timer msec */
|
|
|
|
ulonglong lmax_spent_time; /* mutex os_wait timer msec */
|
|
|
|
const char* cmutex_name;/* mutex name */
|
|
|
|
ulint mutex_type;/* 0 - usual mutex 1 - rw_lock mutex */
|
|
|
|
# endif /* UNIV_DEBUG */
|
2005-10-27 07:29:40 +00:00
|
|
|
#endif /* !UNIV_HOTBACKUP */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* The global array of wait cells for implementation of the databases own
|
|
|
|
mutexes and read-write locks. Appears here for debugging purposes only! */
|
|
|
|
|
|
|
|
extern sync_array_t* sync_primary_wait_array;
|
|
|
|
|
|
|
|
/* Constant determining how long spin wait is continued before suspending
|
|
|
|
the thread. A value 600 rounds on a 1995 100 MHz Pentium seems to correspond
|
|
|
|
to 20 microseconds. */
|
|
|
|
|
|
|
|
#define SYNC_SPIN_ROUNDS srv_n_spin_wait_rounds
|
|
|
|
|
|
|
|
/* The number of system calls made in this module. Intended for performance
|
|
|
|
monitoring. */
|
|
|
|
|
branches/innodb+: Merge revisions 4072:4150 from branches/zip:
------------------------------------------------------------------------
r4074 | vasil | 2009-01-31 08:05:24 +0200 (Sat, 31 Jan 2009) | 4 lines
branches/zip:
Adjust the failing patch patches/information_schema.diff.
------------------------------------------------------------------------
r4076 | vasil | 2009-02-02 09:32:04 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip:
Add ChangeLog entry for the change in r4072.
------------------------------------------------------------------------
r4077 | marko | 2009-02-02 10:48:05 +0200 (Mon, 02 Feb 2009) | 2 lines
branches/zip: innobase_start_or_create_for_mysql(): Remove a factual error
in the function comment. Parameters are not read from a file "srv_init".
------------------------------------------------------------------------
r4081 | marko | 2009-02-02 14:28:17 +0200 (Mon, 02 Feb 2009) | 4 lines
branches/zip: Enclose some backup functions in #ifdef UNIV_HOTBACKUP.
recv_read_cp_info_for_backup(), recv_scan_log_seg_for_backup():
These functions are only called by InnoDB Hot Backup.
------------------------------------------------------------------------
r4082 | vasil | 2009-02-02 18:24:08 +0200 (Mon, 02 Feb 2009) | 10 lines
branches/zip:
Fix a mysql-test failure in innodb-zip:
main.innodb-zip [ fail ]
Test ended at 2009-02-02 18:13:25
CURRENT_TEST: main.innodb-zip
mysqltest: At line 160: Found line beginning with -- that didn't contain a valid mysqltest command, check your syntax or use # if you intended to write a comment
------------------------------------------------------------------------
r4083 | vasil | 2009-02-02 18:33:20 +0200 (Mon, 02 Feb 2009) | 6 lines
branches/zip:
Fix the failing innodb-zip test to restore the environment as it was before
the test execution because a newly added feature in the mysql-test framework
does check for this.
------------------------------------------------------------------------
r4088 | calvin | 2009-02-03 02:35:56 +0200 (Tue, 03 Feb 2009) | 8 lines
branches/zip: fix a compiler error and a warning
Both are minor changes:
1) Compiler error introduced in r4072: double ';' at the end.
2) Warning introduced in r3613: \mem\mem0pool.c(481) :
warning C4098: 'mem_area_free' : 'void' function returning a value
Approved by: Sunny (IM)
------------------------------------------------------------------------
r4098 | marko | 2009-02-03 09:52:45 +0200 (Tue, 03 Feb 2009) | 4 lines
branches/zip: mem_area_free(): Correct a bug that was introduced in r4088.
free() is not the same as ut_free(). ut_free() pairs with ut_malloc(),
not malloc(). free() pairs with malloc() and some other functions.
------------------------------------------------------------------------
r4114 | marko | 2009-02-04 16:09:24 +0200 (Wed, 04 Feb 2009) | 2 lines
branches/zip: buf_block_align(): Fix a bogus debug assertion
that was introduced in r4036, to address Issue #161.
------------------------------------------------------------------------
r4139 | vasil | 2009-02-09 13:47:16 +0200 (Mon, 09 Feb 2009) | 5 lines
branches/zip:
Remove mysql-test/patches/bug35261.diff because that bug has been fixed
in the MySQL repository.
------------------------------------------------------------------------
r4141 | marko | 2009-02-09 15:35:50 +0200 (Mon, 09 Feb 2009) | 1 line
branches/zip: fil_write_lsn_and_arch_no_to_file(): Plug a memory leak.
------------------------------------------------------------------------
r4144 | inaam | 2009-02-10 01:36:25 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip rb://30
This patch changes the innodb mutexes and rw_locks implementation.
On supported platforms it uses GCC builtin atomics. These changes
are based on the patch sent by Mark Callaghan of Google under BSD
license. More technical discussion can be found at rb://30
Approved by: Heikki
------------------------------------------------------------------------
r4145 | vasil | 2009-02-10 07:34:43 +0200 (Tue, 10 Feb 2009) | 9 lines
branches/zip:
Non-functional change: Fix a compilation warning introduced in r4144:
gcc -DHAVE_CONFIG_H -I. -I../../include -I../../include -I../../include -I../../regex -I../../storage/innobase/include -I../../sql -I. -Werror -Wall -g -MT libinnobase_a-sync0arr.o -MD -MP -MF .deps/libinnobase_a-sync0arr.Tpo -c -o libinnobase_a-sync0arr.o `test -f 'sync/sync0arr.c' || echo './'`sync/sync0arr.c
cc1: warnings being treated as errors
sync/sync0arr.c: In function 'sync_array_object_signalled':
sync/sync0arr.c:869: warning: pointer targets in passing argument 1 of 'os_atomic_increment' differ in signedness
------------------------------------------------------------------------
r4148 | marko | 2009-02-10 10:38:41 +0200 (Tue, 10 Feb 2009) | 12 lines
branches/zip: Map ut_malloc(), ut_realloc(), ut_free() to
malloc(), realloc(), free() when innodb_use_sys_malloc is set.
ut_free_all_mem(): If innodb_use_sys_malloc is set, do nothing,
because then ut_mem_block_list_inited will never be set.
log_init(): Use mem_alloc() instead of ut_malloc(), so that the
memory will be freed. (Tested with Valgrind, although it is not
clear why the memory would be freed.)
rb://86 approved by Heikki Tuuri and Ken Jacobs. This addresses Issue #168.
------------------------------------------------------------------------
r4149 | marko | 2009-02-10 11:09:15 +0200 (Tue, 10 Feb 2009) | 1 line
branches/zip: ChangeLog: Document recent changes.
------------------------------------------------------------------------
r4150 | marko | 2009-02-10 11:51:43 +0200 (Tue, 10 Feb 2009) | 6 lines
branches/zip: get_share(), free_share(): Make table locking case sensitive.
If lower_case_table_names=1, MySQL will pass the table names in lower case.
Thus, we can use a binary comparison (strcmp) in the hash table.
rb://87 approved by Heikki Tuuri, to address Bug #41676 and Issue #167.
------------------------------------------------------------------------
2009-02-10 10:03:42 +00:00
|
|
|
extern ib_int64_t mutex_exit_count;
|
2005-10-27 07:29:40 +00:00
|
|
|
|
2006-10-31 16:51:16 +00:00
|
|
|
#ifdef UNIV_SYNC_DEBUG
|
2005-10-27 07:29:40 +00:00
|
|
|
/* Latching order checks start when this is set TRUE */
|
|
|
|
extern ibool sync_order_checks_on;
|
2006-10-31 16:51:16 +00:00
|
|
|
#endif /* UNIV_SYNC_DEBUG */
|
2005-10-27 07:29:40 +00:00
|
|
|
|
|
|
|
/* This variable is set to TRUE when sync_init is called */
|
|
|
|
extern ibool sync_initialized;
|
|
|
|
|
|
|
|
/* Global list of database mutexes (not OS mutexes) created. */
|
|
|
|
typedef UT_LIST_BASE_NODE_T(mutex_t) ut_list_base_node_t;
|
|
|
|
extern ut_list_base_node_t mutex_list;
|
|
|
|
|
|
|
|
/* Mutex protecting the mutex_list variable */
|
|
|
|
extern mutex_t mutex_list_mutex;
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef UNIV_NONINL
|
|
|
|
#include "sync0sync.ic"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|