ethereum / go-ethereum

Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
47.41k stars 20.07k forks source link

[Feature] Push dirty state to temp file on shutdown #20174

Open karalabe opened 5 years ago

karalabe commented 5 years ago

Currently when Geth shuts down, its dirty state is committed to the database. There are two problems with this:

An alternative would be to just flatten the dirty memory cache into a flat file, and reload it from disk on startup. This would both avoid junk being pushed more frequently to disk than needed and also make the shutdown procedure faster since appending to a flat file is fast compared to injecting into leveldb.

Note, this PR would touch quite a bit of sensitive code paths, so it's not something super trivial. Not something insanely hard either.

rjl493456442 commented 5 years ago

@karalabe FastCache can offer the functionality to dump the cached items to file. https://github.com/VictoriaMetrics/fastcache/blob/master/file.go#L24

rjl493456442 commented 4 years ago

It's merged.

karalabe commented 4 years ago

No, it's not. The clean cache is pushed to disk. The dirty is not.

holiman commented 10 months ago

I think this ticket is less relevant with pbss. Closable maybe?

lightclient commented 2 months ago

cc @rjl493456442