Skip to content

Commit 4995cc0

Browse files
nurzhan-saktaganovoleg-jukovec
authored andcommitted
api: TRANSFER_IN_PROGRESS error shoud be retryable
Lua vshard router changed its behavior [1], we should conform. 1. tarantool/vshard#548 Closes #75
1 parent 94e50db commit 4995cc0

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGES:
77
* Get rid of nameToReplicasetMutex, use atomic instead.
88
* Add configurable pause before retrying r.Route in Router.Call method.
99
* Add ability to set custom dialer in InstaceInfo.
10+
* Router.Call: retry on VShardErrNameTransferIsInProgress error as in the `vshard` module (#75).
1011

1112
## v2.0.5
1213

api.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,8 @@ func (r *Router) Call(ctx context.Context, bucketID uint64, mode CallMode,
328328
vshardError := storageCallResponse.VshardError
329329

330330
switch vshardError.Name {
331-
case VShardErrNameWrongBucket, VShardErrNameBucketIsLocked:
332-
// We reproduce here behavior in https://github.com/tarantool/vshard/blob/b6fdbe950a2e4557f05b83bd8b846b126ec3724e/vshard/router/init.lua#L663
331+
case VShardErrNameWrongBucket, VShardErrNameBucketIsLocked, VShardErrNameTransferIsInProgress:
332+
// We reproduce here behavior in https://github.com/tarantool/vshard/blob/0.1.34/vshard/router/init.lua#L667
333333
r.BucketReset(bucketID)
334334

335335
destination := vshardError.Destination
@@ -381,7 +381,7 @@ func (r *Router) Call(ctx context.Context, bucketID uint64, mode CallMode,
381381
}
382382
}
383383

384-
// retry for VShardErrNameWrongBucket, VShardErrNameBucketIsLocked
384+
// retry for VShardErrNameWrongBucket, VShardErrNameBucketIsLocked, VShardErrNameTransferIsInProgress
385385

386386
r.metrics().RetryOnCall("bucket_migrate")
387387

@@ -390,12 +390,6 @@ func (r *Router) Call(ctx context.Context, bucketID uint64, mode CallMode,
390390
// this vshardError will be returned to a caller in case of timeout
391391
err = vshardError
392392
continue
393-
case VShardErrNameTransferIsInProgress:
394-
// Since lua vshard router doesn't retry here, we don't retry too.
395-
// There is a comment why lua vshard router doesn't retry:
396-
// https://github.com/tarantool/vshard/blob/b6fdbe950a2e4557f05b83bd8b846b126ec3724e/vshard/router/init.lua#L697
397-
r.BucketReset(bucketID)
398-
return VshardRouterCallResp{}, vshardError
399393
case VShardErrNameNonMaster:
400394
// vshard.storage has returned NON_MASTER error, lua vshard router updates info about master in this case:
401395
// See: https://github.com/tarantool/vshard/blob/b6fdbe950a2e4557f05b83bd8b846b126ec3724e/vshard/router/init.lua#L704.

0 commit comments

Comments
 (0)