Skip to content

clickhouse backup: deleting a Backup leaves the archive in the bucket, and the documented delete route does not exist #5198

Open

Description

@myasnikovdaniil

Describe the bug

Deleting a Backup taken with the Altinity (ClickHouse) strategy removes the object and nothing else. The archive stays in the bucket and in the sidecar remote list, there is no event or condition on the Backup, and the cleanup finalizer is released right away (the Altinity branch of cleanupOnDelete returns nil, internal/backupcontroller/backup_controller.go).

Comments in backup_controller.go, packages/apps/clickhouse/templates/clickhouse.yaml and examples/backups/clickhouse/92-scenario-user-restore.md send tenants to DELETE /backup/<name>/remote on the sidecar. That route does not exist in clickhouse-backup 2.7.4 and answers 404. The route that deletes a remote archive is POST /backup/delete/remote/<name>.

Environment

Cozystack v1.7.0, clickhouse-backup 2.7.4. The driver code is the same on main (4087218).

To reproduce

ClickHouse app with backup.enabled: true and backup.useSystemBucket: true, pod restarted after the first BackupJob so the sidecar has credentials (see #3986).

  1. Run a BackupJob with cozy-default and wait for Succeeded.
  2. List <bucket>/<namespace>/<release>/ with the AWS CLI and the projected cozy-backups-creds. One prefix clickhouse-<release>-<timestamp>/ with metadata.json, metadata/... and shadow/....
  3. kubectl delete backups.backups.cozystack.io <name>. It is gone in seconds.
  4. List again and call GET /backup/list/remote on port 7171 of the sidecar (basic auth from the <release>-backup-api-auth Secret). The archive is still there after several minutes.
  5. DELETE /backup/<archive>/remote returns 404, POST /backup/delete/remote/<archive> returns 200 and removes the objects.

Expected behaviour

The driver deletes the archive when the Backup is deleted, as MongoDB does on the system bucket flow, or the docs say plainly that it does not and give a delete route that works.

Actual behaviour

Nothing is deleted and the documented route is wrong. The Backup does not record its archive name (it is generated inside the strategy pod), so a delete from the controller needs the driver to record it first. System bucket has no retention either, so every ClickHouse backup stays until somebody calls the sidecar by hand.

Related: #3965, #3966, PR #4192.

Activity

  1. added
    kind/bugCategorizes issue or PR as related to a bug
    area/databaseIssues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse)
    on Nov 4, 2026
  2. dosubot commented on Nov 4, 2026

    @dosubot

    Persisting the archive name would also close a related restore gap: the default Altinity restore template currently lists remote backups and selects the newest matching application prefix, rather than the archive belonging to the selected Backup. createAltinityBackupArtifact saves strategy parameters but not the generated archive identity. I’d use that persisted identity for both restore and deletion, with a regression test that creates two backups and restores/deletes the older one without touching the newer archive. [1] [2]

    The core finalizer already supports waiting for cleanup: a nonzero requeue result keeps the finalizer, and a cleanup error also prevents its removal. So an Altinity cleanup implementation can use that existing mechanism rather than releasing the Backup before remote deletion completes. [3]

    To reply, just mention @dosu.


    Docs are dead. Just use Dosu.

    Leave Feedback Ask Dosu about cozystack Share Dosu with your team

  3. self-assigned this
    on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/databaseIssues or PRs related to managed databases (postgres, mariadb, redis, etcd, kafka, clickhouse)kind/bugCategorizes issue or PR as related to a bugtriage/needs-triageIndicates an issue needs triage by a maintainer

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions