From dc2cfac7128de99c3712e467933e09d6ca48538e Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 10:39:29 +0800 Subject: [PATCH 01/76] test Signed-off-by: lhy1024 --- tests/server/api/api_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/server/api/api_test.go b/tests/server/api/api_test.go index 44a0ae69a46..c73e87f9db0 100644 --- a/tests/server/api/api_test.go +++ b/tests/server/api/api_test.go @@ -30,10 +30,12 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" "go.uber.org/goleak" + "go.uber.org/zap" "github.com/pingcap/failpoint" "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/kvproto/pkg/pdpb" + "github.com/pingcap/log" "github.com/tikv/pd/pkg/core" "github.com/tikv/pd/pkg/utils/apiutil" @@ -850,30 +852,35 @@ func TestRemovingProgress(t *testing.T) { re.NoError(err) defer resp.Body.Close() if resp.StatusCode != http.StatusOK { + log.Info("not ready", zap.String("url", url), zap.Int("status", resp.StatusCode)) return false } output, err := io.ReadAll(resp.Body) re.NoError(err) re.NoError(json.Unmarshal(output, &p)) if p.Action != "removing" { + log.Info("not removing", zap.String("action", p.Action)) return false } // store 1: (60-20)/(60+50) ~= 0.36 // store 2: (30-10)/(30+40) ~= 0.28 // average progress ~= (0.36+0.28)/2 = 0.32 if fmt.Sprintf("%.2f", p.Progress) != "0.32" { + log.Info("progress not match", zap.Float64("progress", p.Progress)) return false } // store 1: 40/10s = 4 // store 2: 20/10s = 2 // average speed = (2+4)/2 = 33 if p.CurrentSpeed != 3.0 { + log.Info("speed not match", zap.Float64("speed", p.CurrentSpeed)) return false } // store 1: (20+50)/4 = 17.5s // store 2: (10+40)/2 = 25s // average time = (17.5+25)/2 = 21.25s if p.LeftSeconds != 21.25 { + log.Info("time not match", zap.Float64("time", p.LeftSeconds)) return false } return true From 8240a5b9221fae7a172451d00b988b3c29b3b3a4 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 10:49:09 +0800 Subject: [PATCH 02/76] test-1 Signed-off-by: lhy1024 From 21d02cf861d2035189f04d7a87a4746d4264e2b8 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 10:56:24 +0800 Subject: [PATCH 03/76] test-1 Signed-off-by: lhy1024 From 042957aaf234b6bb630ceaf494e143bca5f43c31 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 11:10:34 +0800 Subject: [PATCH 04/76] test-1 Signed-off-by: lhy1024 --- tests/server/api/api_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/server/api/api_test.go b/tests/server/api/api_test.go index c73e87f9db0..1f61fed1a42 100644 --- a/tests/server/api/api_test.go +++ b/tests/server/api/api_test.go @@ -841,6 +841,14 @@ func TestRemovingProgress(t *testing.T) { } testutil.Eventually(re, func() bool { + defer func() { + output = sendRequest(re, leader.GetAddr()+"/pd/api/v1/stores/progress?id=1", http.MethodGet, http.StatusOK) + re.NoError(json.Unmarshal(output, &p)) + log.Info("store 1 progress", zap.Any("progress", p)) + output = sendRequest(re, leader.GetAddr()+"/pd/api/v1/stores/progress?id=2", http.MethodGet, http.StatusOK) + re.NoError(json.Unmarshal(output, &p)) + log.Info("store 2 progress", zap.Any("progress", p)) + }() // wait for cluster prepare if !leader.GetRaftCluster().IsPrepared() { leader.GetRaftCluster().SetPrepared() @@ -871,7 +879,7 @@ func TestRemovingProgress(t *testing.T) { } // store 1: 40/10s = 4 // store 2: 20/10s = 2 - // average speed = (2+4)/2 = 33 + // average speed = (2+4)/2 = 3.0 if p.CurrentSpeed != 3.0 { log.Info("speed not match", zap.Float64("speed", p.CurrentSpeed)) return false From d7cd5162a684d4de63bc5a4e44808eebc7cb9426 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 11:16:31 +0800 Subject: [PATCH 05/76] test-1 Signed-off-by: lhy1024 From 0661d8745c5f8fb60013cce278100a8d68fec96a Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 11:24:35 +0800 Subject: [PATCH 06/76] test-2 Signed-off-by: lhy1024 From 451eeb8bf465596860b1bdcca5122ec8e10ff8af Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 11:29:35 +0800 Subject: [PATCH 07/76] test-1 Signed-off-by: lhy1024 From fdbcad5da52b6fe433bfd394cc1d1e301e21e5a9 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 11:35:49 +0800 Subject: [PATCH 08/76] test-1 Signed-off-by: lhy1024 From 52480eb688371d6714370383b6da6e903b073347 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 11:41:28 +0800 Subject: [PATCH 09/76] test-1 Signed-off-by: lhy1024 From 86216d268388cebabed2697565274402f2e55f55 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 11:51:32 +0800 Subject: [PATCH 10/76] t Signed-off-by: lhy1024 --- tests/server/api/api_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/server/api/api_test.go b/tests/server/api/api_test.go index 1f61fed1a42..3f13bebea33 100644 --- a/tests/server/api/api_test.go +++ b/tests/server/api/api_test.go @@ -1120,7 +1120,9 @@ func sendRequest(re *require.Assertions, url string, method string, statusCode i if resp.StatusCode == http.StatusServiceUnavailable { return false } - re.Equal(statusCode, resp.StatusCode) + if resp.StatusCode != statusCode { + return false + } output, err = io.ReadAll(resp.Body) re.NoError(err) return true From a415121bcb883d69693281b6bffef4ba216d1864 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 11:51:37 +0800 Subject: [PATCH 11/76] test-1 Signed-off-by: lhy1024 From b230cad4e03226bff45a1fd2796cf28dd2c6491a Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 11:55:54 +0800 Subject: [PATCH 12/76] test-1 Signed-off-by: lhy1024 From 5e66ddd2e133a14079bf9b755a06f05d7832e309 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 12:15:42 +0800 Subject: [PATCH 13/76] test-1 Signed-off-by: lhy1024 From eb60c1f4686d9a5d07ca820370846d7a095b335f Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 12:21:28 +0800 Subject: [PATCH 14/76] test-1 Signed-off-by: lhy1024 From bb4eb69875113edb57b280fa9b469f0d06a420ed Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 12:28:52 +0800 Subject: [PATCH 15/76] test-1 Signed-off-by: lhy1024 From 72f9e465a91604c96726928784705496187b09d8 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 12:36:56 +0800 Subject: [PATCH 16/76] test-2 Signed-off-by: lhy1024 From f3b3a3872c4b1104c59d6761bc7f25ddc5085273 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 12:45:01 +0800 Subject: [PATCH 17/76] test-3 Signed-off-by: lhy1024 From 1d36f00d09fd81aeddf6f0e84117b50d5e9a9dec Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 12:53:04 +0800 Subject: [PATCH 18/76] test-4 Signed-off-by: lhy1024 From 1e0f9787823068d3cc91c9a44a12443a77a201b0 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 12:57:27 +0800 Subject: [PATCH 19/76] test-1 Signed-off-by: lhy1024 From 3ce7dc449dbf5d7c278aa01c90fdc3f7fb37396d Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 13:29:03 +0800 Subject: [PATCH 20/76] test-1 Signed-off-by: lhy1024 From db8b21b22fca7a5318d7536b4d7c527482c94298 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 13:41:58 +0800 Subject: [PATCH 21/76] test-1 Signed-off-by: lhy1024 From fc528440dd4aafeaa34a302463f6e279dd2ba0ac Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 13:50:02 +0800 Subject: [PATCH 22/76] test-2 Signed-off-by: lhy1024 From 6c545b6e6c2906fb0bb7bc1544af6b512bc5e4cc Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 13:56:01 +0800 Subject: [PATCH 23/76] test-1 Signed-off-by: lhy1024 From ec6640077be5e9a4b36e5645d539f0b19f1f58d5 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 14:01:41 +0800 Subject: [PATCH 24/76] test-1 Signed-off-by: lhy1024 From 9cfae91f566b34b12d00c27cc875d4e19e410c1d Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 14:07:02 +0800 Subject: [PATCH 25/76] test-1 Signed-off-by: lhy1024 From b480ca5fd213aeeb9252fc00b028418a07a9f2e4 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 14:13:10 +0800 Subject: [PATCH 26/76] a Signed-off-by: lhy1024 --- tests/server/api/api_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/server/api/api_test.go b/tests/server/api/api_test.go index 3f13bebea33..4478a3aad58 100644 --- a/tests/server/api/api_test.go +++ b/tests/server/api/api_test.go @@ -1112,7 +1112,9 @@ func sendRequest(re *require.Assertions, url string, method string, statusCode i testutil.Eventually(re, func() bool { resp, err := tests.TestDialClient.Do(req) - re.NoError(err) + if err != nil { + return false + } defer resp.Body.Close() // Due to service unavailability caused by environmental issues, From 979ccd03e120ddf61417500be1494f7b31ea6192 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 14:13:14 +0800 Subject: [PATCH 27/76] test-1 Signed-off-by: lhy1024 From 34b1e592e8524f9761cedd7a51e492a2d44148f9 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 14:24:56 +0800 Subject: [PATCH 28/76] test-1 Signed-off-by: lhy1024 From 4d4c81b3fffe7ea5098b1d278b98f33f016b7d2c Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 14:32:12 +0800 Subject: [PATCH 29/76] test-1 Signed-off-by: lhy1024 From ff21691109c40d01894b7cdf680ec0debff1df60 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 14:37:18 +0800 Subject: [PATCH 30/76] test-1 Signed-off-by: lhy1024 From ad42d1b0309380c4fd2554e723bc1c10fee5717a Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 14:50:39 +0800 Subject: [PATCH 31/76] test-1 Signed-off-by: lhy1024 From 20f14f5c93145a8fb0de28efe479f8be3d91eede Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 15:02:19 +0800 Subject: [PATCH 32/76] test-1 Signed-off-by: lhy1024 From 0dabf16452f1f6a804aae875ccb5ff32e52ca5e7 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 15:09:07 +0800 Subject: [PATCH 33/76] add log Signed-off-by: lhy1024 --- tests/server/api/api_test.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/server/api/api_test.go b/tests/server/api/api_test.go index 4478a3aad58..e637cb9915a 100644 --- a/tests/server/api/api_test.go +++ b/tests/server/api/api_test.go @@ -840,14 +840,17 @@ func TestRemovingProgress(t *testing.T) { }) } + now := time.Now() testutil.Eventually(re, func() bool { defer func() { - output = sendRequest(re, leader.GetAddr()+"/pd/api/v1/stores/progress?id=1", http.MethodGet, http.StatusOK) - re.NoError(json.Unmarshal(output, &p)) - log.Info("store 1 progress", zap.Any("progress", p)) - output = sendRequest(re, leader.GetAddr()+"/pd/api/v1/stores/progress?id=2", http.MethodGet, http.StatusOK) - re.NoError(json.Unmarshal(output, &p)) - log.Info("store 2 progress", zap.Any("progress", p)) + if time.Since(now) > 19*time.Second { + output = sendRequest(re, leader.GetAddr()+"/pd/api/v1/stores/progress?id=1", http.MethodGet, http.StatusOK) + re.NoError(json.Unmarshal(output, &p)) + log.Info("store 1 progress", zap.Any("progress", p)) + output = sendRequest(re, leader.GetAddr()+"/pd/api/v1/stores/progress?id=2", http.MethodGet, http.StatusOK) + re.NoError(json.Unmarshal(output, &p)) + log.Info("store 2 progress", zap.Any("progress", p)) + } }() // wait for cluster prepare if !leader.GetRaftCluster().IsPrepared() { @@ -1113,6 +1116,7 @@ func sendRequest(re *require.Assertions, url string, method string, statusCode i testutil.Eventually(re, func() bool { resp, err := tests.TestDialClient.Do(req) if err != nil { + log.Info("send request failed", zap.Error(err)) return false } defer resp.Body.Close() @@ -1120,9 +1124,11 @@ func sendRequest(re *require.Assertions, url string, method string, statusCode i // Due to service unavailability caused by environmental issues, // we will retry it. if resp.StatusCode == http.StatusServiceUnavailable { + log.Info("service unavailable", zap.String("url", url)) return false } if resp.StatusCode != statusCode { + log.Info("status code not match", zap.String("url", url), zap.Int("status", resp.StatusCode)) return false } output, err = io.ReadAll(resp.Body) From b4d913bcdc0f2c293c31817c0493f75a9b5d65d9 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 15:09:16 +0800 Subject: [PATCH 34/76] test-1 Signed-off-by: lhy1024 From eddc8e87d1032f7b7e73c0e7efdacec29aa84301 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 15:13:31 +0800 Subject: [PATCH 35/76] test-1 Signed-off-by: lhy1024 From 9c0734d9c31a10192829eee53f2c526d3926b649 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 15:20:58 +0800 Subject: [PATCH 36/76] test-1 Signed-off-by: lhy1024 From 3da3772f8048f1daa3f0af8d502251ba2715f1bf Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 15:28:18 +0800 Subject: [PATCH 37/76] test-1 Signed-off-by: lhy1024 From 063332c096c5dceb15686cb2465940a1131d2b6c Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 15:33:12 +0800 Subject: [PATCH 38/76] test-1 Signed-off-by: lhy1024 From 976c5f9b84b26bf1a93a1babe07cf3cc45e4ba60 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 15:40:26 +0800 Subject: [PATCH 39/76] test-1 Signed-off-by: lhy1024 --- tests/server/api/api_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/server/api/api_test.go b/tests/server/api/api_test.go index e637cb9915a..e17f1c11778 100644 --- a/tests/server/api/api_test.go +++ b/tests/server/api/api_test.go @@ -852,6 +852,9 @@ func TestRemovingProgress(t *testing.T) { log.Info("store 2 progress", zap.Any("progress", p)) } }() + if leader.GetRaftCluster() == nil { + return false + } // wait for cluster prepare if !leader.GetRaftCluster().IsPrepared() { leader.GetRaftCluster().SetPrepared() From c58204514f380da7c7a77a54bb05fbf4fcbcd2aa Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 15:49:08 +0800 Subject: [PATCH 40/76] test-1 Signed-off-by: lhy1024 From 126ea6c738c33097cdb6bd9f4aa40d2481729043 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 15:55:54 +0800 Subject: [PATCH 41/76] test-1 Signed-off-by: lhy1024 From ba7384eeee7b555e67f7264cfccdea05ec3a1258 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 16:01:48 +0800 Subject: [PATCH 42/76] test-1 Signed-off-by: lhy1024 From 33133fcf9999bb6ca8b583ca671d1b53596d366b Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 16:08:13 +0800 Subject: [PATCH 43/76] test-1 Signed-off-by: lhy1024 --- tests/testutil.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/testutil.go b/tests/testutil.go index 406e09345b9..fd8c90d1a0f 100644 --- a/tests/testutil.go +++ b/tests/testutil.go @@ -211,7 +211,8 @@ func MustPutStore(re *require.Assertions, cluster *TestCluster, store *metapb.St if ts == 0 { ts = time.Now().UnixNano() } - storeInfo := grpcServer.GetRaftCluster().GetStore(store.GetId()) + raftCluster := grpcServer.GetRaftCluster() + storeInfo := raftCluster.GetStore(store.GetId()) newStore := storeInfo.Clone( core.SetStoreStats(&pdpb.StoreStats{ Capacity: uint64(10 * units.GiB), @@ -220,7 +221,7 @@ func MustPutStore(re *require.Assertions, cluster *TestCluster, store *metapb.St }), core.SetLastHeartbeatTS(time.Unix(ts/1e9, ts%1e9)), ) - grpcServer.GetRaftCluster().GetBasicCluster().PutStore(newStore) + raftCluster.GetBasicCluster().PutStore(newStore) if cluster.GetSchedulingPrimaryServer() != nil { cluster.GetSchedulingPrimaryServer().GetCluster().PutStore(newStore) } From 4f987db2fd34475727a11fe698a0bd9668b5bfb6 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 16:13:44 +0800 Subject: [PATCH 44/76] test-1 Signed-off-by: lhy1024 From 1c394d4e63077f74cdaf9de4716648e8e9fdcdc7 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 16:19:15 +0800 Subject: [PATCH 45/76] test-1 Signed-off-by: lhy1024 From 437b369fae65d7978737f73532b35990547623e8 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 16:23:10 +0800 Subject: [PATCH 46/76] test-1 Signed-off-by: lhy1024 From 40981b4dd9db5f9d9968dca54c99f7d993c3075d Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 16:31:53 +0800 Subject: [PATCH 47/76] test-2 Signed-off-by: lhy1024 --- pkg/core/store.go | 3 +++ tests/testutil.go | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/core/store.go b/pkg/core/store.go index 9ec9a44bfc8..b8b892a20ea 100644 --- a/pkg/core/store.go +++ b/pkg/core/store.go @@ -666,6 +666,9 @@ func NewStoresInfo() *StoresInfo { func (s *StoresInfo) GetStore(storeID uint64) *StoreInfo { s.RLock() defer s.RUnlock() + if s.stores == nil { + return nil + } store, ok := s.stores[storeID] if !ok { return nil diff --git a/tests/testutil.go b/tests/testutil.go index fd8c90d1a0f..9ce3d796e6c 100644 --- a/tests/testutil.go +++ b/tests/testutil.go @@ -212,7 +212,8 @@ func MustPutStore(re *require.Assertions, cluster *TestCluster, store *metapb.St ts = time.Now().UnixNano() } raftCluster := grpcServer.GetRaftCluster() - storeInfo := raftCluster.GetStore(store.GetId()) + id := store.GetId() + storeInfo := raftCluster.GetStore(id) newStore := storeInfo.Clone( core.SetStoreStats(&pdpb.StoreStats{ Capacity: uint64(10 * units.GiB), From 5f21a2c25720a928f082425f988c8928d04f3ee2 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 16:34:12 +0800 Subject: [PATCH 48/76] test Signed-off-by: lhy1024 --- pkg/core/store.go | 1 + tests/testutil.go | 1 + 2 files changed, 2 insertions(+) diff --git a/pkg/core/store.go b/pkg/core/store.go index b8b892a20ea..a7d59355084 100644 --- a/pkg/core/store.go +++ b/pkg/core/store.go @@ -667,6 +667,7 @@ func (s *StoresInfo) GetStore(storeID uint64) *StoreInfo { s.RLock() defer s.RUnlock() if s.stores == nil { + log.Fatal("invalid stores") return nil } store, ok := s.stores[storeID] diff --git a/tests/testutil.go b/tests/testutil.go index 9ce3d796e6c..d499472f83f 100644 --- a/tests/testutil.go +++ b/tests/testutil.go @@ -214,6 +214,7 @@ func MustPutStore(re *require.Assertions, cluster *TestCluster, store *metapb.St raftCluster := grpcServer.GetRaftCluster() id := store.GetId() storeInfo := raftCluster.GetStore(id) + re.NotNil(storeInfo) newStore := storeInfo.Clone( core.SetStoreStats(&pdpb.StoreStats{ Capacity: uint64(10 * units.GiB), From 5832e60098ae54d6ed21b23a173234688b75554f Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 16:40:41 +0800 Subject: [PATCH 49/76] test-1 Signed-off-by: lhy1024 From ec917388b06eae7643f68f2fb99d2e301c42b1ad Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 16:49:09 +0800 Subject: [PATCH 50/76] test-2 Signed-off-by: lhy1024 From 3264e803ce6361746a1ef909a565bd26938caa73 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 16:57:13 +0800 Subject: [PATCH 51/76] test-3 Signed-off-by: lhy1024 --- tests/server/api/api_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/server/api/api_test.go b/tests/server/api/api_test.go index e17f1c11778..8efa6fddfd4 100644 --- a/tests/server/api/api_test.go +++ b/tests/server/api/api_test.go @@ -827,7 +827,7 @@ func TestRemovingProgress(t *testing.T) { resp, err := tests.TestDialClient.Do(req) re.NoError(err) defer resp.Body.Close() - if resp.StatusCode != http.StatusOK { + if resp.StatusCode != http.StatusOK /stores/progress{ return false } // is not prepared From ec6fbb7e51cabc8ffc29b1d6007d79b48499558f Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 18:32:50 +0800 Subject: [PATCH 52/76] test-1 Signed-off-by: lhy1024 --- server/cluster/cluster.go | 2 +- tests/server/api/api_test.go | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/server/cluster/cluster.go b/server/cluster/cluster.go index 8923efef9a6..6316f475785 100644 --- a/server/cluster/cluster.go +++ b/server/cluster/cluster.go @@ -812,7 +812,7 @@ func (c *RaftCluster) runNodeStateCheckJob() { ticker := time.NewTicker(nodeStateCheckJobInterval) failpoint.Inject("highFrequencyClusterJobs", func() { - ticker.Reset(2 * time.Second) + ticker.Reset(time.Millisecond) }) defer ticker.Stop() diff --git a/tests/server/api/api_test.go b/tests/server/api/api_test.go index 8efa6fddfd4..29d2180ca46 100644 --- a/tests/server/api/api_test.go +++ b/tests/server/api/api_test.go @@ -38,6 +38,7 @@ import ( "github.com/pingcap/log" "github.com/tikv/pd/pkg/core" + "github.com/tikv/pd/pkg/response" "github.com/tikv/pd/pkg/utils/apiutil" "github.com/tikv/pd/pkg/utils/testutil" "github.com/tikv/pd/pkg/utils/typeutil" @@ -800,6 +801,23 @@ func TestRemovingProgress(t *testing.T) { output = sendRequest(re, leader.GetAddr()+"/pd/api/v1/stores/progress?id=2", http.MethodGet, http.StatusNotFound) re.Contains(string(output), "no progress found for the given store ID") + testutil.Eventually(re, func() bool { + output = sendRequest(re, leader.GetAddr()+"/pd/api/v1/stores", http.MethodGet, http.StatusOK) + var storesInfo response.StoresInfo + if err := json.Unmarshal(output, &storesInfo); err != nil { + return false + } + if len(storesInfo.Stores) != 3 { + return false + } + for _, store := range storesInfo.Stores { + if store.Store.GetNodeState() != metapb.NodeState_Serving { + return false + } + } + return true + }) + // remove store 1 and store 2 _ = sendRequest(re, leader.GetAddr()+"/pd/api/v1/store/1", http.MethodDelete, http.StatusOK) _ = sendRequest(re, leader.GetAddr()+"/pd/api/v1/store/2", http.MethodDelete, http.StatusOK) @@ -827,7 +845,7 @@ func TestRemovingProgress(t *testing.T) { resp, err := tests.TestDialClient.Do(req) re.NoError(err) defer resp.Body.Close() - if resp.StatusCode != http.StatusOK /stores/progress{ + if resp.StatusCode != http.StatusOK { return false } // is not prepared From 3924fa61b11d506d9377260dfab4a91053e4ff49 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 18:45:13 +0800 Subject: [PATCH 53/76] test-1 Signed-off-by: lhy1024 From e03cc1ead9ab6a40a9f76b665546ca9a390453f6 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 18:54:53 +0800 Subject: [PATCH 54/76] test-1 Signed-off-by: lhy1024 From 67b3f35a309ac378bbda0cb0e4ffabfd726166fc Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 19:06:48 +0800 Subject: [PATCH 55/76] test-1 Signed-off-by: lhy1024 --- server/cluster/cluster.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/cluster/cluster.go b/server/cluster/cluster.go index 6316f475785..8923efef9a6 100644 --- a/server/cluster/cluster.go +++ b/server/cluster/cluster.go @@ -812,7 +812,7 @@ func (c *RaftCluster) runNodeStateCheckJob() { ticker := time.NewTicker(nodeStateCheckJobInterval) failpoint.Inject("highFrequencyClusterJobs", func() { - ticker.Reset(time.Millisecond) + ticker.Reset(2 * time.Second) }) defer ticker.Stop() From c35fbbb935523e0aef578f4183ff47bbe3fa9efe Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 19:16:13 +0800 Subject: [PATCH 56/76] test-2 Signed-off-by: lhy1024 From 6bfeb83838678346c7ce327e24e0b0ec85bddd0c Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 19:23:54 +0800 Subject: [PATCH 57/76] test-1 Signed-off-by: lhy1024 From 12c802083c427492d9cd60182d9790a7ad979e52 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 19:30:57 +0800 Subject: [PATCH 58/76] test-1 Signed-off-by: lhy1024 From f9a4b861fb08f436ea2dfc2e5397cdf2324beb1f Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 19:52:17 +0800 Subject: [PATCH 59/76] test-1 Signed-off-by: lhy1024 From 8b23fe9000ed3913a9b38b828f009bebce2dece1 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 20:00:48 +0800 Subject: [PATCH 60/76] test-1 Signed-off-by: lhy1024 From 22b3df691e6438bf5220882672370c9a79904923 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 20:13:36 +0800 Subject: [PATCH 61/76] test-1 Signed-off-by: lhy1024 From 55c7c3bc8c11141ad73222e95c02644fc24cdb61 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 20:35:11 +0800 Subject: [PATCH 62/76] test-1 Signed-off-by: lhy1024 From d5daf8c6ba198154784f37b81738a5c4a3a8fdda Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 20:43:50 +0800 Subject: [PATCH 63/76] test-1 Signed-off-by: lhy1024 From e0fdbc9d315511250b349f298302096b8928157c Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 20:50:49 +0800 Subject: [PATCH 64/76] test-1 Signed-off-by: lhy1024 From 0bacb68c7b87e336e5ec9feff9ff9eb9e3c16066 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 21:02:33 +0800 Subject: [PATCH 65/76] test-1 Signed-off-by: lhy1024 From cd4b290edc1bede6f1cb9a82fc0e42530a923f12 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 21:09:04 +0800 Subject: [PATCH 66/76] test-1 Signed-off-by: lhy1024 From d7ff6eaa504ae459e5d2db2e3e1ff29aaff257d3 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 21:15:01 +0800 Subject: [PATCH 67/76] test-1 Signed-off-by: lhy1024 From 12c33917abc2cdc8b9d2aa5510ac4b89b1a538d1 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Tue, 14 Jan 2025 21:28:44 +0800 Subject: [PATCH 68/76] test-1 Signed-off-by: lhy1024 From 1c15fe4e49fa3a7a05034c531b411555222fdc92 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Wed, 15 Jan 2025 11:27:11 +0800 Subject: [PATCH 69/76] test-1 Signed-off-by: lhy1024 From a9a3559f37234fe321c21d2a06dda001623424bf Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Wed, 15 Jan 2025 11:41:54 +0800 Subject: [PATCH 70/76] test-2 Signed-off-by: lhy1024 From da279c375b8b027ea44a150b74a1e12b72e7c9da Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Wed, 15 Jan 2025 11:50:42 +0800 Subject: [PATCH 71/76] test-3 Signed-off-by: lhy1024 From 769d48be2805db6f6b9ee093673a39f877e3acb3 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Wed, 15 Jan 2025 11:58:46 +0800 Subject: [PATCH 72/76] test-4 Signed-off-by: lhy1024 From 77b7816d4179fff71d31209b2908e2d7d646bae8 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Wed, 15 Jan 2025 12:06:50 +0800 Subject: [PATCH 73/76] test-5 Signed-off-by: lhy1024 From d01bde4abf4f473267b9ab3f7b93c1fc6b99c256 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Wed, 15 Jan 2025 13:42:27 +0800 Subject: [PATCH 74/76] test-1 Signed-off-by: lhy1024 --- tests/server/api/api_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/server/api/api_test.go b/tests/server/api/api_test.go index 29d2180ca46..8737ff5b54a 100644 --- a/tests/server/api/api_test.go +++ b/tests/server/api/api_test.go @@ -905,6 +905,12 @@ func TestRemovingProgress(t *testing.T) { // store 2: 20/10s = 2 // average speed = (2+4)/2 = 3.0 if p.CurrentSpeed != 3.0 { + output = sendRequest(re, leader.GetAddr()+"/pd/api/v1/stores/progress?id=1", http.MethodGet, http.StatusOK) + re.NoError(json.Unmarshal(output, &p)) + log.Info("store 1 progress", zap.Any("progress", p)) + output = sendRequest(re, leader.GetAddr()+"/pd/api/v1/stores/progress?id=2", http.MethodGet, http.StatusOK) + re.NoError(json.Unmarshal(output, &p)) + log.Info("store 2 progress", zap.Any("progress", p)) log.Info("speed not match", zap.Float64("speed", p.CurrentSpeed)) return false } From c0e6d841aa4af865498f3813542d07afd29e0017 Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Wed, 15 Jan 2025 13:49:37 +0800 Subject: [PATCH 75/76] test-1 Signed-off-by: lhy1024 From 64d5a506641c539d4f586931484289f0add5db0c Mon Sep 17 00:00:00 2001 From: lhy1024 Date: Wed, 15 Jan 2025 13:57:41 +0800 Subject: [PATCH 76/76] test-2 Signed-off-by: lhy1024