summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/schema/schema_drop.c
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2022-05-16 00:12:50 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-05-16 00:39:51 +0000
commit3e37098fa76e4882b502bdae02f5341b6d373b68 (patch)
tree53bb2b29547bfbc6a60a6dae2dcb0d010d5fe9c1 /src/third_party/wiredtiger/src/schema/schema_drop.c
parent4f68039a27c42a993454f701263b9a5d05720b0a (diff)
downloadmongo-3e37098fa76e4882b502bdae02f5341b6d373b68.tar.gz
Import wiredtiger: 91d67b193cb2981edfa5fc9e3bba1442d340c022 from branch mongodb-master
ref: 023918d163..91d67b193c for: 6.1.0-rc0 WT-9030 Add a new undocumented configuration string remove_shared to WT_SESSION::drop
Diffstat (limited to 'src/third_party/wiredtiger/src/schema/schema_drop.c')
-rw-r--r--src/third_party/wiredtiger/src/schema/schema_drop.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/third_party/wiredtiger/src/schema/schema_drop.c b/src/third_party/wiredtiger/src/schema/schema_drop.c
index 1133bcc9cb2..1ce21a7916f 100644
--- a/src/third_party/wiredtiger/src/schema/schema_drop.c
+++ b/src/third_party/wiredtiger/src/schema/schema_drop.c
@@ -182,10 +182,17 @@ __drop_tiered(WT_SESSION_IMPL *session, const char *uri, bool force, const char
WT_TIERED *tiered;
u_int i;
const char *filename, *name;
- bool exist, remove_files;
+ bool exist, remove_files, remove_shared;
WT_RET(__wt_config_gets(session, cfg, "remove_files", &cval));
remove_files = cval.val != 0;
+ WT_RET(__wt_config_gets(session, cfg, "remove_shared", &cval));
+ remove_shared = cval.val != 0;
+
+ if (!remove_files && remove_shared)
+ WT_RET_MSG(session, EINVAL,
+ "drop for tiered storage object must configure removal of underlying files "
+ "if forced removal of shared objects is enabled");
name = NULL;
/* Get the tiered data handle. */
@@ -241,6 +248,13 @@ __drop_tiered(WT_SESSION_IMPL *session, const char *uri, bool force, const char
WT_ERR(__wt_fs_exist(session, filename, &exist));
if (exist)
WT_ERR(__wt_meta_track_drop(session, filename));
+
+ /*
+ * If a drop operation on tiered storage is configured to force removal of shared
+ * objects, we want to remove these files after the drop operation is successful.
+ */
+ if (remove_shared)
+ WT_ERR(__wt_meta_track_drop_object(session, tiered->bstorage, filename));
}
__wt_free(session, name);
}
@@ -256,6 +270,7 @@ __drop_tiered(WT_SESSION_IMPL *session, const char *uri, bool force, const char
__wt_verbose(session, WT_VERB_TIERED, "DROP_TIERED: remove tiered table %s from metadata", uri);
ret = __wt_metadata_remove(session, uri);
+
err:
__wt_free(session, name);
return (ret);