Skip to content

fix: is_object_exist false positive when S3-compatible storage returns NoSuchKey on stderr#1298

Open
LXY1226 wants to merge 1 commit intopercona:mainfrom
LXY1226:main
Open

fix: is_object_exist false positive when S3-compatible storage returns NoSuchKey on stderr#1298
LXY1226 wants to merge 1 commit intopercona:mainfrom
LXY1226:main

Conversation

@LXY1226
Copy link
Copy Markdown

@LXY1226 LXY1226 commented Mar 18, 2026

Due to the high volume of requests, we're unable to provide free service for this account. To continue using the service, please upgarde to a paid plan.

Problem

When using S3-compatible storage such as Alibaba Cloud OSS as a backup target,
is_object_exist() incorrectly returns exists for a non-existent object, causing
the backup flow to stall.

The function currently captures only stdout and checks for Total Objects: 0 to
determine non-existence. On some S3-compatible implementations, the AWS CLI writes
a NoSuchKey error to stderr instead of producing the expected summarize output.
Since stderr was discarded, $res ends up empty, the check never matches, and the
function falls through to return exists.

Fix

Redirect stderr to stdout (2>&1) so all AWS CLI output is available in $res,
then treat a NoSuchKey response as object-not-found explicitly, before the
existing Total Objects: 0 check.

This change is applied consistently across the 5.7, 8.0 and 8.4 backup images.

Testing

Verified on Alibaba Cloud OSS (internal endpoint) with Percona XtraDB Cluster
Operator. Before the fix the backup pod exited with an error; after the fix the
backup completes successfully.

…iyun OSS

When using Aliyun OSS as S3-compatible storage, AWS CLI may return
errors like 'NoSuchKey‘ instead of 'Total Objects: 0', causing is_object_exist()
to incorrectly return exists and blocking the backup flow.
@it-percona-cla
Copy link
Copy Markdown

it-percona-cla commented Mar 18, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants