WencongLiu commented on code in PR #22341: URL: https://github.com/apache/flink/pull/22341#discussion_r1283928788
########## flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/JobResultStore.java: ########## @@ -43,69 +44,70 @@ public interface JobResultStore { * Registers the passed {@link JobResultEntry} instance as {@code dirty} which indicates that * clean-up operations still need to be performed. Once the job resource cleanup has been * finalized, we can mark the {@code JobResultEntry} as {@code clean} result using {@link - * #markResultAsClean(JobID)}. + * #markResultAsCleanAsync(JobID)}. * * @param jobResultEntry The job result we wish to persist. - * @throws IOException if the creation of the dirty result failed for IO reasons. - * @throws IllegalStateException if the passed {@code jobResultEntry} has a {@code JobID} - * attached that is already registered in this {@code JobResultStore}. + * @return a successfully completed future with {@code true} if the dirty result is created + * successfully. The method will throw {@link IllegalStateException} if the passed {@code + * jobResultEntry} has a {@code JobID} attached that is already registered in this {@code + * JobResultStore}. */ - void createDirtyResult(JobResultEntry jobResultEntry) throws IOException, IllegalStateException; + CompletableFuture<Void> createDirtyResultAsync(JobResultEntry jobResultEntry); /** * Marks an existing {@link JobResultEntry} as {@code clean}. This indicates that no more * resource cleanup steps need to be performed. No actions should be triggered if the passed * {@code JobID} belongs to a job that was already marked as clean. * * @param jobId Ident of the job we wish to mark as clean. - * @throws IOException if marking the {@code dirty} {@code JobResultEntry} as {@code clean} - * failed for IO reasons. - * @throws NoSuchElementException if there is no corresponding {@code dirty} job present in the - * store for the given {@code JobID}. + * @return a successfully completed future if the result is marked successfully, The future will + * completed with {@link NoSuchElementException} if there is no corresponding {@code dirty} + * job present in the store for the given {@code JobID}. */ - void markResultAsClean(JobID jobId) throws IOException, NoSuchElementException; + CompletableFuture<Void> markResultAsCleanAsync(JobID jobId); /** - * Returns whether the store already contains an entry for a job. + * Returns the future of whether the store already contains an entry for a job. * * @param jobId Ident of the job we wish to check the store for. - * @return {@code true} if a {@code dirty} or {@code clean} {@link JobResultEntry} exists for - * the given {@code JobID}; otherwise {@code false}. - * @throws IOException if determining whether a job entry is present in the store failed for IO - * reasons. + * @return a successfully completed future with {@code true} if a {@code dirty} or {@code clean} + * {@link JobResultEntry} exists for the given {@code JobID}; otherwise a successfully + * completed future with {@code false}. */ - default boolean hasJobResultEntry(JobID jobId) throws IOException { - return hasDirtyJobResultEntry(jobId) || hasCleanJobResultEntry(jobId); + default CompletableFuture<Boolean> hasJobResultEntryAsync(JobID jobId) { + return hasDirtyJobResultEntryAsync(jobId) + .thenCombine( + hasCleanJobResultEntryAsync(jobId), + (result1, result2) -> result1 || result2); } /** - * Returns whether the store already contains a {@code dirty} entry for the given {@code JobID}. + * Returns the future of whether the store contains a {@code dirty} entry for the given {@code + * JobID}. * * @param jobId Ident of the job we wish to check the store for. - * @return {@code true}, if a {@code dirty} entry exists for the given {@code JobID}; otherwise - * {@code false}. - * @throws IOException if determining whether a job entry is present in the store failed for IO - * reasons. + * @return a successfully completed future with {@code true}, if a {@code dirty} entry exists + * for the given {@code JobID}; otherwise a successfully completed future with {@code Review Comment: Fixed. -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org