summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/session/session_api.c
diff options
context:
space:
mode:
authorEtienne Petrel <etienne.petrel@mongodb.com>2021-11-18 14:43:46 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-11-18 15:39:41 +0000
commit63639d4b9348c7a9943ab38121c5701b8dc09892 (patch)
tree5047ac77eb656f166da75860f144aad4f405aa94 /src/third_party/wiredtiger/src/session/session_api.c
parent041cb777961858638cbb834015d24d6bc2f2fd08 (diff)
downloadmongo-63639d4b9348c7a9943ab38121c5701b8dc09892.tar.gz
Import wiredtiger: 73e6a5f9733205d2b0c1d58a78480fc2f5b08085 from branch mongodb-master
ref: 76bac330da..73e6a5f973 for: 5.2.0 WT-8303 Implement weak hazard pointers
Diffstat (limited to 'src/third_party/wiredtiger/src/session/session_api.c')
-rw-r--r--src/third_party/wiredtiger/src/session/session_api.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/third_party/wiredtiger/src/session/session_api.c b/src/third_party/wiredtiger/src/session/session_api.c
index 74e2cdab612..ca4762298e2 100644
--- a/src/third_party/wiredtiger/src/session/session_api.c
+++ b/src/third_party/wiredtiger/src/session/session_api.c
@@ -191,6 +191,8 @@ __wt_session_release_resources(WT_SESSION_IMPL *session)
static void
__session_clear(WT_SESSION_IMPL *session)
{
+ WT_HAZARD_WEAK_ARRAY *wha;
+
/*
* There's no serialization support around the review of the hazard array, which means threads
* checking for hazard pointers first check the active field (which may be 0) and then use the
@@ -205,6 +207,11 @@ __session_clear(WT_SESSION_IMPL *session)
session->hazard_inuse = 0;
session->nhazard = 0;
+
+ for (wha = session->hazard_weak; wha != NULL; wha = wha->next) {
+ wha->hazard_inuse = 0;
+ wha->nhazard = 0;
+ }
}
/*
@@ -2064,6 +2071,13 @@ __open_session(WT_CONNECTION_IMPL *conn, WT_EVENT_HANDLER *event_handler, const
session_ret->hazard_size = WT_SESSION_INITIAL_HAZARD_SLOTS;
session_ret->hazard_inuse = 0;
session_ret->nhazard = 0;
+
+ WT_ERR(__wt_calloc(session, 1,
+ sizeof(WT_HAZARD_WEAK_ARRAY) + WT_SESSION_INITIAL_HAZARD_SLOTS * sizeof(WT_HAZARD_WEAK),
+ &session_ret->hazard_weak));
+ session_ret->hazard_weak->hazard_size = WT_SESSION_INITIAL_HAZARD_SLOTS;
+ session_ret->hazard_weak->hazard_inuse = 0;
+ session_ret->hazard_weak->nhazard = 0;
}
/*