summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2022-01-11 16:22:18 +1100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-11 05:52:02 +0000
commit2c0f2afab443b792eccc5d57fdd132a5277def6a (patch)
treecc46bc40760e5717d8a5afbc843a6850e6739e57
parent35ba992f21b194fe577cf9069a1591d5d374d29f (diff)
downloadmongo-2c0f2afab443b792eccc5d57fdd132a5277def6a.tar.gz
Import wiredtiger: 799d1c7ff250039f4b22133aa94a996a538a2b1d from branch mongodb-5.2
ref: be77e03902..799d1c7ff2 for: 5.2.0-rc5 WT-8649 WT_SESSION methods cannot release scratch buffers unless reset or closing
-rw-r--r--src/third_party/wiredtiger/import.data2
-rw-r--r--src/third_party/wiredtiger/src/session/session_api.c22
2 files changed, 16 insertions, 8 deletions
diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data
index 0eeac142708..48f03c88099 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-5.2",
- "commit": "be77e039023f314b8c12ef131adaf628c296975f"
+ "commit": "799d1c7ff250039f4b22133aa94a996a538a2b1d"
}
diff --git a/src/third_party/wiredtiger/src/session/session_api.c b/src/third_party/wiredtiger/src/session/session_api.c
index 55d1619c1cc..c4849473513 100644
--- a/src/third_party/wiredtiger/src/session/session_api.c
+++ b/src/third_party/wiredtiger/src/session/session_api.c
@@ -159,9 +159,18 @@ int
__wt_session_release_resources(WT_SESSION_IMPL *session)
{
WT_DECL_RET;
+ bool done;
+
+ /*
+ * Called when sessions are reset and closed, and when heavy-weight session methods or functions
+ * complete (for example, checkpoint and compact). If the session has no open cursors discard it
+ * all; if there are cursors, discard what we can safely clean out.
+ */
+ done = TAILQ_FIRST(&session->cursors) == NULL;
/* Transaction cleanup */
- __wt_txn_release_resources(session);
+ if (done)
+ __wt_txn_release_resources(session);
/* Block manager cleanup */
if (session->block_manager_cleanup != NULL)
@@ -174,12 +183,11 @@ __wt_session_release_resources(WT_SESSION_IMPL *session)
/* Stashed memory. */
__wt_stash_discard(session);
- /*
- * Discard scratch buffers, error memory; last, just in case a cleanup routine uses scratch
- * buffers.
- */
- __wt_scr_discard(session);
- __wt_buf_free(session, &session->err);
+ /* Scratch buffers and error memory. */
+ if (done) {
+ __wt_scr_discard(session);
+ __wt_buf_free(session, &session->err);
+ }
return (ret);
}