summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsueloverso <sue@mongodb.com>2016-06-23 00:52:03 -0400
committerMichael Cahill <michael.cahill@mongodb.com>2016-06-23 14:52:03 +1000
commit5d5082d1bddb2bf52aa7dc3b9f04518ac0313ca8 (patch)
tree1fc915b42cbffca782de7f6322b27d154268d129
parent116e41e5e1960db6855c4202a971107d5aff642d (diff)
downloadmongo-5d5082d1bddb2bf52aa7dc3b9f04518ac0313ca8.tar.gz
WT-2724 Pass in session address, not pointer to it. (#2827)
Also assert that eviction workers don't exit earlier than expected.
-rw-r--r--dist/flags.py1
-rw-r--r--src/evict/evict_lru.c9
-rw-r--r--src/include/flags.h15
-rw-r--r--src/txn/txn_recover.c2
4 files changed, 19 insertions, 8 deletions
diff --git a/dist/flags.py b/dist/flags.py
index 03c0314237b..b5f36fb707a 100644
--- a/dist/flags.py
+++ b/dist/flags.py
@@ -98,6 +98,7 @@ flags = {
'CONN_LSM_MERGE',
'CONN_PANIC',
'CONN_READONLY',
+ 'CONN_RECOVERING',
'CONN_SERVER_ASYNC',
'CONN_SERVER_CHECKPOINT',
'CONN_SERVER_LSM',
diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c
index b5f62f8ab87..748b51acccd 100644
--- a/src/evict/evict_lru.c
+++ b/src/evict/evict_lru.c
@@ -232,6 +232,13 @@ __evict_thread_run(void *arg)
WT_ERR(__wt_verbose(
session, WT_VERB_EVICTSERVER, "cache eviction thread exiting"));
+ /*
+ * The only two cases when eviction workers are expected to stop are
+ * when recovery is finished or when the connection is closing. Check
+ * otherwise fewer eviction worker threads may be running than
+ * expected.
+ */
+ WT_ASSERT(session, F_ISSET(conn, WT_CONN_CLOSING | WT_CONN_RECOVERING));
if (0) {
err: WT_PANIC_MSG(session, ret, "cache eviction thread error");
}
@@ -363,7 +370,7 @@ __evict_workers_resize(WT_SESSION_IMPL *session)
F_SET(&workers[i], WT_EVICT_WORKER_RUN);
WT_ERR(__wt_thread_create(workers[i].session,
&workers[i].tid, __evict_thread_run,
- &workers[i].session));
+ workers[i].session));
}
}
diff --git a/src/include/flags.h b/src/include/flags.h
index 278d578251a..f134af69d29 100644
--- a/src/include/flags.h
+++ b/src/include/flags.h
@@ -13,13 +13,14 @@
#define WT_CONN_LSM_MERGE 0x00000100
#define WT_CONN_PANIC 0x00000200
#define WT_CONN_READONLY 0x00000400
-#define WT_CONN_SERVER_ASYNC 0x00000800
-#define WT_CONN_SERVER_CHECKPOINT 0x00001000
-#define WT_CONN_SERVER_LSM 0x00002000
-#define WT_CONN_SERVER_RUN 0x00004000
-#define WT_CONN_SERVER_STATISTICS 0x00008000
-#define WT_CONN_SERVER_SWEEP 0x00010000
-#define WT_CONN_WAS_BACKUP 0x00020000
+#define WT_CONN_RECOVERING 0x00000800
+#define WT_CONN_SERVER_ASYNC 0x00001000
+#define WT_CONN_SERVER_CHECKPOINT 0x00002000
+#define WT_CONN_SERVER_LSM 0x00004000
+#define WT_CONN_SERVER_RUN 0x00008000
+#define WT_CONN_SERVER_STATISTICS 0x00010000
+#define WT_CONN_SERVER_SWEEP 0x00020000
+#define WT_CONN_WAS_BACKUP 0x00040000
#define WT_EVICTING 0x00000001
#define WT_EVICT_IN_MEMORY 0x00000002
#define WT_EVICT_LOOKASIDE 0x00000004
diff --git a/src/txn/txn_recover.c b/src/txn/txn_recover.c
index 1ea4dba1152..bd004e0f837 100644
--- a/src/txn/txn_recover.c
+++ b/src/txn/txn_recover.c
@@ -424,6 +424,7 @@ __wt_txn_recover(WT_SESSION_IMPL *session)
false, WT_SESSION_NO_LOGGING, &session));
r.session = session;
+ F_SET(conn, WT_CONN_RECOVERING);
WT_ERR(__wt_metadata_search(session, WT_METAFILE_URI, &config));
WT_ERR(__recovery_setup_file(&r, WT_METAFILE_URI, config));
WT_ERR(__wt_metadata_cursor_open(session, NULL, &metac));
@@ -566,6 +567,7 @@ err: WT_TRET(__recovery_free(&r));
WT_TRET(__wt_evict_destroy(session));
WT_TRET(session->iface.close(&session->iface, NULL));
+ F_CLR(conn, WT_CONN_RECOVERING);
return (ret);
}