mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
ensure monotonic n.AppendAtNs
fix https://github.com/seaweedfs/seaweedfs/issues/3852
This commit is contained in:
parent
e05637c42c
commit
9c8678ded9
|
@ -157,7 +157,7 @@ func (v *Volume) doWriteRequest(n *needle.Needle, checkCookie bool) (offset uint
|
|||
}
|
||||
|
||||
// append to dat file
|
||||
n.AppendAtNs = uint64(time.Now().UnixNano())
|
||||
n.AppendAtNs = max(uint64(time.Now().UnixNano()), v.lastAppendAtNs+1)
|
||||
offset, size, _, err = n.Append(v.DataBackend, v.Version())
|
||||
v.checkReadWriteError(err)
|
||||
if err != nil {
|
||||
|
@ -330,3 +330,10 @@ func (v *Volume) WriteNeedleBlob(needleId NeedleId, needleBlob []byte, size Size
|
|||
|
||||
return err
|
||||
}
|
||||
|
||||
func max(x, y uint64) uint64 {
|
||||
if x <= y {
|
||||
return y
|
||||
}
|
||||
return x
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue