dmvk commented on a change in pull request #18526:
URL: https://github.com/apache/flink/pull/18526#discussion_r793365135
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/ExecutionSlotAllocationContext.java
##########
@@ -44,9 +45,9 @@
* Returns prior allocation id for an execution vertex.
*
* @param executionVertexId id of the execution vertex
- * @return prior allocation id for the given execution vertex
+ * @return prior allocation id for the given execution vertex if it exists
*/
- AllocationID getPriorAllocationId(ExecutionVertexID executionVertexId);
+ Optional<AllocationID> getPriorAllocationId(ExecutionVertexID
executionVertexId);
Review comment:
OT: just one thought on naming, I always tried to stick with `find...`
prefix for anything that can return optional, to make it more explicit that you
may not find the result 🤔
But this is not really a common pattern in Flink, so feel free to ignore it.
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionVertex.java
##########
@@ -283,15 +284,30 @@ public ArchivedExecution getPriorExecutionAttempt(int
attemptNumber) {
}
}
- public ArchivedExecution getLatestPriorExecution() {
- synchronized (priorExecutions) {
- final int size = priorExecutions.size();
- if (size > 0) {
- return priorExecutions.get(size - 1);
- } else {
- return null;
+ /**
+ * Gets the latest property from a prior execution that is not null.
+ *
+ * @param extractor defining the property to extract
+ * @param <T> type of the property
+ * @return Optional containing the latest property if it exists; otherwise
{@code
+ * Optional.empty()}.
+ */
+ private <T> Optional<T> getLatestPriorProperty(Function<ArchivedExecution,
T> extractor) {
Review comment:
just wondering, body of the this method used to be synchronized, is it
safe to remove that?
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionVertex.java
##########
@@ -283,15 +284,30 @@ public ArchivedExecution getPriorExecutionAttempt(int
attemptNumber) {
}
Review comment:
OT: Can we remove the unused `LOG` field from this class?
--
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]