diff options
author | Etienne Petrel <etienne.petrel@mongodb.com> | 2022-06-21 23:16:06 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-06-21 23:44:39 +0000 |
commit | ffd6a96e6b1a16f58829252b29ff7f23519c0c8d (patch) | |
tree | e0b82766f0192f24cefed52b835a9e41892de82b /src/third_party | |
parent | 2abe0858f7c3365aa53bd67943b02cfcf579a15f (diff) | |
download | mongo-ffd6a96e6b1a16f58829252b29ff7f23519c0c8d.tar.gz |
Import wiredtiger: eabc335ef595d527a422d6545407a0a052899df3 from branch mongodb-master
ref: 3fc284f161..eabc335ef5
for: 6.1.0-rc0
WT-9388 Pass thread worker session into set_tracking_cursor
Diffstat (limited to 'src/third_party')
7 files changed, 29 insertions, 26 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index 869276528e5..08a61885488 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": "3fc284f1616134fae02adcc73288e95a06122899" + "commit": "eabc335ef595d527a422d6545407a0a052899df3" } diff --git a/src/third_party/wiredtiger/test/cppsuite/configs/cache_resize_default.txt b/src/third_party/wiredtiger/test/cppsuite/configs/cache_resize_default.txt index 5ac46d6b25a..ceadb982b2c 100644 --- a/src/third_party/wiredtiger/test/cppsuite/configs/cache_resize_default.txt +++ b/src/third_party/wiredtiger/test/cppsuite/configs/cache_resize_default.txt @@ -37,5 +37,5 @@ operation_tracker= # Timestamp, transaction id, tracking_key_format=QQ, # Operation type, cache size - tracking_value_format=iS + tracking_value_format=iQ )
\ No newline at end of file diff --git a/src/third_party/wiredtiger/test/cppsuite/src/component/operation_tracker.cpp b/src/third_party/wiredtiger/test/cppsuite/src/component/operation_tracker.cpp index aa997875dab..ade74bf7b1c 100644 --- a/src/third_party/wiredtiger/test/cppsuite/src/component/operation_tracker.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/operation_tracker.cpp @@ -193,7 +193,7 @@ operation_tracker::save_schema_operation( } int -operation_tracker::save_operation(const uint64_t txn_id, const tracking_operation &operation, +operation_tracker::save_operation(WT_SESSION *session, const tracking_operation &operation, const uint64_t &collection_id, const std::string &key, const std::string &value, wt_timestamp_t ts, scoped_cursor &op_track_cursor) { @@ -210,15 +210,15 @@ operation_tracker::save_operation(const uint64_t txn_id, const tracking_operatio "save_operation: invalid operation " + std::to_string(static_cast<int>(operation)); testutil_die(EINVAL, error_message.c_str()); } else { - set_tracking_cursor(txn_id, operation, collection_id, key, value, ts, op_track_cursor); + set_tracking_cursor(session, operation, collection_id, key, value, ts, op_track_cursor); ret = op_track_cursor->insert(op_track_cursor.get()); } return (ret); } -/* Note that the transaction id is not used in the default implementation of the tracking table. */ +/* Note that session is not used in the default implementation of the tracking table. */ void -operation_tracker::set_tracking_cursor(const uint64_t txn_id, const tracking_operation &operation, +operation_tracker::set_tracking_cursor(WT_SESSION *session, const tracking_operation &operation, const uint64_t &collection_id, const std::string &key, const std::string &value, wt_timestamp_t ts, scoped_cursor &op_track_cursor) { diff --git a/src/third_party/wiredtiger/test/cppsuite/src/component/operation_tracker.h b/src/third_party/wiredtiger/test/cppsuite/src/component/operation_tracker.h index 07e1a711a03..c4331501fe1 100644 --- a/src/third_party/wiredtiger/test/cppsuite/src/component/operation_tracker.h +++ b/src/third_party/wiredtiger/test/cppsuite/src/component/operation_tracker.h @@ -75,11 +75,11 @@ class operation_tracker : public component { void save_schema_operation( const tracking_operation &operation, const uint64_t &collection_id, wt_timestamp_t ts); - virtual void set_tracking_cursor(const uint64_t txn_id, const tracking_operation &operation, + virtual void set_tracking_cursor(WT_SESSION *session, const tracking_operation &operation, const uint64_t &collection_id, const std::string &key, const std::string &value, wt_timestamp_t ts, scoped_cursor &op_track_cursor); - int save_operation(const uint64_t txn_id, const tracking_operation &operation, + int save_operation(WT_SESSION *session, const tracking_operation &operation, const uint64_t &collection_id, const std::string &key, const std::string &value, wt_timestamp_t ts, scoped_cursor &op_track_cursor); diff --git a/src/third_party/wiredtiger/test/cppsuite/src/main/thread_worker.cpp b/src/third_party/wiredtiger/test/cppsuite/src/main/thread_worker.cpp index cacaa0f509a..5cf57d73944 100644 --- a/src/third_party/wiredtiger/test/cppsuite/src/main/thread_worker.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/src/main/thread_worker.cpp @@ -120,9 +120,8 @@ thread_worker::update( testutil_die(ret, "unhandled error while trying to update a key"); } - uint64_t txn_id = ((WT_SESSION_IMPL *)session.get())->txn->id; ret = op_tracker->save_operation( - txn_id, tracking_operation::INSERT, collection_id, key, value, ts, op_track_cursor); + session.get(), tracking_operation::INSERT, collection_id, key, value, ts, op_track_cursor); if (ret == 0) txn.add_op(); @@ -162,9 +161,8 @@ thread_worker::insert( testutil_die(ret, "unhandled error while trying to insert a key"); } - uint64_t txn_id = ((WT_SESSION_IMPL *)session.get())->txn->id; ret = op_tracker->save_operation( - txn_id, tracking_operation::INSERT, collection_id, key, value, ts, op_track_cursor); + session.get(), tracking_operation::INSERT, collection_id, key, value, ts, op_track_cursor); if (ret == 0) txn.add_op(); @@ -200,9 +198,8 @@ thread_worker::remove(scoped_cursor &cursor, uint64_t collection_id, const std:: testutil_die(ret, "unhandled error while trying to remove a key"); } - uint64_t txn_id = ((WT_SESSION_IMPL *)session.get())->txn->id; ret = op_tracker->save_operation( - txn_id, tracking_operation::DELETE_KEY, collection_id, key, "", ts, op_track_cursor); + session.get(), tracking_operation::DELETE_KEY, collection_id, key, "", ts, op_track_cursor); if (ret == 0) txn.add_op(); diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/cache_resize.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/cache_resize.cpp index f1254b1de24..68744f554f4 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/cache_resize.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/cache_resize.cpp @@ -45,12 +45,21 @@ class operation_tracker_cache_resize : public operation_tracker { } void - set_tracking_cursor(const uint64_t txn_id, const tracking_operation &operation, - const uint64_t &, const std::string &, const std::string &value, wt_timestamp_t ts, + set_tracking_cursor(WT_SESSION *session, const tracking_operation &operation, const uint64_t &, + const std::string &, const std::string &value, wt_timestamp_t ts, scoped_cursor &op_track_cursor) override final { + uint64_t txn_id = ((WT_SESSION_IMPL *)session)->txn->id; + /* + * The cache_size may have been changed between the time we make an insert to the DB and + * when we write the details to the tracking table, as such we can't take cache_size from + * the connection. Instead, write the cache size as part of the atomic insert into the DB + * and when populating the tracking table take it from there. + */ + uint64_t cache_size = std::stoull(value); + op_track_cursor->set_key(op_track_cursor.get(), ts, txn_id); - op_track_cursor->set_value(op_track_cursor.get(), operation, value.c_str()); + op_track_cursor->set_value(op_track_cursor.get(), operation, cache_size); } }; @@ -103,12 +112,9 @@ class cache_resize : public test { const std::string key; const std::string value = std::to_string(new_cache_size); - /* Retrieve the current transaction id. */ - uint64_t txn_id = ((WT_SESSION_IMPL *)tc->session.get())->txn->id; - /* Save the change of cache size in the tracking table. */ tc->txn.begin(); - int ret = tc->op_tracker->save_operation(txn_id, tracking_operation::CUSTOM, + int ret = tc->op_tracker->save_operation(tc->session.get(), tracking_operation::CUSTOM, collection_id, key, value, tc->tsm->get_next_ts(), tc->op_track_cursor); if (ret == 0) @@ -188,7 +194,7 @@ class cache_resize : public test { uint64_t tracked_ts, tracked_txn_id; int tracked_op_type; - const char *tracked_cache_size; + uint64_t tracked_cache_size; testutil_check(cursor->get_key(cursor.get(), &tracked_ts, &tracked_txn_id)); testutil_check(cursor->get_value(cursor.get(), &tracked_op_type, &tracked_cache_size)); @@ -196,7 +202,7 @@ class cache_resize : public test { logger::log_msg(LOG_TRACE, "Timestamp: " + std::to_string(tracked_ts) + ", transaction id: " + std::to_string(tracked_txn_id) + - ", cache size: " + std::to_string(std::stoull(tracked_cache_size))); + ", cache size: " + std::to_string(tracked_cache_size)); tracking_operation op_type = static_cast<tracking_operation>(tracked_op_type); /* There are only two types of operation tracked. */ @@ -226,7 +232,7 @@ class cache_resize : public test { /* * FIXME-WT-9339 - Save the last cache size seen by the transaction. * - * cache_size = std::stoull(tracked_cache_size); + * cache_size = tracked_cache_size; */ ++num_records; } diff --git a/src/third_party/wiredtiger/test/cppsuite/tests/test_template.cpp b/src/third_party/wiredtiger/test/cppsuite/tests/test_template.cpp index 217e90c3aae..ee75735152d 100644 --- a/src/third_party/wiredtiger/test/cppsuite/tests/test_template.cpp +++ b/src/third_party/wiredtiger/test/cppsuite/tests/test_template.cpp @@ -42,13 +42,13 @@ class operation_tracker_template : public operation_tracker { } void - set_tracking_cursor(const uint64_t txn_id, const tracking_operation &operation, + set_tracking_cursor(WT_SESSION *session, const tracking_operation &operation, const uint64_t &collection_id, const std::string &key, const std::string &value, wt_timestamp_t ts, scoped_cursor &op_track_cursor) override final { /* You can replace this call to define your own tracking table contents. */ operation_tracker::set_tracking_cursor( - txn_id, operation, collection_id, key, value, ts, op_track_cursor); + session, operation, collection_id, key, value, ts, op_track_cursor); } }; |