summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@wiredtiger.com>2014-02-28 17:11:36 +1100
committerMichael Cahill <michael.cahill@wiredtiger.com>2014-02-28 17:11:36 +1100
commitf4d2c0ff304259e3d34d9dcbe59d8432c0a250f3 (patch)
tree32768d8e99742f40b368e67d4550ce12b730668c
parentad9de86fe52aa32ea67e25864fa3eb6c072abc87 (diff)
downloadmongo-f4d2c0ff304259e3d34d9dcbe59d8432c0a250f3.tar.gz
Fix another bug regarding when pages can be evicted: have reconcilition track the maximum transaction ID on the page (regardless of whether it is skipped). A page can only be evicted when it is clean and has no updates that are too new.
refs #884
-rw-r--r--src/btree/rec_write.c18
-rw-r--r--src/include/txn.i15
2 files changed, 12 insertions, 21 deletions
diff --git a/src/btree/rec_write.c b/src/btree/rec_write.c
index 81a4ec7a025..43b5532ad1a 100644
--- a/src/btree/rec_write.c
+++ b/src/btree/rec_write.c
@@ -668,26 +668,12 @@ static inline int
__rec_txn_read(
WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_UPDATE *upd, WT_UPDATE **updp)
{
- uint64_t txnid;
int skip, retried;
retried = 0;
-retry: *updp = __wt_txn_read_skip(session, upd, &skip);
- if (!skip) {
- /*
- * Track the largest transaction ID written to disk for this
- * page. We store this in the page at the end of
- * reconciliation if no updates are skipped. It is used to
- * avoid evicting a clean page from memory with changes that
- * are required to satisfy a snapshot read.
- */
- if (*updp != NULL) {
- txnid = (*updp)->txnid;
- if (TXNID_LT(r->max_txn, txnid))
- r->max_txn = txnid;
- }
+retry: *updp = __wt_txn_read_skip(session, upd, &r->max_txn, &skip);
+ if (!skip)
return (0);
- }
/*
* If skipping this update will cause reconciliation to quit, update
diff --git a/src/include/txn.i b/src/include/txn.i
index 8ec1f52bff4..0c51751ccd2 100644
--- a/src/include/txn.i
+++ b/src/include/txn.i
@@ -170,17 +170,22 @@ __wt_txn_visible(WT_SESSION_IMPL *session, uint64_t id)
* and report whether there are an uncommitted changes in the list.
*/
static inline WT_UPDATE *
-__wt_txn_read_skip(WT_SESSION_IMPL *session, WT_UPDATE *upd, int *skipp)
+__wt_txn_read_skip(
+ WT_SESSION_IMPL *session, WT_UPDATE *upd, uint64_t *max_txn, int *skipp)
{
WT_UPDATE *first_upd;
*skipp = 0;
for (first_upd = NULL; upd != NULL; upd = upd->next)
if (upd->txnid != WT_TXN_ABORTED) {
- if (!__wt_txn_visible(session, upd->txnid))
- *skipp = 1;
- else if (first_upd == NULL)
- first_upd = upd;
+ if (TXNID_LT(*max_txn, upd->txnid))
+ *max_txn = upd->txnid;
+ if (first_upd == NULL) {
+ if (__wt_txn_visible(session, upd->txnid))
+ first_upd = upd;
+ else
+ *skipp = 1;
+ }
}
return (first_upd);