summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2013-06-07 13:59:11 -0400
committerKeith Bostic <keith@wiredtiger.com>2013-06-07 13:59:11 -0400
commite32b05180b5c5454b463e42b8890c6b1f523dcca (patch)
tree452a75c575e08033c197c7c6cf04079c580393fe
parent5bdf248ffeac44c1743c851e1494bb0e30de20f3 (diff)
downloadmongo-e32b05180b5c5454b463e42b8890c6b1f523dcca.tar.gz
Rename WT_CONNECTION.metadata_lock to WT_CONNECTION.checkpoint_lock.
Close #560.
-rw-r--r--src/btree/bt_compact.c4
-rw-r--r--src/conn/conn_dhandle.c4
-rw-r--r--src/conn/conn_handle.c4
-rw-r--r--src/include/connection.h2
-rw-r--r--src/lsm/lsm_meta.c4
-rw-r--r--src/txn/txn_ckpt.c19
6 files changed, 16 insertions, 21 deletions
diff --git a/src/btree/bt_compact.c b/src/btree/bt_compact.c
index 05de936407d..2465b97cb63 100644
--- a/src/btree/bt_compact.c
+++ b/src/btree/bt_compact.c
@@ -41,9 +41,9 @@ __wt_compact(WT_SESSION_IMPL *session, const char *cfg[])
* collide with checkpoints either, they are the other operation that
* can reconcile a page.
*/
- __wt_spin_lock(session, &S2C(session)->metadata_lock);
+ __wt_spin_lock(session, &S2C(session)->checkpoint_lock);
WT_RET(__wt_bt_cache_op(session, NULL, WT_SYNC_COMPACT));
- __wt_spin_unlock(session, &S2C(session)->metadata_lock);
+ __wt_spin_unlock(session, &S2C(session)->checkpoint_lock);
/*
* Walk the tree, reviewing on-disk pages to see if they need to be
diff --git a/src/conn/conn_dhandle.c b/src/conn/conn_dhandle.c
index 420a4534acf..a02f3690bc3 100644
--- a/src/conn/conn_dhandle.c
+++ b/src/conn/conn_dhandle.c
@@ -193,7 +193,7 @@ __wt_conn_btree_sync_and_close(WT_SESSION_IMPL *session)
ckpt_lock = 0;
if (F_ISSET(btree, WT_BTREE_BULK)) {
ckpt_lock = 1;
- __wt_spin_lock(session, &S2C(session)->metadata_lock);
+ __wt_spin_lock(session, &S2C(session)->checkpoint_lock);
}
if (!F_ISSET(btree,
@@ -205,7 +205,7 @@ __wt_conn_btree_sync_and_close(WT_SESSION_IMPL *session)
F_CLR(btree, WT_BTREE_SPECIAL_FLAGS);
if (ckpt_lock)
- __wt_spin_unlock(session, &S2C(session)->metadata_lock);
+ __wt_spin_unlock(session, &S2C(session)->checkpoint_lock);
return (ret);
}
diff --git a/src/conn/conn_handle.c b/src/conn/conn_handle.c
index 1ca8b4b14b5..f699fb4d4fc 100644
--- a/src/conn/conn_handle.c
+++ b/src/conn/conn_handle.c
@@ -35,9 +35,9 @@ __wt_connection_init(WT_CONNECTION_IMPL *conn)
/* Locks. */
__wt_spin_init(session, &conn->api_lock);
+ __wt_spin_init(session, &conn->checkpoint_lock);
__wt_spin_init(session, &conn->fh_lock);
__wt_spin_init(session, &conn->hot_backup_lock);
- __wt_spin_init(session, &conn->metadata_lock);
__wt_spin_init(session, &conn->schema_lock);
__wt_spin_init(session, &conn->serial_lock);
@@ -92,9 +92,9 @@ __wt_connection_destroy(WT_CONNECTION_IMPL *conn)
__wt_spin_destroy(session, &conn->api_lock);
__wt_spin_destroy(session, &conn->block_lock);
+ __wt_spin_destroy(session, &conn->checkpoint_lock);
__wt_spin_destroy(session, &conn->fh_lock);
__wt_spin_destroy(session, &conn->hot_backup_lock);
- __wt_spin_destroy(session, &conn->metadata_lock);
__wt_spin_destroy(session, &conn->schema_lock);
__wt_spin_destroy(session, &conn->serial_lock);
diff --git a/src/include/connection.h b/src/include/connection.h
index 7a27b59d47d..31dfe2c6a91 100644
--- a/src/include/connection.h
+++ b/src/include/connection.h
@@ -71,8 +71,8 @@ struct __wt_connection_impl {
WT_SESSION_IMPL dummy_session;
WT_SPINLOCK api_lock; /* Connection API spinlock */
+ WT_SPINLOCK checkpoint_lock; /* Checkpoint spinlock */
WT_SPINLOCK fh_lock; /* File handle queue spinlock */
- WT_SPINLOCK metadata_lock; /* Metadata spinlock */
WT_SPINLOCK schema_lock; /* Schema operation spinlock */
WT_SPINLOCK serial_lock; /* Serial function call spinlock */
diff --git a/src/lsm/lsm_meta.c b/src/lsm/lsm_meta.c
index da1cca572a4..e7a0c226198 100644
--- a/src/lsm/lsm_meta.c
+++ b/src/lsm/lsm_meta.c
@@ -222,9 +222,9 @@ __wt_lsm_meta_write(WT_SESSION_IMPL *session, WT_LSM_TREE *lsm_tree)
session, buf, ",bloom=\"%s\"", chunk->bloom_uri));
}
WT_ERR(__wt_buf_catfmt(session, buf, "]"));
- __wt_spin_lock(session, &S2C(session)->metadata_lock);
+ __wt_spin_lock(session, &S2C(session)->checkpoint_lock);
ret = __wt_metadata_update(session, lsm_tree->name, buf->data);
- __wt_spin_unlock(session, &S2C(session)->metadata_lock);
+ __wt_spin_unlock(session, &S2C(session)->checkpoint_lock);
WT_ERR(ret);
err: __wt_scr_free(&buf);
diff --git a/src/txn/txn_ckpt.c b/src/txn/txn_ckpt.c
index d1c14362758..e71452d0a40 100644
--- a/src/txn/txn_ckpt.c
+++ b/src/txn/txn_ckpt.c
@@ -147,21 +147,16 @@ __wt_txn_checkpoint(WT_SESSION_IMPL *session, const char *cfg[])
int tracking;
conn = S2C(session);
- tracking = 0;
txn = &session->txn;
+ tracking = 0;
/*
- * Only one checkpoint can be active at a time, and checkpoints must
- * run in the same order as they update the metadata; we are using the
- * schema lock to determine that ordering, so we can't move this to
- * __session_checkpoint.
- *
- * Begin a transaction for the checkpoint.
+ * Only one checkpoint can be active at a time, and checkpoints must run
+ * in the same order as they update the metadata, also, there are other
+ * operations (for example, Btree compaction) that must serialize with
+ * checkpoints.
*/
- WT_ASSERT(session,
- F_ISSET(session, WT_SESSION_SCHEMA_LOCKED) &&
- !F_ISSET(txn, TXN_RUNNING));
- __wt_spin_lock(session, &conn->metadata_lock);
+ __wt_spin_lock(session, &conn->checkpoint_lock);
/* Flush dirty leaf pages before we start the checkpoint. */
txn->isolation = TXN_ISO_READ_COMMITTED;
@@ -230,7 +225,7 @@ err: /*
if (F_ISSET(txn, TXN_RUNNING))
__wt_txn_release(session);
- __wt_spin_unlock(session, &conn->metadata_lock);
+ __wt_spin_unlock(session, &conn->checkpoint_lock);
__wt_scr_free(&tmp);
return (ret);