summaryrefslogtreecommitdiff
path: root/src/support
diff options
context:
space:
mode:
Diffstat (limited to 'src/support')
-rw-r--r--src/support/err.c1
-rw-r--r--src/support/hazard.c24
-rw-r--r--src/support/stat.c2
3 files changed, 23 insertions, 4 deletions
diff --git a/src/support/err.c b/src/support/err.c
index 55f21a5bcd5..c332d18478e 100644
--- a/src/support/err.c
+++ b/src/support/err.c
@@ -382,6 +382,7 @@ __wt_bad_object_type(WT_SESSION_IMPL *session, const char *uri)
WT_PREFIX_MATCH(uri, "config:") ||
WT_PREFIX_MATCH(uri, "file:") ||
WT_PREFIX_MATCH(uri, "index:") ||
+ WT_PREFIX_MATCH(uri, "lsm:") ||
WT_PREFIX_MATCH(uri, "statistics:") ||
WT_PREFIX_MATCH(uri, "table:"))
WT_RET_MSG(session, ENOTSUP,
diff --git a/src/support/hazard.c b/src/support/hazard.c
index df362278d25..78dc1b5a1d8 100644
--- a/src/support/hazard.c
+++ b/src/support/hazard.c
@@ -24,6 +24,7 @@ __wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, int *busyp
{
WT_BTREE *btree;
WT_HAZARD *hp;
+ int restarts = 0;
btree = session->btree;
*busyp = 0;
@@ -45,12 +46,23 @@ __wt_hazard_set(WT_SESSION_IMPL *session, WT_REF *ref, int *busyp
* reference before it discards the page (the eviction server sets the
* state to WT_REF_LOCKED, then flushes memory and checks the hazard
* references).
+ *
+ * For sessions with many active hazard references, skip most of the
+ * active slots: there may be a free slot in there, but checking is
+ * expensive. Most hazard references are released quickly: optimize
+ * for that case.
*/
- for (hp = session->hazard; ; ++hp) {
+ for (hp = session->hazard + session->nhazard;; ++hp) {
/* Expand the number of hazard references if available.*/
if (hp >= session->hazard + session->hazard_size) {
if (session->hazard_size >= S2C(session)->hazard_max)
break;
+ /* Restart the search. */
+ if (session->nhazard < session->hazard_size &&
+ restarts++ == 0) {
+ hp = session->hazard;
+ continue;
+ }
WT_PUBLISH(session->hazard_size,
WT_MIN(session->hazard_size + WT_HAZARD_INCR,
S2C(session)->hazard_max));
@@ -134,9 +146,13 @@ __wt_hazard_clear(WT_SESSION_IMPL *session, WT_PAGE *page)
*/
WT_ASSERT(session, page != NULL);
- /* Clear the caller's hazard pointer. */
- for (hp = session->hazard;
- hp < session->hazard + session->hazard_size; ++hp)
+ /*
+ * Clear the caller's hazard pointer.
+ * The common pattern is LIFO, so do a reverse search.
+ */
+ for (hp = session->hazard + session->hazard_size - 1;
+ hp >= session->hazard;
+ --hp)
if (hp->page == page) {
/*
* We don't publish the hazard reference clear in the
diff --git a/src/support/stat.c b/src/support/stat.c
index c8f67d0ac12..23065e706a5 100644
--- a/src/support/stat.c
+++ b/src/support/stat.c
@@ -26,6 +26,7 @@ __wt_stat_alloc_btree_stats(WT_SESSION_IMPL *session, WT_BTREE_STATS **statsp)
stats->file_col_int_pages.desc = "column-store internal pages";
stats->file_col_var_pages.desc =
"column-store variable-size leaf pages";
+ stats->file_compact_rewrite.desc = "pages rewritten by compaction";
stats->file_entries.desc = "total entries";
stats->file_fixed_len.desc = "fixed-record size";
stats->file_magic.desc = "magic number";
@@ -88,6 +89,7 @@ __wt_stat_clear_btree_stats(WT_STATS *stats_arg)
stats->file_col_fix_pages.v = 0;
stats->file_col_int_pages.v = 0;
stats->file_col_var_pages.v = 0;
+ stats->file_compact_rewrite.v = 0;
stats->file_entries.v = 0;
stats->file_fixed_len.v = 0;
stats->file_magic.v = 0;