From a4c29b95a231792305e3f4b22a21cded291527f1 Mon Sep 17 00:00:00 2001 From: Sears Russell Date: Tue, 27 May 2008 07:32:37 +0000 Subject: [PATCH] Fix bug due to over-zealous optimization. It was accidentally skipping the max slot id check in some cases. --- stasis/page/compression/rle-impl.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/stasis/page/compression/rle-impl.h b/stasis/page/compression/rle-impl.h index 455a482..1c050bc 100644 --- a/stasis/page/compression/rle-impl.h +++ b/stasis/page/compression/rle-impl.h @@ -27,7 +27,11 @@ Rle::append(int xid, const TYPE dat, ret = last_block_ptr()->index + last_block_ptr()->copies; - if (dat != last_block_ptr()->data || + if(ret == MAX_INDEX) { + // out of address space + *free_bytes = -1; + ret = NOSPACE; + } else if (dat != last_block_ptr()->data || last_block_ptr()->copies == MAX_COPY_COUNT) { // this key is not the same as the last one, or // the block is full @@ -42,11 +46,6 @@ Rle::append(int xid, const TYPE dat, // Finalize the changes unless we're out of space (*block_count_ptr()) += (*free_bytes >= 0); - - } else if(ret == MAX_INDEX) { - // out of address space - *free_bytes = -1; - ret = NOSPACE; } else { // success; bump number of copies of this item, and return. last_block_ptr()->copies++;