mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-04-05 20:52:50 +08:00
rename
This commit is contained in:
parent
c5f38c365d
commit
96ce85f5ae
@ -17,9 +17,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type VolumeServer struct {
|
type VolumeServer struct {
|
||||||
inFlightDataSize int64
|
inFlightUploadDataSize int64
|
||||||
concurrentUploadLimit int64
|
concurrentUploadLimit int64
|
||||||
inFlightDataLimitCond *sync.Cond
|
inFlightUploadDataLimitCond *sync.Cond
|
||||||
|
|
||||||
SeedMasterNodes []string
|
SeedMasterNodes []string
|
||||||
currentMaster string
|
currentMaster string
|
||||||
@ -68,18 +68,18 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
|
|||||||
|
|
||||||
vs := &VolumeServer{
|
vs := &VolumeServer{
|
||||||
pulseSeconds: pulseSeconds,
|
pulseSeconds: pulseSeconds,
|
||||||
dataCenter: dataCenter,
|
dataCenter: dataCenter,
|
||||||
rack: rack,
|
rack: rack,
|
||||||
needleMapKind: needleMapKind,
|
needleMapKind: needleMapKind,
|
||||||
FixJpgOrientation: fixJpgOrientation,
|
FixJpgOrientation: fixJpgOrientation,
|
||||||
ReadMode: readMode,
|
ReadMode: readMode,
|
||||||
grpcDialOption: security.LoadClientTLS(util.GetViper(), "grpc.volume"),
|
grpcDialOption: security.LoadClientTLS(util.GetViper(), "grpc.volume"),
|
||||||
compactionBytePerSecond: int64(compactionMBPerSecond) * 1024 * 1024,
|
compactionBytePerSecond: int64(compactionMBPerSecond) * 1024 * 1024,
|
||||||
fileSizeLimitBytes: int64(fileSizeLimitMB) * 1024 * 1024,
|
fileSizeLimitBytes: int64(fileSizeLimitMB) * 1024 * 1024,
|
||||||
isHeartbeating: true,
|
isHeartbeating: true,
|
||||||
stopChan: make(chan bool),
|
stopChan: make(chan bool),
|
||||||
inFlightDataLimitCond: sync.NewCond(new(sync.Mutex)),
|
inFlightUploadDataLimitCond: sync.NewCond(new(sync.Mutex)),
|
||||||
concurrentUploadLimit: concurrentUploadLimit,
|
concurrentUploadLimit: concurrentUploadLimit,
|
||||||
}
|
}
|
||||||
vs.SeedMasterNodes = masterNodes
|
vs.SeedMasterNodes = masterNodes
|
||||||
|
|
||||||
|
@ -45,16 +45,16 @@ func (vs *VolumeServer) privateStoreHandler(w http.ResponseWriter, r *http.Reque
|
|||||||
|
|
||||||
// wait until in flight data is less than the limit
|
// wait until in flight data is less than the limit
|
||||||
contentLength := getContentLength(r)
|
contentLength := getContentLength(r)
|
||||||
vs.inFlightDataLimitCond.L.Lock()
|
vs.inFlightUploadDataLimitCond.L.Lock()
|
||||||
for vs.concurrentUploadLimit != 0 && atomic.LoadInt64(&vs.inFlightDataSize) > vs.concurrentUploadLimit {
|
for vs.concurrentUploadLimit != 0 && atomic.LoadInt64(&vs.inFlightUploadDataSize) > vs.concurrentUploadLimit {
|
||||||
glog.V(4).Infof("wait because inflight data %d > %d", vs.inFlightDataSize, vs.concurrentUploadLimit)
|
glog.V(4).Infof("wait because inflight data %d > %d", vs.inFlightUploadDataSize, vs.concurrentUploadLimit)
|
||||||
vs.inFlightDataLimitCond.Wait()
|
vs.inFlightUploadDataLimitCond.Wait()
|
||||||
}
|
}
|
||||||
atomic.AddInt64(&vs.inFlightDataSize, contentLength)
|
atomic.AddInt64(&vs.inFlightUploadDataSize, contentLength)
|
||||||
vs.inFlightDataLimitCond.L.Unlock()
|
vs.inFlightUploadDataLimitCond.L.Unlock()
|
||||||
defer func() {
|
defer func() {
|
||||||
atomic.AddInt64(&vs.inFlightDataSize, -contentLength)
|
atomic.AddInt64(&vs.inFlightUploadDataSize, -contentLength)
|
||||||
vs.inFlightDataLimitCond.Signal()
|
vs.inFlightUploadDataLimitCond.Signal()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// processs uploads
|
// processs uploads
|
||||||
|
Loading…
Reference in New Issue
Block a user