fix(backup): 归档校验改用 ListObjects 避免依赖对象 HeadObject 权限

This commit is contained in:
yml2213
2026-11-10 15:31:42 +08:00
parent d0572e5001
commit 9e029a519f
2 changed files with 9 additions and 3 deletions
+3 -3
View File
@@ -204,9 +204,9 @@ verify() {
while IFS= read -r -d '' state_file; do
remote_dir="$(awk -F= '$1 == "remote_dir" { print substr($0, index($0, "=") + 1); exit }' "${state_file}")"
[[ -n "${remote_dir}" ]] || { backup_error "归档状态不完整:${state_file}"; exit 1; }
ossutil stat "${remote_dir}/binlog.enc" >/dev/null
ossutil stat "${remote_dir}/binlog.enc.sha256" >/dev/null
ossutil stat "${remote_dir}/complete.env" >/dev/null
backup_oss_object_exists "${remote_dir}/binlog.enc" || { backup_error "远端对象缺失:${remote_dir}/binlog.enc"; exit 1; }
backup_oss_object_exists "${remote_dir}/binlog.enc.sha256" || { backup_error "远端对象缺失:${remote_dir}/binlog.enc.sha256"; exit 1; }
backup_oss_object_exists "${remote_dir}/complete.env" || { backup_error "远端对象缺失:${remote_dir}/complete.env"; exit 1; }
done < <(find "${state_dir}" -maxdepth 1 -name '*.state' -print0)
backup_log '全部本地 binlog 归档状态均有远端完整对象'
}