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

perf: 本地文件准备过程优化 #2611 #2612

Merged
merged 5 commits into from
Nov 13, 2023

Conversation

jsonwan
Copy link
Collaborator

@jsonwan jsonwan commented Nov 11, 2023

  1. 处理traceId断链问题;
  2. 优化日志,重构部分代码;
  3. 支持发布过程中文件准备过程取消后重新准备文件。

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1. 处理traceId断链问题;
2. 优化日志,重构部分代码。
1. 支持发布过程中文件准备过程取消后重新准备文件;
2. 修复StopTask中traceId断链问题。
1. 修复重新准备文件导致的多条任务记录查询报错问题。
1. 第三方文件源临时文件清理优化。
@@ -93,18 +80,21 @@ public void saveFileSourceTaskLog(FileSourceTaskLogDTO fileSourceTaskLog) {
.set(t.START_TIME, fileSourceTaskLog.getStartTime())
.set(t.END_TIME, fileSourceTaskLog.getEndTime())
.set(t.TOTAL_TIME, fileSourceTaskLog.getTotalTime())
.set(t.STATUS, JooqDataTypeUtil.toByte(fileSourceTaskLog.getStatus())).set(t.FILE_SOURCE_BATCH_TASK_ID, fileSourceTaskLog.getFileSourceBatchTaskId())
.set(t.STATUS, JooqDataTypeUtil.toByte(fileSourceTaskLog.getStatus())).set(t.FILE_SOURCE_BATCH_TASK_ID,
Copy link
Collaborator

Choose a reason for hiding this comment

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

换行格式不对

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已修改

.execute();
}

@Override
public FileSourceTaskLogDTO getFileSourceTaskLog(long stepInstanceId, int executeCount) {
public FileSourceTaskLogDTO getLatestFileSourceTaskLog(long stepInstanceId, int executeCount) {
FileSourceTaskLog t = FileSourceTaskLog.FILE_SOURCE_TASK_LOG;
Record record = defaultContext.select(t.STEP_INSTANCE_ID, t.EXECUTE_COUNT, t.START_TIME, t.END_TIME,
t.TOTAL_TIME,
Copy link
Collaborator

Choose a reason for hiding this comment

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

换行格式有点问题

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已修改

@@ -144,6 +144,10 @@ public void checkVolumeAndClear() {
private void doCheckVolumeAndClear() {
long maxSizeBytes = workerConfig.getMaxSizeGB() * 1024L * 1024L * 1024L;
File workDirFile = new File(workerConfig.getWorkspaceDirPath());
if (!workDirFile.exists()) {
log.debug("Workspace({}) not exists yet, ignore clear", workerConfig.getWorkspaceDirPath());
Copy link
Collaborator

Choose a reason for hiding this comment

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

debug 日志需要加上 isDebugEnable 判断

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已修改

@@ -139,6 +139,9 @@ public void handleEvent(StepEvent stepEvent,
case CONTINUE_FILE_PUSH:
continueGseFileStep(stepInstance);
break;
case PREPARE_FILE_AGAIN:
Copy link
Collaborator

Choose a reason for hiding this comment

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

PREPARE_FILE_AGAIN 命名有点奇怪。执行引擎的事件都应该是幂等的,这里不需要加上 AGAIN, 与其它地方不统一。 建议改成 PREPARE_FILE

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已修改

FileSourceTaskLog t = FileSourceTaskLog.FILE_SOURCE_TASK_LOG;
Record record = defaultContext.select(t.STEP_INSTANCE_ID, t.EXECUTE_COUNT, t.START_TIME, t.END_TIME,
t.TOTAL_TIME,
t.STATUS, t.FILE_SOURCE_BATCH_TASK_ID).from(t)
.where(t.STEP_INSTANCE_ID.eq(stepInstanceId))
.and(t.EXECUTE_COUNT.eq(executeCount))
.orderBy(t.ID.desc())
Copy link
Collaborator

Choose a reason for hiding this comment

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

逻辑上有问题,依赖了主键自增长的条件。后续分库分表改造之后,使用分布式自增长主键就没法保证这种连续性了。

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已修改

@@ -139,6 +139,9 @@ public void handleEvent(StepEvent stepEvent,
case CONTINUE_FILE_PUSH:
continueGseFileStep(stepInstance);
break;
case PREPARE_FILE:
prepareFileAgain(stepInstance);
Copy link
Collaborator

Choose a reason for hiding this comment

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

方法名需要修改为 prepareFile(), 与 action 对应起来

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已修改

*
* @param stepInstance 步骤实例
*/
private void prepareFileAgain(StepInstanceDTO stepInstance) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

方法名需要修改为 prepareFile(), 与 action 对应起来。注释需要改成"准备要分发的文件"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

已修改

@jsonwan jsonwan force-pushed the github_perf/localfile branch from c198f68 to 5ff450e Compare November 13, 2023 09:46
@jsonwan jsonwan merged commit 3c0e227 into TencentBlueKing:master Nov 13, 2023
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.

None yet

2 participants