(btree) Add more consistent asserts on sortedness

This commit is contained in:
Viktor Lofgren 2023-09-01 15:45:02 +02:00
parent bafc2a1f30
commit 04212b2cef
2 changed files with 3 additions and 3 deletions

View File

@ -123,9 +123,7 @@ public class BTreeReader {
*/
public long[] queryData(long[] keys, int offset) {
if (getClass().desiredAssertionStatus()) {
assert(isSorted(keys));
}
assert(isSorted(keys)) : "The input array docIds is assumed to be sorted";
if (header.layers() == 0) {
return queryDataNoIndex(keys, offset);

View File

@ -41,6 +41,8 @@ public class BTreeWriter {
throw new IllegalStateException("Dog ear was not overwritten: " + header);
}
assert slice.isSortedN(ctx.entrySize) : "Provided data was not sorted";
if (header.layers() >= 1) { // Omit layer if data fits within a single block
writeIndex(header);
}