commit
89372c3fa7
@ -145,11 +145,11 @@ namespace persistent_data {
|
||||
{
|
||||
internal_node n = spine.get_node<block_traits>();
|
||||
|
||||
// compact the path if there's only one child
|
||||
if (n.get_nr_entries() == 1) {
|
||||
block_address b = n.value_at(0);
|
||||
read_ref child = tm_.read_lock(b, validator_);
|
||||
|
||||
// FIXME: is it safe?
|
||||
::memcpy(n.raw(), child.data(), read_ref::BLOCK_SIZE);
|
||||
|
||||
tm_.get_sm()->dec(child.get_location());
|
||||
@ -341,7 +341,6 @@ namespace persistent_data {
|
||||
if (nr_left < nr_right) {
|
||||
int s = nr_left - target_left;
|
||||
|
||||
// FIXME: signed & unsigned comparison
|
||||
if (s < 0 && nr_center < static_cast<unsigned>(-s)) {
|
||||
// not enough in central node
|
||||
left.move_entries(center, -nr_center);
|
||||
|
@ -338,7 +338,7 @@ namespace persistent_data {
|
||||
unsigned nr_right = rhs.get_nr_entries();
|
||||
unsigned max_entries = get_max_entries();
|
||||
|
||||
if (nr_left - count > max_entries || nr_right - count > max_entries)
|
||||
if (nr_left - count > max_entries || nr_right + count > max_entries)
|
||||
throw runtime_error("too many entries");
|
||||
|
||||
if (count > 0) {
|
||||
|
@ -558,7 +558,7 @@ pub fn unpack_node<V: Unpack>(
|
||||
for k in &keys {
|
||||
if let Some(l) = last {
|
||||
if k <= l {
|
||||
return Err(node_err(&path, "keys out of order"));
|
||||
return Err(node_err(&path, &format!("keys out of order: {} <= {}", k, l)));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user