SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
master fix interruption through ctrl+c (#3834)
Konstantin Lebedev401315f33750
diff --git a/weed/command/master.go b/weed/command/master.goindex a74389b1fc..39dbf42ed0 100644--- a/weed/command/master.go+++ b/weed/command/master.go@@ -255,7 +255,7 @@ func startMaster(masterOption MasterOptions, masterWhiteList []string) {}grace.OnInterrupt(ms.Shutdown)- grace.OnInterrupt(grpcS.GracefulStop)+ grace.OnInterrupt(grpcS.Stop)grace.OnReload(func() {if ms.Topo.HashicorpRaft != nil && ms.Topo.HashicorpRaft.State() == hashicorpRaft.Leader {ms.Topo.HashicorpRaft.LeadershipTransfer()diff --git a/weed/util/grace/signal_handling.go b/weed/util/grace/signal_handling.goindex 14b9987965..0fc0f43e18 100644--- a/weed/util/grace/signal_handling.go+++ b/weed/util/grace/signal_handling.go@@ -4,8 +4,11 @@package graceimport (+ "github.com/seaweedfs/seaweedfs/weed/glog""os""os/signal"+ "reflect"+ "runtime""sync""syscall")@@ -16,6 +19,10 @@ var interruptHookLock sync.RWMutexvar reloadHooks = make([]func(), 0)var reloadHookLock sync.RWMutex+func GetFunctionName(i interface{}) string {+ return runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()+}+func init() {signalChan = make(chan os.Signal, 1)signal.Notify(signalChan,@@ -38,6 +45,7 @@ func init() {} else {interruptHookLock.RLock()for _, hook := range interruptHooks {+ glog.V(4).Infof("exec interrupt hook func name:%s", GetFunctionName(hook))hook()}interruptHookLock.RUnlock()