summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger
diff options
context:
space:
mode:
authorWill Korteland <will.korteland@mongodb.com>2022-02-10 04:19:50 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-02-10 05:45:13 +0000
commit68729ecf131ddddf7f121730c015e8804ded4105 (patch)
tree682d7e16c4fe044ca99650324ffa60b90f4965f0 /src/third_party/wiredtiger
parent51e24ccfd0d9c0e130ad19e816bb8917faa94bf1 (diff)
downloadmongo-68729ecf131ddddf7f121730c015e8804ded4105.tar.gz
Import wiredtiger: 9c99e00c5ed50907c5240d94b95c2e280b230123 from branch mongodb-master
ref: a8fc0585a8..9c99e00c5e for: 5.3.0 WT-8790 Only allow read-only transactions in reset_snapshot
Diffstat (limited to 'src/third_party/wiredtiger')
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/btree/bt_read.c7
-rw-r--r--src/third_party/wiredtiger/src/include/wiredtiger.in16
-rw-r--r--src/third_party/wiredtiger/src/session/session_api.c11
-rw-r--r--src/third_party/wiredtiger/test/suite/test_isolation01.py8
5 files changed, 25 insertions, 19 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index d8a1e920982..650c04ba5d0 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": "a8fc0585a88327cf107e71b2232f088fb87447b4"
+ "commit": "9c99e00c5ed50907c5240d94b95c2e280b230123"
}
diff --git a/src/third_party/wiredtiger/src/btree/bt_read.c b/src/third_party/wiredtiger/src/btree/bt_read.c
index b7126eaf218..6c771be480a 100644
--- a/src/third_party/wiredtiger/src/btree/bt_read.c
+++ b/src/third_party/wiredtiger/src/btree/bt_read.c
@@ -197,12 +197,14 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags
WT_BTREE *btree;
WT_DECL_RET;
WT_PAGE *page;
+ WT_TXN *txn;
uint64_t sleep_usecs, yield_cnt;
uint8_t current_state;
int force_attempts;
bool busy, cache_work, evict_skip, stalled, wont_need;
btree = S2BT(session);
+ txn = session->txn;
if (F_ISSET(session, WT_SESSION_IGNORE_CACHE_SIZE))
LF_SET(WT_READ_IGNORE_CACHE_SIZE);
@@ -221,7 +223,7 @@ __wt_page_in_func(WT_SESSION_IMPL *session, WT_REF *ref, uint32_t flags
if (LF_ISSET(WT_READ_NO_WAIT))
return (WT_NOTFOUND);
if (LF_ISSET(WT_READ_SKIP_DELETED) &&
- __wt_delete_page_skip(session, ref, !F_ISSET(session->txn, WT_TXN_HAS_SNAPSHOT)))
+ __wt_delete_page_skip(session, ref, !F_ISSET(txn, WT_TXN_HAS_SNAPSHOT)))
return (WT_NOTFOUND);
goto read;
case WT_REF_DISK:
@@ -234,8 +236,7 @@ read:
* space in the cache.
*/
if (!LF_ISSET(WT_READ_IGNORE_CACHE_SIZE))
- WT_RET(__wt_cache_eviction_check(
- session, true, !F_ISSET(session->txn, WT_TXN_HAS_ID), NULL));
+ WT_RET(__wt_cache_eviction_check(session, true, txn->mod_count == 0, NULL));
WT_RET(__page_read(session, ref, flags));
/* We just read a page, don't evict it before we have a chance to use it. */
diff --git a/src/third_party/wiredtiger/src/include/wiredtiger.in b/src/third_party/wiredtiger/src/include/wiredtiger.in
index 3ea3b4b0a21..2d9203f6d39 100644
--- a/src/third_party/wiredtiger/src/include/wiredtiger.in
+++ b/src/third_party/wiredtiger/src/include/wiredtiger.in
@@ -1811,14 +1811,14 @@ struct __wt_session {
/*!
* Reset the snapshot.
*
- * This method resets snapshots for snapshot isolation transactions to
- * update their existing snapshot. It raises an error when this API
- * is used for isolation other than snapshot isolation mode or when the session
- * has performed any write operations.
- * This API internally releases the current snapshot and gets the new running
- * transactions snapshot to avoid pinning the content in the database that is no
- * longer needed. Applications that don't use read_timestamp for the search may
- * see different results compared to earlier with the updated snapshot.
+ * This method resets snapshots for snapshot isolation transactions to update their existing
+ * snapshot. It raises an error when this API is used in an isolation other than snapshot,
+ * or when the transaction has performed any write operations.
+ *
+ * This API internally releases the current snapshot and gets the new running transactions
+ * snapshot to avoid pinning the content in the database that is no longer needed.
+ * Applications not using read timestamps for search may see different results after the
+ * snapshot is updated.
*
* @requires_transaction
*
diff --git a/src/third_party/wiredtiger/src/session/session_api.c b/src/third_party/wiredtiger/src/session/session_api.c
index 31caa1d4fbd..3175847766d 100644
--- a/src/third_party/wiredtiger/src/session/session_api.c
+++ b/src/third_party/wiredtiger/src/session/session_api.c
@@ -1832,16 +1832,19 @@ static int
__session_reset_snapshot(WT_SESSION *wt_session)
{
WT_SESSION_IMPL *session;
+ WT_TXN *txn;
session = (WT_SESSION_IMPL *)wt_session;
+ txn = session->txn;
+
/* Return error if the isolation mode is read committed. */
- if (session->txn->isolation != WT_ISO_SNAPSHOT)
+ if (txn->isolation != WT_ISO_SNAPSHOT)
WT_RET_MSG(
- session, ENOTSUP, "not supported in read-committed or read-uncommitted transactions.");
+ session, ENOTSUP, "not supported in read-committed or read-uncommitted transactions");
/* Return error if the session has performed any write operations. */
- if (F_ISSET(session->txn, WT_TXN_HAS_ID))
- WT_RET_MSG(session, ENOTSUP, "not supported in write transactions.");
+ if (txn->mod_count != 0)
+ WT_RET_MSG(session, ENOTSUP, "only supported before a transaction makes modifications");
__wt_txn_release_snapshot(session);
__wt_txn_get_snapshot(session);
diff --git a/src/third_party/wiredtiger/test/suite/test_isolation01.py b/src/third_party/wiredtiger/test/suite/test_isolation01.py
index 84e8523f59b..9145ddc99c3 100644
--- a/src/third_party/wiredtiger/test/suite/test_isolation01.py
+++ b/src/third_party/wiredtiger/test/suite/test_isolation01.py
@@ -65,10 +65,11 @@ class test_isolation01(wttest.WiredTigerTestCase):
if self.isolation == 'snapshot':
self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
- lambda: self.session.reset_snapshot(), "/not supported in write transactions/")
+ lambda: self.session.reset_snapshot(), "/only supported before .* modifications/")
else:
self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
- lambda: self.session.reset_snapshot(), "/not supported in read-committed or read-uncommitted transactions/")
+ lambda: self.session.reset_snapshot(),
+ "/not supported in read-committed or read-uncommitted transactions/")
self.session.commit_transaction()
cursor2 = self.session.open_cursor(self.uri, None)
@@ -79,7 +80,8 @@ class test_isolation01(wttest.WiredTigerTestCase):
self.session.reset_snapshot()
else:
self.assertRaisesWithMessage(wiredtiger.WiredTigerError,
- lambda: self.session.reset_snapshot(), "/not supported in read-committed or read-uncommitted transactions/")
+ lambda: self.session.reset_snapshot(),
+ "/not supported in read-committed or read-uncommitted transactions/")
if __name__ == '__main__':
wttest.run()