MP102WARNINGFreeNeeds --database-url
warn-rewrite-disk-headroom
What It Detects
Full-table rewrite on a large table needs room for a second copy while it runs.
Why It's Dangerous
None of these operations edit the table in place. PostgreSQL builds a complete new copy, heap and indexes, and only drops the original once the new copy is committed — so peak usage is roughly twice the current size. On a 400 GB table that is 400 GB of free space you need to have and probably were not thinking about. Running out partway through does not corrupt anything, but the rewrite rolls back and you have paid the full ACCESS EXCLUSIVE lock duration for nothing.
Bad Example
-- orders is 400 GB; the volume has 120 GB free VACUUM FULL orders;
Good Example
-- Price the second copy before starting, and check the volume with
-- df -h $(psql -tAc "SHOW data_directory")
SELECT pg_size_pretty(pg_total_relation_size('orders')) AS current_size,
pg_size_pretty(pg_total_relation_size('orders') * 2) AS peak_during_rewrite;Configuration
Disable this rule:
# .migrationpilotrc.yml rules: MP102: false
Or change its severity:
# .migrationpilotrc.yml
rules:
MP102:
severity: warning