summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/schema/schema_drop.c
diff options
context:
space:
mode:
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);