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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
103e0fb9
Commit
103e0fb9
authored
Apr 25, 2009
by
Vadim Tkachenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sync to extension rev 55
parent
fee8858e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
36 deletions
+27
-36
include/sync0rw.ic
include/sync0rw.ic
+24
-33
sync/sync0arr.c
sync/sync0arr.c
+1
-1
sync/sync0rw.c
sync/sync0rw.c
+1
-1
trx/trx0sys.c
trx/trx0sys.c
+1
-1
No files found.
include/sync0rw.ic
View file @
103e0fb9
...
@@ -105,8 +105,7 @@ rw_lock_set_s_waiter_flag(
...
@@ -105,8 +105,7 @@ rw_lock_set_s_waiter_flag(
rw_lock_t* lock) /* in: rw-lock */
rw_lock_t* lock) /* in: rw-lock */
{
{
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
// os_compare_and_swap(&lock->s_waiters, 0, 1);
os_compare_and_swap(&lock->s_waiters, 0, 1);
__sync_lock_test_and_set(&lock->s_waiters, 1);
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
lock->s_waiters = 1;
lock->s_waiters = 1;
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
...
@@ -118,8 +117,7 @@ rw_lock_set_x_waiter_flag(
...
@@ -118,8 +117,7 @@ rw_lock_set_x_waiter_flag(
rw_lock_t* lock) /* in: rw-lock */
rw_lock_t* lock) /* in: rw-lock */
{
{
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
// os_compare_and_swap(&lock->x_waiters, 0, 1);
os_compare_and_swap(&lock->x_waiters, 0, 1);
__sync_lock_test_and_set(&lock->x_waiters, 1);
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
lock->x_waiters = 1;
lock->x_waiters = 1;
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
...
@@ -131,8 +129,7 @@ rw_lock_set_wx_waiter_flag(
...
@@ -131,8 +129,7 @@ rw_lock_set_wx_waiter_flag(
rw_lock_t* lock) /* in: rw-lock */
rw_lock_t* lock) /* in: rw-lock */
{
{
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
// os_compare_and_swap(&lock->wait_ex_waiters, 0, 1);
os_compare_and_swap(&lock->wait_ex_waiters, 0, 1);
__sync_lock_test_and_set(&lock->wait_ex_waiters, 1);
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
lock->wait_ex_waiters = 1;
lock->wait_ex_waiters = 1;
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
...
@@ -149,8 +146,7 @@ rw_lock_reset_s_waiter_flag(
...
@@ -149,8 +146,7 @@ rw_lock_reset_s_waiter_flag(
rw_lock_t* lock) /* in: rw-lock */
rw_lock_t* lock) /* in: rw-lock */
{
{
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
// os_compare_and_swap(&lock->s_waiters, 1, 0);
os_compare_and_swap(&lock->s_waiters, 1, 0);
__sync_lock_test_and_set(&lock->s_waiters, 0);
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
lock->s_waiters = 0;
lock->s_waiters = 0;
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
...
@@ -162,8 +158,7 @@ rw_lock_reset_x_waiter_flag(
...
@@ -162,8 +158,7 @@ rw_lock_reset_x_waiter_flag(
rw_lock_t* lock) /* in: rw-lock */
rw_lock_t* lock) /* in: rw-lock */
{
{
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
// os_compare_and_swap(&lock->x_waiters, 1, 0);
os_compare_and_swap(&lock->x_waiters, 1, 0);
__sync_lock_test_and_set(&lock->x_waiters, 0);
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
lock->x_waiters = 0;
lock->x_waiters = 0;
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
...
@@ -175,8 +170,7 @@ rw_lock_reset_wx_waiter_flag(
...
@@ -175,8 +170,7 @@ rw_lock_reset_wx_waiter_flag(
rw_lock_t* lock) /* in: rw-lock */
rw_lock_t* lock) /* in: rw-lock */
{
{
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
// os_compare_and_swap(&lock->wait_ex_waiters, 1, 0);
os_compare_and_swap(&lock->wait_ex_waiters, 1, 0);
__sync_lock_test_and_set(&lock->wait_ex_waiters, 0);
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
#else /* INNODB_RW_LOCKS_USE_ATOMICS */
lock->wait_ex_waiters = 0;
lock->wait_ex_waiters = 0;
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
#endif /* INNODB_RW_LOCKS_USE_ATOMICS */
...
@@ -569,17 +563,16 @@ rw_lock_x_lock_func_nowait(
...
@@ -569,17 +563,16 @@ rw_lock_x_lock_func_nowait(
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
#ifdef INNODB_RW_LOCKS_USE_ATOMICS
success = FALSE;
success = FALSE;
if ((lock->reader_count == 0)
if (lock->reader_count == 0) {
&& rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED) {
/* try to lock writer */
if(__sync_lock_test_and_set(&(lock->writer),RW_LOCK_EX)
== RW_LOCK_NOT_LOCKED) {
/* success */
retry_x_lock:
retry_x_lock:
/* try x-lock */
/* try x-lock */
if(__sync_sub_and_fetch(&(lock->lock_word),
if(__sync_sub_and_fetch(&(lock->lock_word),
X_LOCK_DECR) == 0) {
X_LOCK_DECR) == 0) {
/* success */
/* success */
/* try to lock writer */
if(__sync_lock_test_and_set(&(lock->writer),RW_LOCK_EX)
== RW_LOCK_NOT_LOCKED) {
/* success */
lock->writer_thread = curr_thread;
lock->writer_thread = curr_thread;
lock->recursive = TRUE;
lock->recursive = TRUE;
lock->writer_is_wait_ex = FALSE;
lock->writer_is_wait_ex = FALSE;
...
@@ -597,17 +590,15 @@ retry_x_lock:
...
@@ -597,17 +590,15 @@ retry_x_lock:
ut_ad(rw_lock_validate(lock));
ut_ad(rw_lock_validate(lock));
return(TRUE);
return(TRUE);
} else {
/* x-unlock */
__sync_fetch_and_add(&(lock->lock_word),
X_LOCK_DECR);
}
} else {
} else {
/* fail (x-lock) */
/* fail (x-lock) */
if (__sync_fetch_and_add(&(lock->lock_word),X_LOCK_DECR)
if (__sync_fetch_and_add(&(lock->lock_word),X_LOCK_DECR)
== 0)
== 0)
goto retry_x_lock;
goto retry_x_lock;
}
}
__sync_lock_test_and_set(&(lock->writer),RW_LOCK_NOT_LOCKED);
}
}
}
if (lock->recursive
if (lock->recursive
...
@@ -686,11 +677,11 @@ rw_lock_s_unlock_func(
...
@@ -686,11 +677,11 @@ rw_lock_s_unlock_func(
rw_lock_remove_debug_info(lock, pass, RW_LOCK_SHARED);
rw_lock_remove_debug_info(lock, pass, RW_LOCK_SHARED);
#endif
#endif
if (UNIV_UNLIKELY(last &&
__sync_lock_test_and_set(&lock->wait_ex_waiters
, 0))) {
if (UNIV_UNLIKELY(last &&
os_compare_and_swap(&lock->wait_ex_waiters, 1
, 0))) {
os_event_set(lock->wait_ex_event);
os_event_set(lock->wait_ex_event);
sync_array_object_signalled(sync_primary_wait_array);
sync_array_object_signalled(sync_primary_wait_array);
}
}
else if (UNIV_UNLIKELY(last &&
__sync_lock_test_and_set(&lock->x_waiters
, 0))) {
else if (UNIV_UNLIKELY(last &&
os_compare_and_swap(&lock->x_waiters, 1
, 0))) {
os_event_set(lock->x_event);
os_event_set(lock->x_event);
sync_array_object_signalled(sync_primary_wait_array);
sync_array_object_signalled(sync_primary_wait_array);
}
}
...
@@ -798,10 +789,10 @@ rw_lock_x_unlock_func(
...
@@ -798,10 +789,10 @@ rw_lock_x_unlock_func(
rw_lock_remove_debug_info(lock, pass, RW_LOCK_EX);
rw_lock_remove_debug_info(lock, pass, RW_LOCK_EX);
#endif
#endif
if (last) {
if (last) {
if(
__sync_lock_test_and_set(&lock->s_waiters
, 0)){
if(
os_compare_and_swap(&lock->s_waiters, 1
, 0)){
s_sg = TRUE;
s_sg = TRUE;
}
}
if(
__sync_lock_test_and_set(&lock->x_waiters
, 0)){
if(
os_compare_and_swap(&lock->x_waiters, 1
, 0)){
x_sg = TRUE;
x_sg = TRUE;
}
}
}
}
...
...
sync/sync0arr.c
View file @
103e0fb9
...
@@ -483,7 +483,7 @@ sync_array_cell_print(
...
@@ -483,7 +483,7 @@ sync_array_cell_print(
fprintf
(
file
,
fprintf
(
file
,
"--Thread %lu has waited at %s line %lu"
"--Thread %lu has waited at %s line %lu"
" for %
.2f
seconds the semaphore:
\n
"
,
" for %
#.5g
seconds the semaphore:
\n
"
,
(
ulong
)
os_thread_pf
(
cell
->
thread
),
cell
->
file
,
(
ulong
)
os_thread_pf
(
cell
->
thread
),
cell
->
file
,
(
ulong
)
cell
->
line
,
(
ulong
)
cell
->
line
,
difftime
(
time
(
NULL
),
cell
->
reservation_time
));
difftime
(
time
(
NULL
),
cell
->
reservation_time
));
...
...
sync/sync0rw.c
View file @
103e0fb9
...
@@ -474,7 +474,7 @@ rw_lock_s_lock_spin(
...
@@ -474,7 +474,7 @@ rw_lock_s_lock_spin(
/* If wait_ex_waiter stalls, wakes it. */
/* If wait_ex_waiter stalls, wakes it. */
if
(
lock
->
reader_count
==
0
if
(
lock
->
reader_count
==
0
&&
__sync_lock_test_and_set
(
&
lock
->
wait_ex_waiters
,
0
))
{
&&
os_compare_and_swap
(
&
lock
->
wait_ex_waiters
,
1
,
0
))
{
os_event_set
(
lock
->
wait_ex_event
);
os_event_set
(
lock
->
wait_ex_event
);
sync_array_object_signalled
(
sync_primary_wait_array
);
sync_array_object_signalled
(
sync_primary_wait_array
);
}
}
...
...
trx/trx0sys.c
View file @
103e0fb9
...
@@ -673,7 +673,7 @@ trx_sys_update_mysql_binlog_offset(
...
@@ -673,7 +673,7 @@ trx_sys_update_mysql_binlog_offset(
trx_sysf_t
*
sys_header
;
trx_sysf_t
*
sys_header
;
const
char
*
file_name
;
const
char
*
file_name
;
if
(
ut_strlen
(
file_name
)
>=
TRX_SYS_MYSQL_MASTER_LOG_NAME_LEN
)
{
if
(
ut_strlen
(
file_name
_in
)
>=
TRX_SYS_MYSQL_MASTER_LOG_NAME_LEN
)
{
/* We cannot fit the name to the 512 bytes we have reserved */
/* We cannot fit the name to the 512 bytes we have reserved */
/* -> To store relay log file information, file_name must fit to the 480 bytes */
/* -> To store relay log file information, file_name must fit to the 480 bytes */
...
...
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