Skip to content

mempool: entry_time index removal

Note: It builds on top of !1130 (merged). As such, it is a commit on top of those MRs. If you wish to review this, be sure to review starting from the top-most commit "Removes entry_time from the indexed transaction set".

Closes: #269 (closed)


Co-authored-by: Calin Culianu calin.culianu@gmail.com

Summary

As discussed in private conversations I had with @cculianu and in the following thread: !1128 (comment 535148859)

Age-expiry can use two different code paths:

  • Perf. critical: fast=true (default) on the "hot path" (that is, when LimitSize is called as a result of a mempool accept) we use the entry_id index to iterate forward and delete the obviously old ones (if any) until we get to a timestamp > threshold, then we break out of the loop.

  • Slow but thorough: fast=false we have a "slow path" scheduler task that fires once a day (let's define a good default) that simply iterates through the entire mempool, and deletes oldies. Iterating through 1 million mempool entries takes less than 100ms on @cculianu 's machine. So it will likely be Ok to eat that cost (locks held, etc) every once in a while.

Test Plan

  • ninja all check-all
  • Try the benches:
    • ninja bench_bitcoin
    • src/bench/bench_bitcoin -filter='(Genera.*)|(MempoolAcc.*)|(Evict.*)|(Reorg.*)'
    • Try the above both with and without this commit.

Advanced:

  • Run a node for a while, do IBD, etc.
  • Start bitcoind with -tachyonactivationtime=1000000000 -expire=0 (tachyon already activated) and try and send it lots of very long chains of tx's, etc.
Edited by Calin Culianu

Merge request reports