Skip to content

db clean --skip-archive still copies deletion candidates into temporary archive tables prior to deletion. #75966

Open

Description

@zach-overflow

Under which category would you file this issue?

Airflow Core

Apache Airflow version

3.3.2

What happened and how to reproduce it?

On any Airflow 3.3.2 metadata database containing log rows older than the cutoff, run:

  airflow db clean \
    --tables log \
    --clean-before-timestamp '2026-10-28T00:00:00+00:00' \
    --batch-size 1 \
    --skip-archive \
    --yes \
    --verbose

You can see the following per-batch output:

  1. Moving data to table _airflow_deleted__log__... messages, and
  2. CREATE TABLE ... AS SELECT ... debug SQL output.

Despite --skip-archive being present, each batch copies rows into a staging table before deleting them from log, then drops the staging table. Because of this, checking for archive tables after cleanup will not reveal the intermediate copies, and it also slows down cleanup when skip_archives is enabled.

What you think should happen instead?

With --skip-archive, deleting eligible rows should not create or populate any archive/staging tables.

Operating System

ubuntu 24.04, also MacOS 26.6.2

Deployment

No response

Apache Airflow Provider(s)

No response

Versions of Apache Airflow Providers

No response

Official Helm Chart version

No response

Kubernetes Version

No response

Helm Chart configuration

No response

Docker Image customizations

No response

Anything else?

Only realized after filing this issue that there is currently an open candidate solution for it: #74113

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. Abhi2939 commented on Oct 30, 2026

    @Abhi2939

    Hi @zach-overflow, I’d like to take a look at this one. I can reproduce the flow from your steps and the fix seems to be skipping the staging copy when --skip-archive is set. Are you already working on a PR? If so I’m happy to review it instead, otherwise I’ll start on it and post an update here.

  2. hussein-awala commented on Nov 1, 2026

    @hussein-awala
    Member

    There is an open PR to fix this: #74113

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions