diff options
author | Chenhao Qu <chenhao.qu@mongodb.com> | 2021-03-24 05:41:20 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-03-24 06:03:01 +0000 |
commit | fa94a548b9821b9506f07a2e41ead1956645d2c9 (patch) | |
tree | 91aea1c68e77a6286dd33c098671e94345a19e47 /src/third_party/wiredtiger/src/schema/schema_truncate.c | |
parent | cdd9af120133b2069b7446c6050cda5ed3e6835d (diff) | |
download | mongo-fa94a548b9821b9506f07a2e41ead1956645d2c9.tar.gz |
Import wiredtiger: 7b0dfc145e80a380377f4ce9f2ae1d1d264c123e from branch mongodb-5.0
ref: 17664e9933..7b0dfc145e
for: 5.0.0
WT-7354 Refactor tiered schema code to follow conventions
Diffstat (limited to 'src/third_party/wiredtiger/src/schema/schema_truncate.c')
-rw-r--r-- | src/third_party/wiredtiger/src/schema/schema_truncate.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/third_party/wiredtiger/src/schema/schema_truncate.c b/src/third_party/wiredtiger/src/schema/schema_truncate.c index 8311a812154..35e13389373 100644 --- a/src/third_party/wiredtiger/src/schema/schema_truncate.c +++ b/src/third_party/wiredtiger/src/schema/schema_truncate.c @@ -37,6 +37,31 @@ err: } /* + * __truncate_tiered -- + * Truncate for a tiered data source. + */ +static int +__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); + + /* Truncate the column groups. */ + for (i = 0; i < tiered->ntiers; i++) + WT_ERR(__wt_schema_truncate(session, tiered->tiers[i]->name, cfg)); + +err: + WT_TRET(__wt_session_release_dhandle(session)); + return (ret); +} + +/* * __truncate_dsrc -- * WT_SESSION::truncate for a data-source without a truncate operation. */ @@ -84,7 +109,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 = __wt_tiered_truncate(session, uri, cfg); + ret = __truncate_tiered(session, uri, cfg); else if ((dsrc = __wt_schema_get_source(session, uri)) != NULL) ret = dsrc->truncate == NULL ? __truncate_dsrc(session, uri) : |