mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
set needle AppendAtNs value during writes
This commit is contained in:
parent
655b449270
commit
ea8ecf35f4
|
@ -101,6 +101,7 @@ func (v *Volume) writeNeedle(n *Needle) (size uint32, err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
n.AppendAtNs = uint64(time.Now().UnixNano())
|
||||||
if size, _, err = n.Append(v.dataFile, v.Version()); err != nil {
|
if size, _, err = n.Append(v.dataFile, v.Version()); err != nil {
|
||||||
if e := v.dataFile.Truncate(offset); e != nil {
|
if e := v.dataFile.Truncate(offset); e != nil {
|
||||||
err = fmt.Errorf("%s\ncannot truncate %s: %v", err, v.dataFile.Name(), e)
|
err = fmt.Errorf("%s\ncannot truncate %s: %v", err, v.dataFile.Name(), e)
|
||||||
|
@ -139,6 +140,7 @@ func (v *Volume) deleteNeedle(n *Needle) (uint32, error) {
|
||||||
return size, err
|
return size, err
|
||||||
}
|
}
|
||||||
n.Data = nil
|
n.Data = nil
|
||||||
|
n.AppendAtNs = uint64(time.Now().UnixNano())
|
||||||
_, _, err = n.Append(v.dataFile, v.Version())
|
_, _, err = n.Append(v.dataFile, v.Version())
|
||||||
return size, err
|
return size, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,6 +207,7 @@ func (v *Volume) makeupDiff(newDatFileName, newIdxFileName, oldDatFileName, oldI
|
||||||
fakeDelNeedle := new(Needle)
|
fakeDelNeedle := new(Needle)
|
||||||
fakeDelNeedle.Id = key
|
fakeDelNeedle.Id = key
|
||||||
fakeDelNeedle.Cookie = 0x12345678
|
fakeDelNeedle.Cookie = 0x12345678
|
||||||
|
fakeDelNeedle.AppendAtNs = uint64(time.Now().UnixNano())
|
||||||
_, _, err = fakeDelNeedle.Append(dst, v.Version())
|
_, _, err = fakeDelNeedle.Append(dst, v.Version())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("append deleted %d failed: %v", key, err)
|
return fmt.Errorf("append deleted %d failed: %v", key, err)
|
||||||
|
|
Loading…
Reference in a new issue