store: two-scan SH extract (unique keys, then windowed postings) - #668
rearden-grok[bot] wants to merge 3 commits into
Conversation
|
Hi @reardencode was observing the CI cargon mutants in-diffs test and saw it was running workspace or something, and was talking to my clanker about it, had some tiered idea, but idk maybe he found some other approach which may help. I will post the response here for you and your clanker to see if we come up good appropriate and improved approach! I hope it is not too confusing! The test seemed to be cancelled after 30 minutes according to the #609 implementation. That why I started asking my clanker what's up. Below are some convo dump sorry! For the purpose of hoping to brainstorm with you & your AI to find a good improvement forward that fits rbitcoin's testing regime Convo dump 1:Observation from
|
7cd2349 to
be17fab
Compare
432935e to
f46a3f1
Compare
Fix for 30m cancel on this PR
Root cause: 313 * ~19s / 2 workers = ~50m of work needed, but Since rbitcoin is public, standard runners are free - sharding doesn't cost Rearden, it just trades wall time for parallelism. Proposed fix - shard the PR diff instead of raising timeout: Change mutants-pr:
strategy:
matrix:
shard: [0,1,2,3]
fail-fast: false
timeout-minutes: 30
steps:
- run: cargo mutants --workspace --in-diff git.diff --shard ${{ matrix.shard }}/4 --sharding slice --jobs 2 --baseline skip --timeout 240
continue-on-error: true
- uses: actions/upload-artifact@v4
with:
name: mutants-pr-${{ matrix.shard }}
path: mutants.out
If you want minimal change, just bump Within Bitcoin specifically, no reputable project shards the PR diff yet - they do the first half of what you're doing.
So Bitcoin Rust projects today are: PR = single The sharding to fix the 30m cancel is from the general Rust ecosystem - If you do 4-way sharded |
f46a3f1 to
1aa095b
Compare
Pass 1 appends 18 B key16||u16 frames to keys/NN (65535-fk windows). Merge sort-dedups each shard in RAM, writes scripthash.head/NN and multi/NN.fuse8, then unlinks keys. Pass 2 writes fuse-hit postings; pack rewrites 2+ bodies and skips 1-fk fuse FPs. Co-authored-by: Cursor <cursoragent@cursor.com>
Record the RAM-merge-to-head path, leftover SHKEYS01/16 B/SHUNSRT3 restart, and extract worker cap (1.5 GiB). Co-authored-by: Cursor <cursoragent@cursor.com>
c985c60 to
02ce85e
Compare
1aa095b to
156de27
Compare
|
Sorry it might depends on how many concurrent jobs running! Idk how many exactly.. But if based on below numbers of concurrent... below might be an idea for improvement. But if concurrent jobs are different to what below says, might have different solution ideas -- Based on their current 9 concurrent jobs per PR, conditional 4-way, not always 4-way. Here's why:
rbitcoin is 38 stars, so you rarely have 2 PRs at once right now, but conditional is still better because:
Best final solution for rbitcoin: Keep
That fixes the cancel, keeps concurrency low for normal work, and matches what If you want absolute simplest fix to unblock #668 today: just change |
|
Thanks @Hero-Gamer. Yeah, was thinking something along these lines after seeing that some PRs timed out while others didn't. We'll think about what to do with it and possibly revise the overall PR workflow to be a little bit less concurrent to make space for more mutants runners. |
BDZ and fuse8 do not need key16 order. Spill 150 MiB/shard as SHKSP01 files under keys/NN/ and walk the map once to head+fuse. Leftover in-process keys refuse. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
key16 → pack8 word;0= multi) and spills at 150 MiB tokeys/NN/(SHKSP01files, first-fk delta singles). Merge folds those spills into one map, one walk toscripthash.head/NN+multi/NN.fuse8, then unlinkskeys/NN/.keys/NNfile,SHKEYU02, framed 18 B, wrong magic) refuse — wipescripthash.unsorted/ rematerialize.DONE.keysstaysSHKEYS02as the last-fk marker. NoSCHEMA_VERSIONbump.key16‖offsetpostings, pack rewrites 2+ bodies, skips 1-fk fuse FPs. Stacked onstore/txfixed(store: schema 25 txstat.body 8 B/create ULEB #659).Test plan
cargo test -p rbitcoin-store --libcargo clippy -p rbitcoin-store --lib -- -D warnings