diff options
author | Keith Bostic <keith@wiredtiger.com> | 2015-04-21 06:54:35 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2015-04-21 06:54:35 -0400 |
commit | b6eccf666cf5fe3248033047aac0daee2ec1c148 (patch) | |
tree | d7a0c3b9f63ab5135319c27413919cb973b7d4cc | |
parent | 2b072393cf184ff2486ab0f31fa57a5e2580a48d (diff) | |
parent | 83444a571c9704ee64164ecb892052493f891f1f (diff) | |
download | mongo-b6eccf666cf5fe3248033047aac0daee2ec1c148.tar.gz |
Merge branch 'develop' into merge-config-early
-rw-r--r-- | src/btree/bt_debug.c | 13 | ||||
-rw-r--r-- | src/conn/conn_cache.c | 16 | ||||
-rw-r--r-- | src/conn/conn_open.c | 4 | ||||
-rw-r--r-- | src/evict/evict_lru.c | 63 | ||||
-rw-r--r-- | src/log/log.c | 27 | ||||
-rw-r--r-- | test/format/ops.c | 4 |
6 files changed, 86 insertions, 41 deletions
diff --git a/src/btree/bt_debug.c b/src/btree/bt_debug.c index c9e0a62c8b6..e8e802ea74c 100644 --- a/src/btree/bt_debug.c +++ b/src/btree/bt_debug.c @@ -323,14 +323,23 @@ __wt_debug_disk( /* FALLTHROUGH */ case WT_PAGE_ROW_INT: case WT_PAGE_ROW_LEAF: - __dmsg(ds, ", entries %" PRIu32 "\n", dsk->u.entries); + __dmsg(ds, ", entries %" PRIu32, dsk->u.entries); break; case WT_PAGE_OVFL: - __dmsg(ds, ", datalen %" PRIu32 "\n", dsk->u.datalen); + __dmsg(ds, ", datalen %" PRIu32, dsk->u.datalen); break; WT_ILLEGAL_VALUE(session); } + if (F_ISSET(dsk, WT_PAGE_COMPRESSED)) + __dmsg(ds, ", compressed"); + if (F_ISSET(dsk, WT_PAGE_EMPTY_V_ALL)) + __dmsg(ds, ", empty-all"); + if (F_ISSET(dsk, WT_PAGE_EMPTY_V_NONE)) + __dmsg(ds, ", empty-none"); + + __dmsg(ds, ", generation %" PRIu64 "\n", dsk->write_gen); + switch (dsk->type) { case WT_PAGE_BLOCK_MANAGER: break; diff --git a/src/conn/conn_cache.c b/src/conn/conn_cache.c index a99e6d3ad20..8de8cd3f8bc 100644 --- a/src/conn/conn_cache.c +++ b/src/conn/conn_cache.c @@ -215,6 +215,22 @@ __wt_cache_destroy(WT_SESSION_IMPL *session) if (cache == NULL) return (0); + /* The cache should be empty at this point. Complain if not. */ + if (cache->pages_inmem != cache->pages_evict) + __wt_errx(session, + "cache server: exiting with %" PRIu64 " pages in " + "memory and %" PRIu64 " pages evicted", + cache->pages_inmem, cache->pages_evict); + if (cache->bytes_inmem != 0) + __wt_errx(session, + "cache server: exiting with %" PRIu64 " bytes in memory", + cache->bytes_inmem); + if (cache->bytes_dirty != 0 || cache->pages_dirty != 0) + __wt_errx(session, + "cache server: exiting with %" PRIu64 + " bytes dirty and %" PRIu64 " pages dirty", + cache->bytes_dirty, cache->pages_dirty); + WT_TRET(__wt_cond_destroy(session, &cache->evict_cond)); WT_TRET(__wt_cond_destroy(session, &cache->evict_waiter_cond)); __wt_spin_destroy(session, &cache->evict_lock); diff --git a/src/conn/conn_open.c b/src/conn/conn_open.c index 86f62e176ad..e0e59dea8ba 100644 --- a/src/conn/conn_open.c +++ b/src/conn/conn_open.c @@ -116,6 +116,7 @@ __wt_connection_close(WT_CONNECTION_IMPL *conn) WT_TRET(__wt_checkpoint_server_destroy(session)); WT_TRET(__wt_statlog_destroy(session, 1)); WT_TRET(__wt_sweep_destroy(session)); + WT_TRET(__wt_evict_destroy(session)); /* Close open data handles. */ WT_TRET(__wt_conn_dhandle_discard(session)); @@ -153,9 +154,6 @@ __wt_connection_close(WT_CONNECTION_IMPL *conn) fh = SLIST_FIRST(&conn->fhlh); } - /* Shut down the eviction server thread. */ - WT_TRET(__wt_evict_destroy(session)); - /* Disconnect from shared cache - must be before cache destroy. */ WT_TRET(__wt_conn_cache_pool_destroy(session)); diff --git a/src/evict/evict_lru.c b/src/evict/evict_lru.c index f658a62ddab..c50369f0e50 100644 --- a/src/evict/evict_lru.c +++ b/src/evict/evict_lru.c @@ -8,6 +8,7 @@ #include "wt_internal.h" +static int __evict_clear_all_walks(WT_SESSION_IMPL *); static int __evict_clear_walks(WT_SESSION_IMPL *); static int __evict_has_work(WT_SESSION_IMPL *, uint32_t *); static int WT_CDECL __evict_lru_cmp(const void *, const void *); @@ -211,24 +212,15 @@ __evict_server(void *arg) WT_ERR(__wt_verbose(session, WT_VERB_EVICTSERVER, "waking")); } + /* + * The eviction server is shutting down: in case any trees are still + * open, clear all walks now so that they can be closed. + */ + WT_ERR(__evict_clear_all_walks(session)); + WT_ERR(__wt_verbose( session, WT_VERB_EVICTSERVER, "cache eviction server exiting")); - if (cache->pages_inmem != cache->pages_evict) - __wt_errx(session, - "cache server: exiting with %" PRIu64 " pages in " - "memory and %" PRIu64 " pages evicted", - cache->pages_inmem, cache->pages_evict); - if (cache->bytes_inmem != 0) - __wt_errx(session, - "cache server: exiting with %" PRIu64 " bytes in memory", - cache->bytes_inmem); - if (cache->bytes_dirty != 0 || cache->pages_dirty != 0) - __wt_errx(session, - "cache server: exiting with %" PRIu64 - " bytes dirty and %" PRIu64 " pages dirty", - cache->bytes_dirty, cache->pages_dirty); - if (0) { err: WT_PANIC_MSG(session, ret, "cache eviction server error"); } @@ -322,7 +314,7 @@ __wt_evict_create(WT_SESSION_IMPL *session) /* * __wt_evict_destroy -- - * Destroy the eviction server thread. + * Destroy the eviction threads. */ int __wt_evict_destroy(WT_SESSION_IMPL *session) @@ -613,11 +605,12 @@ __evict_clear_walks(WT_SESSION_IMPL *session) } /* - * __evict_tree_walk_clear -- - * Clear the tree's current eviction point, acquiring the eviction lock. + * __evict_request_walk_clear -- + * Request that the eviction server clear the tree's current eviction + * point. */ static int -__evict_tree_walk_clear(WT_SESSION_IMPL *session) +__evict_request_walk_clear(WT_SESSION_IMPL *session) { WT_BTREE *btree; WT_CACHE *cache; @@ -640,6 +633,36 @@ __evict_tree_walk_clear(WT_SESSION_IMPL *session) } /* + * __evict_clear_all_walks -- + * Clear the eviction walk points for all file a session is waiting on. + */ +static int +__evict_clear_all_walks(WT_SESSION_IMPL *session) +{ + WT_BTREE *btree; + WT_CONNECTION_IMPL *conn; + WT_DATA_HANDLE *dhandle; + WT_DECL_RET; + WT_REF *ref; + + conn = S2C(session); + + SLIST_FOREACH(dhandle, &conn->dhlh, l) { + if (!WT_PREFIX_MATCH(dhandle->name, "file:")) + continue; + session->dhandle = dhandle; + btree = S2BT(session); + if ((ref = btree->evict_ref) != NULL) { + btree->evict_ref = NULL; + WT_TRET(__wt_page_release(session, ref, 0)); + } + session->dhandle = NULL; + } + + return (ret); +} + +/* * __wt_evict_page -- * Evict a given page. */ @@ -711,7 +734,7 @@ __wt_evict_file_exclusive_on(WT_SESSION_IMPL *session, int *evict_resetp) __wt_spin_unlock(session, &cache->evict_walk_lock); /* Clear any existing LRU eviction walk for the file. */ - WT_RET(__evict_tree_walk_clear(session)); + WT_RET(__evict_request_walk_clear(session)); /* Hold the evict lock to remove any queued pages from this file. */ __wt_spin_lock(session, &cache->evict_lock); diff --git a/src/log/log.c b/src/log/log.c index a87d7226f69..27be3dfb07c 100644 --- a/src/log/log.c +++ b/src/log/log.c @@ -63,31 +63,30 @@ __wt_log_needs_recovery(WT_SESSION_IMPL *session, WT_LSN *ckp_lsn, int *rec) return (0); /* - * The LSN is the last written log record before the checkpoint. - * See if the next record after that is a checkpoint and it is - * the last record. That is the only case where we can skip. + * See if there are any data modification records between the + * checkpoint LSN and the end of the log. If there are none then + * we can skip recovery. */ WT_RET(__wt_curlog_open(session, "log:", NULL, &c)); c->set_key(c, ckp_lsn->file, ckp_lsn->offset, 0); if ((ret = c->search(c)) == 0) { - if ((ret = c->next(c)) == 0) { + while ((ret = c->next(c)) == 0) { /* * The only thing we care about is the rectype. */ WT_ERR(c->get_value(c, &dummy_txnid, &rectype, &dummy_optype, &dummy_fileid, &dummy_key, &dummy_value)); - /* - * Only if the record is a checkpoint and it is the - * last record can we skip. - */ - if (rectype == WT_LOGREC_CHECKPOINT && - (ret = c->next(c)) == WT_NOTFOUND) { - *rec = 0; - ret = 0; - } - } else if (ret == WT_NOTFOUND) + if (rectype == WT_LOGREC_COMMIT) + break; + } + /* + * If we get to the end of the log, we can skip recovery. + */ + if (ret == WT_NOTFOUND) { + *rec = 0; ret = 0; + } } else if (ret == WT_NOTFOUND) /* * We should always find the checkpoint LSN as it now points diff --git a/test/format/ops.c b/test/format/ops.c index e338860fb75..9232fc41a33 100644 --- a/test/format/ops.c +++ b/test/format/ops.c @@ -90,7 +90,7 @@ wts_ops(int lastrun) if (g.c_timer == 0) fourths = -1; else - fourths = (g.c_timer * 4 * 60) / FORMAT_OPERATION_REPS; + fourths = ((int64_t)g.c_timer * 4 * 60) / FORMAT_OPERATION_REPS; /* Initialize the table extension code. */ table_append_init(); @@ -486,7 +486,7 @@ skip_insert: if (col_update(cursor, &key, &value, keyno)) goto deadlock; /* Reset the cursor: there is no reason to keep pages pinned. */ - if (cursor != NULL && (ret = cursor->reset(cursor)) != 0) + if ((ret = cursor->reset(cursor)) != 0) die(ret, "cursor.reset"); /* |