baidu / braft

An industrial-grade C++ implementation of RAFT consensus algorithm based on brpc, widely used inside Baidu to build highly-available distributed systems.
Apache License 2.0
3.84k stars 862 forks source link

iter->set_error_and_rollback()框架内不应该调用当前entry的done->Run(),应该由业务方统一处理(成功、失败都调用done->Run()) #439

Closed historyliao closed 3 months ago

historyliao commented 4 months ago

iter->set_error_and_rollback()框架内不应该调用当前entry的done->Run(),应该由业务方统一处理(成功、失败都调用done->Run())。否则,就得像example:block中那样写: // Let raft run this closure. closure_guard.release(); // Some disk error occurred, notify raft and never apply any data // ever after iter.set_error_and_rollback();

这样写很丑陋,逻辑异化了。而且IteratorImpl::run_the_rest_closure_with_error()名字表达的是调用剩余的closure,但是实现上把当前closure也调用了(ntail=1时候)。