wordhardqi commented on a change in pull request #5656:
URL: https://github.com/apache/dolphinscheduler/pull/5656#discussion_r653730623



##########
File path: 
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/cache/impl/TaskInstanceCacheManagerImpl.java
##########
@@ -110,6 +110,7 @@ public void cacheTaskInstance(TaskExecutionContext 
taskExecutionContext) {
     @Override
     public void cacheTaskInstance(TaskExecuteAckCommand taskAckCommand) {
         TaskInstance taskInstance = new TaskInstance();
+        taskInstance.setId(taskAckCommand.getTaskInstanceId());

Review comment:
       I think it's better to creating a new object either for updating or 
creating new entries.
   The problem here is that taskInstanceCache is a concurrent hashmap. if the 
taskInstance is already in this map and we read it out and then modify it, the 
instance in the map is also modified. the readers may read some middle-state 
object (the series of set methods are not atomic).




-- 
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to