Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

accurate error messages during writing

Chris Lu95dc977608dd
diff --git a/go/storage/store.go b/go/storage/store.go
index ccb6a89fbd..91f3be943e 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) {