From 4631ec39c391186c60522c4607cbb66bc9e625b9 Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Thu, 10 Dec 2015 15:00:50 -0500 Subject: WT-2246: Don't use the maximum record number (UINT64_MAX) to flag an append search, use WT_RECNO_OOB instead, UINT64_MAX is a valid record number, we could theoretically legitimately want to search for it. Add tests that basic CRUD operations work on the maximum possible record number. Fix overflow bugs in the variable-length column-store page-search and append-list reconciliation. --- src/reconcile/rec_write.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/reconcile') diff --git a/src/reconcile/rec_write.c b/src/reconcile/rec_write.c index fd2aec45115..ece7e2c9a5d 100644 --- a/src/reconcile/rec_write.c +++ b/src/reconcile/rec_write.c @@ -4465,7 +4465,7 @@ compare: /* WT_ERR(__rec_txn_read(session, r, ins, NULL, NULL, &upd)); if (upd == NULL) continue; - for (n = WT_INSERT_RECNO(ins); src_recno <= n; ++src_recno) { + for (n = WT_INSERT_RECNO(ins); src_recno <= n;) { /* * The application may have inserted records which left * gaps in the name space, and these gaps can be huge. @@ -4505,7 +4505,7 @@ compare: /* last->size == size && memcmp(last->data, data, size) == 0)) { ++rle; - continue; + goto next; } WT_ERR(__rec_col_var_helper(session, r, salvage, last, last_deleted, 0, rle)); @@ -4524,6 +4524,15 @@ compare: /* } last_deleted = deleted; rle = 1; + + /* + * Move to the next record. It's not a simple increment + * because if it's the maximum record, incrementing it + * wraps to 0 and this turns into an infinite loop. + */ +next: if (src_recno == UINT64_MAX) + break; + ++src_recno; } } -- cgit v1.2.1