summaryrefslogtreecommitdiff
path: root/src/include/cursor.i
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-12-09 15:58:28 +1100
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-12-09 15:58:28 +1100
commitbe364821d75c0c42169d79c486fa582c777f7082 (patch)
tree19fbf92ecc10835c4fdbbeb6009f9e5f8dff1c6d /src/include/cursor.i
parent7907694fe1a38612b958cf15be82082b3e356583 (diff)
downloadmongo-be364821d75c0c42169d79c486fa582c777f7082.tar.gz
Sweep old handles more aggressively:
1. don't have checkpoint or other periodic operations like statistics logging keep old handles alive; 2. don't wait for all sessions to empty the file from their cache before closing; 3. only update the time of death from the sweep thread.
Diffstat (limited to 'src/include/cursor.i')
-rw-r--r--src/include/cursor.i32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/include/cursor.i b/src/include/cursor.i
index 7716a16fe0b..737ac8dcdba 100644
--- a/src/include/cursor.i
+++ b/src/include/cursor.i
@@ -136,6 +136,38 @@ __curfile_leave(WT_CURSOR_BTREE *cbt)
}
/*
+ * __wt_cursor_dhandle_incr_use --
+ * Increment the in-use counter in cursor's data source.
+ */
+static inline void
+__wt_cursor_dhandle_incr_use(WT_SESSION_IMPL *session)
+{
+ WT_DATA_HANDLE *dhandle;
+
+ dhandle = session->dhandle;
+
+ /* If we open a handle with a time of death set, clear it. */
+ if (WT_ATOMIC_ADD4(dhandle->session_inuse, 1) == 1 &&
+ dhandle->timeofdeath != 0)
+ dhandle->timeofdeath = 0;
+}
+
+/*
+ * __wt_cursor_dhandle_decr_use --
+ * Decrement the in-use counter in cursor's data source.
+ */
+static inline void
+__wt_cursor_dhandle_decr_use(WT_SESSION_IMPL *session)
+{
+ WT_DATA_HANDLE *dhandle;
+
+ dhandle = session->dhandle;
+
+ WT_ASSERT(session, dhandle->session_inuse > 0);
+ (void)WT_ATOMIC_SUB4(dhandle->session_inuse, 1);
+}
+
+/*
* __cursor_func_init --
* Cursor call setup.
*/