Skip to content

Bug Report: OnlineDDL cancelled migration artifacts are not getting cleaned up #14022

@shlomi-noach

Description

@shlomi-noach

Overview of the Issue

Followup to, and a bit of an oversight of #13927. Migrations that have been cancelled may have artifacts (specifically ALTER TABLE migrations will have artifacts if cancelled after starting).

The migration cleanup mechanism does not collect artifacts of cancelled migrations; only of completed and failed migrations, as per:

sqlSelectUncollectedArtifacts = `SELECT
migration_uuid,
artifacts,
log_path
FROM _vt.schema_migrations
WHERE
migration_status IN ('complete', 'failed')
AND cleanup_timestamp IS NULL
AND completed_timestamp <= IF(retain_artifacts_seconds=0,
NOW() - INTERVAL %a SECOND,
NOW() - INTERVAL retain_artifacts_seconds SECOND
)

#13928 fixed completed_timestamp to ensure it's not null, but that was not enough, we should also have updated sqlSelectUncollectedArtifacts.

Reproduction Steps

Cancel a vitess ALTER TABLE migration halfway through.

Binary Version

18, 17, 16, probably 15

Operating System and Environment details

-

Log Fragments

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions