From c057ce74a83301fb68031fde4804da5a3ef13b9a Mon Sep 17 00:00:00 2001 From: Viktor Lofgren Date: Tue, 22 Nov 2022 16:33:29 +0100 Subject: [PATCH] Bugfix for rare bug where some queries may miss hits due to BTreeReader's retain function giving up too fast. --- .../main/java/nu/marginalia/util/btree/BTreeReader.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/marginalia_nu/src/main/java/nu/marginalia/util/btree/BTreeReader.java b/marginalia_nu/src/main/java/nu/marginalia/util/btree/BTreeReader.java index 472478ea..be9de7cc 100644 --- a/marginalia_nu/src/main/java/nu/marginalia/util/btree/BTreeReader.java +++ b/marginalia_nu/src/main/java/nu/marginalia/util/btree/BTreeReader.java @@ -52,7 +52,9 @@ public class BTreeReader { public void retainEntries(BTreeQueryBuffer buffer) { if (header.layers() == 0) { BTreePointer pointer = new BTreePointer(header); - pointer.retainData(buffer); + while (buffer.hasMore()) { + pointer.retainData(buffer); + } } retainSingle(buffer); } @@ -61,7 +63,9 @@ public class BTreeReader { public void rejectEntries(BTreeQueryBuffer buffer) { if (header.layers() == 0) { BTreePointer pointer = new BTreePointer(header); - pointer.rejectData(buffer); + while (buffer.hasMore()) { + pointer.rejectData(buffer); + } } rejectSingle(buffer); }