Merge branch 'master' into mq
This commit is contained in:
@@ -63,6 +63,7 @@ type FilerOptions struct {
|
||||
diskType *string
|
||||
allowedOrigins *string
|
||||
exposeDirectoryData *bool
|
||||
joinExistingFiler *bool
|
||||
}
|
||||
|
||||
func init() {
|
||||
@@ -95,6 +96,7 @@ func init() {
|
||||
f.diskType = cmdFiler.Flag.String("disk", "", "[hdd|ssd|<tag>] hard drive or solid state drive or any tag")
|
||||
f.allowedOrigins = cmdFiler.Flag.String("allowedOrigins", "*", "comma separated list of allowed origins")
|
||||
f.exposeDirectoryData = cmdFiler.Flag.Bool("exposeDirectoryData", true, "whether to return directory metadata and content in Filer UI")
|
||||
f.joinExistingFiler = cmdFiler.Flag.Bool("joinExistingFiler", false, "enable if new filer wants to join existing cluster")
|
||||
|
||||
// start s3 on filer
|
||||
filerStartS3 = cmdFiler.Flag.Bool("s3", false, "whether to start S3 gateway")
|
||||
@@ -262,6 +264,7 @@ func (fo *FilerOptions) startFiler() {
|
||||
DownloadMaxBytesPs: int64(*fo.downloadMaxMBps) * 1024 * 1024,
|
||||
DiskType: *fo.diskType,
|
||||
AllowedOrigins: strings.Split(*fo.allowedOrigins, ","),
|
||||
JoinExistingFiler: *fo.joinExistingFiler,
|
||||
})
|
||||
if nfs_err != nil {
|
||||
glog.Fatalf("Filer startup error: %v", nfs_err)
|
||||
|
||||
@@ -119,6 +119,7 @@ func init() {
|
||||
filerOptions.downloadMaxMBps = cmdServer.Flag.Int("filer.downloadMaxMBps", 0, "download max speed for each download request, in MB per second")
|
||||
filerOptions.diskType = cmdServer.Flag.String("filer.disk", "", "[hdd|ssd|<tag>] hard drive or solid state drive or any tag")
|
||||
filerOptions.exposeDirectoryData = cmdServer.Flag.Bool("filer.exposeDirectoryData", true, "expose directory data via filer. If false, filer UI will be innaccessible.")
|
||||
filerOptions.joinExistingFiler = cmdServer.Flag.Bool("filer.joinExistingFiler", false, "enable if new filer wants to join existing cluster")
|
||||
|
||||
serverOptions.v.port = cmdServer.Flag.Int("volume.port", 8080, "volume server http listen port")
|
||||
serverOptions.v.portGrpc = cmdServer.Flag.Int("volume.port.grpc", 0, "volume server grpc listen port")
|
||||
|
||||
@@ -74,6 +74,7 @@ type FilerOption struct {
|
||||
DiskType string
|
||||
AllowedOrigins []string
|
||||
ExposeDirectoryData bool
|
||||
JoinExistingFiler bool
|
||||
}
|
||||
|
||||
type FilerServer struct {
|
||||
@@ -197,6 +198,9 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption)
|
||||
|
||||
existingNodes := fs.filer.ListExistingPeerUpdates()
|
||||
startFromTime := time.Now().Add(-filer.LogFlushInterval)
|
||||
if option.JoinExistingFiler {
|
||||
startFromTime = time.Time{}
|
||||
}
|
||||
if isFresh {
|
||||
glog.V(0).Infof("%s bootstrap from peers %+v", option.Host, existingNodes)
|
||||
if err := fs.filer.MaybeBootstrapFromPeers(option.Host, existingNodes, startFromTime); err != nil {
|
||||
|
||||
@@ -651,9 +651,12 @@ func (c *commandVolumeFsck) collectVolumeIds() (volumeIdToServer map[string]map[
|
||||
}
|
||||
|
||||
eachDataNode(topologyInfo, func(dc string, rack RackId, t *master_pb.DataNodeInfo) {
|
||||
var volumeCount, ecShardCount int
|
||||
dataNodeId := t.GetId()
|
||||
for _, diskInfo := range t.DiskInfos {
|
||||
dataNodeId := t.GetId()
|
||||
volumeIdToServer[dataNodeId] = make(map[uint32]VInfo)
|
||||
if _, ok := volumeIdToServer[dataNodeId]; !ok {
|
||||
volumeIdToServer[dataNodeId] = make(map[uint32]VInfo)
|
||||
}
|
||||
for _, vi := range diskInfo.VolumeInfos {
|
||||
volumeIdToServer[dataNodeId][vi.Id] = VInfo{
|
||||
server: pb.NewServerAddressFromDataNode(t),
|
||||
@@ -661,6 +664,7 @@ func (c *commandVolumeFsck) collectVolumeIds() (volumeIdToServer map[string]map[
|
||||
isEcVolume: false,
|
||||
isReadOnly: vi.ReadOnly,
|
||||
}
|
||||
volumeCount += 1
|
||||
}
|
||||
for _, ecShardInfo := range diskInfo.EcShardInfos {
|
||||
volumeIdToServer[dataNodeId][ecShardInfo.Id] = VInfo{
|
||||
@@ -669,10 +673,11 @@ func (c *commandVolumeFsck) collectVolumeIds() (volumeIdToServer map[string]map[
|
||||
isEcVolume: true,
|
||||
isReadOnly: true,
|
||||
}
|
||||
ecShardCount += 1
|
||||
}
|
||||
if *c.verbose {
|
||||
fmt.Fprintf(c.writer, "dn %+v collected %d volumes and locations.\n", dataNodeId, len(volumeIdToServer[dataNodeId]))
|
||||
}
|
||||
}
|
||||
if *c.verbose {
|
||||
fmt.Fprintf(c.writer, "dn %+v collected %d volumes and %d ec shards.\n", dataNodeId, volumeCount, ecShardCount)
|
||||
}
|
||||
})
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user