DB uses ~55% as much space as the blockchain during full compaction
The documentation says that it'll use up to 35% of the size of the blockchain near the end of sync, and this is true. However, during compaction it uses that ~35%+~20% of the final DB size.
You should at least warn about this, and possibly make --jsonrpc-import enable compaction throughout rather than compacting fully at the end (possibly optional behavior) for those of us running on resource limited machines.
What would you think about a safety measure that turns on --json-rpc if there's low space available?
Combined with enabling compaction throughout import for --jsonrpc-import mode, I think that'd be great. IIUC that trade-off will be slower more IO intensive import, but lower RAM and disk usage.
Yes, and it took ~1.5 GB of RAM during import. Would be nice to mention that in the docs too.
This issue should be addressed by the latest release:
$ du -sh electrs/db/bitcoin .bitcoin/blocks/
39G electrs/db/bitcoin
509G .bitcoin/blocks/