Skip to content

Commit 1dbb94f

Browse files
committed
fix test
Signed-off-by: nolouch <nolouch@gmail.com>
1 parent 79a6904 commit 1dbb94f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

server/cluster/cluster.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1846,12 +1846,13 @@ func (c *RaftCluster) checkStores() {
18461846
if err := c.ReadyToServe(storeID); err != nil {
18471847
log.Error("change store to serving failed",
18481848
zap.Stringer("store", store.GetMeta()),
1849+
zap.Int("region-count", c.GetTotalRegionCount()),
18491850
errs.ZapError(err))
18501851
}
18511852
} else if c.IsPrepared() {
18521853
threshold := c.getThreshold(stores, store)
1853-
log.Debug("store serving threshold", zap.Uint64("store-id", storeID), zap.Float64("threshold", threshold))
18541854
regionSize := float64(store.GetRegionSize())
1855+
log.Debug("store serving threshold", zap.Uint64("store-id", storeID), zap.Float64("threshold", threshold), zap.Float64("region-size", regionSize))
18551856
if regionSize >= threshold {
18561857
if err := c.ReadyToServe(storeID); err != nil {
18571858
log.Error("change store to serving failed",

tests/server/api/api_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ func TestPreparingProgress(t *testing.T) {
914914
tests.MustPutStore(re, cluster, store)
915915
}
916916
for i := 0; i < 100; i++ {
917-
tests.MustPutRegion(re, cluster, uint64(i+1), uint64(i)%3+1, []byte(fmt.Sprintf("p%d", i)), []byte(fmt.Sprintf("%d", i+1)), core.SetApproximateSize(10))
917+
tests.MustPutRegion(re, cluster, uint64(i+1), uint64(i)%3+1, []byte(fmt.Sprintf("%20d", i)), []byte(fmt.Sprintf("%20d", i+1)), core.SetApproximateSize(10))
918918
}
919919
// no store preparing
920920
output := sendRequest(re, leader.GetAddr()+"/pd/api/v1/stores/progress?action=preparing", http.MethodGet, http.StatusNotFound)
@@ -941,8 +941,8 @@ func TestPreparingProgress(t *testing.T) {
941941
re.Equal(math.MaxFloat64, p.LeftSeconds)
942942

943943
// update size
944-
tests.MustPutRegion(re, cluster, 1000, 4, []byte(fmt.Sprintf("%d", 1000)), []byte(fmt.Sprintf("%d", 1001)), core.SetApproximateSize(10))
945-
tests.MustPutRegion(re, cluster, 1001, 5, []byte(fmt.Sprintf("%d", 1001)), []byte(fmt.Sprintf("%d", 1002)), core.SetApproximateSize(40))
944+
tests.MustPutRegion(re, cluster, 1000, 4, []byte(fmt.Sprintf("%20d", 1000)), []byte(fmt.Sprintf("%20d", 1001)), core.SetApproximateSize(10))
945+
tests.MustPutRegion(re, cluster, 1001, 5, []byte(fmt.Sprintf("%20d", 1001)), []byte(fmt.Sprintf("%20d", 1002)), core.SetApproximateSize(40))
946946
time.Sleep(2 * time.Second)
947947
output = sendRequest(re, leader.GetAddr()+"/pd/api/v1/stores/progress?action=preparing", http.MethodGet, http.StatusOK)
948948
re.NoError(json.Unmarshal(output, &p))

0 commit comments

Comments
 (0)