Skip to content

Commit

Permalink
Merge branch 'develop' into WT-2064
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelcahill committed Aug 27, 2015
2 parents 77294c1 + 8f42f02 commit 3956aac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
20 changes: 12 additions & 8 deletions src/evict/evict_lru.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,18 @@ __evict_pass(WT_SESSION_IMPL *session)
*/
__wt_cache_read_gen_incr(session);

/*
* Update the oldest ID: we use it to decide whether pages are
* candidates for eviction. Without this, if all threads are
* blocked after a long-running transaction (such as a
* checkpoint) completes, we may never start evicting again.
*
* Do this every time the eviction server wakes up, regardless
* of whether the cache is full, to prevent the oldest ID
* falling too far behind.
*/
__wt_txn_update_oldest(session, 1);

WT_RET(__evict_has_work(session, &flags));
if (flags == 0)
break;
Expand Down Expand Up @@ -933,14 +945,6 @@ __evict_walk(WT_SESSION_IMPL *session, uint32_t flags)
incr = dhandle_locked = 0;
retries = 0;

/*
* Update the oldest ID: we use it to decide whether pages are
* candidates for eviction. Without this, if all threads are blocked
* after a long-running transaction (such as a checkpoint) completes,
* we may never start evicting again.
*/
__wt_txn_update_oldest(session, 1);

if (cache->evict_current == NULL)
WT_STAT_FAST_CONN_INCR(session, cache_eviction_queue_empty);
else
Expand Down
13 changes: 0 additions & 13 deletions src/txn/txn.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,13 @@ __wt_txn_release(WT_SESSION_IMPL *session)
WT_TXN *txn;
WT_TXN_GLOBAL *txn_global;
WT_TXN_STATE *txn_state;
int was_oldest;

txn = &session->txn;
WT_ASSERT(session, txn->mod_count == 0);
txn->notify = NULL;

txn_global = &S2C(session)->txn_global;
txn_state = WT_SESSION_TXN_STATE(session);
was_oldest = 0;

/* Clear the transaction's ID from the global table. */
if (WT_SESSION_IS_CHECKPOINT(session)) {
Expand All @@ -424,9 +422,6 @@ __wt_txn_release(WT_SESSION_IMPL *session)
WT_ASSERT(session, txn_state->id != WT_TXN_NONE &&
txn->id != WT_TXN_NONE);
WT_PUBLISH(txn_state->id, WT_TXN_NONE);

/* Quick check for the oldest transaction. */
was_oldest = (txn->id == txn_global->last_running);
txn->id = WT_TXN_NONE;
}

Expand All @@ -445,14 +440,6 @@ __wt_txn_release(WT_SESSION_IMPL *session)
txn->isolation = session->isolation;
/* Ensure the transaction flags are cleared on exit */
txn->flags = 0;

/*
* When the oldest transaction in the system completes, bump the oldest
* ID. This is racy and so not guaranteed, but in practice it keeps
* the oldest ID from falling too far behind.
*/
if (was_oldest)
__wt_txn_update_oldest(session, 1);
}

/*
Expand Down

0 comments on commit 3956aac

Please sign in to comment.