Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复数据清理中脏数据错误 --story=121862836 #7700

Merged
merged 3 commits into from
Feb 12, 2025

Conversation

guohelu
Copy link
Collaborator

@guohelu guohelu commented Feb 11, 2025

No description provided.

@@ -146,10 +149,20 @@ def archive_expired_v2_task_data():
logger.info(f"[archive_expired_v2_task_data] archived nums: {len(archived_task_instances)}")
TaskFlowInstance.objects.filter(id__in=task_ids).delete()
logger.info(f"[archive_expired_v2_task_data] delete task nums: {len(task_ids)}, e.x.: {task_ids[:3]}...")
PipelineInstance.objects.filter(id__in=pipeline_instance_ids).delete()
# 删除 PeriodicTaskHistory 模型中遗留的脏数据,避免因为外键约束导致 PipelineInstance 删除失败
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PeriodicTaskHistory 对 PipelineInstance 有do nothing外键,需要保证引用关系被清除,避免外键约束导致清理失败

过期任务的 periodic_task_history 必定可清理

@normal-wls normal-wls merged commit a4e4a44 into TencentBlueKing:master Feb 12, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants