chore: Add detailed logging for migration state update
Added logging to trace the final migration state update process: - Log final count from PostgreSQL - Log final last ID from table - Log before and after _update_migration_state() call This helps debug why migration_state might not be getting updated when migration completes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -161,6 +161,7 @@ class FullMigrator:
|
|||||||
|
|
||||||
# Get final actual count from PostgreSQL
|
# Get final actual count from PostgreSQL
|
||||||
final_count = pg_conn.get_row_count(pg_table)
|
final_count = pg_conn.get_row_count(pg_table)
|
||||||
|
logger.info(f"Final count from PostgreSQL: {final_count}")
|
||||||
|
|
||||||
# Update migration state with final count and mark as completed
|
# Update migration state with final count and mark as completed
|
||||||
# Get the actual last ID from the table
|
# Get the actual last ID from the table
|
||||||
@@ -171,12 +172,16 @@ class FullMigrator:
|
|||||||
)
|
)
|
||||||
result = cursor.fetchone()
|
result = cursor.fetchone()
|
||||||
final_last_id = result[0] if result and result[0] else None
|
final_last_id = result[0] if result and result[0] else None
|
||||||
except Exception:
|
logger.info(f"Final last ID from table: {final_last_id}")
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f"Failed to get final last ID: {e}")
|
||||||
final_last_id = None
|
final_last_id = None
|
||||||
|
|
||||||
|
logger.info(f"About to update migration_state with count={final_count}, last_id={final_last_id}")
|
||||||
self._update_migration_state(
|
self._update_migration_state(
|
||||||
pg_conn, final_count, final_last_id, migration_start_time
|
pg_conn, final_count, final_last_id, migration_start_time
|
||||||
)
|
)
|
||||||
|
logger.info(f"Migration state update complete")
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
f"✓ Migration complete: {final_count} total rows in {pg_table}"
|
f"✓ Migration complete: {final_count} total rows in {pg_table}"
|
||||||
|
|||||||
Reference in New Issue
Block a user