diff --git a/go/storage/needle.go b/go/storage/needle.go index 31e8a267c..353ca6dd5 100644 --- a/go/storage/needle.go +++ b/go/storage/needle.go @@ -15,9 +15,10 @@ import ( ) const ( - NeedleHeaderSize = 16 //should never change this - NeedlePaddingSize = 8 - NeedleChecksumSize = 4 + NeedleHeaderSize = 16 //should never change this + NeedlePaddingSize = 8 + NeedleChecksumSize = 4 + MaxPossibleVolumeSize = 4 * 1024 * 1024 * 1024 * 8 ) /* diff --git a/go/storage/store.go b/go/storage/store.go index cc9fef7d0..0f10331ca 100644 --- a/go/storage/store.go +++ b/go/storage/store.go @@ -262,15 +262,15 @@ func (s *Store) Write(i VolumeId, n *Needle) (size uint32, err error) { err = fmt.Errorf("Volume %s is read only!", i) return } else { - if s.volumeSizeLimit >= v.ContentSize()+uint64(size) { + if MaxPossibleVolumeSize >= v.ContentSize()+uint64(size) { size, err = v.write(n) } else { err = fmt.Errorf("Volume Size Limit %d Exceeded! Current size is %d", s.volumeSizeLimit, v.ContentSize()) } - if err != nil && s.volumeSizeLimit < v.ContentSize()+uint64(size) && s.volumeSizeLimit >= v.ContentSize() { - glog.V(0).Infoln("volume", i, "size is", v.ContentSize(), "close to", s.volumeSizeLimit) - if err = s.Join(); err != nil { - glog.V(0).Infoln("error with Join:", err) + if s.volumeSizeLimit < v.ContentSize()+uint64(size) { + glog.V(0).Infoln("volume", i, "size", v.ContentSize(), "will exceed limit", s.volumeSizeLimit) + if e = s.Join(); e != nil { + glog.V(0).Infoln("error when reporting size:", e) } } } diff --git a/go/weed/master.go b/go/weed/master.go index 971d6ce96..146974166 100644 --- a/go/weed/master.go +++ b/go/weed/master.go @@ -30,7 +30,7 @@ var ( mport = cmdMaster.Flag.Int("port", 9333, "http listen port") mip = cmdMaster.Flag.String("ip", "localhost", "http listen port") metaFolder = cmdMaster.Flag.String("mdir", os.TempDir(), "data directory to store meta data") - volumeSizeLimitMB = cmdMaster.Flag.Uint("volumeSizeLimitMB", 32*1024, "Default Volume Size in MegaBytes") + volumeSizeLimitMB = cmdMaster.Flag.Uint("volumeSizeLimitMB", 32*1000, "Default Volume Size in MegaBytes") mpulse = cmdMaster.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats") confFile = cmdMaster.Flag.String("conf", "/etc/weedfs/weedfs.conf", "xml configuration file") defaultRepType = cmdMaster.Flag.String("defaultReplicationType", "000", "Default replication type if not specified.")