Commit d6260a79 authored by rich prohaska's avatar rich prohaska

#27 rename the low priority multi operation checkpoint lock

parent e94961e8
...@@ -183,7 +183,7 @@ static LSN last_completed_checkpoint_lsn; ...@@ -183,7 +183,7 @@ static LSN last_completed_checkpoint_lsn;
static toku_pthread_rwlock_t checkpoint_safe_lock; static toku_pthread_rwlock_t checkpoint_safe_lock;
static toku_pthread_rwlock_t multi_operation_lock; static toku_pthread_rwlock_t multi_operation_lock;
static toku_pthread_rwlock_t big_multi_operation_lock; static toku_pthread_rwlock_t low_priority_multi_operation_lock;
static bool initialized = false; // sanity check static bool initialized = false; // sanity check
static volatile bool locked_mo = false; // true when the multi_operation write lock is held (by checkpoint) static volatile bool locked_mo = false; // true when the multi_operation write lock is held (by checkpoint)
...@@ -205,7 +205,7 @@ multi_operation_lock_init(void) { ...@@ -205,7 +205,7 @@ multi_operation_lock_init(void) {
// happen on osx // happen on osx
#endif #endif
toku_pthread_rwlock_init(&multi_operation_lock, &attr); toku_pthread_rwlock_init(&multi_operation_lock, &attr);
toku_pthread_rwlock_init(&big_multi_operation_lock, &attr); toku_pthread_rwlock_init(&low_priority_multi_operation_lock, &attr);
pthread_rwlockattr_destroy(&attr); pthread_rwlockattr_destroy(&attr);
locked_mo = false; locked_mo = false;
} }
...@@ -213,12 +213,12 @@ multi_operation_lock_init(void) { ...@@ -213,12 +213,12 @@ multi_operation_lock_init(void) {
static void static void
multi_operation_lock_destroy(void) { multi_operation_lock_destroy(void) {
toku_pthread_rwlock_destroy(&multi_operation_lock); toku_pthread_rwlock_destroy(&multi_operation_lock);
toku_pthread_rwlock_destroy(&big_multi_operation_lock); toku_pthread_rwlock_destroy(&low_priority_multi_operation_lock);
} }
static void static void
multi_operation_checkpoint_lock(void) { multi_operation_checkpoint_lock(void) {
toku_pthread_rwlock_wrlock(&big_multi_operation_lock); toku_pthread_rwlock_wrlock(&low_priority_multi_operation_lock);
toku_pthread_rwlock_wrlock(&multi_operation_lock); toku_pthread_rwlock_wrlock(&multi_operation_lock);
locked_mo = true; locked_mo = true;
} }
...@@ -227,7 +227,7 @@ static void ...@@ -227,7 +227,7 @@ static void
multi_operation_checkpoint_unlock(void) { multi_operation_checkpoint_unlock(void) {
locked_mo = false; locked_mo = false;
toku_pthread_rwlock_wrunlock(&multi_operation_lock); toku_pthread_rwlock_wrunlock(&multi_operation_lock);
toku_pthread_rwlock_wrunlock(&big_multi_operation_lock); toku_pthread_rwlock_wrunlock(&low_priority_multi_operation_lock);
} }
static void static void
...@@ -269,12 +269,12 @@ toku_multi_operation_client_unlock(void) { ...@@ -269,12 +269,12 @@ toku_multi_operation_client_unlock(void) {
toku_pthread_rwlock_rdunlock(&multi_operation_lock); toku_pthread_rwlock_rdunlock(&multi_operation_lock);
} }
void toku_big_multi_operation_client_lock(void) { void toku_low_priority_multi_operation_client_lock(void) {
toku_pthread_rwlock_rdlock(&big_multi_operation_lock); toku_pthread_rwlock_rdlock(&low_priority_multi_operation_lock);
} }
void toku_big_multi_operation_client_unlock(void) { void toku_low_priority_multi_operation_client_unlock(void) {
toku_pthread_rwlock_rdunlock(&big_multi_operation_lock); toku_pthread_rwlock_rdunlock(&low_priority_multi_operation_lock);
} }
void void
......
...@@ -135,10 +135,10 @@ void toku_checkpoint_safe_client_unlock(void); ...@@ -135,10 +135,10 @@ void toku_checkpoint_safe_client_unlock(void);
*****/ *****/
void toku_multi_operation_client_lock(void); void toku_multi_operation_client_lock(void);
void toku_big_multi_operation_client_lock(void); void toku_low_priority_multi_operation_client_lock(void);
void toku_multi_operation_client_unlock(void); void toku_multi_operation_client_unlock(void);
void toku_big_multi_operation_client_unlock(void); void toku_low_priority_multi_operation_client_unlock(void);
// Initialize the checkpoint mechanism, must be called before any client operations. // Initialize the checkpoint mechanism, must be called before any client operations.
......
...@@ -136,7 +136,7 @@ toku_txn_destroy(DB_TXN *txn) { ...@@ -136,7 +136,7 @@ toku_txn_destroy(DB_TXN *txn) {
static int static int
toku_txn_commit(DB_TXN * txn, uint32_t flags, toku_txn_commit(DB_TXN * txn, uint32_t flags,
TXN_PROGRESS_POLL_FUNCTION poll, void *poll_extra, TXN_PROGRESS_POLL_FUNCTION poll, void *poll_extra,
bool release_mo_lock, bool big_txn) { bool release_mo_lock, bool low_priority) {
HANDLE_PANICKED_ENV(txn->mgrp); HANDLE_PANICKED_ENV(txn->mgrp);
//Recursively kill off children //Recursively kill off children
if (db_txn_struct_i(txn)->child) { if (db_txn_struct_i(txn)->child) {
...@@ -192,8 +192,8 @@ toku_txn_commit(DB_TXN * txn, uint32_t flags, ...@@ -192,8 +192,8 @@ toku_txn_commit(DB_TXN * txn, uint32_t flags,
// begin checkpoint logs these associations, so we must be protect // begin checkpoint logs these associations, so we must be protect
// the changing of these associations with checkpointing // the changing of these associations with checkpointing
if (release_mo_lock) { if (release_mo_lock) {
if (big_txn) { if (low_priority) {
toku_big_multi_operation_client_unlock(); toku_low_priority_multi_operation_client_unlock();
} else { } else {
toku_multi_operation_client_unlock(); toku_multi_operation_client_unlock();
} }
...@@ -328,14 +328,14 @@ static int ...@@ -328,14 +328,14 @@ static int
locked_txn_commit_with_progress(DB_TXN *txn, uint32_t flags, locked_txn_commit_with_progress(DB_TXN *txn, uint32_t flags,
TXN_PROGRESS_POLL_FUNCTION poll, void* poll_extra) { TXN_PROGRESS_POLL_FUNCTION poll, void* poll_extra) {
bool holds_mo_lock = false; bool holds_mo_lock = false;
bool big_txn = false; bool low_priority = false;
TOKUTXN tokutxn = db_txn_struct_i(txn)->tokutxn; TOKUTXN tokutxn = db_txn_struct_i(txn)->tokutxn;
if (!toku_txn_is_read_only(tokutxn)) { if (!toku_txn_is_read_only(tokutxn)) {
// A readonly transaction does no logging, and therefore does not need the MO lock. // A readonly transaction does no logging, and therefore does not need the MO lock.
holds_mo_lock = true; holds_mo_lock = true;
if (toku_txn_has_spilled_rollback(tokutxn)) { if (toku_txn_has_spilled_rollback(tokutxn)) {
big_txn = true; low_priority = true;
toku_big_multi_operation_client_lock(); toku_low_priority_multi_operation_client_lock();
} else { } else {
toku_multi_operation_client_lock(); toku_multi_operation_client_lock();
} }
...@@ -345,7 +345,7 @@ locked_txn_commit_with_progress(DB_TXN *txn, uint32_t flags, ...@@ -345,7 +345,7 @@ locked_txn_commit_with_progress(DB_TXN *txn, uint32_t flags,
// see a non-readonly txn in the recursive commit. // see a non-readonly txn in the recursive commit.
// But released in the first-level toku_txn_commit (if taken), // But released in the first-level toku_txn_commit (if taken),
// this way, we don't hold it while we fsync the log. // this way, we don't hold it while we fsync the log.
int r = toku_txn_commit(txn, flags, poll, poll_extra, holds_mo_lock, big_txn); int r = toku_txn_commit(txn, flags, poll, poll_extra, holds_mo_lock, low_priority);
return r; return r;
} }
...@@ -357,22 +357,22 @@ locked_txn_abort_with_progress(DB_TXN *txn, ...@@ -357,22 +357,22 @@ locked_txn_abort_with_progress(DB_TXN *txn,
// see a non-readonly txn in the abort (or recursive commit). // see a non-readonly txn in the abort (or recursive commit).
// But released here so we don't have to hold additional state. // But released here so we don't have to hold additional state.
bool holds_mo_lock = false; bool holds_mo_lock = false;
bool big_txn = false; bool low_priority = false;
TOKUTXN tokutxn = db_txn_struct_i(txn)->tokutxn; TOKUTXN tokutxn = db_txn_struct_i(txn)->tokutxn;
if (!toku_txn_is_read_only(tokutxn)) { if (!toku_txn_is_read_only(tokutxn)) {
// A readonly transaction does no logging, and therefore does not need the MO lock. // A readonly transaction does no logging, and therefore does not need the MO lock.
holds_mo_lock = true; holds_mo_lock = true;
if (toku_txn_has_spilled_rollback(tokutxn)) { if (toku_txn_has_spilled_rollback(tokutxn)) {
big_txn = true; low_priority = true;
toku_big_multi_operation_client_lock(); toku_low_priority_multi_operation_client_lock();
} else { } else {
toku_multi_operation_client_lock(); toku_multi_operation_client_lock();
} }
} }
int r = toku_txn_abort(txn, poll, poll_extra); int r = toku_txn_abort(txn, poll, poll_extra);
if (holds_mo_lock) { if (holds_mo_lock) {
if (big_txn) { if (low_priority) {
toku_big_multi_operation_client_unlock(); toku_low_priority_multi_operation_client_unlock();
} else { } else {
toku_multi_operation_client_unlock(); toku_multi_operation_client_unlock();
} }
......
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