Class AbstractThreadsafeJobResultStore

java.lang.Object
org.apache.flink.runtime.highavailability.AbstractThreadsafeJobResultStore
All Implemented Interfaces:
JobResultStore
Direct Known Subclasses:
EmbeddedJobResultStore, FileSystemJobResultStore

public abstract class AbstractThreadsafeJobResultStore extends Object implements JobResultStore
An abstract class for threadsafe implementations of the JobResultStore.
  • Constructor Details

    • AbstractThreadsafeJobResultStore

      protected AbstractThreadsafeJobResultStore(Executor ioExecutor)
  • Method Details

    • createDirtyResultAsync

      public CompletableFuture<Void> createDirtyResultAsync(JobResultEntry jobResultEntry)
      Description copied from interface: JobResultStore
      Registers the passed JobResultEntry instance as dirty which indicates that clean-up operations still need to be performed. Once the job resource cleanup has been finalized, we can mark the JobResultEntry as clean result using JobResultStore.markResultAsCleanAsync(JobID).
      Specified by:
      createDirtyResultAsync in interface JobResultStore
      Parameters:
      jobResultEntry - The job result we wish to persist.
      Returns:
      a successfully completed future if the dirty result is created successfully. The future will be completed with IllegalStateException if the passed jobResultEntry has a JobID attached that is already registered in this JobResultStore.
    • createDirtyResultInternal

      protected abstract void createDirtyResultInternal(JobResultEntry jobResultEntry) throws IOException
      Throws:
      IOException
    • markResultAsCleanAsync

      public CompletableFuture<Void> markResultAsCleanAsync(org.apache.flink.api.common.JobID jobId)
      Description copied from interface: JobResultStore
      Marks an existing JobResultEntry as clean. This indicates that no more resource cleanup steps need to be performed. No actions should be triggered if the passed JobID belongs to a job that was already marked as clean.
      Specified by:
      markResultAsCleanAsync in interface JobResultStore
      Parameters:
      jobId - Ident of the job we wish to mark as clean.
      Returns:
      a successfully completed future if the result is marked successfully. The future can complete exceptionally with a NoSuchElementException. i.e. there is no corresponding dirty job present in the store for the given JobID.
    • markResultAsCleanInternal

      protected abstract void markResultAsCleanInternal(org.apache.flink.api.common.JobID jobId) throws IOException, NoSuchElementException
      Throws:
      IOException
      NoSuchElementException
    • hasJobResultEntryAsync

      public CompletableFuture<Boolean> hasJobResultEntryAsync(org.apache.flink.api.common.JobID jobId)
      Description copied from interface: JobResultStore
      Returns the future of whether the store already contains an entry for a job.
      Specified by:
      hasJobResultEntryAsync in interface JobResultStore
      Parameters:
      jobId - Ident of the job we wish to check the store for.
      Returns:
      a successfully completed future with true if a dirty or clean JobResultEntry exists for the given JobID; otherwise false.
    • hasDirtyJobResultEntryAsync

      public CompletableFuture<Boolean> hasDirtyJobResultEntryAsync(org.apache.flink.api.common.JobID jobId)
      Description copied from interface: JobResultStore
      Returns the future of whether the store contains a dirty entry for the given JobID.
      Specified by:
      hasDirtyJobResultEntryAsync in interface JobResultStore
      Parameters:
      jobId - Ident of the job we wish to check the store for.
      Returns:
      a successfully completed future with true, if a dirty entry exists for the given JobID; otherwise false.
    • hasDirtyJobResultEntryInternal

      protected abstract boolean hasDirtyJobResultEntryInternal(org.apache.flink.api.common.JobID jobId) throws IOException
      Throws:
      IOException
    • hasCleanJobResultEntryAsync

      public CompletableFuture<Boolean> hasCleanJobResultEntryAsync(org.apache.flink.api.common.JobID jobId)
      Description copied from interface: JobResultStore
      Returns the future of whether the store contains a clean entry for the given JobID.
      Specified by:
      hasCleanJobResultEntryAsync in interface JobResultStore
      Parameters:
      jobId - Ident of the job we wish to check the store for.
      Returns:
      a successfully completed future with true, if a clean entry exists for the given JobID; otherwise a successfully completed future with false.
    • hasCleanJobResultEntryInternal

      protected abstract boolean hasCleanJobResultEntryInternal(org.apache.flink.api.common.JobID jobId) throws IOException
      Throws:
      IOException
    • getDirtyResults

      public Set<JobResult> getDirtyResults() throws IOException
      Description copied from interface: JobResultStore
      Get the persisted JobResult instances that are marked as dirty. This is useful for recovery of finalization steps.
      Specified by:
      getDirtyResults in interface JobResultStore
      Returns:
      A set of dirty JobResults from the store.
      Throws:
      IOException - if collecting the set of dirty results failed for IO reasons.
    • getDirtyResultsInternal

      protected abstract Set<JobResult> getDirtyResultsInternal() throws IOException
      Throws:
      IOException