-
Notifications
You must be signed in to change notification settings - Fork 202
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: 执行历史归档,备份冷数据不正确 #3349 #3350
Conversation
wangyu096
commented
Dec 23, 2024
•
edited
Loading
edited
- 修复 AbstractJobInstanceRecordResultSet 中 next() 返回不正确的问题。 原先的逻辑会导致最后一次查询的数据(数量 < readRowLimit),next() 返回 false,导致实际读取的数据漏了
![image](https://private-user-images.githubusercontent.com/28581184/398193641-e3f6e4b5-7135-4483-b80a-d735d232ef94.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNjM2NjgsIm5iZiI6MTczOTM2MzM2OCwicGF0aCI6Ii8yODU4MTE4NC8zOTgxOTM2NDEtZTNmNmU0YjUtNzEzNS00NDgzLWI4MGEtZDczNWQyMzJlZjk0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDEyMjkyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU0ZGZkNzIxM2UwNDZjNDI2NTUyMzM4ZGZmMzZlZGQ0ZWIwODc5MDJmMzA0MTcwODU0NGY1OTA0NmI4NzRkNzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.EaU9RyG_qfgSX3dzj-1dcIUqA735k71slZIgkt7kxCQ)
- 修复 backupCost 耗时不正确的问题
- 日志优化
- 解决异步线程池导致调用链丢失的问题
- 修复 gse_file_execute_obj_task 由于排序不正确,导致归档失败的问题
- 新增备份/删除数据行数比较功能,及时发现归档 bug
- 修复从表中分批读取数据,偏移条件设置不正确的问题(全部整改为按照 id单一字段排序)。经过亿级大表的测试,查询 1000 行数据的响应在 20ms 以内,能命中索引,符合预期
if (CollectionUtils.isNotEmpty(records)) { | ||
jobInstanceColdDAO.batchInsert(records, | ||
archiveTablePropsStorage.getBatchInsertRowSize(tableName)); | ||
backupRows += records.size(); | ||
} | ||
offset = offsetEnd; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的逻辑可能不太对,每次步进增长应该是rowSize,但是这里多减了1,前面减1应该只是打印需要?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix
...mons/common-service/src/main/java/com/tencent/bk/job/common/service/async/TraceCallable.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2个问题需要再看下。
测试过程中发现了一些新的问题,代码已更新。需要重新 review 下 |
List<Long> jobInstanceIds = | ||
jobInstanceRecords.stream().map(this::extractJobInstanceId).collect(Collectors.toList()); | ||
// 备份主表数据 | ||
backupPrimaryTableRecord(jobInstanceRecords); | ||
backupPrimaryTableRecord(jobInstanceRecords, tablesBackupResult); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议让方法返回BackupResult,tablesBackupResult在外层进行add,采用和子表一样的处理方式,可读性更好。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
}); | ||
// 删除主表数据 | ||
deletePrimaryTableRecord(jobInstanceIds); | ||
deletePrimaryTableRecord(jobInstanceIds, tablesDeleteResult); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议让方法返回DeleteResult,tablesDeleteResult在外层进行add,采用和子表一样的处理方式,可读性更好。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2个小问题需要处理下。