From 9fd24287e684e18f2aae8d0b24c9acf6ebcbbfea Mon Sep 17 00:00:00 2001 From: Chenhao Qu Date: Tue, 19 Apr 2022 23:39:07 +0000 Subject: Import wiredtiger: 12f6c1c6976e1bff7cc4b7a5041498ff94767358 from branch mongodb-master ref: ad0b418109..12f6c1c697 for: 6.1.0-rc0 WT-8973 Define semantics of zero timestamp in our APIs --- src/third_party/wiredtiger/dist/api_data.py | 19 ++-- src/third_party/wiredtiger/examples/c/ex_all.c | 7 ++ src/third_party/wiredtiger/import.data | 2 +- src/third_party/wiredtiger/src/config/config_def.c | 10 +- .../wiredtiger/src/docs/timestamp-global.dox | 11 ++- .../wiredtiger/src/docs/timestamp-model.dox | 28 +++--- .../wiredtiger/src/docs/timestamp-txn.dox | 6 +- src/third_party/wiredtiger/src/include/config.h | 33 ++++--- src/third_party/wiredtiger/src/include/extern.h | 7 +- .../wiredtiger/src/include/wiredtiger.in | 27 +++--- src/third_party/wiredtiger/src/txn/txn.c | 11 ++- src/third_party/wiredtiger/src/txn/txn_timestamp.c | 108 ++++++++++----------- .../wiredtiger/test/checkpoint/checkpointer.c | 2 +- .../wiredtiger/test/csuite/tiered_abort/main.c | 27 +++--- .../wiredtiger/test/csuite/timestamp_abort/main.c | 77 +++++++-------- .../test/csuite/wt6616_checkpoint_oldest_ts/main.c | 4 +- .../wt8246_compact_rts_data_correctness/main.c | 13 +-- src/third_party/wiredtiger/test/format/util.c | 4 +- .../wiredtiger/test/suite/test_timestamp08.py | 10 +- .../wiredtiger/test/suite/test_timestamp13.py | 12 +-- .../wiredtiger/test/suite/test_timestamp14.py | 24 ++--- src/third_party/wiredtiger/test/utility/misc.c | 13 --- .../wiredtiger/test/utility/test_util.h | 28 ++++-- 23 files changed, 236 insertions(+), 247 deletions(-) (limited to 'src/third_party') diff --git a/src/third_party/wiredtiger/dist/api_data.py b/src/third_party/wiredtiger/dist/api_data.py index f67c6deed59..45dd064ec35 100644 --- a/src/third_party/wiredtiger/dist/api_data.py +++ b/src/third_party/wiredtiger/dist/api_data.py @@ -1644,11 +1644,11 @@ methods = { 'WT_SESSION.query_timestamp' : Method([ Config('get', 'read', r''' - specify which timestamp to query: \c commit returns the most recently - set commit_timestamp; \c first_commit returns the first set - commit_timestamp; \c prepare returns the timestamp used in preparing a - transaction; \c read returns the timestamp at which the transaction is - reading at. See @ref timestamp_txn_api''', + specify which timestamp to query: \c commit returns the most + recently set commit_timestamp; \c first_commit returns the first set + commit_timestamp; \c prepare returns the timestamp used in preparing + a transaction; \c read returns the timestamp at which the transaction + is reading. See @ref timestamp_txn_api''', choices=['commit', 'first_commit', 'prepare', 'read']), ]), @@ -1663,10 +1663,6 @@ methods = { ]), 'WT_SESSION.flush_tier' : Method([ - Config('flush_timestamp', '', r''' - flush objects to all storage sources using the specified timestamp. - The value must not be older than the current oldest timestamp and it must - not be newer than the stable timestamp'''), Config('force', 'false', r''' force sharing of all data''', type='boolean'), @@ -1820,6 +1816,7 @@ methods = { be newer than the current stable timestamp. See @ref timestamp_prepare'''), ]), +'WT_SESSION.timestamp_transaction_uint' : Method([]), 'WT_SESSION.timestamp_transaction' : Method([ Config('commit_timestamp', '', r''' set the commit timestamp for the current transaction. For non-prepared transactions, @@ -1959,8 +1956,8 @@ methods = { recent \c oldest_timestamp set with WT_CONNECTION::set_timestamp; \c oldest_reader returns the minimum of the read timestamps of all active readers; \c pinned returns the minimum of the \c oldest_timestamp and the read timestamps of all active readers; - \c recovery returns the timestamp of the most recent stable checkpoint taken prior to a - shutdown; \c stable_timestamp returns the most recent \c stable_timestamp set with + \c recovery returns the timestamp of the most recent stable checkpoint taken prior + to a shutdown; \c stable_timestamp returns the most recent \c stable_timestamp set with WT_CONNECTION::set_timestamp. (The \c oldest and \c stable arguments are deprecated short-hand for \c oldest_timestamp and \c stable_timestamp, respectively.) See @ref timestamp_global_api''', diff --git a/src/third_party/wiredtiger/examples/c/ex_all.c b/src/third_party/wiredtiger/examples/c/ex_all.c index e4c49e2f9a0..f76d57b40fd 100644 --- a/src/third_party/wiredtiger/examples/c/ex_all.c +++ b/src/third_party/wiredtiger/examples/c/ex_all.c @@ -896,6 +896,7 @@ transaction_ops(WT_SESSION *session_arg) { /*! [hexadecimal timestamp] */ uint64_t ts; + /* 2 bytes for each byte converted to hexadecimal; sizeof includes the trailing nul byte */ char timestamp_buf[sizeof("commit_timestamp=") + 2 * sizeof(uint64_t)]; @@ -920,6 +921,12 @@ transaction_ops(WT_SESSION *session_arg) error_check(conn->query_timestamp(conn, timestamp_buf, "get=all_durable")); /*! [query timestamp] */ + + error_check(session->begin_transaction(session, NULL)); + /*! [transaction timestamp_uint] */ + error_check(session->timestamp_transaction_uint(session, WT_TS_TXN_TYPE_COMMIT, 42)); + /*! [transaction timestamp_uint] */ + error_check(session->commit_transaction(session, NULL)); } /*! [set durable timestamp] */ diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index f054921907c..6562455c74d 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -2,5 +2,5 @@ "vendor": "wiredtiger", "github": "wiredtiger/wiredtiger.git", "branch": "mongodb-master", - "commit": "ad0b418109f05284ecdc343683988388a1a7fd39" + "commit": "12f6c1c6976e1bff7cc4b7a5041498ff94767358" } diff --git a/src/third_party/wiredtiger/src/config/config_def.c b/src/third_party/wiredtiger/src/config/config_def.c index bc1a7a93990..8c3e008201e 100644 --- a/src/third_party/wiredtiger/src/config/config_def.c +++ b/src/third_party/wiredtiger/src/config/config_def.c @@ -355,8 +355,7 @@ static const WT_CONFIG_CHECK confchk_WT_SESSION_drop[] = { {NULL, NULL, NULL, NULL, NULL, 0}}; static const WT_CONFIG_CHECK confchk_WT_SESSION_flush_tier[] = { - {"flush_timestamp", "string", NULL, NULL, NULL, 0}, {"force", "boolean", NULL, NULL, NULL, 0}, - {"lock_wait", "boolean", NULL, NULL, NULL, 0}, + {"force", "boolean", NULL, NULL, NULL, 0}, {"lock_wait", "boolean", NULL, NULL, NULL, 0}, {"sync", "string", NULL, "choices=[\"off\",\"on\"]", NULL, 0}, {"timeout", "int", NULL, NULL, NULL, 0}, {NULL, NULL, NULL, NULL, NULL, 0}}; @@ -1278,8 +1277,8 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator", "checkpoint_wait=true,force=false,lock_wait=true," "remove_files=true", confchk_WT_SESSION_drop, 4}, - {"WT_SESSION.flush_tier", "flush_timestamp=,force=false,lock_wait=true,sync=on,timeout=0", - confchk_WT_SESSION_flush_tier, 5}, + {"WT_SESSION.flush_tier", "force=false,lock_wait=true,sync=on,timeout=0", + confchk_WT_SESSION_flush_tier, 4}, {"WT_SESSION.join", "bloom_bit_count=16,bloom_false_positives=false," "bloom_hash_count=8,compare=\"eq\",count=,operation=\"and\"," @@ -1314,7 +1313,8 @@ static const WT_CONFIG_ENTRY config_entries[] = {{"WT_CONNECTION.add_collator", "commit_timestamp=,durable_timestamp=,prepare_timestamp=," "read_timestamp=", confchk_WT_SESSION_timestamp_transaction, 4}, - {"WT_SESSION.truncate", "", NULL, 0}, {"WT_SESSION.upgrade", "", NULL, 0}, + {"WT_SESSION.timestamp_transaction_uint", "", NULL, 0}, {"WT_SESSION.truncate", "", NULL, 0}, + {"WT_SESSION.upgrade", "", NULL, 0}, {"WT_SESSION.verify", "do_not_clear_txn_id=false,dump_address=false,dump_blocks=false," "dump_layout=false,dump_offsets=,dump_pages=false," diff --git a/src/third_party/wiredtiger/src/docs/timestamp-global.dox b/src/third_party/wiredtiger/src/docs/timestamp-global.dox index 7bddc1c4345..df708687c29 100644 --- a/src/third_party/wiredtiger/src/docs/timestamp-global.dox +++ b/src/third_party/wiredtiger/src/docs/timestamp-global.dox @@ -127,20 +127,21 @@ USING THE FORCE FLAG NEEDS MOTIVATION AND DISCUSSION. --> @section timestamp_global_querying_timestamps Querying global timestamps The following table lists the global timestamps an application can query using -the WT_CONNECTION::set_timestamp method, including constraints. +the WT_CONNECTION::set_timestamp method, including constraints. In all cases, +a timestamp of 0 is returned if the timestamp is not available or has not been +set, for example, the \c last_checkpoint timestamp if no checkpoints have run, +or \c oldest_reader if there are no active transactions. | Timestamp | Constraints | Description | |-----------|-------------|-------------| | all_durable | None | The largest timestamp such that all timestamps up to that value have been made durable (see @ref timestamp_prepare for discussion of the durable timestamp). | -| last_checkpoint | <= stable | The stable timestamp at which the last checkpoint ran (or 0 if no checkpoints have run). | +| last_checkpoint | <= stable | The stable timestamp at which the last checkpoint ran. | | oldest_reader | None | The timestamp of the oldest currently active read transaction. | | oldest_timestamp | <= stable | The current application-set \c oldest_timestamp value. | | pinned | <= oldest | The minimum of the \c oldest_timestamp and the oldest active reader. | -| recovery | <= stable | The stable timestamp used in the most recent checkpoint prior to the last shutdown (or 0 if none available). | +| recovery | <= stable | The stable timestamp used in the most recent checkpoint prior to the last shutdown. | | stable_timestamp | None | The current application-set \c stable_timestamp value. | -In all cases, ::WT_NOTFOUND is returned if there is no matching timestamp. - @subsection timestamp_global_query_api_all_durable Reading the "all_durable" timestamp