fix: Allow dry-run even when migration is in progress
Problem: dry-run was blocked with 'Migration already in progress' error, even though dry-run should not require --resume (it doesn't modify data). Fix: Skip the 'already in progress' check if dry_run is True. This allows: - Testing partitions without interrupting active migration - Verifying what would be migrated without needing --resume - Checking consolidation logic on specific partitions Also improved dry-run message to show partition info if specified. 🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -78,11 +78,12 @@ class FullMigrator:
|
||||
logger.warning(
|
||||
f"Found previous migration state: {pg_row_count} rows already in {pg_table}"
|
||||
)
|
||||
if not resume:
|
||||
if not resume and not dry_run:
|
||||
raise ValueError(
|
||||
f"Migration already in progress for {pg_table}. "
|
||||
f"Use --resume to continue from last checkpoint, or delete data to restart."
|
||||
)
|
||||
if resume:
|
||||
logger.info(f"Resuming migration - found {pg_row_count} existing rows")
|
||||
if last_completed_partition:
|
||||
logger.info(f"Last completed partition: {last_completed_partition}")
|
||||
@@ -95,6 +96,9 @@ class FullMigrator:
|
||||
rows_to_migrate = total_rows
|
||||
|
||||
if dry_run:
|
||||
if partition:
|
||||
logger.info(f"[DRY RUN] Would migrate partition {partition} (~{rows_to_migrate} total rows in table)")
|
||||
else:
|
||||
logger.info(f"[DRY RUN] Would migrate {rows_to_migrate} rows")
|
||||
return rows_to_migrate
|
||||
|
||||
|
||||
Reference in New Issue
Block a user