diff options
author | Alex Gorrod <alexander.gorrod@mongodb.com> | 2015-05-11 13:44:19 +1000 |
---|---|---|
committer | Alex Gorrod <alexg@wiredtiger.com> | 2015-07-03 06:21:11 +0000 |
commit | a3b359d22ae96f5dc68d8ce8029a5959a29f46fd (patch) | |
tree | 928fee607e986ada231f5c5ab78e329efa18108c /src/schema | |
parent | 10eb756c7bb8cc1a6847a2f2fec5fcb2ee883d91 (diff) | |
download | mongo-a3b359d22ae96f5dc68d8ce8029a5959a29f46fd.tar.gz |
WT-1924 Ensure the metadata is flushed when closing an LSM bulk cursor.
(cherry picked from commit dde4092ebb9bcaede1d550ed32dabe3062272bea)
Diffstat (limited to 'src/schema')
-rw-r--r-- | src/schema/schema_drop.c | 14 | ||||
-rw-r--r-- | src/schema/schema_rename.c | 9 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/schema/schema_drop.c b/src/schema/schema_drop.c index 2be8088f83b..694d07c65bf 100644 --- a/src/schema/schema_drop.c +++ b/src/schema/schema_drop.c @@ -120,8 +120,13 @@ __drop_table( for (i = 0; i < WT_COLGROUPS(table); i++) { if ((colgroup = table->cgroups[i]) == NULL) continue; - WT_ERR(__wt_metadata_remove(session, colgroup->name)); + /* + * Drop the column group before updating the metadata to avoid + * the metadata for the table becoming inconsistent if we can't + * get exclusive access. + */ WT_ERR(__wt_schema_drop(session, colgroup->source, cfg)); + WT_ERR(__wt_metadata_remove(session, colgroup->name)); } /* Drop the indices. */ @@ -129,8 +134,13 @@ __drop_table( for (i = 0; i < table->nindices; i++) { if ((idx = table->indices[i]) == NULL) continue; - WT_ERR(__wt_metadata_remove(session, idx->name)); + /* + * Drop the column group before updating the metadata to avoid + * the metadata for the table becoming inconsistent if we can't + * get exclusive access. + */ WT_ERR(__wt_schema_drop(session, idx->source, cfg)); + WT_ERR(__wt_metadata_remove(session, idx->name)); } WT_ERR(__wt_schema_remove_table(session, table)); diff --git a/src/schema/schema_rename.c b/src/schema/schema_rename.c index 51281eccec5..c00ffa7d61c 100644 --- a/src/schema/schema_rename.c +++ b/src/schema/schema_rename.c @@ -155,15 +155,18 @@ __rename_tree(WT_SESSION_IMPL *session, cval.str + cval.len)); /* + * Do the rename before updating the metadata to avoid leaving the + * metadata inconsistent if the rename fails. + */ + WT_ERR(__wt_schema_rename(session, os->data, ns->data, cfg)); + + /* * Remove the old metadata entry. * Insert the new metadata entry. */ WT_ERR(__wt_metadata_remove(session, name)); WT_ERR(__wt_metadata_insert(session, nn->data, nv->data)); - /* Rename the file. */ - WT_ERR(__wt_schema_rename(session, os->data, ns->data, cfg)); - err: __wt_scr_free(session, &nn); __wt_scr_free(session, &ns); __wt_scr_free(session, &nv); |