This commit is contained in:
Chris Lu
2020-07-14 07:34:16 -07:00
parent 4f6096c7f0
commit ddec7b2bb9
10 changed files with 27 additions and 30 deletions

View File

@@ -26,13 +26,13 @@ var (
) )
type MasterOptions struct { type MasterOptions struct {
port *int port *int
ip *string ip *string
ipBind *string ipBind *string
metaFolder *string metaFolder *string
peers *string peers *string
volumeSizeLimitMB *uint volumeSizeLimitMB *uint
volumePreallocate *bool volumePreallocate *bool
// pulseSeconds *int // pulseSeconds *int
defaultReplication *string defaultReplication *string
garbageThreshold *float64 garbageThreshold *float64
@@ -173,11 +173,11 @@ func checkPeers(masterIp string, masterPort int, peers string) (masterAddress st
func (m *MasterOptions) toMasterOption(whiteList []string) *weed_server.MasterOption { func (m *MasterOptions) toMasterOption(whiteList []string) *weed_server.MasterOption {
return &weed_server.MasterOption{ return &weed_server.MasterOption{
Host: *m.ip, Host: *m.ip,
Port: *m.port, Port: *m.port,
MetaFolder: *m.metaFolder, MetaFolder: *m.metaFolder,
VolumeSizeLimitMB: *m.volumeSizeLimitMB, VolumeSizeLimitMB: *m.volumeSizeLimitMB,
VolumePreallocate: *m.volumePreallocate, VolumePreallocate: *m.volumePreallocate,
// PulseSeconds: *m.pulseSeconds, // PulseSeconds: *m.pulseSeconds,
DefaultReplicaPlacement: *m.defaultReplication, DefaultReplicaPlacement: *m.defaultReplication,
GarbageThreshold: *m.garbageThreshold, GarbageThreshold: *m.garbageThreshold,

View File

@@ -98,7 +98,7 @@ func (ma *MetaAggregator) subscribeToOneFiler(f *Filer, self string, filer strin
for { for {
err := pb.WithFilerClient(filer, ma.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error { err := pb.WithFilerClient(filer, ma.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error {
stream, err := client.SubscribeLocalMetadata(context.Background(), &filer_pb.SubscribeMetadataRequest{ stream, err := client.SubscribeLocalMetadata(context.Background(), &filer_pb.SubscribeMetadataRequest{
ClientName: "filer:"+self, ClientName: "filer:" + self,
PathPrefix: "/", PathPrefix: "/",
SinceNs: lastTsNs, SinceNs: lastTsNs,
}) })

View File

@@ -60,7 +60,7 @@ func (mc *MetaCache) AtomicUpdateEntry(ctx context.Context, oldPath util.FullPat
return err return err
} }
} }
}else{ } else {
// println("unknown old directory:", oldDir) // println("unknown old directory:", oldDir)
} }

View File

@@ -10,11 +10,13 @@ import (
// https://github.com/bazil/fuse/issues/130 // https://github.com/bazil/fuse/issues/130
var _ = fs.NodeAccesser(&Dir{}) var _ = fs.NodeAccesser(&Dir{})
func (dir *Dir) Access(ctx context.Context, req *fuse.AccessRequest) error { func (dir *Dir) Access(ctx context.Context, req *fuse.AccessRequest) error {
return fuse.ENOSYS return fuse.ENOSYS
} }
var _ = fs.NodeAccesser(&File{}) var _ = fs.NodeAccesser(&File{})
func (file *File) Access(ctx context.Context, req *fuse.AccessRequest) error { func (file *File) Access(ctx context.Context, req *fuse.AccessRequest) error {
return fuse.ENOSYS return fuse.ENOSYS
} }

View File

@@ -101,7 +101,6 @@ func TestCreateNeedleFromRequest(t *testing.T) {
} }
var textContent = `Redistribution and use in source and binary forms, with or without var textContent = `Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are modification, are permitted provided that the following conditions are
met: met:
@@ -127,4 +126,4 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
` `

View File

@@ -32,11 +32,11 @@ const (
) )
type MasterOption struct { type MasterOption struct {
Host string Host string
Port int Port int
MetaFolder string MetaFolder string
VolumeSizeLimitMB uint VolumeSizeLimitMB uint
VolumePreallocate bool VolumePreallocate bool
// PulseSeconds int // PulseSeconds int
DefaultReplicaPlacement string DefaultReplicaPlacement string
GarbageThreshold float64 GarbageThreshold float64
@@ -66,7 +66,7 @@ type MasterServer struct {
MasterClient *wdclient.MasterClient MasterClient *wdclient.MasterClient
adminLocks *AdminLocks adminLocks *AdminLocks
} }
func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *MasterServer { func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *MasterServer {

View File

@@ -119,7 +119,7 @@ func iterateEcxFile(baseFileName string, processNeedleFn func(key types.NeedleId
} }
func iterateEcjFile(baseFileName string, processNeedleFn func(key types.NeedleId) error) error { func iterateEcjFile(baseFileName string, processNeedleFn func(key types.NeedleId) error) error {
if !util.FileExists(baseFileName+".ecj") { if !util.FileExists(baseFileName + ".ecj") {
return nil return nil
} }
ecjFile, openErr := os.OpenFile(baseFileName+".ecj", os.O_RDONLY, 0644) ecjFile, openErr := os.OpenFile(baseFileName+".ecj", os.O_RDONLY, 0644)

View File

@@ -24,8 +24,8 @@ func TestPositioning(t *testing.T) {
tests := []struct { tests := []struct {
needleId string needleId string
offset int64 offset int64
size int size int
}{ }{
{needleId: "0f0edb92", offset: 31300679656, size: 1167}, {needleId: "0f0edb92", offset: 31300679656, size: 1167},
{needleId: "0ef7d7f8", offset: 11513014944, size: 66044}, {needleId: "0ef7d7f8", offset: 11513014944, size: 66044},

View File

@@ -9,9 +9,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/util"
) )
var ( var (
visitFn = func(path util.FullPath) (childDirectories []string, err error) { visitFn = func(path util.FullPath) (childDirectories []string, err error) {
fmt.Printf(" visit %v ...\n", path) fmt.Printf(" visit %v ...\n", path)
switch path { switch path {
@@ -37,14 +35,11 @@ var (
return nil, nil return nil, nil
} }
printMap = func(m map[string]*Node) { printMap = func(m map[string]*Node) {
for k := range m { for k := range m {
println(" >", k) println(" >", k)
} }
} }
) )
func TestBoundedTree(t *testing.T) { func TestBoundedTree(t *testing.T) {

View File

@@ -54,6 +54,7 @@ func ungzipData(input []byte) ([]byte, error) {
} }
var decoder, _ = zstd.NewReader(nil) var decoder, _ = zstd.NewReader(nil)
func unzstdData(input []byte) ([]byte, error) { func unzstdData(input []byte) ([]byte, error) {
return decoder.DecodeAll(input, nil) return decoder.DecodeAll(input, nil)
} }