diff options
author | Luke Chen <luke.chen@mongodb.com> | 2020-09-14 16:01:08 +1000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-09-14 06:19:46 +0000 |
commit | fd8e132ebe4d544a5c99d81fffa2ffb8fcb3f841 (patch) | |
tree | 7a741a9f090c2f2fcb4e3a72145d771808aa219a /src/third_party/wiredtiger/src/meta | |
parent | 827a25eb01bc5ddf766b3a543ef0ba5112953e1b (diff) | |
download | mongo-fd8e132ebe4d544a5c99d81fffa2ffb8fcb3f841.tar.gz |
Import wiredtiger: 2b801c9c68c8d866fcfe5a9affaff06190c11ce6 from branch mongodb-4.6
ref: a68890f718..2b801c9c68
for: 4.8.0
WT-6616 Set the oldest timestamp of the checkpoint when it is finished
WT-6649 Coverity: Unintentional integer overflow in __wt_rec_need_split
Diffstat (limited to 'src/third_party/wiredtiger/src/meta')
-rw-r--r-- | src/third_party/wiredtiger/src/meta/meta_ckpt.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/third_party/wiredtiger/src/meta/meta_ckpt.c b/src/third_party/wiredtiger/src/meta/meta_ckpt.c index c555279fca6..6626f789da7 100644 --- a/src/third_party/wiredtiger/src/meta/meta_ckpt.c +++ b/src/third_party/wiredtiger/src/meta/meta_ckpt.c @@ -932,14 +932,18 @@ __wt_meta_sysinfo_set(WT_SESSION_IMPL *session) { WT_DECL_ITEM(buf); WT_DECL_RET; + WT_TXN_GLOBAL *txn_global; + wt_timestamp_t oldest_timestamp; char hex_timestamp[WT_TS_HEX_STRING_SIZE]; + txn_global = &S2C(session)->txn_global; + WT_ERR(__wt_scr_alloc(session, 0, &buf)); /* * We need to record the timestamp of the checkpoint in the metadata. The timestamp value is set * at a higher level, either in checkpoint or in recovery. */ - __wt_timestamp_to_hex_string(S2C(session)->txn_global.meta_ckpt_timestamp, hex_timestamp); + __wt_timestamp_to_hex_string(txn_global->meta_ckpt_timestamp, hex_timestamp); /* * Don't leave a zero entry in the metadata: remove it. This avoids downgrade issues if the @@ -953,9 +957,18 @@ __wt_meta_sysinfo_set(WT_SESSION_IMPL *session) WT_ERR(__wt_metadata_update(session, WT_SYSTEM_CKPT_URI, buf->data)); } - /* We also need to record the oldest timestamp in the metadata so we can set it on startup. */ + /* + * We also need to record the oldest timestamp in the metadata so we can set it on startup. We + * should set the checkpoint's oldest timestamp as the minimum of the current oldest timestamp + * and the checkpoint timestamp. + * + * Cache the oldest timestamp and use a read barrier to prevent us from reading two different + * values of the oldest timestamp. + */ + oldest_timestamp = txn_global->oldest_timestamp; + WT_READ_BARRIER(); __wt_timestamp_to_hex_string( - S2C(session)->txn_global.checkpoint_oldest_timestamp, hex_timestamp); + WT_MIN(oldest_timestamp, txn_global->meta_ckpt_timestamp), hex_timestamp); if (strcmp(hex_timestamp, "0") == 0) WT_ERR_NOTFOUND_OK(__wt_metadata_remove(session, WT_SYSTEM_OLDEST_URI), false); else { |