diff options
author | Luke Chen <luke.chen@mongodb.com> | 2021-05-07 12:24:29 +1000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-05-07 02:50:19 +0000 |
commit | 58817e04308cbea4aa7627005cb5aaadd32c89fe (patch) | |
tree | fdb9352b858fe8f93baa22fccf7541ed7cf50142 /src/third_party/wiredtiger/src/include | |
parent | bf895e6c5d415e1687bfd879e073b231cd2200e8 (diff) | |
download | mongo-58817e04308cbea4aa7627005cb5aaadd32c89fe.tar.gz |
Import wiredtiger: 3a5a0b5e0c09af6906c0d539a1547bb73e2cc142 from branch mongodb-5.0
ref: 073ad6d27f..3a5a0b5e0c
for: 5.0.0
WT-7346 Connect new API changes to local storage extension
Diffstat (limited to 'src/third_party/wiredtiger/src/include')
-rw-r--r-- | src/third_party/wiredtiger/src/include/block.h | 1 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/connection.h | 12 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/extern.h | 10 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/os_fs_inline.h | 24 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/session.h | 8 |
5 files changed, 44 insertions, 11 deletions
diff --git a/src/third_party/wiredtiger/src/include/block.h b/src/third_party/wiredtiger/src/include/block.h index 3b0370f63dd..b8a982e1713 100644 --- a/src/third_party/wiredtiger/src/include/block.h +++ b/src/third_party/wiredtiger/src/include/block.h @@ -185,6 +185,7 @@ struct __wt_bm { int (*compact_skip)(WT_BM *, WT_SESSION_IMPL *, bool *); int (*compact_start)(WT_BM *, WT_SESSION_IMPL *); int (*corrupt)(WT_BM *, WT_SESSION_IMPL *, const uint8_t *, size_t); + int (*flush_tier)(WT_BM *, WT_SESSION_IMPL *, uint8_t **, size_t *); int (*free)(WT_BM *, WT_SESSION_IMPL *, const uint8_t *, size_t); bool (*is_mapped)(WT_BM *, WT_SESSION_IMPL *); int (*map_discard)(WT_BM *, WT_SESSION_IMPL *, void *, size_t); diff --git a/src/third_party/wiredtiger/src/include/connection.h b/src/third_party/wiredtiger/src/include/connection.h index 5a7ab8407db..a9e2474d1e7 100644 --- a/src/third_party/wiredtiger/src/include/connection.h +++ b/src/third_party/wiredtiger/src/include/connection.h @@ -54,6 +54,15 @@ struct __wt_bucket_storage { uint32_t flags; }; +/* Call a function with the bucket storage and its associated file system. */ +#define WT_WITH_BUCKET_STORAGE(bsto, s, e) \ + do { \ + WT_BUCKET_STORAGE *__saved_bstorage = (s)->bucket_storage; \ + (s)->bucket_storage = ((bsto) == NULL ? S2C(s)->bstorage : (bsto)); \ + e; \ + (s)->bucket_storage = __saved_bstorage; \ + } while (0) + /* * WT_KEYED_ENCRYPTOR -- * A list entry for an encryptor with a unique (name, keyid). @@ -379,7 +388,8 @@ struct __wt_connection_impl { WT_LSM_MANAGER lsm_manager; /* LSM worker thread information */ - WT_BUCKET_STORAGE *bstorage; /* Bucket storage for the connection */ + WT_BUCKET_STORAGE *bstorage; /* Bucket storage for the connection */ + WT_BUCKET_STORAGE bstorage_none; /* Bucket storage for "none" */ WT_KEYED_ENCRYPTOR *kencryptor; /* Encryptor for metadata and log */ diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h index e3c45a16f05..fb5c8e361ba 100644 --- a/src/third_party/wiredtiger/src/include/extern.h +++ b/src/third_party/wiredtiger/src/include/extern.h @@ -175,8 +175,6 @@ extern int __wt_block_map(WT_SESSION_IMPL *session, WT_BLOCK *block, void *mappe extern int __wt_block_misplaced(WT_SESSION_IMPL *session, WT_BLOCK *block, const char *list, wt_off_t offset, uint32_t size, bool live, const char *func, int line) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_block_newfile(WT_SESSION_IMPL *session, WT_BLOCK *block) - WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_block_off_free(WT_SESSION_IMPL *session, WT_BLOCK *block, uint32_t logid, wt_off_t offset, wt_off_t size) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_block_off_remove_overlap(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_EXTLIST *el, @@ -199,6 +197,12 @@ extern int __wt_block_salvage_valid(WT_SESSION_IMPL *session, WT_BLOCK *block, u size_t addr_size, bool valid) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_block_size_alloc(WT_SESSION_IMPL *session, WT_SIZE **szp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_block_tiered_flush(WT_SESSION_IMPL *session, WT_BLOCK *block, + uint8_t **flush_cookie, size_t *cookie_size) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_block_tiered_load(WT_SESSION_IMPL *session, WT_BLOCK *block, WT_BLOCK_CKPT *ci) + WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_block_tiered_newfile(WT_SESSION_IMPL *session, WT_BLOCK *block) + WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_block_truncate(WT_SESSION_IMPL *session, WT_BLOCK *block, wt_off_t len) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_block_unmap(WT_SESSION_IMPL *session, WT_BLOCK *block, void *mapped_region, @@ -1833,6 +1837,8 @@ static inline WT_CELL *__wt_cell_leaf_value_parse(WT_PAGE *page, WT_CELL *cell) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); static inline WT_CURSOR_BTREE *__wt_curhs_get_cbt(WT_CURSOR *cursor) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +static inline WT_FILE_SYSTEM *__wt_fs_file_system(WT_SESSION_IMPL *session) + WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); static inline WT_IKEY *__wt_ref_key_instantiated(WT_REF *ref) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); static inline WT_VISIBLE_TYPE __wt_txn_upd_visible_type(WT_SESSION_IMPL *session, WT_UPDATE *upd) diff --git a/src/third_party/wiredtiger/src/include/os_fs_inline.h b/src/third_party/wiredtiger/src/include/os_fs_inline.h index 56d0bc2a5f3..2276f096312 100644 --- a/src/third_party/wiredtiger/src/include/os_fs_inline.h +++ b/src/third_party/wiredtiger/src/include/os_fs_inline.h @@ -7,6 +7,16 @@ */ /* + * __wt_fs_file_system -- + * Get the active file system handle. + */ +static inline WT_FILE_SYSTEM * +__wt_fs_file_system(WT_SESSION_IMPL *session) +{ + return (S2FS(session)); +} + +/* * __wt_fs_directory_list -- * Return a list of files from a directory. */ @@ -27,7 +37,7 @@ __wt_fs_directory_list( WT_RET(__wt_filename(session, dir, &path)); - file_system = S2C(session)->file_system; + file_system = __wt_fs_file_system(session); wt_session = (WT_SESSION *)session; ret = file_system->fs_directory_list(file_system, wt_session, path, prefix, dirlistp, countp); @@ -56,7 +66,7 @@ __wt_fs_directory_list_single( WT_RET(__wt_filename(session, dir, &path)); - file_system = S2C(session)->file_system; + file_system = __wt_fs_file_system(session); wt_session = (WT_SESSION *)session; ret = file_system->fs_directory_list_single( file_system, wt_session, path, prefix, dirlistp, countp); @@ -77,7 +87,7 @@ __wt_fs_directory_list_free(WT_SESSION_IMPL *session, char ***dirlistp, u_int co WT_SESSION *wt_session; if (*dirlistp != NULL) { - file_system = S2C(session)->file_system; + file_system = __wt_fs_file_system(session); wt_session = (WT_SESSION *)session; ret = file_system->fs_directory_list_free(file_system, wt_session, *dirlistp, count); } @@ -102,7 +112,7 @@ __wt_fs_exist(WT_SESSION_IMPL *session, const char *name, bool *existp) WT_RET(__wt_filename(session, name, &path)); - file_system = S2C(session)->file_system; + file_system = __wt_fs_file_system(session); wt_session = (WT_SESSION *)session; ret = file_system->fs_exist(file_system, wt_session, path, existp); @@ -137,7 +147,7 @@ __wt_fs_remove(WT_SESSION_IMPL *session, const char *name, bool durable) WT_RET(__wt_filename(session, name, &path)); - file_system = S2C(session)->file_system; + file_system = __wt_fs_file_system(session); wt_session = (WT_SESSION *)session; ret = file_system->fs_remove(file_system, wt_session, path, durable ? WT_FS_DURABLE : 0); @@ -176,7 +186,7 @@ __wt_fs_rename(WT_SESSION_IMPL *session, const char *from, const char *to, bool WT_ERR(__wt_filename(session, from, &from_path)); WT_ERR(__wt_filename(session, to, &to_path)); - file_system = S2C(session)->file_system; + file_system = __wt_fs_file_system(session); wt_session = (WT_SESSION *)session; ret = file_system->fs_rename( file_system, wt_session, from_path, to_path, durable ? WT_FS_DURABLE : 0); @@ -203,7 +213,7 @@ __wt_fs_size(WT_SESSION_IMPL *session, const char *name, wt_off_t *sizep) WT_RET(__wt_filename(session, name, &path)); - file_system = S2C(session)->file_system; + file_system = __wt_fs_file_system(session); wt_session = (WT_SESSION *)session; ret = file_system->fs_size(file_system, wt_session, path, sizep); diff --git a/src/third_party/wiredtiger/src/include/session.h b/src/third_party/wiredtiger/src/include/session.h index cbedb56856e..f7ec0464a29 100644 --- a/src/third_party/wiredtiger/src/include/session.h +++ b/src/third_party/wiredtiger/src/include/session.h @@ -37,6 +37,11 @@ struct __wt_hazard { #define S2BT(session) ((WT_BTREE *)(session)->dhandle->handle) #define S2BT_SAFE(session) ((session)->dhandle == NULL ? NULL : S2BT(session)) +/* Get the file system for a session */ +#define S2FS(session) \ + ((session)->bucket_storage == NULL ? S2C(session)->file_system : \ + (session)->bucket_storage->file_system) + typedef TAILQ_HEAD(__wt_cursor_list, __wt_cursor) WT_CURSOR_LIST; /* Number of cursors cached to trigger cursor sweep. */ @@ -68,7 +73,8 @@ struct __wt_session_impl { uint64_t operation_timeout_us; /* Maximum operation period before rollback */ u_int api_call_counter; /* Depth of api calls */ - WT_DATA_HANDLE *dhandle; /* Current data handle */ + WT_DATA_HANDLE *dhandle; /* Current data handle */ + WT_BUCKET_STORAGE *bucket_storage; /* Current bucket storage and file system */ /* * Each session keeps a cache of data handles. The set of handles can grow quite large so we |