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: 执行历史归档,备份冷数据不正确 #3349 #3350

Merged
merged 8 commits into from
Dec 24, 2024

Conversation

wangyu096
Copy link
Collaborator

@wangyu096 wangyu096 commented Dec 23, 2024

  1. 修复 AbstractJobInstanceRecordResultSet 中 next() 返回不正确的问题。 原先的逻辑会导致最后一次查询的数据(数量 < readRowLimit),next() 返回 false,导致实际读取的数据漏了
image
  1. 修复 backupCost 耗时不正确的问题
  2. 日志优化
  3. 解决异步线程池导致调用链丢失的问题
  4. 修复 gse_file_execute_obj_task 由于排序不正确,导致归档失败的问题
  5. 新增备份/删除数据行数比较功能,及时发现归档 bug
  6. 修复从表中分批读取数据,偏移条件设置不正确的问题(全部整改为按照 id单一字段排序)。经过亿级大表的测试,查询 1000 行数据的响应在 20ms 以内,能命中索引,符合预期

@wangyu096 wangyu096 requested a review from jsonwan December 23, 2024 15:10
if (CollectionUtils.isNotEmpty(records)) {
jobInstanceColdDAO.batchInsert(records,
archiveTablePropsStorage.getBatchInsertRowSize(tableName));
backupRows += records.size();
}
offset = offsetEnd;
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里的逻辑可能不太对,每次步进增长应该是rowSize,但是这里多减了1,前面减1应该只是打印需要?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fix

Copy link
Collaborator

@jsonwan jsonwan left a comment

Choose a reason for hiding this comment

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

2个问题需要再看下。

@wangyu096
Copy link
Collaborator Author

测试过程中发现了一些新的问题,代码已更新。需要重新 review 下

List<Long> jobInstanceIds =
jobInstanceRecords.stream().map(this::extractJobInstanceId).collect(Collectors.toList());
// 备份主表数据
backupPrimaryTableRecord(jobInstanceRecords);
backupPrimaryTableRecord(jobInstanceRecords, tablesBackupResult);
Copy link
Collaborator

Choose a reason for hiding this comment

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

建议让方法返回BackupResult,tablesBackupResult在外层进行add,采用和子表一样的处理方式,可读性更好。

Copy link
Collaborator Author

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);
Copy link
Collaborator

Choose a reason for hiding this comment

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

建议让方法返回DeleteResult,tablesDeleteResult在外层进行add,采用和子表一样的处理方式,可读性更好。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Copy link
Collaborator

@jsonwan jsonwan left a comment

Choose a reason for hiding this comment

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

2个小问题需要处理下。

@jsonwan jsonwan merged commit 52922c3 into TencentBlueKing:master Dec 24, 2024
4 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