aggiunta log
This commit is contained in:
@@ -294,6 +294,7 @@ class MySQLConnector:
|
|||||||
ORDER BY UnitName ASC, ToolNameID ASC, EventDate ASC, EventTime ASC
|
ORDER BY UnitName ASC, ToolNameID ASC, EventDate ASC, EventTime ASC
|
||||||
LIMIT %s
|
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,))
|
cursor.execute(rows_query, (limit,))
|
||||||
else:
|
else:
|
||||||
# Resume AFTER last completely yielded key
|
# Resume AFTER last completely yielded key
|
||||||
@@ -304,9 +305,11 @@ class MySQLConnector:
|
|||||||
ORDER BY UnitName ASC, ToolNameID ASC, EventDate ASC, EventTime ASC
|
ORDER BY UnitName ASC, ToolNameID ASC, EventDate ASC, EventTime ASC
|
||||||
LIMIT %s
|
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))
|
cursor.execute(rows_query, (last_completed_key[0], last_completed_key[1], last_completed_key[2], last_completed_key[3], limit))
|
||||||
|
|
||||||
rows = cursor.fetchall()
|
rows = cursor.fetchall()
|
||||||
|
logger.debug(f"Fetched {len(rows)} rows from partition {partition}")
|
||||||
|
|
||||||
if not rows:
|
if not rows:
|
||||||
# No more rows - yield any buffered group and finish
|
# No more rows - yield any buffered group and finish
|
||||||
|
|||||||
@@ -120,6 +120,9 @@ class PartitionMigrator:
|
|||||||
description=f"Streaming {mysql_table} partition {partition_name}"
|
description=f"Streaming {mysql_table} partition {partition_name}"
|
||||||
) as progress:
|
) 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
|
# 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)
|
# MySQL will skip all keys <= start_key using WHERE clause (no unnecessary data transfer)
|
||||||
for group in mysql_conn.fetch_consolidation_groups_from_partition(
|
for group in mysql_conn.fetch_consolidation_groups_from_partition(
|
||||||
|
|||||||
Reference in New Issue
Block a user