mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
write file info only when data is not empty
This commit is contained in:
parent
b87ec11c1c
commit
90018be9d2
|
@ -87,7 +87,6 @@ func (n *Needle) Append(w io.Writer, version Version) (size uint32, err error) {
|
|||
if _, err = w.Write(header[0:1]); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if n.HasName() {
|
||||
util.Uint8toBytes(header[0:1], n.NameSize)
|
||||
if _, err = w.Write(header[0:1]); err != nil {
|
||||
|
@ -112,6 +111,7 @@ func (n *Needle) Append(w io.Writer, version Version) (size uint32, err error) {
|
|||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
padding := NeedlePaddingSize - ((NeedleHeaderSize + n.Size + NeedleChecksumSize) % NeedlePaddingSize)
|
||||
util.Uint32toBytes(header[0:NeedleChecksumSize], n.Checksum.Value())
|
||||
_, err = w.Write(header[0 : NeedleChecksumSize+padding])
|
||||
|
|
Loading…
Reference in a new issue