summaryrefslogtreecommitdiff
path: root/src/btree
diff options
context:
space:
mode:
authorAlex Gorrod <alexander.gorrod@mongodb.com>2015-05-04 14:03:56 +1000
committerMichael Cahill <michael.cahill@mongodb.com>2015-05-25 16:39:39 +1000
commitbf0408ec3310f5a81746169cb12781c931866bd1 (patch)
treea9b3f919c1a52c193fa520828763395878f04bf8 /src/btree
parenta1d1334260de46879aae637f1b67c7bbe3a59fd6 (diff)
downloadmongo-bf0408ec3310f5a81746169cb12781c931866bd1.tar.gz
Merge pull request #1931 from wiredtiger/avoid-obsolete-checks
Avoid obsolete update checks during long-running transactions (cherry picked from commit 7677519536c9db9d7b86a8adca1a70a07d2e9747)
Diffstat (limited to 'src/btree')
-rw-r--r--src/btree/row_modify.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/btree/row_modify.c b/src/btree/row_modify.c
index 0e351682e9e..d56b44bbd95 100644
--- a/src/btree/row_modify.c
+++ b/src/btree/row_modify.c
@@ -287,9 +287,11 @@ __wt_update_alloc(
* Check for obsolete updates.
*/
WT_UPDATE *
-__wt_update_obsolete_check(WT_SESSION_IMPL *session, WT_UPDATE *upd)
+__wt_update_obsolete_check(
+ WT_SESSION_IMPL *session, WT_PAGE *page, WT_UPDATE *upd)
{
WT_UPDATE *first, *next;
+ u_int count;
/*
* This function identifies obsolete updates, and truncates them from
@@ -299,7 +301,7 @@ __wt_update_obsolete_check(WT_SESSION_IMPL *session, WT_UPDATE *upd)
*
* Walk the list of updates, looking for obsolete updates at the end.
*/
- for (first = NULL; upd != NULL; upd = upd->next)
+ for (first = NULL, count = 0; upd != NULL; upd = upd->next, count++)
if (__wt_txn_visible_all(session, upd->txnid)) {
if (first == NULL)
first = upd;
@@ -317,6 +319,14 @@ __wt_update_obsolete_check(WT_SESSION_IMPL *session, WT_UPDATE *upd)
WT_ATOMIC_CAS8(first->next, next, NULL))
return (next);
+ /*
+ * If the list is long, don't retry checks on this page until the
+ * transaction state has moved forwards.
+ */
+ if (count > 20)
+ page->modify->obsolete_check_txn =
+ S2C(session)->txn_global.last_running;
+
return (NULL);
}