Skip to content

Commit 792f20e

Browse files
authored
server: Fix mppcoordinatorMananger server addr empty issue (#52632) (#52691)
close #52608
1 parent 64ca76e commit 792f20e

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

cmd/tidb-server/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,6 @@ func createServer(storage kv.Storage, dom *domain.Domain) *server.Server {
901901
closeDomainAndStorage(storage, dom)
902902
log.Fatal("failed to create the server", zap.Error(err), zap.Stack("stack"))
903903
}
904-
mppcoordmanager.InstanceMPPCoordinatorManager.InitServerAddr(svr.GetStatusServerAddr())
905904
svr.SetDomain(dom)
906905
go dom.ExpensiveQueryHandle().SetSessionManager(svr).Run()
907906
go dom.MemoryUsageAlarmHandle().SetSessionManager(svr).Run()

pkg/server/handler/tests/BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ go_test(
99
"main_test.go",
1010
],
1111
flaky = True,
12-
shard_count = 38,
12+
shard_count = 39,
1313
deps = [
1414
"//pkg/config",
1515
"//pkg/ddl",
1616
"//pkg/ddl/util",
1717
"//pkg/domain",
1818
"//pkg/domain/infosync",
19+
"//pkg/executor/mppcoordmanager",
1920
"//pkg/infoschema",
2021
"//pkg/kv",
2122
"//pkg/meta",

pkg/server/handler/tests/http_handler_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import (
4040
"github.com/pingcap/tidb/pkg/ddl"
4141
"github.com/pingcap/tidb/pkg/domain"
4242
"github.com/pingcap/tidb/pkg/domain/infosync"
43+
"github.com/pingcap/tidb/pkg/executor/mppcoordmanager"
4344
"github.com/pingcap/tidb/pkg/infoschema"
4445
"github.com/pingcap/tidb/pkg/kv"
4546
"github.com/pingcap/tidb/pkg/meta"
@@ -1502,3 +1503,13 @@ func testUpgradeShow(t *testing.T, ts *basicHTTPHandlerTestSuite) {
15021503
require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/domain/infosync/mockGetAllServerInfo", makeFailpointRes(mockedAllServerInfos)))
15031504
checkUpgradeShow(3, 100, 0)
15041505
}
1506+
1507+
func TestIssue52608(t *testing.T) {
1508+
ts := createBasicHTTPHandlerTestSuite()
1509+
1510+
ts.startServer(t)
1511+
defer ts.stopServer(t)
1512+
on, addr := mppcoordmanager.InstanceMPPCoordinatorManager.GetServerAddr()
1513+
require.Equal(t, on, true)
1514+
require.Equal(t, addr[:10], "127.0.0.1:")
1515+
}

pkg/server/server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import (
5353
autoid "github.com/pingcap/tidb/pkg/autoid_service"
5454
"github.com/pingcap/tidb/pkg/config"
5555
"github.com/pingcap/tidb/pkg/domain"
56+
"github.com/pingcap/tidb/pkg/executor/mppcoordmanager"
5657
"github.com/pingcap/tidb/pkg/extension"
5758
"github.com/pingcap/tidb/pkg/kv"
5859
"github.com/pingcap/tidb/pkg/metrics"
@@ -436,6 +437,7 @@ func (s *Server) Run(dom *domain.Domain) error {
436437
log.Error("failed to create the server", zap.Error(err), zap.Stack("stack"))
437438
return err
438439
}
440+
mppcoordmanager.InstanceMPPCoordinatorManager.InitServerAddr(s.GetStatusServerAddr())
439441
}
440442
if config.GetGlobalConfig().Performance.ForceInitStats && dom != nil {
441443
<-dom.StatsHandle().InitStatsDone

0 commit comments

Comments
 (0)