diff options
author | Michael Cahill <michael.cahill@wiredtiger.com> | 2015-02-04 11:34:24 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@wiredtiger.com> | 2015-02-04 11:34:24 +1100 |
commit | fcd5b44200c4ff2d0ccae7b254c318b0996da567 (patch) | |
tree | 5cb816a8aa7ca88ab2854a0f2e603ad6845c883c | |
parent | 57121e153cc0fb6b932b345ab5494b181dbb85d6 (diff) | |
download | mongo-fcd5b44200c4ff2d0ccae7b254c318b0996da567.tar.gz |
Take more care to clear dhandle->timeofdeath: we sometimes seem to be sweeping handles while a workload is still running.
-rw-r--r-- | src/conn/conn_sweep.c | 8 | ||||
-rw-r--r-- | src/include/cursor.i | 5 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/conn/conn_sweep.c b/src/conn/conn_sweep.c index 01f08aa5f07..a5bd8e1343c 100644 --- a/src/conn/conn_sweep.c +++ b/src/conn/conn_sweep.c @@ -32,14 +32,14 @@ __sweep(WT_SESSION_IMPL *session) dhandle_next = SLIST_NEXT(dhandle, l); if (WT_IS_METADATA(dhandle)) continue; - if (dhandle->session_inuse == 0 && dhandle->timeofdeath == 0) { + if (dhandle->session_inuse != 0 || + now <= dhandle->timeofdeath + WT_DHANDLE_SWEEP_WAIT) + continue; + if (dhandle->timeofdeath == 0) { dhandle->timeofdeath = now; WT_STAT_FAST_CONN_INCR(session, dh_conn_tod); continue; } - if (dhandle->session_inuse != 0 || - now <= dhandle->timeofdeath + WT_DHANDLE_SWEEP_WAIT) - continue; /* * We have a candidate for closing; if it's open, acquire an diff --git a/src/include/cursor.i b/src/include/cursor.i index 8fa9790e096..d261635706e 100644 --- a/src/include/cursor.i +++ b/src/include/cursor.i @@ -164,8 +164,11 @@ __wt_cursor_dhandle_decr_use(WT_SESSION_IMPL *session) dhandle = session->dhandle; + /* If we close a handle with a time of death set, clear it. */ WT_ASSERT(session, dhandle->session_inuse > 0); - (void)WT_ATOMIC_SUB4(dhandle->session_inuse, 1); + if (WT_ATOMIC_SUB4(dhandle->session_inuse, 1) == 0 && + dhandle->timeofdeath != 0) + dhandle->timeofdeath = 0; } /* |