just exit in case of duplicated volume directories were loaded

This commit is contained in:
guol-fnst
2022-05-17 11:06:41 +08:00
committed by guol-fnst
parent 8fab39e775
commit 076595fbdd
3 changed files with 2 additions and 8 deletions

View File

@@ -267,7 +267,7 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, v
stopChan := make(chan bool) stopChan := make(chan bool)
grace.OnInterrupt(func() { grace.OnInterrupt(func() {
fmt.Println("volume server has be killed") fmt.Println("volume server has been killed")
// Stop heartbeats // Stop heartbeats
if !volumeServer.StopHeartbeat() { if !volumeServer.StopHeartbeat() {

View File

@@ -3,7 +3,6 @@ package weed_server
import ( import (
"fmt" "fmt"
"os" "os"
"syscall"
"time" "time"
"github.com/chrislusf/seaweedfs/weed/operation" "github.com/chrislusf/seaweedfs/weed/operation"
@@ -121,9 +120,7 @@ func (vs *VolumeServer) doHeartbeat(masterAddress pb.ServerAddress, grpcDialOpti
} }
if in.HasDuplicatedDirectory { if in.HasDuplicatedDirectory {
glog.Error("Shut Down Volume Server due to duplicated volume directory") glog.Error("Shut Down Volume Server due to duplicated volume directory")
glog.V(0).Infof("send SIGINT to Volume Server") os.Exit(1)
p, _ := os.FindProcess(vs.pid)
p.Signal(syscall.SIGINT)
} }
if in.GetVolumeSizeLimit() != 0 && vs.store.GetVolumeSizeLimit() != in.GetVolumeSizeLimit() { if in.GetVolumeSizeLimit() != 0 && vs.store.GetVolumeSizeLimit() != in.GetVolumeSizeLimit() {
vs.store.SetVolumeSizeLimit(in.GetVolumeSizeLimit()) vs.store.SetVolumeSizeLimit(in.GetVolumeSizeLimit())

View File

@@ -2,7 +2,6 @@ package weed_server
import ( import (
"net/http" "net/http"
"os"
"sync" "sync"
"github.com/chrislusf/seaweedfs/weed/pb" "github.com/chrislusf/seaweedfs/weed/pb"
@@ -45,7 +44,6 @@ type VolumeServer struct {
fileSizeLimitBytes int64 fileSizeLimitBytes int64
isHeartbeating bool isHeartbeating bool
stopChan chan bool stopChan chan bool
pid int
} }
func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string, func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
@@ -89,7 +87,6 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
inFlightDownloadDataLimitCond: sync.NewCond(new(sync.Mutex)), inFlightDownloadDataLimitCond: sync.NewCond(new(sync.Mutex)),
concurrentUploadLimit: concurrentUploadLimit, concurrentUploadLimit: concurrentUploadLimit,
concurrentDownloadLimit: concurrentDownloadLimit, concurrentDownloadLimit: concurrentDownloadLimit,
pid: os.Getpid(),
} }
vs.SeedMasterNodes = masterNodes vs.SeedMasterNodes = masterNodes