Skip to content

K8SPG-781 add original error #1207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 3 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
3 changes: 3 additions & 0 deletions percona/watcher/wal.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func GetLatestCommitTimestamp(ctx context.Context, cli client.Client, execCli *c

primary, err := perconaPG.GetPrimaryPod(ctx, cli, cr)
if err != nil {
log.Error(err, "failed to get primary pod")
Copy link
Contributor

@gkech gkech Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Jira ticket description, they are suggesting the wrapping of the error like that

errors.Wrap(err, PrimaryPodNotFound.Error())   

Why aren't we wrapping the error, and instead we are adding logs?

Copy link
Contributor

@gkech gkech Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: the clause you describe on the description can be modified to:

case errors.Is(errors.Cause(err), PrimaryPodNotFound) && localCr.Status.State != pgv2.AppStateReady:

Can you confirm this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed!

return nil, PrimaryPodNotFound
}

Expand Down Expand Up @@ -202,7 +203,9 @@ func GetLatestCommitTimestamp(ctx context.Context, cli client.Client, execCli *c

func getBackupStartTimestamp(ctx context.Context, cli client.Client, cr *pgv2.PerconaPGCluster, backup *pgv2.PerconaPGBackup) (time.Time, error) {
primary, err := perconaPG.GetPrimaryPod(ctx, cli, cr)
log := logging.FromContext(ctx)
if err != nil {
log.Error(err, "failed to get primary pod")
return time.Time{}, PrimaryPodNotFound
}

Expand Down
Loading