raft-engine
raft-engine copied to clipboard
Discontinuous append queue file sequnce
Accidentally I found that raft-engine's data directory contains discontinuous file sequences in append queue:
0000000000000003.rewrite
0000000000000846.raftlog
0000000000000847.raftlog
0000000000000848.raftlog
0000000000000849.raftlog
0000000000000850.raftlog
0000000000000851.raftlog
0000000000000852.raftlog
0000000000000853.raftlog
0000000000000854.raftlog
0000000000000855.raftlog
0000000000000856.raftlog
0000000000000857.raftlog
0000000000000858.raftlog
0000000000000859.raftlog
0000000000000860.raftlog < here
0000000000000890.raftlog
During raft-engine's recover process, all files before 0000000000000890
in append queue will be skipped.
I am curious if such a situation would occur in normal program operation as when I dive into the purge code:
https://github.com/tikv/raft-engine/blob/e8de5d75ae40b0eec8736321f9dedb1662feb69d/src/file_pipe_log/pipe.rs#L426
Looks like in purge_to
method normally all files before file_seq
are either all deleted or not.
I think it's caused by file recycling (SinglePipe::recycled_files
), some of obsolete log files will be kept around for future writes to reuse. After https://github.com/tikv/raft-engine/pull/310, those files no longer use a different file extension, so you can't distinguish them based on file name alone.
I think it's caused by file recycling (
SinglePipe::recycled_files
), some of obsolete log files will be kept around for future writes to reuse. After #310, those files no longer use a different file extension, so you can't distinguish them based on file name alone.
Log recycle is not enabled yet, could it be any other reason?
Did you disable it explicitly? It is enabled by default for a while now.