Skip to content
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CHANGES:
* Get rid of nameToReplicasetMutex, use atomic instead.
* Add configurable pause before retrying r.Route in Router.Call method.
* Add ability to set custom dialer in InstaceInfo.
* Router.Call: retry on VShardErrNameTransferIsInProgress error as in the `vshard` module (#75).

## v2.0.5

Expand Down
12 changes: 3 additions & 9 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ func (r *Router) Call(ctx context.Context, bucketID uint64, mode CallMode,
vshardError := storageCallResponse.VshardError

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

destination := vshardError.Destination
Expand Down Expand Up @@ -381,7 +381,7 @@ func (r *Router) Call(ctx context.Context, bucketID uint64, mode CallMode,
}
}

// retry for VShardErrNameWrongBucket, VShardErrNameBucketIsLocked
// retry for VShardErrNameWrongBucket, VShardErrNameBucketIsLocked, VShardErrNameTransferIsInProgress

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

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