mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
be lenient when writing, but report right away when volume size limit is
exceeded
This commit is contained in:
parent
2cba123474
commit
2a8c60f71b
|
@ -18,6 +18,7 @@ const (
|
||||||
NeedleHeaderSize = 16 //should never change this
|
NeedleHeaderSize = 16 //should never change this
|
||||||
NeedlePaddingSize = 8
|
NeedlePaddingSize = 8
|
||||||
NeedleChecksumSize = 4
|
NeedleChecksumSize = 4
|
||||||
|
MaxPossibleVolumeSize = 4 * 1024 * 1024 * 1024 * 8
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -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)
|
err = fmt.Errorf("Volume %s is read only!", i)
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
if s.volumeSizeLimit >= v.ContentSize()+uint64(size) {
|
if MaxPossibleVolumeSize >= v.ContentSize()+uint64(size) {
|
||||||
size, err = v.write(n)
|
size, err = v.write(n)
|
||||||
} else {
|
} else {
|
||||||
err = fmt.Errorf("Volume Size Limit %d Exceeded! Current size is %d", s.volumeSizeLimit, v.ContentSize())
|
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() {
|
if s.volumeSizeLimit < v.ContentSize()+uint64(size) {
|
||||||
glog.V(0).Infoln("volume", i, "size is", v.ContentSize(), "close to", s.volumeSizeLimit)
|
glog.V(0).Infoln("volume", i, "size", v.ContentSize(), "will exceed limit", s.volumeSizeLimit)
|
||||||
if err = s.Join(); err != nil {
|
if e = s.Join(); e != nil {
|
||||||
glog.V(0).Infoln("error with Join:", err)
|
glog.V(0).Infoln("error when reporting size:", e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ var (
|
||||||
mport = cmdMaster.Flag.Int("port", 9333, "http listen port")
|
mport = cmdMaster.Flag.Int("port", 9333, "http listen port")
|
||||||
mip = cmdMaster.Flag.String("ip", "localhost", "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")
|
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")
|
mpulse = cmdMaster.Flag.Int("pulseSeconds", 5, "number of seconds between heartbeats")
|
||||||
confFile = cmdMaster.Flag.String("conf", "/etc/weedfs/weedfs.conf", "xml configuration file")
|
confFile = cmdMaster.Flag.String("conf", "/etc/weedfs/weedfs.conf", "xml configuration file")
|
||||||
defaultRepType = cmdMaster.Flag.String("defaultReplicationType", "000", "Default replication type if not specified.")
|
defaultRepType = cmdMaster.Flag.String("defaultReplicationType", "000", "Default replication type if not specified.")
|
||||||
|
|
Loading…
Reference in a new issue