aggiunta log

This commit is contained in:
2026-01-05 15:14:39 +01:00
parent 931fec0959
commit d1dbf7f0de
2 changed files with 6 additions and 0 deletions

View File

@@ -294,6 +294,7 @@ class MySQLConnector:
ORDER BY UnitName ASC, ToolNameID ASC, EventDate ASC, EventTime ASC
LIMIT %s
"""
logger.info(f"Executing first query on partition {partition} (fetching up to {limit} rows, sorted by consolidation key)...")
cursor.execute(rows_query, (limit,))
else:
# Resume AFTER last completely yielded key
@@ -304,9 +305,11 @@ class MySQLConnector:
ORDER BY UnitName ASC, ToolNameID ASC, EventDate ASC, EventTime ASC
LIMIT %s
"""
logger.debug(f"Executing query on partition {partition} (resuming from key {last_completed_key}, limit {limit})...")
cursor.execute(rows_query, (last_completed_key[0], last_completed_key[1], last_completed_key[2], last_completed_key[3], limit))
rows = cursor.fetchall()
logger.debug(f"Fetched {len(rows)} rows from partition {partition}")
if not rows:
# No more rows - yield any buffered group and finish

View File

@@ -120,6 +120,9 @@ class PartitionMigrator:
description=f"Streaming {mysql_table} partition {partition_name}"
) as progress:
# Log before starting to fetch (this query can take several minutes for large partitions)
logger.info(f"Fetching consolidation groups from MySQL partition {partition_name}...")
# Use fetch_consolidation_groups_from_partition with start_key for efficient resume
# MySQL will skip all keys <= start_key using WHERE clause (no unnecessary data transfer)
for group in mysql_conn.fetch_consolidation_groups_from_partition(