jieguangzhou commented on code in PR #13194:
URL:
https://github.com/apache/dolphinscheduler/pull/13194#discussion_r1049336876
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java:
##########
@@ -319,4 +327,38 @@ public TaskInstance queryTaskInstanceById(User loginUser,
long projectCode, Long
}
return taskInstance;
}
+
+ @Override
+ public TaskInstanceRemoveCacheResponse removeTaskInstanceCache(User
loginUser, long projectCode,
+ Integer
taskInstanceId) {
+ Result result = new Result();
+
+ Project project = projectMapper.queryByCode(projectCode);
+ projectService.checkProjectAndAuthThrowException(loginUser, project,
INSTANCE_UPDATE);
+
+ TaskInstance taskInstance =
taskInstanceMapper.selectById(taskInstanceId);
+ if (taskInstance == null) {
+ logger.error("Task definition can not be found, projectCode:{},
taskInstanceId:{}.", projectCode,
+ taskInstanceId);
+ putMsg(result, Status.TASK_INSTANCE_NOT_FOUND);
+ return new TaskInstanceRemoveCacheResponse(result);
+ }
+ String tagCacheKey = taskInstance.getCacheKey();
+ String cacheKey = TaskCacheUtils.revertCacheKey(tagCacheKey);
+ List<Integer> cacheTaskInstanceIds = new ArrayList<>();
+ while (true) {
+ TaskInstance cacheTaskInstance =
taskInstanceDao.findTaskInstanceByCacheKey(cacheKey);
Review Comment:
There may be one `cacheKey` for multiple pieces of data. For example, two
cache tasks will same cache key run almost simultaneously.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]