Skip to content

Commit f40e07d

Browse files
committed
cherry-pick pingcap#58473 into release-7.1
Signed-off-by: you06 <[email protected]> enabel race Signed-off-by: you06 <[email protected]> fix build Signed-off-by: you06 <[email protected]> fix build Signed-off-by: you06 <[email protected]> fix test Signed-off-by: you06 <[email protected]> fix test Signed-off-by: you06 <[email protected]>
1 parent 350b4a8 commit f40e07d

File tree

7 files changed

+319
-87
lines changed

7 files changed

+319
-87
lines changed

disttask/framework/dispatcher/dispatcher_test.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,18 @@ func TestGetInstance(t *testing.T) {
8484
serverIDs := []string{"10.123.124.10:32457", "[ABCD:EF01:2345:6789:ABCD:EF01:2345:6789]:65535"}
8585
mockedAllServerInfos = map[string]*infosync.ServerInfo{
8686
uuids[0]: {
87-
ID: uuids[0],
88-
IP: "10.123.124.10",
89-
Port: 32457,
87+
StaticServerInfo: infosync.StaticServerInfo{
88+
ID: uuids[0],
89+
IP: "10.123.124.10",
90+
Port: 32457,
91+
},
9092
},
9193
uuids[1]: {
92-
ID: uuids[1],
93-
IP: "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789",
94-
Port: 65535,
94+
StaticServerInfo: infosync.StaticServerInfo{
95+
ID: uuids[1],
96+
IP: "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789",
97+
Port: 65535,
98+
},
9599
},
96100
}
97101
require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/domain/infosync/mockGetAllServerInfo", makeFailpointRes(mockedAllServerInfos)))

domain/domain_test.go

Lines changed: 49 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,23 @@ func TestClosestReplicaReadChecker(t *testing.T) {
271271

272272
mockedAllServerInfos := map[string]*infosync.ServerInfo{
273273
"s1": {
274-
ID: "s1",
275-
Labels: map[string]string{
276-
"zone": "zone1",
274+
StaticServerInfo: infosync.StaticServerInfo{
275+
ID: "s1",
276+
},
277+
DynamicServerInfo: infosync.DynamicServerInfo{
278+
Labels: map[string]string{
279+
"zone": "zone1",
280+
},
277281
},
278282
},
279283
"s2": {
280-
ID: "s2",
281-
Labels: map[string]string{
282-
"zone": "zone2",
284+
StaticServerInfo: infosync.StaticServerInfo{
285+
ID: "s2",
286+
},
287+
DynamicServerInfo: infosync.DynamicServerInfo{
288+
Labels: map[string]string{
289+
"zone": "zone2",
290+
},
283291
},
284292
},
285293
}
@@ -345,33 +353,53 @@ func TestClosestReplicaReadChecker(t *testing.T) {
345353
// partial matches
346354
mockedAllServerInfos = map[string]*infosync.ServerInfo{
347355
"s1": {
348-
ID: "s1",
349-
Labels: map[string]string{
350-
"zone": "zone1",
356+
StaticServerInfo: infosync.StaticServerInfo{
357+
ID: "s1",
358+
},
359+
DynamicServerInfo: infosync.DynamicServerInfo{
360+
Labels: map[string]string{
361+
"zone": "zone1",
362+
},
351363
},
352364
},
353365
"s2": {
354-
ID: "s2",
355-
Labels: map[string]string{
356-
"zone": "zone2",
366+
StaticServerInfo: infosync.StaticServerInfo{
367+
ID: "s2",
368+
},
369+
DynamicServerInfo: infosync.DynamicServerInfo{
370+
Labels: map[string]string{
371+
"zone": "zone2",
372+
},
357373
},
358374
},
359375
"s22": {
360-
ID: "s22",
361-
Labels: map[string]string{
362-
"zone": "zone2",
376+
StaticServerInfo: infosync.StaticServerInfo{
377+
ID: "s22",
378+
},
379+
DynamicServerInfo: infosync.DynamicServerInfo{
380+
Labels: map[string]string{
381+
"zone": "zone2",
382+
},
363383
},
364384
},
365385
"s3": {
366-
ID: "s3",
367-
Labels: map[string]string{
368-
"zone": "zone3",
386+
StaticServerInfo: infosync.StaticServerInfo{
387+
ID: "s3",
388+
},
389+
DynamicServerInfo: infosync.DynamicServerInfo{
390+
Labels: map[string]string{
391+
"zone": "zone3",
392+
},
369393
},
370394
},
371395
"s4": {
372-
ID: "s4",
373-
Labels: map[string]string{
374-
"zone": "zone4",
396+
StaticServerInfo: infosync.StaticServerInfo{
397+
ID: "s4",
398+
},
399+
DynamicServerInfo: infosync.DynamicServerInfo{
400+
Labels: map[string]string{
401+
"zone": "zone4",
402+
},
375403
},
376404
},
377405
}

domain/infosync/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ go_test(
6262
srcs = ["info_test.go"],
6363
embed = [":infosync"],
6464
flaky = True,
65-
shard_count = 4,
65+
shard_count = 5,
6666
deps = [
6767
"//ddl/placement",
6868
"//ddl/util",

0 commit comments

Comments
 (0)