Closed morph-dev closed 2 months ago
Future ideas
We can speed up the shutdown by abandoning changes that are in memory (by not committing anything), but we would have the same problem that is described in #1440.
Even if implemented, it's questionable if this is desired behavior, so maybe we would need a flag that controls whether to commit on ctrl+c or not.
https://github.com/ethereum/trin/issues/1440#issuecomment-2346615788 as said in my comment here we would want to switch to an ACID compliment
database.
We want ctrl+c to instantly shutdown the node, as we want to prevent the Operating System from force killing trin-execution on shutdown, which could corrupt the database. Switching to an ACID compliment
database, resolves this class of problems to my knowledge. We should be able to shutdown even if we are in the middle of writing to the database, as we could set it to only consider the writes valid when we are done them (like the full set of commit
class writes).
ACID compliment
database should also protect the user from power outages, force kills, etc.
Executing blocks is time consuming, RocksDB sucks in that regard because you are way more likely to get your database corrupted which sucks. LMDB
or MXDB
solves a lot of these problems
ACID
In computer science, ACID is a set of properties of database
transactions intended to guarantee data validity despite errors,
power failures, and other mishaps. In the context of databases,
a sequence of database operations that satisfies the ACID
properties is called a transaction.
This solves that whole* class of problems
What was wrong?
Using Ctrl+C to stop trin_execution can take a lot of time, partially due to committing to db (which can't be avoided), and partially because execution doesn't stop until next checkpoint (which can take another 30 min).
How was it fixed?
Refactor how TrinExecution executes blocks (built on top of #1450).
Instead of executing until the first commit (which can come early), it will now execute all the way to the provided block but it accepts
stop_signal
receiver. When stop signal is received, it will commit and return.Note: Tested it locally (around block 6'000'000).
Future ideas
We can speed up the shutdown by abandoning changes that are in memory (by not committing anything), but we would have the same problem that is described in #1440.
Even if implemented, it's questionable if this is desired behavior, so maybe we would need a flag that controls whether to commit on ctrl+c or not.
To-Do