summaryrefslogtreecommitdiff
path: root/src/cursor/cur_table.c
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-11-14 21:12:21 +1100
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-11-14 21:12:21 +1100
commit5c90c15af595e3c207534ca2b42f098704259be9 (patch)
treee63112d6fdc1bccae21fb732d239e720519d7c14 /src/cursor/cur_table.c
parente5b624b976429cd1dd3dc6a4ac90fc9c5e58aed3 (diff)
downloadmongo-5c90c15af595e3c207534ca2b42f098704259be9.tar.gz
Fix use of the table lock, which prevents tables from being opened when partially created.
Diffstat (limited to 'src/cursor/cur_table.c')
-rw-r--r--src/cursor/cur_table.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cursor/cur_table.c b/src/cursor/cur_table.c
index 0146e0999a4..fd0cad0beeb 100644
--- a/src/cursor/cur_table.c
+++ b/src/cursor/cur_table.c
@@ -724,11 +724,16 @@ __curtable_open_colgroups(WT_CURSOR_TABLE *ctable, const char *cfg_arg[])
cfg_arg[0], cfg_arg[1], "dump=\"\"", NULL, NULL
};
u_int i;
+ int complete;
session = (WT_SESSION_IMPL *)ctable->iface.session;
table = ctable->table;
- if (!table->cg_complete)
+ /* If the table is incomplete, wait on the table lock and recheck. */
+ complete = table->cg_complete;
+ if (!complete)
+ WT_WITH_TABLE_LOCK(session, complete = table->cg_complete);
+ if (!complete)
WT_RET_MSG(session, EINVAL,
"Can't use '%s' until all column groups are created",
table->name);