Browse Source

volume server: remote tier volumes only soft delete in local index

fix https://github.com/seaweedfs/seaweedfs/issues/3889
pull/3895/head
chrislu 2 years ago
parent
commit
184fbb6c50
  1. 6
      weed/storage/volume_write.go

6
weed/storage/volume_write.go

@ -213,14 +213,18 @@ func (v *Volume) doDeleteRequest(n *needle.Needle) (Size, error) {
nv, ok := v.nm.Get(n.Id) nv, ok := v.nm.Get(n.Id)
// fmt.Println("key", n.Id, "volume offset", nv.Offset, "data_size", n.Size, "cached size", nv.Size) // fmt.Println("key", n.Id, "volume offset", nv.Offset, "data_size", n.Size, "cached size", nv.Size)
if ok && nv.Size.IsValid() { if ok && nv.Size.IsValid() {
var offset uint64
var err error
if !v.hasRemoteFile {
size := nv.Size size := nv.Size
n.Data = nil n.Data = nil
n.AppendAtNs = uint64(time.Now().UnixNano()) n.AppendAtNs = uint64(time.Now().UnixNano())
offset, _, _, err := n.Append(v.DataBackend, v.Version())
offset, _, _, err = n.Append(v.DataBackend, v.Version())
v.checkReadWriteError(err) v.checkReadWriteError(err)
if err != nil { if err != nil {
return size, err return size, err
} }
}
v.lastAppendAtNs = n.AppendAtNs v.lastAppendAtNs = n.AppendAtNs
if err = v.nm.Delete(n.Id, ToOffset(int64(offset))); err != nil { if err = v.nm.Delete(n.Id, ToOffset(int64(offset))); err != nil {
return size, err return size, err

Loading…
Cancel
Save