aboutsummaryrefslogtreecommitdiff
path: root/go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2013-04-14 19:34:37 -0700
committerChris Lu <chris.lu@gmail.com>2013-04-14 19:34:37 -0700
commit95dc977608dd6d6e0d1e2c1fb98c6ac9e6567ef7 (patch)
tree1807c2271b1352a00aa88d10e38b1cbdf7f2b8b1 /go
parenta4369b35a74752c4fc4005dbdf682401c2fb000c (diff)
downloadseaweedfs-95dc977608dd6d6e0d1e2c1fb98c6ac9e6567ef7.tar.xz
seaweedfs-95dc977608dd6d6e0d1e2c1fb98c6ac9e6567ef7.zip
accurate error messages during writing
Diffstat (limited to 'go')
-rw-r--r--go/storage/store.go15
1 files changed, 10 insertions, 5 deletions
diff --git a/go/storage/store.go b/go/storage/store.go
index ccb6a89fb..91f3be943 100644
--- a/go/storage/store.go
+++ b/go/storage/store.go
@@ -174,16 +174,21 @@ func (s *Store) Close() {
}
func (s *Store) Write(i VolumeId, n *Needle) (size uint32, err error) {
if v := s.volumes[i]; v != nil && !v.readOnly {
- size, err = v.write(n)
- if err != nil && s.volumeSizeLimit < v.ContentSize()+uint64(size) && s.volumeSizeLimit >= v.ContentSize() {
- log.Println("volume", i, "size is", v.ContentSize(), "close to", s.volumeSizeLimit)
- if err = s.Join(); err != nil {
- log.Printf("error with Join: %s", err)
+ if v.readOnly {
+ err = errors.New("Volume " + i + " is read only!")
+ } else {
+ size, err = v.write(n)
+ if err != nil && s.volumeSizeLimit < v.ContentSize()+uint64(size) && s.volumeSizeLimit >= v.ContentSize() {
+ log.Println("volume", i, "size is", v.ContentSize(), "close to", s.volumeSizeLimit)
+ if err = s.Join(); err != nil {
+ log.Printf("error with Join: %s", err)
+ }
}
}
return
}
log.Println("volume", i, "not found!")
+ err = errors.New("Volume " + i + " not found!")
return
}
func (s *Store) Delete(i VolumeId, n *Needle) (uint32, error) {