diff options
author | Michael Cahill <michael.cahill@mongodb.com> | 2015-11-27 16:39:13 +1100 |
---|---|---|
committer | Michael Cahill <michael.cahill@mongodb.com> | 2015-11-27 16:39:13 +1100 |
commit | a6da10e9fe561c931490345807332757395e15ce (patch) | |
tree | 998baeab2b7719fd9b5d7b185961e20812a20350 | |
parent | 39dfd21030ac08e425213f9bc382877dff9458da (diff) | |
parent | 5dd8d4dc2e24c4d6633fde475e44f5bc1de47a50 (diff) | |
download | mongo-a6da10e9fe561c931490345807332757395e15ce.tar.gz |
Merge pull request #2341 from wiredtiger/SERVER-21553
SERVER-21553 Enable fast-path truncate after splits.
-rw-r--r-- | src/btree/bt_delete.c | 11 | ||||
-rw-r--r-- | src/btree/bt_split.c | 14 |
2 files changed, 14 insertions, 11 deletions
diff --git a/src/btree/bt_delete.c b/src/btree/bt_delete.c index dc9352ec981..760954a7fea 100644 --- a/src/btree/bt_delete.c +++ b/src/btree/bt_delete.c @@ -102,22 +102,15 @@ __wt_delete_page(WT_SESSION_IMPL *session, WT_REF *ref, bool *skipp) * out is to check the on-page cell type for the page, cells for leaf * pages that have no overflow items are special. * - * In some cases, the reference address may not reference an on-page - * cell (for example, some combination of page splits), in which case - * we can't check the original cell value and we fail. - * * To look at an on-page cell, we need to look at the parent page, and * that's dangerous, our parent page could change without warning if * the parent page were to split, deepening the tree. It's safe: the * page's reference will always point to some valid page, and if we find * any problems we simply fail the fast-delete optimization. - * - * !!! - * I doubt it's worth the effort, but we could copy the cell's type into - * the reference structure, and then we wouldn't need an on-page cell. */ parent = ref->home; - if (__wt_off_page(parent, ref->addr) || + if (__wt_off_page(parent, ref->addr) ? + ((WT_ADDR *)ref->addr)->type != WT_ADDR_LEAF_NO : __wt_cell_type_raw(ref->addr) != WT_CELL_ADDR_LEAF_NO) goto err; diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c index 35c3bfea711..3e49d177ca6 100644 --- a/src/btree/bt_split.c +++ b/src/btree/bt_split.c @@ -340,8 +340,18 @@ __split_ref_move(WT_SESSION_IMPL *session, WT_PAGE *from_home, return (ret); } addr->size = (uint8_t)unpack.size; - addr->type = - unpack.raw == WT_CELL_ADDR_INT ? WT_ADDR_INT : WT_ADDR_LEAF; + switch (unpack.raw) { + case WT_CELL_ADDR_INT: + addr->type = WT_ADDR_INT; + break; + case WT_CELL_ADDR_LEAF: + addr->type = WT_ADDR_LEAF; + break; + case WT_CELL_ADDR_LEAF_NO: + addr->type = WT_ADDR_LEAF_NO; + break; + WT_ILLEGAL_VALUE(session); + } ref->addr = addr; } |