summaryrefslogtreecommitdiff
path: root/src/btree/bt_slvg.c
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2014-09-01 12:22:43 -0400
committerKeith Bostic <keith@wiredtiger.com>2014-09-01 12:22:43 -0400
commitf0e50fc591071ea91d01b0537310d28c64478039 (patch)
tree1c6e427f76adb9215b5a1b7a5bf4f58042bab76f /src/btree/bt_slvg.c
parent2638cc5191512c0f52f9d1dc2ca2a9c3c33bba75 (diff)
downloadmongo-f0e50fc591071ea91d01b0537310d28c64478039.tar.gz
One more try to get the range check for overflow records correct.
Diffstat (limited to 'src/btree/bt_slvg.c')
-rw-r--r--src/btree/bt_slvg.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/btree/bt_slvg.c b/src/btree/bt_slvg.c
index 6a4bee61392..3d1e1822e93 100644
--- a/src/btree/bt_slvg.c
+++ b/src/btree/bt_slvg.c
@@ -1328,8 +1328,8 @@ __slvg_col_merge_ovfl(WT_SESSION_IMPL *session,
uint32_t i;
/*
- * We're merging a row-store page, and we took some number of records,
- * figure out which (if any) overflow records we used.
+ * Merging a variable-length column-store page, and we took some number
+ * of records, figure out which (if any) overflow records we used.
*/
recno = page->pg_var_recno;
start = recno + skip;
@@ -1340,7 +1340,20 @@ __slvg_col_merge_ovfl(WT_SESSION_IMPL *session,
__wt_cell_unpack(cell, &unpack);
recno += __wt_cell_rle(&unpack);
- if (recno >= start && unpack.type == WT_CELL_VALUE_OVFL)
+ /*
+ * I keep getting this calculation wrong, so here's the logic.
+ * Start is the first record we want, stop is the last record
+ * we want. The record number has already been incremented one
+ * past the maximum record number for this page entry, that is,
+ * it's set to the first record number for the next page entry.
+ * The test of start should be greater-than (not greater-than-
+ * or-equal), because of that increment, if the record number
+ * equals start, we want the next record, not this one. The
+ * test against stop is greater-than, not greater-than-or-equal
+ * because stop is the last record wanted, if the record number
+ * equals stop, we want the next record.
+ */
+ if (recno > start && unpack.type == WT_CELL_VALUE_OVFL)
WT_RET(__slvg_col_merge_ovfl_single(
session, trk, &unpack));
if (recno > stop)