diff options
author | Etienne Petrel <etienne.petrel@mongodb.com> | 2022-04-22 01:16:12 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-04-22 01:46:54 +0000 |
commit | a5f68db52a7b45700e6885eb6ec6227c503c6f80 (patch) | |
tree | e682afce2b0d868ade3c2759530a4d374b9383ba /src/third_party/wiredtiger/src/include | |
parent | 834380e8f40188d8b4c33c11875fa76915b7eced (diff) | |
download | mongo-a5f68db52a7b45700e6885eb6ec6227c503c6f80.tar.gz |
Import wiredtiger: 3fa9aed7f25f1af8b1d71b72ab45c21817e8150c from branch mongodb-master
ref: 0cbb7bdf05..3fa9aed7f2
for: 6.1.0-rc0
WT-5927 Make checkpoint cursors work again
Diffstat (limited to 'src/third_party/wiredtiger/src/include')
-rw-r--r-- | src/third_party/wiredtiger/src/include/btree_inline.h | 2 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/cell_inline.h | 19 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/cursor.h | 19 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/cursor_inline.h | 8 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/dhandle.h | 15 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/extern.h | 27 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/meta.h | 18 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/session.h | 12 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/txn.h | 30 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/txn_inline.h | 7 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/wiredtiger.in | 4 | ||||
-rw-r--r-- | src/third_party/wiredtiger/src/include/wt_internal.h | 2 |
12 files changed, 125 insertions, 38 deletions
diff --git a/src/third_party/wiredtiger/src/include/btree_inline.h b/src/third_party/wiredtiger/src/include/btree_inline.h index a3f38030c50..7857277c948 100644 --- a/src/third_party/wiredtiger/src/include/btree_inline.h +++ b/src/third_party/wiredtiger/src/include/btree_inline.h @@ -707,7 +707,7 @@ __wt_tree_modify_set(WT_SESSION_IMPL *session) */ if (!S2BT(session)->modified) { /* Assert we never dirty a checkpoint handle. */ - WT_ASSERT(session, session->dhandle->checkpoint == NULL); + WT_ASSERT(session, !WT_READING_CHECKPOINT(session)); S2BT(session)->modified = true; WT_FULL_BARRIER(); diff --git a/src/third_party/wiredtiger/src/include/cell_inline.h b/src/third_party/wiredtiger/src/include/cell_inline.h index 65a2f7dc3a8..5c9f5aead51 100644 --- a/src/third_party/wiredtiger/src/include/cell_inline.h +++ b/src/third_party/wiredtiger/src/include/cell_inline.h @@ -1050,6 +1050,8 @@ static inline void __cell_unpack_window_cleanup(WT_SESSION_IMPL *session, const WT_PAGE_HEADER *dsk, WT_CELL_UNPACK_ADDR *unpack_addr, WT_CELL_UNPACK_KV *unpack_kv) { + uint64_t write_gen; + /* * If the page came from a previous run, reset the transaction ids to "none" and timestamps to 0 * as appropriate. Transaction ids shouldn't persist between runs so these are always set to @@ -1069,8 +1071,23 @@ __cell_unpack_window_cleanup(WT_SESSION_IMPL *session, const WT_PAGE_HEADER *dsk * No delete txnid=MAX, ts=MAX, txnid=MAX, ts=MAX, * durable_ts=NONE durable_ts=NONE */ + + if (WT_READING_CHECKPOINT(session) && session->checkpoint_write_gen != 0) { + /* + * When reading a checkpoint, override the tree's base write generation with the write + * generation from the global metadata, which might be newer. This comes into play if the + * tree checkpoint is from an older database run than the global checkpoint, which can + * happen if checkpointing skips the tree at the right points. Bypass this logic if the + * checkpoint write generation isn't set because the checkpoint is from an older version of + * WiredTiger; in that case we use the tree's write generation and hope for the best. + */ + write_gen = session->checkpoint_write_gen; + WT_ASSERT(session, write_gen >= S2BT(session)->base_write_gen); + } else + write_gen = S2BT(session)->base_write_gen; + WT_ASSERT(session, dsk->write_gen != 0); - if (dsk->write_gen > S2BT(session)->base_write_gen) + if (dsk->write_gen > write_gen) return; if (F_ISSET(session, WT_SESSION_DEBUG_DO_NOT_CLEAR_TXN_ID)) diff --git a/src/third_party/wiredtiger/src/include/cursor.h b/src/third_party/wiredtiger/src/include/cursor.h index 2a2638660d6..945f6683ff9 100644 --- a/src/third_party/wiredtiger/src/include/cursor.h +++ b/src/third_party/wiredtiger/src/include/cursor.h @@ -196,6 +196,17 @@ struct __wt_cursor_btree { WT_UPDATE_VALUE *upd_value, _upd_value; /* + * Bits used by checkpoint cursor: a private transaction, used to provide the proper read + * snapshot; a reference to the corresponding history store checkpoint, which keeps it from + * disappearing under us if it's unnamed and also tracks its identity for use in history store + * accesses; and a write generation, used to override the tree's base write generation in the + * unpacking cleanup code. + */ + WT_TXN *checkpoint_txn; + WT_DATA_HANDLE *checkpoint_hs_dhandle; + uint64_t checkpoint_write_gen; + + /* * Fixed-length column-store items are a single byte, and it's simpler and cheaper to allocate * the space for it now than keep checking to see if we need to grow the buffer. */ @@ -223,11 +234,9 @@ struct __wt_cursor_btree { #define WT_CBT_ITERATE_PREV 0x010u /* Prev iteration configuration */ #define WT_CBT_ITERATE_RETRY_NEXT 0x020u /* Prepare conflict by next. */ #define WT_CBT_ITERATE_RETRY_PREV 0x040u /* Prepare conflict by prev. */ -#define WT_CBT_NO_TRACKING 0x080u /* Non tracking cursor. */ -#define WT_CBT_NO_TXN 0x100u /* Non-txn cursor (e.g. a checkpoint) */ -#define WT_CBT_READ_ONCE 0x200u /* Page in with WT_READ_WONT_NEED */ -#define WT_CBT_SEARCH_SMALLEST 0x400u /* Row-store: small-key insert list */ -#define WT_CBT_VAR_ONPAGE_MATCH 0x800u /* Var-store: on-page recno match */ +#define WT_CBT_READ_ONCE 0x080u /* Page in with WT_READ_WONT_NEED */ +#define WT_CBT_SEARCH_SMALLEST 0x100u /* Row-store: small-key insert list */ +#define WT_CBT_VAR_ONPAGE_MATCH 0x200u /* Var-store: on-page recno match */ /* AUTOMATIC FLAG VALUE GENERATION STOP 32 */ #define WT_CBT_POSITION_MASK /* Flags associated with position */ \ diff --git a/src/third_party/wiredtiger/src/include/cursor_inline.h b/src/third_party/wiredtiger/src/include/cursor_inline.h index 65262eeea08..b16b2086e53 100644 --- a/src/third_party/wiredtiger/src/include/cursor_inline.h +++ b/src/third_party/wiredtiger/src/include/cursor_inline.h @@ -225,7 +225,7 @@ __cursor_reset(WT_CURSOR_BTREE *cbt) /* If the cursor was active, deactivate it. */ if (F_ISSET(cbt, WT_CBT_ACTIVE)) { - if (!F_ISSET(cbt, WT_CBT_NO_TRACKING)) + if (!WT_READING_CHECKPOINT(session)) __cursor_leave(session); F_CLR(cbt, WT_CBT_ACTIVE); } @@ -234,7 +234,7 @@ __cursor_reset(WT_CURSOR_BTREE *cbt) * When the count of active cursors in the session goes to zero, there are no active cursors, * and we can release any snapshot we're holding for read committed isolation. */ - if (session->ncursors == 0 && !F_ISSET(cbt, WT_CBT_NO_TXN)) + if (session->ncursors == 0 && !WT_READING_CHECKPOINT(session)) __wt_txn_read_last(session); /* If we're not holding a cursor reference, we're done. */ @@ -400,7 +400,7 @@ __wt_cursor_func_init(WT_CURSOR_BTREE *cbt, bool reenter) /* Activate the file cursor. */ if (!F_ISSET(cbt, WT_CBT_ACTIVE)) { - if (!F_ISSET(cbt, WT_CBT_NO_TRACKING)) + if (!WT_READING_CHECKPOINT(session)) WT_RET(__cursor_enter(session)); F_SET(cbt, WT_CBT_ACTIVE); } @@ -408,7 +408,7 @@ __wt_cursor_func_init(WT_CURSOR_BTREE *cbt, bool reenter) /* * If this is an ordinary transactional cursor, make sure we are set up to read. */ - if (!F_ISSET(cbt, WT_CBT_NO_TXN)) + if (!WT_READING_CHECKPOINT(session)) __wt_txn_cursor_op(session); return (0); } diff --git a/src/third_party/wiredtiger/src/include/dhandle.h b/src/third_party/wiredtiger/src/include/dhandle.h index 0c6026feeac..8bbae1539a0 100644 --- a/src/third_party/wiredtiger/src/include/dhandle.h +++ b/src/third_party/wiredtiger/src/include/dhandle.h @@ -55,6 +55,8 @@ WT_DHANDLE_ACQUIRE(dhandle); \ } while (0) +#define WT_DHANDLE_IS_CHECKPOINT(dhandle) ((dhandle)->checkpoint != NULL) + /* * WT_DATA_HANDLE -- * A handle for a generic named data source. @@ -64,12 +66,13 @@ struct __wt_data_handle { TAILQ_ENTRY(__wt_data_handle) q; TAILQ_ENTRY(__wt_data_handle) hashq; - const char *name; /* Object name as a URI */ - uint64_t name_hash; /* Hash of name */ - const char *checkpoint; /* Checkpoint name (or NULL) */ - const char **cfg; /* Configuration information */ - const char *meta_base; /* Base metadata configuration */ - size_t meta_base_length; /* Base metadata length */ + const char *name; /* Object name as a URI */ + uint64_t name_hash; /* Hash of name */ + const char *checkpoint; /* Checkpoint name (or NULL) */ + int64_t checkpoint_order; /* Checkpoint order number, when applicable */ + const char **cfg; /* Configuration information */ + const char *meta_base; /* Base metadata configuration */ + size_t meta_base_length; /* Base metadata length */ #ifdef HAVE_DIAGNOSTIC const char *orig_meta_base; /* Copy of the base metadata configuration */ #endif diff --git a/src/third_party/wiredtiger/src/include/extern.h b/src/third_party/wiredtiger/src/include/extern.h index ddeb313f996..efc2d55a76f 100644 --- a/src/third_party/wiredtiger/src/include/extern.h +++ b/src/third_party/wiredtiger/src/include/extern.h @@ -1051,10 +1051,14 @@ extern int __wt_meta_block_metadata(WT_SESSION_IMPL *session, const char *config WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_meta_checkpoint(WT_SESSION_IMPL *session, const char *fname, const char *checkpoint, WT_CKPT *ckpt) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_meta_checkpoint_by_name(WT_SESSION_IMPL *session, const char *uri, + const char *checkpoint, int64_t *orderp, uint64_t *timep) + WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_meta_checkpoint_clear(WT_SESSION_IMPL *session, const char *fname) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_meta_checkpoint_last_name(WT_SESSION_IMPL *session, const char *fname, - const char **namep) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_meta_checkpoint_last_name( + WT_SESSION_IMPL *session, const char *fname, const char **namep, int64_t *orderp, uint64_t *timep) + WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_meta_ckptlist_get(WT_SESSION_IMPL *session, const char *fname, bool update, WT_CKPT **ckptbasep, size_t *allocated) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_meta_ckptlist_get_from_config(WT_SESSION_IMPL *session, bool update, @@ -1066,8 +1070,17 @@ extern int __wt_meta_ckptlist_to_meta(WT_SESSION_IMPL *session, WT_CKPT *ckptbas WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_meta_ckptlist_update_config(WT_SESSION_IMPL *session, WT_CKPT *ckptbase, const char *oldcfg, char **newcfgp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_meta_sysinfo_set(WT_SESSION_IMPL *session) - WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_meta_read_checkpoint_oldest(WT_SESSION_IMPL *session, const char *ckpt_name, + wt_timestamp_t *timestampp, uint64_t *ckpttime) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_meta_read_checkpoint_snapshot(WT_SESSION_IMPL *session, const char *ckpt_name, + uint64_t *snap_write_gen, uint64_t *snap_min, uint64_t *snap_max, uint64_t **snapshot, + uint32_t *snapshot_count, uint64_t *ckpttime) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_meta_read_checkpoint_timestamp(WT_SESSION_IMPL *session, const char *ckpt_name, + wt_timestamp_t *timestampp, uint64_t *ckpttime) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_meta_sysinfo_clear(WT_SESSION_IMPL *session, const char *name, size_t namelen) + WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_meta_sysinfo_set(WT_SESSION_IMPL *session, bool full, const char *name, + size_t namelen) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_meta_track_checkpoint(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_meta_track_destroy(WT_SESSION_IMPL *session) @@ -1376,7 +1389,8 @@ extern int __wt_session_create(WT_SESSION_IMPL *session, const char *uri, const extern int __wt_session_cursor_cache_sweep(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_session_get_btree_ckpt(WT_SESSION_IMPL *session, const char *uri, const char *cfg[], - uint32_t flags) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); + uint32_t flags, WT_DATA_HANDLE **hs_dhandlep, WT_CKPT_SNAPSHOT *ckpt_snapshot) + WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_session_get_dhandle(WT_SESSION_IMPL *session, const char *uri, const char *checkpoint, const char *cfg[], uint32_t flags) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); @@ -1551,6 +1565,8 @@ extern int __wt_txn_global_shutdown(WT_SESSION_IMPL *session, const char **cfg) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_txn_init(WT_SESSION_IMPL *session, WT_SESSION_IMPL *session_ret) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_txn_init_checkpoint_cursor(WT_SESSION_IMPL *session, WT_CKPT_SNAPSHOT *snapinfo, + WT_TXN **txn_ret) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_txn_is_blocking(WT_SESSION_IMPL *session) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_txn_log_commit(WT_SESSION_IMPL *session, const char *cfg[]) @@ -1858,6 +1874,7 @@ extern void __wt_timestamp_to_hex_string(wt_timestamp_t ts, char *hex_timestamp) extern void __wt_txn_bump_snapshot(WT_SESSION_IMPL *session); extern void __wt_txn_clear_durable_timestamp(WT_SESSION_IMPL *session); extern void __wt_txn_clear_read_timestamp(WT_SESSION_IMPL *session); +extern void __wt_txn_close_checkpoint_cursor(WT_SESSION_IMPL *session, WT_TXN **txn_arg); extern void __wt_txn_destroy(WT_SESSION_IMPL *session); extern void __wt_txn_get_pinned_timestamp( WT_SESSION_IMPL *session, wt_timestamp_t *tsp, uint32_t flags); diff --git a/src/third_party/wiredtiger/src/include/meta.h b/src/third_party/wiredtiger/src/include/meta.h index 7daa9e5e162..04aa4581240 100644 --- a/src/third_party/wiredtiger/src/include/meta.h +++ b/src/third_party/wiredtiger/src/include/meta.h @@ -38,11 +38,15 @@ #define WT_SYSTEM_CKPT_URI "system:checkpoint" /* Checkpoint timestamp URI */ #define WT_SYSTEM_OLDEST_TS "oldest_timestamp" /* Oldest timestamp name */ #define WT_SYSTEM_OLDEST_URI "system:oldest" /* Oldest timestamp URI */ +#define WT_SYSTEM_TS_TIME "checkpoint_time" /* Checkpoint wall time */ +#define WT_SYSTEM_TS_WRITE_GEN "write_gen" /* Checkpoint write generation */ #define WT_SYSTEM_CKPT_SNAPSHOT "snapshots" /* List of snapshots */ #define WT_SYSTEM_CKPT_SNAPSHOT_MIN "snapshot_min" /* Snapshot minimum */ #define WT_SYSTEM_CKPT_SNAPSHOT_MAX "snapshot_max" /* Snapshot maximum */ #define WT_SYSTEM_CKPT_SNAPSHOT_COUNT "snapshot_count" /* Snapshot count */ #define WT_SYSTEM_CKPT_SNAPSHOT_URI "system:checkpoint_snapshot" /* Checkpoint snapshot URI */ +#define WT_SYSTEM_CKPT_SNAPSHOT_TIME "checkpoint_time" /* Checkpoint wall time */ +#define WT_SYSTEM_CKPT_SNAPSHOT_WRITE_GEN "write_gen" /* Checkpoint write generation */ #define WT_SYSTEM_BASE_WRITE_GEN_URI "system:checkpoint_base_write_gen" /* Base write gen URI */ #define WT_SYSTEM_BASE_WRITE_GEN "base_write_gen" /* Base write gen name */ @@ -165,3 +169,17 @@ struct __wt_ckpt { /* AUTOMATIC FLAG VALUE GENERATION STOP 32 */ uint32_t flags; }; + +/* + * WT_CKPT_SNAPSHOT -- + * Snapshot and timestamp information associated with a checkpoint. + */ +struct __wt_ckpt_snapshot { + uint64_t oldest_ts; + uint64_t stable_ts; + uint64_t snapshot_write_gen; + uint64_t snapshot_min; + uint64_t snapshot_max; + uint64_t *snapshot_txns; + uint32_t snapshot_count; +}; diff --git a/src/third_party/wiredtiger/src/include/session.h b/src/third_party/wiredtiger/src/include/session.h index 58551f5b702..37553eeaab8 100644 --- a/src/third_party/wiredtiger/src/include/session.h +++ b/src/third_party/wiredtiger/src/include/session.h @@ -141,11 +141,20 @@ struct __wt_session_impl { void *block_manager; /* Block-manager support */ int (*block_manager_cleanup)(WT_SESSION_IMPL *); + const char *hs_checkpoint; /* History store checkpoint name, during checkpoint cursor ops */ + uint64_t checkpoint_write_gen; /* Write generation override, during checkpoint cursor ops */ + /* Checkpoint handles */ WT_DATA_HANDLE **ckpt_handle; /* Handle list */ u_int ckpt_handle_next; /* Next empty slot */ size_t ckpt_handle_allocated; /* Bytes allocated */ + /* Named checkpoint drop list, during a checkpoint */ + WT_ITEM *ckpt_drop_list; + + /* Checkpoint time of current checkpoint, during a checkpoint */ + uint64_t current_ckpt_sec; + /* * Operations acting on handles. * @@ -288,3 +297,6 @@ struct __wt_session_impl { WT_SESSION_STATS stats; }; + +/* Consider moving this to session_inline.h if it ever appears. */ +#define WT_READING_CHECKPOINT(s) ((s)->dhandle != NULL && WT_DHANDLE_IS_CHECKPOINT((s)->dhandle)) diff --git a/src/third_party/wiredtiger/src/include/txn.h b/src/third_party/wiredtiger/src/include/txn.h index 7c60dfc23bb..f34f4679fc3 100644 --- a/src/third_party/wiredtiger/src/include/txn.h +++ b/src/third_party/wiredtiger/src/include/txn.h @@ -290,6 +290,11 @@ struct __wt_txn { */ wt_timestamp_t prepare_timestamp; + /* + * Timestamp used for reading via a checkpoint cursor instead of txn_shared->read_timestamp. + */ + wt_timestamp_t checkpoint_read_timestamp; + /* Array of modifications by this transaction. */ WT_TXN_OP *mod; size_t mod_alloc; @@ -333,22 +338,23 @@ struct __wt_txn { #define WT_TXN_HAS_TS_DURABLE 0x00020u #define WT_TXN_HAS_TS_PREPARE 0x00040u #define WT_TXN_IGNORE_PREPARE 0x00080u -#define WT_TXN_PREPARE 0x00100u -#define WT_TXN_PREPARE_IGNORE_API_CHECK 0x00200u -#define WT_TXN_READONLY 0x00400u -#define WT_TXN_RUNNING 0x00800u -#define WT_TXN_SHARED_TS_DURABLE 0x01000u -#define WT_TXN_SHARED_TS_READ 0x02000u -#define WT_TXN_SYNC_SET 0x04000u -#define WT_TXN_TS_ROUND_PREPARED 0x08000u -#define WT_TXN_TS_ROUND_READ 0x10000u -#define WT_TXN_UPDATE 0x20000u +#define WT_TXN_IS_CHECKPOINT 0x00100u +#define WT_TXN_PREPARE 0x00200u +#define WT_TXN_PREPARE_IGNORE_API_CHECK 0x00400u +#define WT_TXN_READONLY 0x00800u +#define WT_TXN_RUNNING 0x01000u +#define WT_TXN_SHARED_TS_DURABLE 0x02000u +#define WT_TXN_SHARED_TS_READ 0x04000u +#define WT_TXN_SYNC_SET 0x08000u +#define WT_TXN_TS_ROUND_PREPARED 0x10000u +#define WT_TXN_TS_ROUND_READ 0x20000u +#define WT_TXN_UPDATE 0x40000u /* AUTOMATIC FLAG VALUE GENERATION STOP 32 */ uint32_t flags; /* - * Zero or more bytes of value (the payload) immediately follows the WT_UPDATE structure. We use - * a C99 flexible array member which has the semantics we want. + * Zero or more bytes of value (the payload) immediately follows the WT_TXN structure. We use a + * C99 flexible array member which has the semantics we want. */ uint64_t __snapshot[]; }; diff --git a/src/third_party/wiredtiger/src/include/txn_inline.h b/src/third_party/wiredtiger/src/include/txn_inline.h index 915dfe763fa..21b0fde5b10 100644 --- a/src/third_party/wiredtiger/src/include/txn_inline.h +++ b/src/third_party/wiredtiger/src/include/txn_inline.h @@ -697,8 +697,8 @@ __txn_visible_id(WT_SESSION_IMPL *session, uint64_t id) if (txn->isolation == WT_ISO_READ_UNCOMMITTED) return (true); - /* Otherwise, we should be called with a snapshot or we are in a checkpoint cursor. */ - WT_ASSERT(session, F_ISSET(txn, WT_TXN_HAS_SNAPSHOT) || session->dhandle->checkpoint != NULL); + /* Otherwise, we should be called with a snapshot. */ + WT_ASSERT(session, F_ISSET(txn, WT_TXN_HAS_SNAPSHOT)); return (__wt_txn_visible_id_snapshot( id, txn->snap_min, txn->snap_max, txn->snapshot, txn->snapshot_count)); @@ -728,6 +728,9 @@ __wt_txn_visible(WT_SESSION_IMPL *session, uint64_t id, wt_timestamp_t timestamp if (!F_ISSET(txn, WT_TXN_SHARED_TS_READ) || timestamp == WT_TS_NONE) return (true); + if (WT_READING_CHECKPOINT(session)) + return (timestamp <= txn->checkpoint_read_timestamp); + return (timestamp <= txn_shared->read_timestamp); } diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in index 02d46311861..0914289c62b 100644 --- a/src/third_party/wiredtiger/src/include/wiredtiger.in +++ b/src/third_party/wiredtiger/src/include/wiredtiger.in @@ -908,8 +908,8 @@ struct __wt_session { * Bulk-loaded bitmap values must end on a byte boundary relative to the bit count (except * for the last set of values loaded)., a string; default \c false.} * @config{checkpoint, the name of a checkpoint to open (the reserved name - * "WiredTigerCheckpoint" opens the most recent internal checkpoint taken for the object). - * The cursor does not support data modification., a string; default empty.} + * "WiredTigerCheckpoint" opens the most recent checkpoint taken for the object). The cursor + * does not support data modification., a string; default empty.} * @config{debug = (, configure debug specific behavior on a cursor. Generally only used * for internal testing purposes., a set of related configuration options defined below.} * @config{ dump_version, open a version cursor\, which is a debug diff --git a/src/third_party/wiredtiger/src/include/wt_internal.h b/src/third_party/wiredtiger/src/include/wt_internal.h index 1fa544ab841..8c393ff2a7d 100644 --- a/src/third_party/wiredtiger/src/include/wt_internal.h +++ b/src/third_party/wiredtiger/src/include/wt_internal.h @@ -113,6 +113,8 @@ struct __wt_cell_unpack_kv; typedef struct __wt_cell_unpack_kv WT_CELL_UNPACK_KV; struct __wt_ckpt; typedef struct __wt_ckpt WT_CKPT; +struct __wt_ckpt_snapshot; +typedef struct __wt_ckpt_snapshot WT_CKPT_SNAPSHOT; struct __wt_col; typedef struct __wt_col WT_COL; struct __wt_col_fix_auxiliary_header; |