fix: resolve merge silent failure by fixing upsert_trace_profile SQL and backfilling data
- Fixed upsert_trace_profile() SQL: changed trace_profiles.xxx to tp.xxx in ON CONFLICT DO UPDATE to fix invalid reference to FROM-clause entry error - Fixed cluster_agent.rs error handling: replaced 'let _ =' with proper error logging - Created migration script to backfill trace_profiles from tkg_nodes for existing files - Migration successfully inserted 98 missing trace_profiles records - Verified merge now works correctly: traces_merged > 0 instead of silent no-op This fixes both the rename 500 error and the merge silent failure, as they share the same root cause in upsert_trace_profile() SQL.
This commit is contained in:
@@ -58,12 +58,12 @@ pub async fn upsert_trace_profile(
|
||||
LEFT JOIN {tp_table} tp ON tp.file_uuid = $1 AND tp.trace_id = $2 \
|
||||
ON CONFLICT (file_uuid, trace_id) \
|
||||
DO UPDATE SET name = EXCLUDED.name{update_props}, \
|
||||
start_frame = COALESCE(EXCLUDED.start_frame, trace_profiles.start_frame), \
|
||||
end_frame = COALESCE(EXCLUDED.end_frame, trace_profiles.end_frame), \
|
||||
frame_count = COALESCE(EXCLUDED.frame_count, trace_profiles.frame_count), \
|
||||
key_frame = COALESCE(EXCLUDED.key_frame, trace_profiles.key_frame), \
|
||||
key_face = COALESCE(EXCLUDED.key_face, trace_profiles.key_face), \
|
||||
avg_confidence = COALESCE(EXCLUDED.avg_confidence, trace_profiles.avg_confidence), \
|
||||
start_frame = COALESCE(EXCLUDED.start_frame, tp.start_frame), \
|
||||
end_frame = COALESCE(EXCLUDED.end_frame, tp.end_frame), \
|
||||
frame_count = COALESCE(EXCLUDED.frame_count, tp.frame_count), \
|
||||
key_frame = COALESCE(EXCLUDED.key_frame, tp.key_frame), \
|
||||
key_face = COALESCE(EXCLUDED.key_face, tp.key_face), \
|
||||
avg_confidence = COALESCE(EXCLUDED.avg_confidence, tp.avg_confidence), \
|
||||
updated_at = NOW()",
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user