mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
accurate error messages during writing
This commit is contained in:
parent
a4369b35a7
commit
95dc977608
|
@ -174,6 +174,9 @@ func (s *Store) Close() {
|
||||||
}
|
}
|
||||||
func (s *Store) Write(i VolumeId, n *Needle) (size uint32, err error) {
|
func (s *Store) Write(i VolumeId, n *Needle) (size uint32, err error) {
|
||||||
if v := s.volumes[i]; v != nil && !v.readOnly {
|
if v := s.volumes[i]; v != nil && !v.readOnly {
|
||||||
|
if v.readOnly {
|
||||||
|
err = errors.New("Volume " + i + " is read only!")
|
||||||
|
} else {
|
||||||
size, err = v.write(n)
|
size, err = v.write(n)
|
||||||
if err != nil && s.volumeSizeLimit < v.ContentSize()+uint64(size) && s.volumeSizeLimit >= v.ContentSize() {
|
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)
|
log.Println("volume", i, "size is", v.ContentSize(), "close to", s.volumeSizeLimit)
|
||||||
|
@ -181,9 +184,11 @@ func (s *Store) Write(i VolumeId, n *Needle) (size uint32, err error) {
|
||||||
log.Printf("error with Join: %s", err)
|
log.Printf("error with Join: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Println("volume", i, "not found!")
|
log.Println("volume", i, "not found!")
|
||||||
|
err = errors.New("Volume " + i + " not found!")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func (s *Store) Delete(i VolumeId, n *Needle) (uint32, error) {
|
func (s *Store) Delete(i VolumeId, n *Needle) (uint32, error) {
|
||||||
|
|
Loading…
Reference in a new issue