Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
9af69370
Commit
9af69370
authored
Nov 21, 2006
by
marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port r972 from branches/zip: Enclose some debug code in #ifdef UNIV_SYNC_DEBUG.
The code was previously unused in non-debug builds.
parent
0fb091df
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
28 deletions
+26
-28
include/sync0sync.h
include/sync0sync.h
+3
-1
sync/sync0sync.c
sync/sync0sync.c
+23
-27
No files found.
include/sync0sync.h
View file @
9af69370
...
@@ -149,6 +149,7 @@ void
...
@@ -149,6 +149,7 @@ void
sync_print
(
sync_print
(
/*=======*/
/*=======*/
FILE
*
file
);
/* in: file where to print */
FILE
*
file
);
/* in: file where to print */
#ifdef UNIV_DEBUG
/**********************************************************************
/**********************************************************************
Checks that the mutex has been initialized. */
Checks that the mutex has been initialized. */
...
@@ -156,6 +157,8 @@ ibool
...
@@ -156,6 +157,8 @@ ibool
mutex_validate
(
mutex_validate
(
/*===========*/
/*===========*/
mutex_t
*
mutex
);
mutex_t
*
mutex
);
#endif
/* UNIV_DEBUG */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
/**********************************************************************
Adds a latch and its level in the thread level array. Allocates the memory
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
for the array if called first time for this OS thread. Makes the checks
...
@@ -197,7 +200,6 @@ sync_thread_levels_empty_gen(
...
@@ -197,7 +200,6 @@ sync_thread_levels_empty_gen(
allowed to be owned by the thread,
allowed to be owned by the thread,
also purge_is_running mutex is
also purge_is_running mutex is
allowed */
allowed */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
/**********************************************************************
Checks that the current thread owns the mutex. Works only
Checks that the current thread owns the mutex. Works only
in the debug version. */
in the debug version. */
...
...
sync/sync0sync.c
View file @
9af69370
...
@@ -108,8 +108,6 @@ will set the waiters field to 0 in mutex_exit, and then call
...
@@ -108,8 +108,6 @@ will set the waiters field to 0 in mutex_exit, and then call
sync_array_signal_object with the mutex as an argument.
sync_array_signal_object with the mutex as an argument.
Q.E.D. */
Q.E.D. */
ulint
sync_dummy
=
0
;
/* The number of system calls made in this module. Intended for performance
/* The number of system calls made in this module. Intended for performance
monitoring. */
monitoring. */
...
@@ -133,6 +131,7 @@ ibool sync_initialized = FALSE;
...
@@ -133,6 +131,7 @@ ibool sync_initialized = FALSE;
typedef
struct
sync_level_struct
sync_level_t
;
typedef
struct
sync_level_struct
sync_level_t
;
typedef
struct
sync_thread_struct
sync_thread_t
;
typedef
struct
sync_thread_struct
sync_thread_t
;
#ifdef UNIV_SYNC_DEBUG
/* The latch levels currently owned by threads are stored in this data
/* The latch levels currently owned by threads are stored in this data
structure; the size of this array is OS_THREAD_MAX_N */
structure; the size of this array is OS_THREAD_MAX_N */
...
@@ -140,6 +139,7 @@ sync_thread_t* sync_thread_level_arrays;
...
@@ -140,6 +139,7 @@ sync_thread_t* sync_thread_level_arrays;
/* Mutex protecting sync_thread_level_arrays */
/* Mutex protecting sync_thread_level_arrays */
mutex_t
sync_thread_mutex
;
mutex_t
sync_thread_mutex
;
#endif
/* UNIV_SYNC_DEBUG */
/* Global list of database mutexes (not OS mutexes) created. */
/* Global list of database mutexes (not OS mutexes) created. */
ut_list_base_node_t
mutex_list
;
ut_list_base_node_t
mutex_list
;
...
@@ -239,7 +239,11 @@ mutex_create_func(
...
@@ -239,7 +239,11 @@ mutex_create_func(
/* NOTE! The very first mutexes are not put to the mutex list */
/* NOTE! The very first mutexes are not put to the mutex list */
if
((
mutex
==
&
mutex_list_mutex
)
||
(
mutex
==
&
sync_thread_mutex
))
{
if
((
mutex
==
&
mutex_list_mutex
)
#ifdef UNIV_SYNC_DEBUG
||
(
mutex
==
&
sync_thread_mutex
)
#endif
/* UNIV_SYNC_DEBUG */
)
{
return
;
return
;
}
}
...
@@ -265,13 +269,15 @@ mutex_free(
...
@@ -265,13 +269,15 @@ mutex_free(
/*=======*/
/*=======*/
mutex_t
*
mutex
)
/* in: mutex */
mutex_t
*
mutex
)
/* in: mutex */
{
{
#ifdef UNIV_DEBUG
ut_ad
(
mutex_validate
(
mutex
));
ut_a
(
mutex_validate
(
mutex
));
#endif
/* UNIV_DEBUG */
ut_a
(
mutex_get_lock_word
(
mutex
)
==
0
);
ut_a
(
mutex_get_lock_word
(
mutex
)
==
0
);
ut_a
(
mutex_get_waiters
(
mutex
)
==
0
);
ut_a
(
mutex_get_waiters
(
mutex
)
==
0
);
if
(
mutex
!=
&
mutex_list_mutex
&&
mutex
!=
&
sync_thread_mutex
)
{
if
(
mutex
!=
&
mutex_list_mutex
#ifdef UNIV_SYNC_DEBUG
&&
mutex
!=
&
sync_thread_mutex
#endif
/* UNIV_SYNC_DEBUG */
)
{
mutex_enter
(
&
mutex_list_mutex
);
mutex_enter
(
&
mutex_list_mutex
);
...
@@ -598,9 +604,7 @@ mutex_get_debug_info(
...
@@ -598,9 +604,7 @@ mutex_get_debug_info(
*
line
=
mutex
->
line
;
*
line
=
mutex
->
line
;
*
thread_id
=
mutex
->
thread_id
;
*
thread_id
=
mutex
->
thread_id
;
}
}
#endif
/* UNIV_SYNC_DEBUG */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
/**********************************************************************
Checks that the current thread owns the mutex. Works only in the debug
Checks that the current thread owns the mutex. Works only in the debug
version. */
version. */
...
@@ -611,7 +615,7 @@ mutex_own(
...
@@ -611,7 +615,7 @@ mutex_own(
/* out: TRUE if owns */
/* out: TRUE if owns */
mutex_t
*
mutex
)
/* in: mutex */
mutex_t
*
mutex
)
/* in: mutex */
{
{
ut_a
(
mutex_validate
(
mutex
));
ut_a
d
(
mutex_validate
(
mutex
));
if
(
mutex_get_lock_word
(
mutex
)
!=
1
)
{
if
(
mutex_get_lock_word
(
mutex
)
!=
1
)
{
...
@@ -710,7 +714,6 @@ sync_all_freed(void)
...
@@ -710,7 +714,6 @@ sync_all_freed(void)
{
{
return
(
mutex_n_reserved
()
+
rw_lock_n_locked
()
==
0
);
return
(
mutex_n_reserved
()
+
rw_lock_n_locked
()
==
0
);
}
}
#endif
/* UNIV_SYNC_DEBUG */
/**********************************************************************
/**********************************************************************
Gets the value in the nth slot in the thread level arrays. */
Gets the value in the nth slot in the thread level arrays. */
...
@@ -834,7 +837,6 @@ sync_thread_levels_g(
...
@@ -834,7 +837,6 @@ sync_thread_levels_g(
(
ulong
)
mutex
->
cline
);
(
ulong
)
mutex
->
cline
);
if
(
mutex_get_lock_word
(
mutex
)
!=
0
)
{
if
(
mutex_get_lock_word
(
mutex
)
!=
0
)
{
#ifdef UNIV_SYNC_DEBUG
const
char
*
file_name
;
const
char
*
file_name
;
ulint
line
;
ulint
line
;
os_thread_id_t
thread_id
;
os_thread_id_t
thread_id
;
...
@@ -852,19 +854,11 @@ sync_thread_levels_g(
...
@@ -852,19 +854,11 @@ sync_thread_levels_g(
thread_id
),
thread_id
),
file_name
,
file_name
,
(
ulong
)
line
);
(
ulong
)
line
);
#else
/* UNIV_SYNC_DEBUG */
fprintf
(
stderr
,
"InnoDB: Locked mutex:"
" addr %p
\n
"
,
(
void
*
)
mutex
);
#endif
/* UNIV_SYNC_DEBUG */
}
else
{
}
else
{
fputs
(
"Not locked
\n
"
,
stderr
);
fputs
(
"Not locked
\n
"
,
stderr
);
}
}
}
else
{
}
else
{
#ifdef UNIV_SYNC_DEBUG
rw_lock_print
(
lock
);
rw_lock_print
(
lock
);
#endif
/* UNIV_SYNC_DEBUG */
}
}
return
(
FALSE
);
return
(
FALSE
);
...
@@ -996,9 +990,7 @@ sync_thread_add_level(
...
@@ -996,9 +990,7 @@ sync_thread_add_level(
if
((
latch
==
(
void
*
)
&
sync_thread_mutex
)
if
((
latch
==
(
void
*
)
&
sync_thread_mutex
)
||
(
latch
==
(
void
*
)
&
mutex_list_mutex
)
||
(
latch
==
(
void
*
)
&
mutex_list_mutex
)
#ifdef UNIV_SYNC_DEBUG
||
(
latch
==
(
void
*
)
&
rw_lock_debug_mutex
)
||
(
latch
==
(
void
*
)
&
rw_lock_debug_mutex
)
#endif
/* UNIV_SYNC_DEBUG */
||
(
latch
==
(
void
*
)
&
rw_lock_list_mutex
))
{
||
(
latch
==
(
void
*
)
&
rw_lock_list_mutex
))
{
return
;
return
;
...
@@ -1219,9 +1211,7 @@ sync_thread_reset_level(
...
@@ -1219,9 +1211,7 @@ sync_thread_reset_level(
if
((
latch
==
(
void
*
)
&
sync_thread_mutex
)
if
((
latch
==
(
void
*
)
&
sync_thread_mutex
)
||
(
latch
==
(
void
*
)
&
mutex_list_mutex
)
||
(
latch
==
(
void
*
)
&
mutex_list_mutex
)
#ifdef UNIV_SYNC_DEBUG
||
(
latch
==
(
void
*
)
&
rw_lock_debug_mutex
)
||
(
latch
==
(
void
*
)
&
rw_lock_debug_mutex
)
#endif
/* UNIV_SYNC_DEBUG */
||
(
latch
==
(
void
*
)
&
rw_lock_list_mutex
))
{
||
(
latch
==
(
void
*
)
&
rw_lock_list_mutex
))
{
return
(
FALSE
);
return
(
FALSE
);
...
@@ -1260,6 +1250,7 @@ sync_thread_reset_level(
...
@@ -1260,6 +1250,7 @@ sync_thread_reset_level(
return
(
FALSE
);
return
(
FALSE
);
}
}
#endif
/* UNIV_SYNC_DEBUG */
/**********************************************************************
/**********************************************************************
Initializes the synchronization data structures. */
Initializes the synchronization data structures. */
...
@@ -1268,8 +1259,10 @@ void
...
@@ -1268,8 +1259,10 @@ void
sync_init
(
void
)
sync_init
(
void
)
/*===========*/
/*===========*/
{
{
#ifdef UNIV_SYNC_DEBUG
sync_thread_t
*
thread_slot
;
sync_thread_t
*
thread_slot
;
ulint
i
;
ulint
i
;
#endif
/* UNIV_SYNC_DEBUG */
ut_a
(
sync_initialized
==
FALSE
);
ut_a
(
sync_initialized
==
FALSE
);
...
@@ -1280,7 +1273,7 @@ sync_init(void)
...
@@ -1280,7 +1273,7 @@ sync_init(void)
sync_primary_wait_array
=
sync_array_create
(
OS_THREAD_MAX_N
,
sync_primary_wait_array
=
sync_array_create
(
OS_THREAD_MAX_N
,
SYNC_ARRAY_OS_MUTEX
);
SYNC_ARRAY_OS_MUTEX
);
#ifdef UNIV_SYNC_DEBUG
/* Create the thread latch level array where the latch levels
/* Create the thread latch level array where the latch levels
are stored for each OS thread */
are stored for each OS thread */
...
@@ -1291,13 +1284,14 @@ sync_init(void)
...
@@ -1291,13 +1284,14 @@ sync_init(void)
thread_slot
=
sync_thread_level_arrays_get_nth
(
i
);
thread_slot
=
sync_thread_level_arrays_get_nth
(
i
);
thread_slot
->
levels
=
NULL
;
thread_slot
->
levels
=
NULL
;
}
}
#endif
/* UNIV_SYNC_DEBUG */
/* Init the mutex list and create the mutex to protect it. */
/* Init the mutex list and create the mutex to protect it. */
UT_LIST_INIT
(
mutex_list
);
UT_LIST_INIT
(
mutex_list
);
mutex_create
(
&
mutex_list_mutex
,
SYNC_NO_ORDER_CHECK
);
mutex_create
(
&
mutex_list_mutex
,
SYNC_NO_ORDER_CHECK
);
#ifdef UNIV_SYNC_DEBUG
mutex_create
(
&
sync_thread_mutex
,
SYNC_NO_ORDER_CHECK
);
mutex_create
(
&
sync_thread_mutex
,
SYNC_NO_ORDER_CHECK
);
#endif
/* UNIV_SYNC_DEBUG */
/* Init the rw-lock list and create the mutex to protect it. */
/* Init the rw-lock list and create the mutex to protect it. */
...
@@ -1332,7 +1326,9 @@ sync_close(void)
...
@@ -1332,7 +1326,9 @@ sync_close(void)
}
}
mutex_free
(
&
mutex_list_mutex
);
mutex_free
(
&
mutex_list_mutex
);
#ifdef UNIV_SYNC_DEBUG
mutex_free
(
&
sync_thread_mutex
);
mutex_free
(
&
sync_thread_mutex
);
#endif
/* UNIV_SYNC_DEBUG */
}
}
/***********************************************************************
/***********************************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment