vmware / splinterdb

High Performance Embedded Key-Value Store
https://splinterdb.org
Apache License 2.0
684 stars 57 forks source link

(#561) Fix routing_filter_prefetch() to account for page-size while computing next page-address. #562

Closed gapisback closed 1 year ago

gapisback commented 1 year ago

This commit fixes a simple arithmetic error in routing_filter_prefetch() while computing next page's address. A new test case test_issue_458_mini_destroy_unused_debug_assert has been added to existing unit/splinterdb_stress_test, which reproduces the problem.

NOTE: Even with this fix, this simple test case does not succeed in debug builds. We are failing with a new assertion:

(gdb) c
Continuing.
btree_pack(): req->num_tuples=6291456 exceeded output size limit, req->max_tuples=6291456
btree_pack(): req->num_tuples=6291456 exceeded output size limit, req->max_tuples=6291456
[Switching to Thread 0x7ffff6894640 (LWP 484069)]

Thread 4 "splinterdb_stre" hit Breakpoint 1, trunk_flush_into_bundle (spl=0x7fffb5f8c040, parent=0x7ffff68917c0, child=0x7ffff6891620, pdata=0x7fffd355458c, req=0x7fffac388640) at src/trunk.c:4102
4102                trunk_inc_filter(spl, child_filter);
(gdb) p parent_filter->addr
$6 = 0
(gdb) p *parent_filter
$7 = {addr = 0, meta_head = 0, num_fingerprints = 0, num_unique = 0, value_size = 0}
(gdb) bt
#0  trunk_flush_into_bundle (spl=0x7fffb5f8c040, parent=0x7ffff68917c0,
    child=0x7ffff6891620, pdata=0x7fffd355458c, req=0x7fffac388640) at src/trunk.c:4102
#1  0x00007ffff7f828b1 in trunk_flush (spl=0x7fffb5f8c040, parent=0x7ffff68917c0,
    pdata=0x7fffd355458c, is_space_rec=0) at src/trunk.c:4214
#2  0x00007ffff7f82e58 in trunk_flush_fullest (spl=0x7fffb5f8c040, node=0x7ffff68917c0)
    at src/trunk.c:4295
#3  0x00007ffff7f83e23 in trunk_compact_bundle (arg=0x55555747bfc0,
    scratch_buf=0x7ffff6895040) at src/trunk.c:4642
#4  0x00007ffff7f7291b in task_group_run_task (group=0x555555575b80,
    assigned_task=0x555557479c40) at src/task.c:475
#5  0x00007ffff7f72a94 in task_worker_thread (arg=0x555555575b80) at src/task.c:514
#6  0x00007ffff7f72068 in task_invoke_with_hooks (func_and_args=0x5555555782c0)
    at src/task.c:221
#7  0x00007ffff7d4db43 in start_thread (arg=<optimized out>)

(gdb) n
OS-pid=484066, OS-tid=484069, Thread-ID=3, Assertion failed at src/trunk.c:3543:trunk_inc_filter(): "filter->addr != 0".
netlify[bot] commented 1 year ago

Deploy Preview for splinterdb canceled.

Name Link
Latest commit ee0e916bb4707ac7dbde661df44539e310a6ff5b
Latest deploy log https://app.netlify.com/sites/splinterdb/deploys/642e02db984db00008bd2fba