Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lightning: skip check if PD returns zero StoreInfo #49861

Merged
merged 2 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions br/pkg/lightning/backend/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,11 @@ func checkDiskAvail(ctx context.Context, store *pdhttp.StoreInfo) error {
zap.String("capacity", store.Status.Capacity), zap.Error(err))
return nil
}
if capacity <= 0 {
// PD will return a zero value StoreInfo if heartbeat is not received after
// startup, skip temporarily.
return nil
}
available, err := units.RAMInBytes(store.Status.Available)
if err != nil {
logger.Warn("failed to parse available",
Expand Down
5 changes: 5 additions & 0 deletions br/pkg/lightning/backend/local/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2386,4 +2386,9 @@ func TestCheckDiskAvail(t *testing.T) {
ctx := context.Background()
err := checkDiskAvail(ctx, store)
require.NoError(t, err)

// pd may return this StoreInfo before the store reports heartbeat
store = &http.StoreInfo{Status: http.StoreStatus{LeaderWeight: 1.0, RegionWeight: 1.0}}
err = checkDiskAvail(ctx, store)
require.NoError(t, err)
}
Loading