Commit 98e4b124 authored by Yoni Fogel's avatar Yoni Fogel

[t:2476] Recovery yield calls the function it is told to.

Added asserts to rwlock locks

git-svn-id: file:///svn/toku/tokudb@18779 c7de825b-a66e-492c-adef-691d508d4ae1
parent eb9ad2a8
...@@ -219,9 +219,10 @@ static const char *recover_state(RECOVER_ENV renv) { ...@@ -219,9 +219,10 @@ static const char *recover_state(RECOVER_ENV renv) {
return scan_state_string(&renv->ss); return scan_state_string(&renv->ss);
} }
// Null function supplied to transaction commit and abort // function supplied to transaction commit and abort
static void recover_yield(voidfp UU(f), void *UU(extra)) { // No yielding is necessary, but it must call the f function if provided.
// nothing static void recover_yield(voidfp f, void *UU(extra)) {
if (f) f();
} }
static int static int
......
...@@ -103,6 +103,8 @@ static inline int rwlock_try_prefer_read_lock(RWLOCK rwlock, toku_pthread_mutex_ ...@@ -103,6 +103,8 @@ static inline int rwlock_try_prefer_read_lock(RWLOCK rwlock, toku_pthread_mutex_
// expects: mutex is locked // expects: mutex is locked
static inline void rwlock_read_unlock(RWLOCK rwlock) { static inline void rwlock_read_unlock(RWLOCK rwlock) {
assert(rwlock->reader > 0);
assert(rwlock->writer == 0);
rwlock->reader--; rwlock->reader--;
if (rwlock->reader == 0 && rwlock->want_write) { if (rwlock->reader == 0 && rwlock->want_write) {
int r = toku_pthread_cond_signal(&rwlock->wait_write); assert(r == 0); int r = toku_pthread_cond_signal(&rwlock->wait_write); assert(r == 0);
...@@ -127,6 +129,8 @@ static inline void rwlock_write_lock(RWLOCK rwlock, toku_pthread_mutex_t *mutex) ...@@ -127,6 +129,8 @@ static inline void rwlock_write_lock(RWLOCK rwlock, toku_pthread_mutex_t *mutex)
// expects: mutex is locked // expects: mutex is locked
static inline void rwlock_write_unlock(RWLOCK rwlock) { static inline void rwlock_write_unlock(RWLOCK rwlock) {
assert(rwlock->reader == 0);
assert(rwlock->writer == 1);
rwlock->writer--; rwlock->writer--;
if (rwlock->writer == 0) { if (rwlock->writer == 0) {
if (rwlock->want_write) { if (rwlock->want_write) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment