diff options
author | Chenhao Qu <chenhao.qu@mongodb.com> | 2022-04-13 01:46:08 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-04-13 02:12:41 +0000 |
commit | 975b6cf999f3901fabd9f31ed7c2b0297fe852ec (patch) | |
tree | 21ba99d04d766053dc05d5ae64249026b3bb5908 | |
parent | 36ca5a0bda2fbb65d2f64e6f001ca544e7630a5a (diff) | |
download | mongo-975b6cf999f3901fabd9f31ed7c2b0297fe852ec.tar.gz |
Import wiredtiger: d071d4624a0bb5005d9968553dd493c15a3400da from branch mongodb-master
ref: c810eab0f4..d071d4624a
for: 6.0.0-rc0
WT-9003 Fix bug dropping tiered objects
-rw-r--r-- | src/third_party/wiredtiger/import.data | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/schema/schema_drop.c | 22 | ||||
-rw-r--r-- | src/third_party/wiredtiger/test/suite/test_tiered07.py | 7 |
3 files changed, 19 insertions, 12 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index e89c175c00f..6b2d2e15fb5 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -2,5 +2,5 @@ "vendor": "wiredtiger", "github": "wiredtiger/wiredtiger.git", "branch": "mongodb-master", - "commit": "c810eab0f47ab0d6e242ff921c179d836b8fd5dc" + "commit": "d071d4624a0bb5005d9968553dd493c15a3400da" } diff --git a/src/third_party/wiredtiger/src/schema/schema_drop.c b/src/third_party/wiredtiger/src/schema/schema_drop.c index 294b458dbcf..109c71211b6 100644 --- a/src/third_party/wiredtiger/src/schema/schema_drop.c +++ b/src/third_party/wiredtiger/src/schema/schema_drop.c @@ -181,8 +181,8 @@ __drop_tiered(WT_SESSION_IMPL *session, const char *uri, bool force, const char WT_DECL_RET; WT_TIERED *tiered; u_int i; - const char *name; - bool remove_files; + const char *filename, *name; + bool exist, remove_files; WT_RET(__wt_config_gets(session, cfg, "remove_files", &cval)); remove_files = cval.val != 0; @@ -205,8 +205,11 @@ __drop_tiered(WT_SESSION_IMPL *session, const char *uri, bool force, const char session, ret = __wt_conn_dhandle_close_all(session, tier->name, true, force))); WT_ERR(ret); WT_ERR(__wt_metadata_remove(session, tier->name)); - if (remove_files) - WT_TRET(__wt_meta_track_drop(session, tier->name)); + if (remove_files) { + filename = tier->name; + WT_PREFIX_SKIP_REQUIRED(session, filename, "file:"); + WT_ERR(__wt_meta_track_drop(session, filename)); + } } /* Close any dhandle and remove any tier: entry from metadata. */ @@ -234,8 +237,13 @@ __drop_tiered(WT_SESSION_IMPL *session, const char *uri, bool force, const char WT_ERR(__wt_tiered_name(session, &tiered->iface, i, WT_TIERED_NAME_OBJECT, &name)); __wt_verbose(session, WT_VERB_TIERED, "DROP_TIERED: remove object %s from metadata", name); WT_ERR_NOTFOUND_OK(__wt_metadata_remove(session, name), false); - if (remove_files && tier != NULL) - WT_TRET(__wt_meta_track_drop(session, tier->name)); + if (remove_files && tier != NULL) { + filename = name; + WT_PREFIX_SKIP_REQUIRED(session, filename, "object:"); + WT_ERR(__wt_fs_exist(session, filename, &exist)); + if (exist) + WT_ERR(__wt_meta_track_drop(session, filename)); + } __wt_free(session, name); } @@ -243,7 +251,7 @@ __drop_tiered(WT_SESSION_IMPL *session, const char *uri, bool force, const char * Close all btree handles associated with this table. This must be done after we're done using * the tiered structure because that is from the dhandle. */ - WT_TRET(__wt_session_release_dhandle(session)); + WT_ERR(__wt_session_release_dhandle(session)); WT_WITH_HANDLE_LIST_WRITE_LOCK( session, ret = __wt_conn_dhandle_close_all(session, uri, true, force)); WT_ERR(ret); diff --git a/src/third_party/wiredtiger/test/suite/test_tiered07.py b/src/third_party/wiredtiger/test/suite/test_tiered07.py index 4be4b13b507..96170327072 100644 --- a/src/third_party/wiredtiger/test/suite/test_tiered07.py +++ b/src/third_party/wiredtiger/test/suite/test_tiered07.py @@ -133,10 +133,9 @@ class test_tiered07(wttest.WiredTigerTestCase): # By default, the remove_files configuration for drop is true. This means that the # drop operation for tiered tables should both remove the files from the metadata - # file and remove the corresponding local object files in the directory. Currently the - # below code is commented as the files are not removed from the directory. FIXME: WT-9003 - # self.assertFalse(os.path.isfile("abc-0000000001.wtobj")) - # self.assertFalse(os.path.isfile("abc-0000000002.wtobj")) + # file and remove the corresponding local object files in the directory. + self.assertFalse(os.path.isfile("abc-0000000001.wtobj")) + self.assertFalse(os.path.isfile("abc-0000000002.wtobj")) # Dropping a table using the force setting should succeed even if the table does not exist. self.session.drop(self.localuri, 'force=true') |