summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/schema/schema_truncate.c
diff options
context:
space:
mode:
authorHari Babu Kommi <haribabu.kommi@mongodb.com>2023-05-08 13:41:53 +1000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-08 04:19:27 +0000
commit207c65e39a06e0b00b73e56ae6c41cb17d89d8a4 (patch)
tree596d9679246a1551bfe5ff582587c0b478154682 /src/third_party/wiredtiger/src/schema/schema_truncate.c
parentee488fdbf89bf73a5b9dcf99d155d2c12c1dcaef (diff)
downloadmongo-207c65e39a06e0b00b73e56ae6c41cb17d89d8a4.tar.gz
Import wiredtiger: 8587a3713ed1f9b6372a135d433ac8c3957d4f42 from branch mongodb-master
ref: 0dc273cfce..8587a3713e for: 7.1.0-rc0 Revert "WT-10971 Fix truncate for tiered storage."
Diffstat (limited to 'src/third_party/wiredtiger/src/schema/schema_truncate.c')
-rw-r--r--src/third_party/wiredtiger/src/schema/schema_truncate.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/third_party/wiredtiger/src/schema/schema_truncate.c b/src/third_party/wiredtiger/src/schema/schema_truncate.c
index be9a62a56ba..3b1cfcfd1e2 100644
--- a/src/third_party/wiredtiger/src/schema/schema_truncate.c
+++ b/src/third_party/wiredtiger/src/schema/schema_truncate.c
@@ -41,16 +41,23 @@ err:
* Truncate for a tiered data source.
*/
static int
-__truncate_tiered(WT_SESSION_IMPL *session, const char *uri)
+__truncate_tiered(WT_SESSION_IMPL *session, const char *uri, const char *cfg[])
{
WT_DECL_RET;
+ WT_TIERED *tiered;
+ u_int i;
WT_RET(__wt_session_get_dhandle(session, uri, NULL, NULL, WT_DHANDLE_EXCLUSIVE));
+ tiered = (WT_TIERED *)session->dhandle;
WT_STAT_DATA_INCR(session, cursor_truncate);
- WT_WITHOUT_DHANDLE(session, ret = __wt_session_range_truncate(session, uri, NULL, NULL));
- WT_ERR(ret);
+ /* Truncate the tiered entries. */
+ for (i = 0; i < WT_TIERED_MAX_TIERS; i++) {
+ if (tiered->tiers[i].tier == NULL)
+ continue;
+ WT_ERR(__wt_schema_truncate(session, tiered->tiers[i].name, cfg));
+ }
err:
WT_TRET(__wt_session_release_dhandle(session));
@@ -105,7 +112,7 @@ __wt_schema_truncate(WT_SESSION_IMPL *session, const char *uri, const char *cfg[
else if (WT_PREFIX_SKIP(tablename, "table:"))
ret = __truncate_table(session, tablename, cfg);
else if (WT_PREFIX_MATCH(uri, "tiered:"))
- ret = __truncate_tiered(session, uri);
+ ret = __truncate_tiered(session, uri, cfg);
else if ((dsrc = __wt_schema_get_source(session, uri)) != NULL)
ret = dsrc->truncate == NULL ?
__truncate_dsrc(session, uri) :