summaryrefslogtreecommitdiff
path: root/src/schema
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-11-13 21:09:20 +1100
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-11-13 21:09:20 +1100
commita23ac8a5fa9b5225b5cd0293399eb5b01dbd194d (patch)
tree62428d421462e8da03df41bc2a2e6e592cb16b64 /src/schema
parentb4df6ce9d74be9841d631657cd09cdedb562c007 (diff)
downloadmongo-a23ac8a5fa9b5225b5cd0293399eb5b01dbd194d.tar.gz
Split the schema lock into a lock that prevents concurrent schema-changing operations (create, drop, rename, etc.), and a separate lock that protects the shared handle list. The main goal in the short term is to ensure that checkpoints don't hold any locks that block cursor opens while doing I/O.
Diffstat (limited to 'src/schema')
-rw-r--r--src/schema/schema_list.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/schema/schema_list.c b/src/schema/schema_list.c
index fae3cacb617..d67a16a25a6 100644
--- a/src/schema/schema_list.c
+++ b/src/schema/schema_list.c
@@ -15,9 +15,17 @@ static int
__schema_add_table(WT_SESSION_IMPL *session,
const char *name, size_t namelen, WT_TABLE **tablep)
{
+ WT_DECL_RET;
WT_TABLE *table;
- WT_RET(__wt_schema_open_table(session, name, namelen, &table));
+ /*
+ * Make sure the metadata is open before we grab the handle
+ * list lock.
+ */
+ WT_RET(__wt_metadata_open(session));
+ WT_WITH_DHANDLE_LOCK(session,
+ ret = __wt_schema_open_table(session, name, namelen, &table));
+ WT_RET(ret);
/* Copy the schema generation into the new table. */
table->schema_gen = S2C(session)->schema_gen;
@@ -84,8 +92,7 @@ __wt_schema_get_table(WT_SESSION_IMPL *session,
ret = __schema_find_table(session, name, namelen, &table);
if (ret == WT_NOTFOUND)
- WT_WITH_SCHEMA_LOCK(session,
- ret = __schema_add_table(session, name, namelen, &table));
+ ret = __schema_add_table(session, name, namelen, &table);
if (ret == 0) {
if (!ok_incomplete && !table->cg_complete)