Skip to content

Commit

Permalink
Import wiredtiger: c1dde2389d34cf4bc0ccfbc5e6e1136f3dbc8ae9 from bran…
Browse files Browse the repository at this point in the history
…ch mongodb-master

ref: 15e567db3a..c1dde2389d
for: 7.2.0-rc0

WT-11772 Only rollback txn when the target has been reached in the cppsuite
  • Loading branch information
ruby-oujo authored and Evergreen Agent committed Oct 9, 2023
1 parent 915b78f commit 6f9b82e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/third_party/wiredtiger/import.data
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"vendor": "wiredtiger",
"github": "wiredtiger/wiredtiger.git",
"branch": "mongodb-master",
"commit": "15e567db3a1adbc9b520a479a9d99bd448a1bd9c"
"commit": "c1dde2389d34cf4bc0ccfbc5e6e1136f3dbc8ae9"
}
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ database_operation::read_operation(thread_worker *tc)
testutil_die(ret, "Unexpected error returned from cursor->next()");
}
tc->txn.add_op();
tc->txn.try_rollback();
if (tc->txn.get_op_count() >= tc->txn.get_target_op_count())
tc->txn.rollback();
tc->sleep();
}
/* Reset our cursor to avoid pinning content. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ transaction::try_rollback(const std::string &config)
rollback(config);
}

int64_t
transaction::get_op_count() const
{
return _op_count;
}

int64_t
transaction::get_target_op_count() const
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class transaction {
* the transaction.
*/
bool can_commit();
/* Get the current number of operations executed. */
int64_t get_op_count() const;
/* Get the number of operations this transaction needs before it can commit */
int64_t get_target_op_count() const;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ class bounded_cursor_prefix_search_near : public test {
ret, exact_prefix, key_prefix_str, cursor_default, generated_prefix);

tc->txn.add_op();
tc->txn.try_rollback();
if (tc->txn.get_op_count() >= tc->txn.get_target_op_count())
tc->txn.rollback();
tc->sleep();
}
testutil_check(cursor_prefix->reset(cursor_prefix.get()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,8 @@ class bounded_cursor_stress : public test {
testutil_assert(ret == 0 || ret == WT_ROLLBACK);
}
tc->txn.add_op();
tc->txn.try_rollback();
if (tc->txn.get_op_count() >= tc->txn.get_target_op_count())
tc->txn.rollback();
tc->sleep();
}
normal_cursor->reset(normal_cursor.get());
Expand Down

0 comments on commit 6f9b82e

Please sign in to comment.