BFS: Fix check of key compare in BPlusTree::_ValidateChildren().
In ba32021824
the key comparison was fixed
to use a compatible version. Since then the check can actually return
results other than -1. The check done on the result was too strict
however. The child nodes may never contain keys that are larger than the
keys they are reached by. But the last key of a child node may be equal
to the one in the parent. This change fixes the check to take this
special case into account.
Fixes #11026 and #11289. The issue was unproblematic in so far that it
was only hit during a filesystem check and, since BPlusTree does not
yet attempt to correct corrupted trees, did not result in any actual
actions.
This commit is contained in:
parent
de59ef0760
commit
33d9fb8663
@ -2367,7 +2367,7 @@ BPlusTree::_ValidateChildren(TreeCheck& check, uint32 level, off_t offset,
|
||||
if (largestKey != NULL) {
|
||||
int result = _CompareKeys(key, keyLength, largestKey,
|
||||
largestKeyLength);
|
||||
if (result >= 0) {
|
||||
if (result > 0 || (result == 0 && i != count - 1)) {
|
||||
dprintf("inode %" B_PRIdOFF ": node %" B_PRIdOFF " key %"
|
||||
B_PRIu32 " larger than it should!\n",
|
||||
fStream->ID(), offset, i);
|
||||
|
Loading…
Reference in New Issue
Block a user