zentol commented on code in PR #22251:
URL: https://github.com/apache/flink/pull/22251#discussion_r1147690649


##########
flink-runtime/src/main/java/org/apache/flink/runtime/jobmanager/DefaultJobGraphStore.java:
##########
@@ -241,6 +243,22 @@ public void putJobGraph(JobGraph jobGraph) throws 
Exception {
         LOG.info("Added {} to {}.", jobGraph, jobGraphStateHandleStore);
     }
 
+    @Override
+    public void putJobResourceRequirements(
+            JobID jobId, JobResourceRequirements jobResourceRequirements) 
throws Exception {
+        synchronized (lock) {
+            @Nullable final JobGraph jobGraph = recoverJobGraph(jobId);
+            if (jobGraph == null) {
+                throw new FileNotFoundException(
+                        String.format(
+                                "JobGraph for job [%s] was not found in 
JobGraphStore and is needed for attaching JobResourceRequirements.",
+                                jobId));
+            }
+            JobResourceRequirements.writeToJobGraph(jobGraph, 
jobResourceRequirements);
+            putJobGraph(jobGraph);

Review Comment:
   That can indeed happen. It's unlikely to be a _problem_ though, because even 
in the worst case (i.e., a JM is writing the requirements while loosing 
leadership, and another one gains leadership and starts reading job graphs 
before that write is complete, which is already unlikely) you we might "forget" 
the last set requirements after a failover.



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

Reply via email to