|
@ -107,16 +107,9 @@ func (v *Volume) asyncRequestAppend(request *needle.AsyncRequest) { |
|
|
|
|
|
|
|
|
func (v *Volume) syncWrite(n *needle.Needle, checkCookie bool) (offset uint64, size Size, isUnchanged bool, err error) { |
|
|
func (v *Volume) syncWrite(n *needle.Needle, checkCookie bool) (offset uint64, size Size, isUnchanged bool, err error) { |
|
|
// glog.V(4).Infof("writing needle %s", needle.NewFileIdFromNeedle(v.Id, n).String())
|
|
|
// glog.V(4).Infof("writing needle %s", needle.NewFileIdFromNeedle(v.Id, n).String())
|
|
|
actualSize := needle.GetActualSize(Size(len(n.Data)), v.Version()) |
|
|
|
|
|
|
|
|
|
|
|
v.dataFileAccessLock.Lock() |
|
|
v.dataFileAccessLock.Lock() |
|
|
defer v.dataFileAccessLock.Unlock() |
|
|
defer v.dataFileAccessLock.Unlock() |
|
|
|
|
|
|
|
|
if MaxPossibleVolumeSize < v.nm.ContentSize()+uint64(actualSize) { |
|
|
|
|
|
err = fmt.Errorf("volume size limit %d exceeded! current size is %d", MaxPossibleVolumeSize, v.nm.ContentSize()) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return v.doWriteRequest(n, checkCookie) |
|
|
return v.doWriteRequest(n, checkCookie) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -193,7 +186,6 @@ func (v *Volume) doWriteRequest(n *needle.Needle, checkCookie bool) (offset uint |
|
|
|
|
|
|
|
|
func (v *Volume) syncDelete(n *needle.Needle) (Size, error) { |
|
|
func (v *Volume) syncDelete(n *needle.Needle) (Size, error) { |
|
|
// glog.V(4).Infof("delete needle %s", needle.NewFileIdFromNeedle(v.Id, n).String())
|
|
|
// glog.V(4).Infof("delete needle %s", needle.NewFileIdFromNeedle(v.Id, n).String())
|
|
|
actualSize := needle.GetActualSize(0, v.Version()) |
|
|
|
|
|
v.dataFileAccessLock.Lock() |
|
|
v.dataFileAccessLock.Lock() |
|
|
defer v.dataFileAccessLock.Unlock() |
|
|
defer v.dataFileAccessLock.Unlock() |
|
|
|
|
|
|
|
@ -201,11 +193,6 @@ func (v *Volume) syncDelete(n *needle.Needle) (Size, error) { |
|
|
return 0, nil |
|
|
return 0, nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if MaxPossibleVolumeSize < v.nm.ContentSize()+uint64(actualSize) { |
|
|
|
|
|
err := fmt.Errorf("volume size limit %d exceeded! current size is %d", MaxPossibleVolumeSize, v.nm.ContentSize()) |
|
|
|
|
|
return 0, err |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return v.doDeleteRequest(n) |
|
|
return v.doDeleteRequest(n) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|