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: fix test lightning_error_summary #33616

Merged
merged 2 commits into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion br/pkg/lightning/restore/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ func (rc *Controller) saveStatusCheckpoint(ctx context.Context, tableName string
switch {
case err == nil:
break
case utils.IsRetryableError(err), utils.MessageIsRetryableStorageError(err.Error()), common.IsContextCanceledError(err):
case utils.MessageIsRetryableStorageError(err.Error()), common.IsContextCanceledError(err):
sleepymole marked this conversation as resolved.
Show resolved Hide resolved
// recoverable error, should not be recorded in checkpoint
// which will prevent lightning from automatically recovering
return nil
Expand Down
10 changes: 7 additions & 3 deletions br/pkg/lightning/restore/table_restore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"context"
"encoding/json"
"fmt"
"net"
"net/http"
"net/http/httptest"
"os"
Expand Down Expand Up @@ -996,9 +995,14 @@ func (s *tableRestoreSuite) TestSaveStatusCheckpoint() {
require.NoError(s.T(), err)
require.Equal(s.T(), 0, len(rc.errorSummaries.summary))

err = rc.saveStatusCheckpoint(context.Background(), common.UniqueTable("test", "tbl"), indexEngineID, &net.DNSError{IsTimeout: true}, checkpoints.CheckpointStatusImported)
err = rc.saveStatusCheckpoint(
context.Background(),
common.UniqueTable("test", "tbl"), indexEngineID,
common.ErrChecksumMismatch.GenWithStackByArgs(0, 0, 0, 0, 0, 0),
checkpoints.CheckpointStatusImported,
)
require.NoError(s.T(), err)
require.Equal(s.T(), 0, len(rc.errorSummaries.summary))
require.Equal(s.T(), 1, len(rc.errorSummaries.summary))

start := time.Now()
err = rc.saveStatusCheckpoint(context.Background(), common.UniqueTable("test", "tbl"), indexEngineID, nil, checkpoints.CheckpointStatusImported)
Expand Down