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.95k
stars
881
forks
source link
Erase last_segment from _segment when it transform into open_segment #293
After truncating suffix log, a last_segment that exists in _segments maybe change from closed to open, so it would erase from _segments. Or it will be deleted twice when SegmentLogStorage::reset call.
After truncating suffix log, a
last_segment
that exists in_segments
maybe change fromclosed
toopen
, so it would erase from_segments
. Or it will be deleted twice whenSegmentLogStorage::reset
call.https://github.com/baidu/braft/blob/154d805bd1eb88df97121fe1c73a5b469df88056/test/test_log.cpp#L374
In
multi_segment_and_segment_logstorage
unit test, after truncating suffix log atfirst_seg->last_index() + 1
, last_segment at the second to last of the_segments
which is closed, when it transform into open, it would erase from_segments
. https://github.com/baidu/braft/blob/154d805bd1eb88df97121fe1c73a5b469df88056/src/braft/log.cpp#L927