@@ -77,50 +77,12 @@ type Checksum struct {
77
77
// ProgressUnit represents the unit of progress.
78
78
type ProgressUnit string
79
79
80
- func MakeStoreBasedErr (storeID uint64 , err error ) * StoreBasedErr {
81
- return & StoreBasedErr {storeID : storeID , err : err }
82
- }
83
-
84
- type StoreBasedErr struct {
85
- storeID uint64
86
- err error
87
- }
88
-
89
- func (e * StoreBasedErr ) Error () string {
90
- return fmt .Sprintf ("Store ID '%d': %v" , e .storeID , e .err .Error ())
91
- }
92
-
93
- func (e * StoreBasedErr ) Unwrap () error {
94
- return e .err
95
- }
96
-
97
- func (e * StoreBasedErr ) Cause () error {
98
- return e .Unwrap ()
99
- }
100
-
101
- // Errors implements errors.ErrorGroup.
102
- // For now `WalkDeep` cannot walk "subtree"s like:
103
- /* 1 - 2 - 5
104
- * |
105
- * + 3 - 4
106
- */
107
- // It stops after walking `1` and then gave up.
108
- // This is a bug: see https://github.com/pingcap/errors/issues/72
109
- // We manually make this a multierr to workaround this...
110
- func (e * StoreBasedErr ) Errors () []error {
111
- if errs , ok := e .err .(errors.ErrorGroup ); ok {
112
- return errs .Errors ()
113
- }
114
- return nil
115
- }
116
-
117
80
const (
118
81
// backupFineGrainedMaxBackoff is 1 hour.
119
82
// given it begins the fine-grained backup, there must be some problems in the cluster.
120
83
// We need to be more patient.
121
84
backupFineGrainedMaxBackoff = 3600000
122
85
backupRetryTimes = 5
123
- disconnectRetryTimeout = 20000
124
86
// RangeUnit represents the progress updated counter when a range finished.
125
87
RangeUnit ProgressUnit = "range"
126
88
// RegionUnit represents the progress updated counter when a region finished.
@@ -1160,7 +1122,6 @@ func (bc *Client) fineGrainedBackup(
1160
1122
})
1161
1123
1162
1124
bo := utils .AdaptTiKVBackoffer (ctx , backupFineGrainedMaxBackoff , berrors .ErrUnknown )
1163
- maxDisconnect := make (map [uint64 ]uint )
1164
1125
for {
1165
1126
// Step1, check whether there is any incomplete range
1166
1127
incomplete := pr .Res .GetIncompleteRange (req .StartKey , req .EndKey )
@@ -1208,19 +1169,8 @@ func (bc *Client) fineGrainedBackup(
1208
1169
for {
1209
1170
select {
1210
1171
case err := <- errCh :
1211
- if ! berrors .Is (err , berrors .ErrFailedToConnect ) {
1212
- return errors .Trace (err )
1213
- }
1214
- storeErr , ok := err .(* StoreBasedErr )
1215
- if ! ok {
1216
- return errors .Trace (err )
1217
- }
1218
-
1219
- storeID := storeErr .storeID
1220
- maxDisconnect [storeID ]++
1221
- if maxDisconnect [storeID ] > backupRetryTimes {
1222
- return errors .Annotatef (err , "Failed to connect to store %d more than %d times" , storeID , backupRetryTimes )
1223
- }
1172
+ // TODO: should we handle err here?
1173
+ return errors .Trace (err )
1224
1174
case resp , ok := <- respCh :
1225
1175
if ! ok {
1226
1176
// Finished.
@@ -1321,22 +1271,12 @@ func (bc *Client) handleFineGrained(
1321
1271
storeID := targetPeer .GetStoreId ()
1322
1272
lockResolver := bc .mgr .GetLockResolver ()
1323
1273
client , err := bc .mgr .GetBackupClient (ctx , storeID )
1324
-
1325
- // inject a disconnect failpoint
1326
- failpoint .Inject ("disconnect" , func (_ failpoint.Value ) {
1327
- logutil .CL (ctx ).Warn ("This is a injected disconnection error" )
1328
- err = berrors .ErrFailedToConnect
1329
- })
1330
-
1331
1274
if err != nil {
1332
1275
if berrors .Is (err , berrors .ErrFailedToConnect ) {
1333
1276
// When the leader store is died,
1334
1277
// 20s for the default max duration before the raft election timer fires.
1335
1278
logutil .CL (ctx ).Warn ("failed to connect to store, skipping" , logutil .ShortError (err ), zap .Uint64 ("storeID" , storeID ))
1336
- return disconnectRetryTimeout , & StoreBasedErr {
1337
- storeID : storeID ,
1338
- err : err ,
1339
- }
1279
+ return 20000 , nil
1340
1280
}
1341
1281
1342
1282
logutil .CL (ctx ).Error ("fail to connect store" , zap .Uint64 ("StoreID" , storeID ))
@@ -1375,10 +1315,7 @@ func (bc *Client) handleFineGrained(
1375
1315
// When the leader store is died,
1376
1316
// 20s for the default max duration before the raft election timer fires.
1377
1317
logutil .CL (ctx ).Warn ("failed to connect to store, skipping" , logutil .ShortError (err ), zap .Uint64 ("storeID" , storeID ))
1378
- return disconnectRetryTimeout , & StoreBasedErr {
1379
- storeID : storeID ,
1380
- err : err ,
1381
- }
1318
+ return 20000 , nil
1382
1319
}
1383
1320
logutil .CL (ctx ).Error ("failed to send fine-grained backup" , zap .Uint64 ("storeID" , storeID ), logutil .ShortError (err ))
1384
1321
return 0 , errors .Annotatef (err , "failed to send fine-grained backup [%s, %s)" ,
0 commit comments