Skip to content

Commit

Permalink
Deal with deleted pages if a file discard is interrupted.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Cahill committed Nov 28, 2014
1 parent 3dd68ca commit e3f0bdb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
9 changes: 2 additions & 7 deletions src/btree/bt_sync.c
Expand Up @@ -295,15 +295,10 @@ __evict_file(WT_SESSION_IMPL *session, int syncop)
!__wt_txn_visible_all(session,
page->modify->rec_max_txn))
WT_ERR(EBUSY);

if (syncop == WT_SYNC_DISCARD_FORCE)
F_SET(session, WT_SESSION_DISCARD_FORCE);
__wt_ref_out(session, ref);
/*
* In case we don't discard the whole tree, make sure
* that future readers know that the page is no longer
* in cache.
*/
ref->state = WT_REF_DISK;
__wt_rec_page_clean_update(session, ref);
F_CLR(session, WT_SESSION_DISCARD_FORCE);
break;
WT_ILLEGAL_VALUE_ERR(session);
Expand Down
9 changes: 4 additions & 5 deletions src/btree/rec_evict.c
Expand Up @@ -10,7 +10,6 @@
static int __hazard_exclusive(WT_SESSION_IMPL *, WT_REF *, int);
static void __rec_discard_tree(WT_SESSION_IMPL *, WT_REF *, int, int);
static void __rec_excl_clear(WT_SESSION_IMPL *);
static void __rec_page_clean_update(WT_SESSION_IMPL *, WT_REF *);
static int __rec_page_dirty_update(WT_SESSION_IMPL *, WT_REF *, int);
static int __rec_review(WT_SESSION_IMPL *, WT_REF *, int, int, int *);

Expand Down Expand Up @@ -77,7 +76,7 @@ __wt_rec_evict(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
if (__wt_ref_is_root(ref))
__wt_ref_out(session, ref);
else
__rec_page_clean_update(session, ref);
__wt_rec_page_clean_update(session, ref);

WT_STAT_FAST_CONN_INCR(session, cache_eviction_clean);
WT_STAT_FAST_DATA_INCR(session, cache_eviction_clean);
Expand Down Expand Up @@ -112,11 +111,11 @@ __wt_rec_evict(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive)
}

/*
* __rec_page_clean_update --
* __wt_rec_page_clean_update --
* Update a clean page's reference on eviction.
*/
static void
__rec_page_clean_update(WT_SESSION_IMPL *session, WT_REF *ref)
void
__wt_rec_page_clean_update(WT_SESSION_IMPL *session, WT_REF *ref)
{
/*
* Discard the page and update the reference structure; if the page has
Expand Down
1 change: 1 addition & 0 deletions src/include/extern.h
Expand Up @@ -164,6 +164,7 @@ extern int __wt_tree_walk(WT_SESSION_IMPL *session, WT_REF **refp, uint32_t flag
extern int __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, uint64_t recno, WT_ITEM *value, WT_UPDATE *upd, int is_remove);
extern int __wt_col_search(WT_SESSION_IMPL *session, uint64_t recno, WT_REF *leaf, WT_CURSOR_BTREE *cbt);
extern int __wt_rec_evict(WT_SESSION_IMPL *session, WT_REF *ref, int exclusive);
extern void __wt_rec_page_clean_update(WT_SESSION_IMPL *session, WT_REF *ref);
extern void __wt_split_stash_discard(WT_SESSION_IMPL *session);
extern void __wt_split_stash_discard_all( WT_SESSION_IMPL *session_safe, WT_SESSION_IMPL *session);
extern int __wt_multi_to_ref(WT_SESSION_IMPL *session, WT_PAGE *page, WT_MULTI *multi, WT_REF **refp, size_t *incrp);
Expand Down

0 comments on commit e3f0bdb

Please sign in to comment.