diff options
| author | chrislusf <chris.lu@gmail.com> | 2015-03-09 00:34:26 -0700 |
|---|---|---|
| committer | chrislusf <chris.lu@gmail.com> | 2015-03-09 01:10:04 -0700 |
| commit | 853701cb6b13c0e56c0b9c242aa027003e32f6c2 (patch) | |
| tree | 4e486ff9e330d63f5ec7839e2a918743dd3f9983 /go/storage | |
| parent | 9d8a6d2562b20fe20028938f96397a0921a47a18 (diff) | |
| download | seaweedfs-853701cb6b13c0e56c0b9c242aa027003e32f6c2.tar.xz seaweedfs-853701cb6b13c0e56c0b9c242aa027003e32f6c2.zip | |
Avoid wrong way to delete on replication failure
Avoid wrong way to delete on replication failure. This deletion has bug
to write. The better fix is not to use the deletion on failure at all.
Diffstat (limited to 'go/storage')
| -rw-r--r-- | go/storage/needle_read_write.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/go/storage/needle_read_write.go b/go/storage/needle_read_write.go index 6925c04e0..24a2c45ed 100644 --- a/go/storage/needle_read_write.go +++ b/go/storage/needle_read_write.go @@ -76,6 +76,8 @@ func (n *Needle) Append(w io.Writer, version Version) (size uint32, err error) { if n.HasTtl() { n.Size = n.Size + TtlBytesLength } + } else { + n.Size = 0 } size = n.DataSize util.Uint32toBytes(header[12:16], n.Size) @@ -185,6 +187,11 @@ func (n *Needle) readNeedleDataVersion2(bytes []byte) { if index < lenBytes { n.DataSize = util.BytesToUint32(bytes[index : index+4]) index = index + 4 + if int(n.DataSize)+index > lenBytes { + // this if clause is due to bug #87 and #93, fixed in v0.69 + // remove this clause later + return + } n.Data = bytes[index : index+int(n.DataSize)] index = index + int(n.DataSize) n.Flags = bytes[index] |
