summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/src/include/session.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/third_party/wiredtiger/src/include/session.h')
-rw-r--r--src/third_party/wiredtiger/src/include/session.h65
1 files changed, 41 insertions, 24 deletions
diff --git a/src/third_party/wiredtiger/src/include/session.h b/src/third_party/wiredtiger/src/include/session.h
index 0f3b2488e9f..1ece86b6ce0 100644
--- a/src/third_party/wiredtiger/src/include/session.h
+++ b/src/third_party/wiredtiger/src/include/session.h
@@ -37,6 +37,14 @@ struct __wt_hazard {
#define S2BT(session) ((WT_BTREE *)(session)->dhandle->handle)
#define S2BT_SAFE(session) ((session)->dhandle == NULL ? NULL : S2BT(session))
+typedef TAILQ_HEAD(__wt_cursor_list, __wt_cursor) WT_CURSOR_LIST;
+
+/* Number of cursors cached to trigger sweep. */
+#define WT_SESSION_CURSOR_SWEEP_COUNTDOWN 20
+
+/* Maximum number of buckets to visit during sweep. */
+#define WT_SESSION_CURSOR_SWEEP_MAX 32
+
/*
* WT_SESSION_IMPL --
* Implementation of WT_SESSION.
@@ -68,8 +76,9 @@ struct __wt_session_impl {
time_t last_sweep; /* Last sweep for dead handles */
struct timespec last_epoch; /* Last epoch time returned */
- /* Cursors closed with the session */
- TAILQ_HEAD(__cursors, __wt_cursor) cursors;
+ WT_CURSOR_LIST cursors; /* Cursors closed with the session */
+ uint32_t cursor_sweep_position; /* Position in cursor_cache for sweep */
+ uint32_t cursor_sweep_countdown;/* Countdown to cursor sweep */
WT_CURSOR_BACKUP *bkp_cursor; /* Hot backup cursor */
@@ -149,28 +158,30 @@ struct __wt_session_impl {
u_int stat_bucket; /* Statistics bucket offset */
/* AUTOMATIC FLAG VALUE GENERATION START */
-#define WT_SESSION_CAN_WAIT 0x000001u
-#define WT_SESSION_IGNORE_CACHE_SIZE 0x000002u
-#define WT_SESSION_INTERNAL 0x000004u
-#define WT_SESSION_LOCKED_CHECKPOINT 0x000008u
-#define WT_SESSION_LOCKED_HANDLE_LIST_READ 0x000010u
-#define WT_SESSION_LOCKED_HANDLE_LIST_WRITE 0x000020u
-#define WT_SESSION_LOCKED_METADATA 0x000040u
-#define WT_SESSION_LOCKED_PASS 0x000080u
-#define WT_SESSION_LOCKED_SCHEMA 0x000100u
-#define WT_SESSION_LOCKED_SLOT 0x000200u
-#define WT_SESSION_LOCKED_TABLE_READ 0x000400u
-#define WT_SESSION_LOCKED_TABLE_WRITE 0x000800u
-#define WT_SESSION_LOCKED_TURTLE 0x001000u
-#define WT_SESSION_LOGGING_INMEM 0x002000u
-#define WT_SESSION_LOOKASIDE_CURSOR 0x004000u
-#define WT_SESSION_NO_DATA_HANDLES 0x008000u
-#define WT_SESSION_NO_LOGGING 0x010000u
-#define WT_SESSION_NO_RECONCILE 0x020000u
-#define WT_SESSION_NO_SCHEMA_LOCK 0x040000u
-#define WT_SESSION_QUIET_CORRUPT_FILE 0x080000u
-#define WT_SESSION_READ_WONT_NEED 0x100000u
-#define WT_SESSION_SERVER_ASYNC 0x200000u
+#define WT_SESSION_CACHE_CURSORS 0x000001u
+#define WT_SESSION_CAN_WAIT 0x000002u
+#define WT_SESSION_IGNORE_CACHE_SIZE 0x000004u
+#define WT_SESSION_INTERNAL 0x000008u
+#define WT_SESSION_LOCKED_CHECKPOINT 0x000010u
+#define WT_SESSION_LOCKED_HANDLE_LIST_READ 0x000020u
+#define WT_SESSION_LOCKED_HANDLE_LIST_WRITE 0x000040u
+#define WT_SESSION_LOCKED_METADATA 0x000080u
+#define WT_SESSION_LOCKED_PASS 0x000100u
+#define WT_SESSION_LOCKED_SCHEMA 0x000200u
+#define WT_SESSION_LOCKED_SLOT 0x000400u
+#define WT_SESSION_LOCKED_TABLE_READ 0x000800u
+#define WT_SESSION_LOCKED_TABLE_WRITE 0x001000u
+#define WT_SESSION_LOCKED_TURTLE 0x002000u
+#define WT_SESSION_LOGGING_INMEM 0x004000u
+#define WT_SESSION_LOOKASIDE_CURSOR 0x008000u
+#define WT_SESSION_NO_DATA_HANDLES 0x010000u
+#define WT_SESSION_NO_LOGGING 0x020000u
+#define WT_SESSION_NO_RECONCILE 0x040000u
+#define WT_SESSION_NO_SCHEMA_LOCK 0x080000u
+#define WT_SESSION_QUIET_CORRUPT_FILE 0x100000u
+#define WT_SESSION_READ_WONT_NEED 0x200000u
+#define WT_SESSION_SCHEMA_TXN 0x400000u
+#define WT_SESSION_SERVER_ASYNC 0x800000u
/* AUTOMATIC FLAG VALUE GENERATION STOP */
uint32_t flags;
@@ -187,6 +198,12 @@ struct __wt_session_impl {
*/
WT_RAND_STATE rnd; /* Random number generation state */
+ /*
+ * Hash tables are allocated lazily as sessions are used to keep the
+ * size of this structure from growing too large.
+ */
+ WT_CURSOR_LIST *cursor_cache; /* Hash table of cached cursors */
+
/* Hashed handle reference list array */
TAILQ_HEAD(__dhandles_hash, __wt_data_handle_cache) *dhhash;