Only when tailing volume, the zero-ed cookie should skip checking.

This only happens when checkCookie == false and fsync == false.
This commit is contained in:
Chris Lu
2021-08-13 02:09:35 -07:00
parent a8617c1a39
commit 78e8ddf910
6 changed files with 16 additions and 14 deletions

View File

@@ -332,13 +332,13 @@ func (s *Store) Close() {
}
}
func (s *Store) WriteVolumeNeedle(i needle.VolumeId, n *needle.Needle, fsync bool) (isUnchanged bool, err error) {
func (s *Store) WriteVolumeNeedle(i needle.VolumeId, n *needle.Needle, checkCookie bool, fsync bool) (isUnchanged bool, err error) {
if v := s.findVolume(i); v != nil {
if v.IsReadOnly() {
err = fmt.Errorf("volume %d is read only", i)
return
}
_, _, isUnchanged, err = v.writeNeedle2(n, fsync && s.isStopping)
_, _, isUnchanged, err = v.writeNeedle2(n, checkCookie, fsync && s.isStopping)
return
}
glog.V(0).Infoln("volume", i, "not found!")