diff options
author | Luke Chen <luke.chen@mongodb.com> | 2021-08-11 14:29:27 +1000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-08-11 04:42:04 +0000 |
commit | 08bd2e4a83e711cba3938684a32c3544b56a61dd (patch) | |
tree | 4e6802a3105d03dd794ebe22b2b76ec8cb553ed0 /src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c | |
parent | 7c6b85895f41c914873198fbc0510fe44eea3ae7 (diff) | |
download | mongo-08bd2e4a83e711cba3938684a32c3544b56a61dd.tar.gz |
Import wiredtiger: 03eb45ea7fd94d6f241f8668a58d0119c39bbf52 from branch mongodb-4.4
ref: 2b73914cd8..03eb45ea7f
for: 4.4.9
WT-6755 Documentation: populate developer glossary
WT-6902 Metadata subpage for Architecture Guide
WT-6905 Write row-store and column-store subpage for Architecture Guide
WT-6910 Write "history store" subpage for Architecture Guide
WT-6914 Write "database files" subpage for Architecture Guide
WT-7007 Backup architecture guide page
WT-7198 Fix test_backup15 failure with backup mismatch
WT-7352 Fix test_hs01 conflict between concurrent operations in cursor modify
WT-7521 Remove excess ckplist invalidations
WT-7592 Remove log_flush("sync=background") support
WT-7599 Update the CONFIG file based on the release that is about to run for compatibility tests
WT-7607 Add the possibility to use an existing database for many-coll-test
WT-7673 Investigate and fix manydbs test failure on Windows
WT-7703 Fix timeout in test_checkpoint_snapshot04
WT-7732 Add a timeout configuration for flush_tier
WT-7758 Force evict a page when the update chain is too long
WT-7787 Don't read pages for checkpoint cleanup when the cache is in aggressive mode
WT-7789 Change tiered python tests to fail without extension library
WT-7817 Make tiered storage address cookies backward compatible
WT-7830 Migrate the python setup scripts to use cmake
WT-7838 Ability for ordered timestamp assertion to do more than a log message
WT-7842 Remove explicit ulimit -n call in many-collection-test
WT-7860 Improve code coverage reporting
WT-7864 Add support to run.py for running lists/ranges of scenarios in a test
WT-7865 Disable timeout assert while waiting for eviction to quiesce prior to RTS and test
WT-7870 Fix measurement of cyclomatic code complexity
WT-7871 Remove comment that is no longer true
WT-7874 Remove two other stale comments
WT-7876 Update rollback to stable test to use correct boolean values and update statistic checking logic
WT-7882 Fix discrepancy for wiredtiger.in on mongodb-4.4 branch
WT-7883 Remove incorrect wt_free statement
WT-7889 Find/replace existing uses of WT with WiredTiger in reference guide
WT-7890 Fix CMake syntax error in config_lib
WT-7893 Remove ignored message from wiredtiger_open in test_encrypt08
WT-7895 Fix arch-data-file.dox documentation build failure
WT-7897 Enable verbose logging for test_backup15 to aid debugging
WT-7898 Upload many-coll-test artifacts
WT-7900 Fix insertion of new records in test format for column-store
WT-7901 test suite cleanup
WT-7908 Make variable-length column store work again with the static tests
WT-7935 Add arm64 implementation of rdtsc equivalent instruction
WT-7937 Fix s_docs to use sh, not bash syntax
WT-7938 Fix rollback-to-stable memory leak on error
Diffstat (limited to 'src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c')
-rw-r--r-- | src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c | 53 |
1 files changed, 30 insertions, 23 deletions
diff --git a/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c b/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c index 0a6b7e52cf9..5bc0f245497 100644 --- a/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c +++ b/src/third_party/wiredtiger/src/txn/txn_rollback_to_stable.c @@ -339,11 +339,11 @@ __rollback_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_REF *ref, WT_PAGE *page WT_CELL *kcell; WT_CELL_UNPACK_KV *unpack, _unpack; WT_CURSOR *hs_cursor; + WT_DECL_ITEM(full_value); WT_DECL_ITEM(hs_key); WT_DECL_ITEM(hs_value); WT_DECL_ITEM(key); WT_DECL_RET; - WT_ITEM full_value; WT_TIME_WINDOW *hs_tw; WT_UPDATE *tombstone, *upd; wt_timestamp_t hs_durable_ts, hs_start_ts, hs_stop_durable_ts, newer_hs_durable_ts; @@ -371,7 +371,6 @@ __rollback_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_REF *ref, WT_PAGE *page tombstone = upd = NULL; hs_durable_ts = hs_start_ts = hs_stop_durable_ts = WT_TS_NONE; hs_btree_id = S2BT(session)->id; - WT_CLEAR(full_value); valid_update_found = false; #ifdef HAVE_DIAGNOSTIC first_record = true; @@ -392,18 +391,19 @@ __rollback_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_REF *ref, WT_PAGE *page } else { /* Unpack a column cell. */ WT_ERR(__wt_scr_alloc(session, WT_INTPACK64_MAXSIZE, &key)); + memp = key->mem; + WT_ERR(__wt_vpack_uint(&memp, 0, recno)); + key->size = WT_PTRDIFF(memp, key->data); /* Get the full update value from the data store. */ unpack = &_unpack; kcell = WT_COL_PTR(page, cip); __wt_cell_unpack_kv(session, page->dsk, kcell, unpack); - memp = key->mem; - WT_ERR(__wt_vpack_uint(&memp, 0, recno)); - key->size = WT_PTRDIFF(memp, key->data); } - WT_ERR(__wt_page_cell_data_ref(session, page, unpack, &full_value)); - WT_ERR(__wt_buf_set(session, &full_value, full_value.data, full_value.size)); + WT_ERR(__wt_scr_alloc(session, 0, &full_value)); + WT_ERR(__wt_page_cell_data_ref(session, page, unpack, full_value)); + WT_ERR(__wt_buf_set(session, full_value, full_value->data, full_value->size)); newer_hs_durable_ts = unpack->tw.durable_start_ts; /* Open a history store table cursor. */ @@ -447,10 +447,10 @@ __rollback_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_REF *ref, WT_PAGE *page if (hs_start_ts <= unpack->tw.start_ts || unpack->tw.prepare) { if (type == WT_UPDATE_MODIFY) WT_ERR(__wt_modify_apply_item( - session, S2BT(session)->value_format, &full_value, hs_value->data)); + session, S2BT(session)->value_format, full_value, hs_value->data)); else { WT_ASSERT(session, type == WT_UPDATE_STANDARD); - WT_ERR(__wt_buf_set(session, &full_value, hs_value->data, hs_value->size)); + WT_ERR(__wt_buf_set(session, full_value, hs_value->data, hs_value->size)); } } else __wt_verbose(session, WT_VERB_RECOVERY_RTS(session), @@ -532,7 +532,7 @@ __rollback_ondisk_fixup_key(WT_SESSION_IMPL *session, WT_REF *ref, WT_PAGE *page __wt_hs_upd_time_window(hs_cursor, &hs_tw); WT_ASSERT(session, hs_tw->start_ts < unpack->tw.start_ts || hs_tw->start_txn < unpack->tw.start_txn); - WT_ERR(__wt_upd_alloc(session, &full_value, WT_UPDATE_STANDARD, &upd, NULL)); + WT_ERR(__wt_upd_alloc(session, full_value, WT_UPDATE_STANDARD, &upd, NULL)); /* * Set the transaction id of updates to WT_TXN_NONE when called from recovery, because the @@ -624,10 +624,10 @@ err: WT_ASSERT(session, tombstone == NULL || upd == tombstone); __wt_free_update_list(session, &upd); } + __wt_scr_free(session, &full_value); __wt_scr_free(session, &hs_key); __wt_scr_free(session, &hs_value); __wt_scr_free(session, &key); - __wt_buf_free(session, &full_value); if (hs_cursor != NULL) WT_TRET(hs_cursor->close(hs_cursor)); return (ret); @@ -643,8 +643,8 @@ __rollback_abort_ondisk_kv(WT_SESSION_IMPL *session, WT_REF *ref, WT_COL *cip, W { WT_CELL *kcell; WT_CELL_UNPACK_KV *vpack, _vpack; + WT_DECL_ITEM(tmp); WT_DECL_RET; - WT_ITEM buf; WT_PAGE *page; WT_UPDATE *upd; char ts_string[5][WT_TS_INT_STRING_SIZE]; @@ -652,7 +652,6 @@ __rollback_abort_ondisk_kv(WT_SESSION_IMPL *session, WT_REF *ref, WT_COL *cip, W page = ref->page; vpack = &_vpack; - WT_CLEAR(buf); upd = NULL; /* @@ -712,12 +711,6 @@ __rollback_abort_ondisk_kv(WT_SESSION_IMPL *session, WT_REF *ref, WT_COL *cip, W (vpack->tw.durable_stop_ts > rollback_timestamp || __rollback_check_if_txnid_non_committed(session, vpack->tw.stop_txn) || prepared)) { /* - * Clear the remove operation from the key by inserting the original on-disk value as a - * standard update. - */ - WT_RET(__wt_page_cell_data_ref(session, page, vpack, &buf)); - - /* * For prepared transactions, it is possible that both the on-disk key start and stop time * windows can be the same. To abort these updates, check for any stable update from history * store or remove the key. @@ -738,7 +731,16 @@ __rollback_abort_ondisk_kv(WT_SESSION_IMPL *session, WT_REF *ref, WT_COL *cip, W WT_STAT_CONN_DATA_INCR(session, txn_rts_keys_removed); } } else { - WT_ERR(__wt_upd_alloc(session, &buf, WT_UPDATE_STANDARD, &upd, NULL)); + /* + * Clear the remove operation from the key by inserting the original on-disk value as a + * standard update. + */ + WT_RET(__wt_scr_alloc(session, 0, &tmp)); + if ((ret = __wt_page_cell_data_ref(session, page, vpack, tmp)) == 0) + ret = __wt_upd_alloc(session, tmp, WT_UPDATE_STANDARD, &upd, NULL); + __wt_scr_free(session, &tmp); + WT_RET(ret); + /* * Set the transaction id of updates to WT_TXN_NONE when called from recovery, because * the connections write generation will be initialized after rollback to stable and the @@ -774,10 +776,9 @@ __rollback_abort_ondisk_kv(WT_SESSION_IMPL *session, WT_REF *ref, WT_COL *cip, W WT_ERR(__rollback_row_modify(session, page, rip, upd)); else WT_ERR(__rollback_col_modify(session, ref, upd, recno)); - upd = NULL; + return (0); err: - __wt_buf_free(session, &buf); __wt_free(session, upd); return (ret); } @@ -1672,7 +1673,13 @@ __rollback_to_stable(WT_SESSION_IMPL *session, bool no_ckpt) if (retries == WT_RTS_EVICT_MAX_RETRIES) { WT_ERR(__wt_msg( session, "timed out waiting for eviction to quiesce, running rollback to stable")); - WT_ASSERT(session, false && "Timed out waiting for eviction to quiesce prior to rts"); + /* + * FIXME: WT-7877 RTS fails when there are active transactions running in parallel to it. + * Waiting in a loop for eviction to quiesce is not efficient in some scenarios where the + * cache is not cleared in 2 minutes. Enable the following assert and + * test_rollback_to_stable22.py when the cache issue is addressed. + */ + /* WT_ASSERT(session, false && "Timed out waiting for eviction to quiesce prior to rts"); */ } /* |