Repository navigation
Fix flaky test_database_backup: skip the S3 disk startup access check - #124184
Conversation
Both servers of the module (`instance` and `instance_local_metadata`, the second added in 88a9fbd) load `configs/backups.xml` and run the `IDisk::startup` access check of `backup_disk_s3_plain` (PUT, GET, DELETE of `clickhouse_access_check_<uuid>`) at the same time, in the same fresh MinIO prefix `root/data/disks/disk_s3_plain/` that holds nothing but the two probes. MinIO's DELETE removes the object directory and then every now-empty parent (`cmd/xl-storage.go`, `deleteFile`), while the other server's PUT creates the same parents in `RenameData -> renameAll -> reliableRename -> reliableMkdirAll` (`cmd/os-reliable.go`). When a parent is removed between its EEXIST and the child's mkdir, `os.Mkdir` returns an ENOENT PathError, and `renameAll` classifies it with `isSysErrPathNotFound` (non-Windows branch is `pathErr.Err == ENOENT`, `cmd/xl-storage-errors.go`) as `errFileAccessDenied`, i.e. `403 AccessDenied`, even for the root user. The code is unchanged in the latest pgsty/silo release. In the failing job (PR ClickHouse#123069, amd_llvm_coverage 6/8) the denied PUT was sent at 14:11:26.619465 and failed at .624049, 0.47 ms after `instance`'s DELETE of its own probe completed (.622793-.623583); the server exited and all 14 tests failed in `start_cluster`. Two clients doing the same PUT/GET/DELETE against the same MinIO image locally got 7 and 13 AccessDenied PUTs in two 120 s runs with an empty prefix, and 0 of 49876 with one extra object keeping the prefix non-empty. With `skip_access_check` neither server writes to MinIO at startup; the disk is still used by every BACKUP/RESTORE in the module. Same remedy as ClickHouse#110300 and ClickHouse#110592. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding) plus my own cold review (1 nit).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20261006-092300 |
|
Workflow [PR], commit [37617ca] Summary: ✅ AI ReviewSummaryThis PR makes Final Verdict✅ Looks good to merge. |
|
@groeneai I'll merge this. But the right solution is - all access checks should use a random file name (not just with the server uuid, but unique). You can send a follow-up PR. |
|
Acknowledged, I'll send a follow-up PR that makes the disk access checks use a unique random file name. Note that this alone would not have prevented this failure: the two servers already used different names ( |
1a7c64c
|
Follow-up PR: #125098 |
`IDisk::checkAccess` named its probe after the server UUID, so the name was unique only per server identity: two servers with the same `uuid` file (one data directory copied from the other) that share a disk location, such as an S3 prefix, and check it at the same time write, read and delete the same file, and one delete can fail the other's reads. Name the probe from a fresh random UUID per check, as the other two disk probes (`DiskLocalCheckThread` and `IDisk::isCaseInsensitive`) already do. The `clickhouse_access_check_` prefix is kept, so prefix-scoped bucket policies keep working. The Nil-server-UUID guard goes with the dependency: both programs that run startup checks load the UUID before any disk starts. Follow-up to ClickHouse#124184 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Description
All 14
test_database_backuptests failed instart_clusterin Integration tests (amd_llvm_coverage, 6/8), reported in #123069 (comment).instance_local_metadataexited at startup because the access check of diskbackup_disk_s3_plaingot403 AccessDeniedfrom MinIO, although it uses the MinIO root user.Root cause: it is neither MinIO readiness nor user setup. Both servers load the same
configs/backups.xmland run the startup access check (PUT, GET, DELETE of a probe object) in the same fresh, otherwise empty prefix at the same time. MinIO's DELETE removes the now-empty parent directories while the other server's PUT is creating them, and MinIO maps the resultingmkdirENOENT toAccessDenied(renameAllincmd/os-reliable.go, viaisSysErrPathNotFound). In the CI log the denied PUT failed 0.5 ms after the other server's DELETE completed. The code is unchanged in the latest MinIO release, so an image bump does not help.I reproduced it without ClickHouse against the same MinIO image: two clients doing PUT/GET/DELETE of unique probes in an empty prefix got 7 and 13
AccessDeniedPUTs in two 120 s runs (about 45k PUTs each), and 0 of 49876 when one extra object kept the prefix non-empty.Fix:
skip_access_checkonbackup_disk_s3_plain, as in #110300 and #110592. The disk is still used by the tests, so a broken disk config still fails at first use. Server logs confirm 0 probe writes on that disk with the change (1 per server without it); the module passed all 4 local runs (14/14 each).Other modules that start several MinIO-backed servers share this shape. The
ENOENTtoAccessDeniedmapping is a MinIO bug; I can report it to pgsty/silo (the project the image mirrors) if that is useful.Workflow [PR]
Sync PR [sync-upstream/pr/124184]
Version info
26.10.1.2039-master(included in26.10and later)