fix: Only update last_completed_partition when partition is fully processed
Previously, last_completed_partition was updated during batch flushes while the partition was still being processed. This caused resume to skip partitions that were only partially completed. Now, last_completed_partition is only updated AFTER all consolidation groups in a partition have been processed and the final buffer flush is complete. 🤖 Generated with Claude Code Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
36
test_d10_migration.py
Normal file
36
test_d10_migration.py
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Test migration of just d10 partition with consolidation debugging."""
|
||||
import sys
|
||||
from src.migrator.full_migration import FullMigrator
|
||||
from src.utils.logger import setup_logger, get_logger
|
||||
from src.connectors.postgres_connector import PostgreSQLConnector
|
||||
|
||||
setup_logger(__name__)
|
||||
logger = get_logger(__name__)
|
||||
|
||||
print("\n" + "="*80)
|
||||
print("Testing ELABDATADISP migration for partition d10 with debugging")
|
||||
print("="*80 + "\n")
|
||||
|
||||
# Clear the target table first
|
||||
print("Clearing target table...")
|
||||
with PostgreSQLConnector() as pg_conn:
|
||||
with pg_conn.connection.cursor() as cursor:
|
||||
cursor.execute("DELETE FROM elabdatadisp")
|
||||
pg_conn.connection.commit()
|
||||
print("Target table cleared.")
|
||||
|
||||
# Now run migration
|
||||
print("\nStarting migration...")
|
||||
try:
|
||||
migrator = FullMigrator("ELABDATADISP")
|
||||
result = migrator.migrate(dry_run=False, resume=False)
|
||||
print(f"\nMigration result: {result} rows")
|
||||
except Exception as e:
|
||||
logger.error(f"Migration error: {e}", exc_info=True)
|
||||
print(f"Migration error: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
print("\n" + "="*80)
|
||||
print("Migration complete - check logs for [CONSOLIDATION DEBUG] messages")
|
||||
print("="*80 + "\n")
|
||||
Reference in New Issue
Block a user