Closed zidian666 closed 10 months ago
@zidian666
pre_commit
is executed right after appending the log to log store, hence it is not possible to make it fail; once a log is appended, it should be replicated. commit
may not be invoked according to the consensus result though.
The return value of pre_commit
is not used in normal path. There is a special option asynchronous replication which returns the result of pre_commit
without waiting for the consensus. Other than that, its return value is just ignored.
https://github.com/eBay/NuRaft/blob/e66b4b65c90ff3a0be852d484bf15583672ea7fd/include/libnuraft/state_machine.hxx#L99
I'm confused about the return value of this function.
If I want to return a non-null pointer, how can I know NuRaft how to deserialize it ?
Actually, I'm going to let
state_machine::pre_commit
return a failure to make pre-commit fail. Or is there another way to make pre-commit fail ?Thanks.