Skip to content

Commit

Permalink
Return pulic error if checkpoint replica was broken during snapshot f…
Browse files Browse the repository at this point in the history
…illing
  • Loading branch information
gy2411 committed Feb 11, 2025
1 parent 6bfb931 commit 120c4ed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cloud/disk_manager/internal/pkg/clients/nbs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,13 @@ func IsGetChangedBlocksNotSupportedError(e error) bool {
clientErr.Code == nbs_client.E_NOT_IMPLEMENTED
}

func IsIOError(e error) bool {
clientErr := nbs_client.GetClientError(e)

return clientErr.Code == nbs_client.E_IO ||
clientErr.Code == nbs_client.E_IO_SILENT
}

////////////////////////////////////////////////////////////////////////////////

func setupStderrLogger(ctx context.Context) context.Context {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
performance_config "github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/performance/config"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/resources"
"github.com/ydb-platform/nbs/cloud/disk_manager/internal/pkg/services/snapshots/protos"
"github.com/ydb-platform/nbs/cloud/disk_manager/pkg/client/codes"
"github.com/ydb-platform/nbs/cloud/tasks"
"github.com/ydb-platform/nbs/cloud/tasks/errors"
"github.com/ydb-platform/nbs/cloud/tasks/headers"
Expand Down Expand Up @@ -123,6 +124,14 @@ func (t *createSnapshotFromDiskTask) run(

response, err := t.scheduler.WaitTask(ctx, execCtx, taskID)
if err != nil {
if nbs.IsIOError(err) {
return errors.NewDetailedError(err, &errors.ErrorDetails{
Code: codes.Aborted,
Message: "Snapshot creation failed, please retry", // TODO:_ should user know about it?
Internal: false,
})
// TODO:_ public => silent... Are we sure?
}
return err
}

Expand Down

0 comments on commit 120c4ed

Please sign in to comment.