Hi everyone, It seems that this commit aa3d8b7dcb9891972a1c8a23d2c1412e827b3a16 has broken the initialization of the raft server when the server is initialized from a snapshot. Unless I misunderstood something, doing the following used to work:
s := raft.NewServer(name, path, transporter, nil, nil, "")
s.LoadSnapsho()
But with the latest release of influxdb (which uses master), we noticed that the followers panic with an invalid argument in appendEntries. Digging in the source code, it turns out that LoadSnapshot() will set the startIndex on this line which is used in isEmpty()here to determine whether the log file is empty or not. This will cause the log file not to be empty on startup, which will cause this line to return and the log file will never be opened. Any subsequent calls to the log file to sync it or write to it will return an error or panic because the log file isn't opened.
Hi everyone, It seems that this commit aa3d8b7dcb9891972a1c8a23d2c1412e827b3a16 has broken the initialization of the raft server when the server is initialized from a snapshot. Unless I misunderstood something, doing the following used to work:
But with the latest release of influxdb (which uses master), we noticed that the followers panic with an invalid argument in appendEntries. Digging in the source code, it turns out that
LoadSnapshot()
will set thestartIndex
on this line which is used inisEmpty()
here to determine whether the log file is empty or not. This will cause the log file not to be empty on startup, which will cause this line to return and the log file will never be opened. Any subsequent calls to the log file to sync it or write to it will return an error or panic because the log file isn't opened.