Skip to content

Commit

Permalink
blockstore & filestore SDK retriable error codes should be in sync wi…
Browse files Browse the repository at this point in the history
…th cloud/storage/core/libs/common/error.cpp (#2119)
  • Loading branch information
SvartMetal committed Sep 24, 2024
1 parent 06116d1 commit 8da2a1f
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 15 deletions.
28 changes: 26 additions & 2 deletions cloud/blockstore/public/sdk/go/client/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,14 @@ func (e *ClientError) IsRetriable() bool {
}

switch e.Facility() {
case FACILITY_GRPC, FACILITY_SYSTEM:
// system/network errors should be retriable
case FACILITY_GRPC:
if e.Code == E_GRPC_UNIMPLEMENTED {
return false
}
// network errors should be retriable
return true
case FACILITY_SYSTEM:
// system errors should be retriable
return true
case FACILITY_KIKIMR:
switch e.Status() {
Expand All @@ -59,6 +65,24 @@ func (e *ClientError) IsRetriable() bool {
20: // NKikimrProto::NOT_YET
return true
}
case FACILITY_SCHEMESHARD:
switch e.Status() {
case
13, // NKikimrScheme::StatusNotAvailable
8: // NKikimrScheme::StatusMultipleModifications
return true
}
case FACILITY_TXPROXY:
switch e.Status() {
case
16, // NKikimr::NTxProxy::TResultStatus::ProxyNotReady
20, // NKikimr::NTxProxy::TResultStatus::ProxyShardNotAvailable
21, // NKikimr::NTxProxy::TResultStatus::ProxyShardTryLater
22, // NKikimr::NTxProxy::TResultStatus::ProxyShardOverloaded
51, // NKikimr::NTxProxy::TResultStatus::ExecTimeout
55: // NKikimr::NTxProxy::TResultStatus::ExecResultUnavailable
return true
}
}

// any other errors should not be retried automatically
Expand Down
29 changes: 24 additions & 5 deletions cloud/blockstore/public/sdk/python/client/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,14 @@ def is_retriable(self) -> bool:

facility = self.facility

if facility in [
EFacility.FACILITY_GRPC.value,
EFacility.FACILITY_SYSTEM.value,
]:
# system/network errors should be retriable
if facility == EFacility.FACILITY_GRPC.value:
if self.code == EResult.E_GRPC_UNIMPLEMENTED.value:
return False
# network errors should be retriable
return True

if facility == EFacility.FACILITY_SYSTEM.value:
# system errors should be retriable
return True

if facility == EFacility.FACILITY_KIKIMR.value and self.status in [
Expand All @@ -83,6 +86,22 @@ def is_retriable(self) -> bool:
]:
return True

if facility == EFacility.FACILITY_SCHEMESHARD.value and self.status in [
13, # NKikimrScheme::StatusNotAvailable
8, # NKikimrScheme::StatusMultipleModifications
]:
return True

if facility == EFacility.FACILITY_TXPROXY.value and self.status in [
16, # NKikimr::NTxProxy::TResultStatus::ProxyNotReady
20, # NKikimr::NTxProxy::TResultStatus::ProxyShardNotAvailable
21, # NKikimr::NTxProxy::TResultStatus::ProxyShardTryLater
22, # NKikimr::NTxProxy::TResultStatus::ProxyShardOverloaded
51, # NKikimr::NTxProxy::TResultStatus::ExecTimeout:
55, # NKikimr::NTxProxy::TResultStatus::ExecResultUnavailable:
]:
return True

# any other errors should not be retried automatically
return False

Expand Down
12 changes: 9 additions & 3 deletions cloud/filestore/public/sdk/go/client/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,20 @@ func (e *ClientError) Error() string {

func (e *ClientError) IsRetriable() bool {
switch e.Code {
case E_REJECTED, E_TIMEOUT:
case E_REJECTED, E_TIMEOUT, E_FS_OUT_OF_SPACE:
// special error code for retries
return true
}

switch e.Facility() {
case FACILITY_GRPC, FACILITY_SYSTEM:
// system/network errors should be retriable
case FACILITY_GRPC:
if e.Code == E_GRPC_UNIMPLEMENTED {
return false
}
// network errors should be retriable
return true
case FACILITY_SYSTEM:
// system errors should be retriable
return true
case FACILITY_KIKIMR:
switch e.Status() {
Expand Down
14 changes: 9 additions & 5 deletions cloud/filestore/public/sdk/python/client/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,20 @@ def is_retriable(self):
if self.code in [
EResult.E_REJECTED.value,
EResult.E_TIMEOUT.value,
EResult.E_FS_OUT_OF_SPACE.value,
]:
return True

facility = self.facility

if facility in [
EFacility.FACILITY_GRPC.value,
EFacility.FACILITY_SYSTEM.value,
]:
# system/network errors should be retriable
if facility == EFacility.FACILITY_GRPC.value:
if self.code == EResult.E_GRPC_UNIMPLEMENTED.value:
return False
# network errors should be retriable
return True

if facility == EFacility.FACILITY_SYSTEM.value:
# system errors should be retriable
return True

if facility == EFacility.FACILITY_KIKIMR.value and self.status in [
Expand Down

0 comments on commit 8da2a1f

Please sign in to comment.