From eb9d2cb127de82ef1c1544857dce07e79daec31d Mon Sep 17 00:00:00 2001 From: husharp Date: Thu, 21 Mar 2024 14:41:22 +0800 Subject: [PATCH 1/2] fix deploy path Signed-off-by: husharp --- pkg/mcs/scheduling/server/server.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/mcs/scheduling/server/server.go b/pkg/mcs/scheduling/server/server.go index 738140612b8..47a7cf9962b 100644 --- a/pkg/mcs/scheduling/server/server.go +++ b/pkg/mcs/scheduling/server/server.go @@ -20,6 +20,7 @@ import ( "net/http" "os" "os/signal" + "path/filepath" "runtime" "strconv" "sync" @@ -413,7 +414,8 @@ func (s *Server) startServer() (err error) { // different service modes provided by the same pd-server binary bs.ServerInfoGauge.WithLabelValues(versioninfo.PDReleaseVersion, versioninfo.PDGitHash).Set(float64(time.Now().Unix())) bs.ServerMaxProcsGauge.Set(float64(runtime.GOMAXPROCS(0))) - deployPath, err := os.Executable() + execPath, err := os.Executable() + deployPath := filepath.Dir(execPath) if err != nil { deployPath = "" } From d3e9e7fc915c22b2d730207eb52dcc8600b79479 Mon Sep 17 00:00:00 2001 From: husharp Date: Thu, 21 Mar 2024 14:47:47 +0800 Subject: [PATCH 2/2] fix deploy path Signed-off-by: husharp --- pkg/mcs/tso/server/server.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/mcs/tso/server/server.go b/pkg/mcs/tso/server/server.go index bac93ddfb6b..f5f46a29504 100644 --- a/pkg/mcs/tso/server/server.go +++ b/pkg/mcs/tso/server/server.go @@ -20,6 +20,7 @@ import ( "net/http" "os" "os/signal" + "path/filepath" "runtime" "strconv" "sync" @@ -368,7 +369,8 @@ func (s *Server) startServer() (err error) { s.serverLoopCtx, s.serverLoopCancel = context.WithCancel(s.Context()) legacySvcRootPath := endpoint.LegacyRootPath(s.clusterID) tsoSvcRootPath := endpoint.TSOSvcRootPath(s.clusterID) - deployPath, err := os.Executable() + execPath, err := os.Executable() + deployPath := filepath.Dir(execPath) if err != nil { deployPath = "" }