|
@ -7,6 +7,7 @@ import ( |
|
|
"os" |
|
|
"os" |
|
|
"strings" |
|
|
"strings" |
|
|
"sync" |
|
|
"sync" |
|
|
|
|
|
"sync/atomic" |
|
|
"time" |
|
|
"time" |
|
|
|
|
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/stats" |
|
|
"github.com/seaweedfs/seaweedfs/weed/stats" |
|
@ -76,7 +77,13 @@ type FilerOption struct { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
type FilerServer struct { |
|
|
type FilerServer struct { |
|
|
inFlightDataSize int64 |
|
|
|
|
|
|
|
|
inFlightDataSize int64 |
|
|
|
|
|
listenersWaits int64 |
|
|
|
|
|
|
|
|
|
|
|
// notifying clients
|
|
|
|
|
|
listenersLock sync.Mutex |
|
|
|
|
|
listenersCond *sync.Cond |
|
|
|
|
|
|
|
|
inFlightDataLimitCond *sync.Cond |
|
|
inFlightDataLimitCond *sync.Cond |
|
|
|
|
|
|
|
|
filer_pb.UnimplementedSeaweedFilerServer |
|
|
filer_pb.UnimplementedSeaweedFilerServer |
|
@ -90,10 +97,6 @@ type FilerServer struct { |
|
|
metricsAddress string |
|
|
metricsAddress string |
|
|
metricsIntervalSec int |
|
|
metricsIntervalSec int |
|
|
|
|
|
|
|
|
// notifying clients
|
|
|
|
|
|
listenersLock sync.Mutex |
|
|
|
|
|
listenersCond *sync.Cond |
|
|
|
|
|
|
|
|
|
|
|
// track known metadata listeners
|
|
|
// track known metadata listeners
|
|
|
knownListenersLock sync.Mutex |
|
|
knownListenersLock sync.Mutex |
|
|
knownListeners map[int32]int32 |
|
|
knownListeners map[int32]int32 |
|
@ -135,7 +138,9 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption) |
|
|
v.SetDefault("filer.options.max_file_name_length", 255) |
|
|
v.SetDefault("filer.options.max_file_name_length", 255) |
|
|
maxFilenameLength := v.GetUint32("filer.options.max_file_name_length") |
|
|
maxFilenameLength := v.GetUint32("filer.options.max_file_name_length") |
|
|
fs.filer = filer.NewFiler(*option.Masters, fs.grpcDialOption, option.Host, option.FilerGroup, option.Collection, option.DefaultReplication, option.DataCenter, maxFilenameLength, func() { |
|
|
fs.filer = filer.NewFiler(*option.Masters, fs.grpcDialOption, option.Host, option.FilerGroup, option.Collection, option.DefaultReplication, option.DataCenter, maxFilenameLength, func() { |
|
|
fs.listenersCond.Broadcast() |
|
|
|
|
|
|
|
|
if atomic.LoadInt64(&fs.listenersWaits) > 0 { |
|
|
|
|
|
fs.listenersCond.Broadcast() |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
fs.filer.Cipher = option.Cipher |
|
|
fs.filer.Cipher = option.Cipher |
|
|
// we do not support IP whitelist right now
|
|
|
// we do not support IP whitelist right now
|
|
|