Skip to content

Commit

Permalink
changefeed (ticdc): don't set changefeed to failed state when error r…
Browse files Browse the repository at this point in the history
…etry reach limit (pingcap#9386)

ref pingcap#5647, close pingcap#8382, close pingcap#9388
  • Loading branch information
asddongmen authored Jul 14, 2023
1 parent 33e9f95 commit 6aa3091
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cdc/owner/feed_state_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ func (m *feedStateManager) handleError(errs ...*model.RunningError) {
log.Warn("changefeed will not be restarted because it has been failing for a long time period",
zap.Duration("maxElapsedTime", m.errBackoff.MaxElapsedTime))
m.shouldBeRunning = false
m.patchState(model.StateFailed)
m.patchState(model.StateError)
} else {
log.Info("changefeed restart backoff interval is changed",
zap.String("namespace", m.state.ID.Namespace),
Expand Down
2 changes: 1 addition & 1 deletion cdc/owner/feed_state_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func TestHandleError(t *testing.T) {

require.False(t, manager.ShouldRunning())
require.False(t, manager.ShouldRemoved())
require.Equal(t, state.Info.State, model.StateFailed)
require.Equal(t, state.Info.State, model.StateError)
require.Equal(t, state.Info.AdminJobType, model.AdminStop)
require.Equal(t, state.Status.AdminJobType, model.AdminStop)

Expand Down
7 changes: 1 addition & 6 deletions pkg/txnutil/gc/gc_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"context"
"time"

"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
"github.com/pingcap/log"
"github.com/pingcap/tiflow/cdc/model"
Expand Down Expand Up @@ -113,11 +112,7 @@ func (m *gcManager) CheckStaleCheckpointTs(
) error {
gcSafepointUpperBound := checkpointTs - 1
if m.isTiCDCBlockGC {
pdTime, err := m.pdClock.CurrentTime()
// TODO: should we return err here, or just log it?
if err != nil {
return errors.Trace(err)
}
pdTime, _ := m.pdClock.CurrentTime()
if pdTime.Sub(oracle.GetTimeFromTS(gcSafepointUpperBound)) > time.Duration(m.gcTTL)*time.Second {
return cerror.ErrGCTTLExceeded.GenWithStackByArgs(checkpointTs, changefeedID)
}
Expand Down

0 comments on commit 6aa3091

Please sign in to comment.