/* * __split_ovfl_key_cleanup -- * Handle cleanup for on-page row-store overflow keys. */ static int __split_ovfl_key_cleanup(WT_SESSION_IMPL *session, WT_PAGE *page, WT_REF *ref) { WT_CELL *cell; WT_CELL_UNPACK kpack; WT_IKEY *ikey; uint32_t cell_offset; /* * A key being discarded (page split) or moved to a different page (page * deepening) may be an on-page overflow key. Clear any reference to an * underlying disk image, and, if the key hasn't been deleted, delete it * along with any backing blocks. */ if ((ikey = __wt_ref_key_instantiated(ref)) == NULL) return (0); if ((cell_offset = ikey->cell_offset) == 0) return (0); /* Leak blocks rather than try this twice. */ ikey->cell_offset = 0; cell = WT_PAGE_REF_OFFSET(page, cell_offset); __wt_cell_unpack(cell, &kpack); if (kpack.ovfl && kpack.raw != WT_CELL_KEY_OVFL_RM) WT_RET(__wt_ovfl_discard(session, cell)); return (0); }
/* * __split_ovfl_key_cleanup -- * Handle cleanup for on-page row-store overflow keys. */ static int __split_ovfl_key_cleanup(WT_SESSION_IMPL *session, WT_PAGE *page, WT_REF *ref) { WT_CELL *cell; WT_CELL_UNPACK kpack; WT_IKEY *ikey; uint32_t cell_offset; /* There's a per-page flag if there are any overflow keys at all. */ if (!F_ISSET_ATOMIC(page, WT_PAGE_OVERFLOW_KEYS)) return (0); /* * A key being discarded (page split) or moved to a different page (page * deepening) may be an on-page overflow key. Clear any reference to an * underlying disk image, and, if the key hasn't been deleted, delete it * along with any backing blocks. */ if ((ikey = __wt_ref_key_instantiated(ref)) == NULL) return (0); if ((cell_offset = ikey->cell_offset) == 0) return (0); /* Leak blocks rather than try this twice. */ ikey->cell_offset = 0; cell = WT_PAGE_REF_OFFSET(page, cell_offset); __wt_cell_unpack(cell, &kpack); if (kpack.ovfl && kpack.raw != WT_CELL_KEY_OVFL_RM) { /* * Eviction cannot free overflow items once a checkpoint is * running in a tree: that can corrupt the checkpoint's block * management. Assert that checkpoints aren't running to make * sure we're catching all paths and to avoid regressions. */ WT_ASSERT(session, S2BT(session)->checkpointing != WT_CKPT_RUNNING); WT_RET(__wt_ovfl_discard(session, cell)); } return (0); }
/* * __ovfl_discard_wrapup -- * Resolve the page's overflow discard list after a page is written. */ static int __ovfl_discard_wrapup(WT_SESSION_IMPL *session, WT_PAGE *page) { WT_CELL **cellp; WT_DECL_RET; WT_OVFL_TRACK *track; uint32_t i; track = page->modify->ovfl_track; for (i = 0, cellp = track->discard; i < track->discard_entries; ++i, ++cellp) { if (WT_VERBOSE_ISSET(session, WT_VERB_OVERFLOW)) WT_RET(__ovfl_discard_verbose( session, page, *cellp, "free")); /* Discard each cell's overflow item. */ WT_RET(__wt_ovfl_discard(session, *cellp)); } __wt_free(session, track->discard); track->discard_entries = track->discard_allocated = 0; return (ret); }