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 theJobResultStore.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractThreadsafeJobResultStore(Executor ioExecutor)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>createDirtyResultAsync(JobResultEntry jobResultEntry)Registers the passedJobResultEntryinstance asdirtywhich indicates that clean-up operations still need to be performed.protected abstract voidcreateDirtyResultInternal(JobResultEntry jobResultEntry)Set<JobResult>getDirtyResults()Get the persistedJobResultinstances that are marked asdirty.protected abstract Set<JobResult>getDirtyResultsInternal()CompletableFuture<Boolean>hasCleanJobResultEntryAsync(org.apache.flink.api.common.JobID jobId)Returns the future of whether the store contains acleanentry for the givenJobID.protected abstract booleanhasCleanJobResultEntryInternal(org.apache.flink.api.common.JobID jobId)CompletableFuture<Boolean>hasDirtyJobResultEntryAsync(org.apache.flink.api.common.JobID jobId)Returns the future of whether the store contains adirtyentry for the givenJobID.protected abstract booleanhasDirtyJobResultEntryInternal(org.apache.flink.api.common.JobID jobId)CompletableFuture<Boolean>hasJobResultEntryAsync(org.apache.flink.api.common.JobID jobId)Returns the future of whether the store already contains an entry for a job.CompletableFuture<Void>markResultAsCleanAsync(org.apache.flink.api.common.JobID jobId)Marks an existingJobResultEntryasclean.protected abstract voidmarkResultAsCleanInternal(org.apache.flink.api.common.JobID jobId)
-
-
-
Constructor Detail
-
AbstractThreadsafeJobResultStore
protected AbstractThreadsafeJobResultStore(Executor ioExecutor)
-
-
Method Detail
-
createDirtyResultAsync
public CompletableFuture<Void> createDirtyResultAsync(JobResultEntry jobResultEntry)
Description copied from interface:JobResultStoreRegisters the passedJobResultEntryinstance asdirtywhich indicates that clean-up operations still need to be performed. Once the job resource cleanup has been finalized, we can mark theJobResultEntryascleanresult usingJobResultStore.markResultAsCleanAsync(JobID).- Specified by:
createDirtyResultAsyncin interfaceJobResultStore- 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
IllegalStateExceptionif the passedjobResultEntryhas aJobIDattached that is already registered in thisJobResultStore.
-
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:JobResultStoreMarks an existingJobResultEntryasclean. This indicates that no more resource cleanup steps need to be performed. No actions should be triggered if the passedJobIDbelongs to a job that was already marked as clean.- Specified by:
markResultAsCleanAsyncin interfaceJobResultStore- 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 correspondingdirtyjob present in the store for the givenJobID.
-
markResultAsCleanInternal
protected abstract void markResultAsCleanInternal(org.apache.flink.api.common.JobID jobId) throws IOException, NoSuchElementException- Throws:
IOExceptionNoSuchElementException
-
hasJobResultEntryAsync
public CompletableFuture<Boolean> hasJobResultEntryAsync(org.apache.flink.api.common.JobID jobId)
Description copied from interface:JobResultStoreReturns the future of whether the store already contains an entry for a job.- Specified by:
hasJobResultEntryAsyncin interfaceJobResultStore- Parameters:
jobId- Ident of the job we wish to check the store for.- Returns:
- a successfully completed future with
trueif adirtyorcleanJobResultEntryexists for the givenJobID; otherwisefalse.
-
hasDirtyJobResultEntryAsync
public CompletableFuture<Boolean> hasDirtyJobResultEntryAsync(org.apache.flink.api.common.JobID jobId)
Description copied from interface:JobResultStoreReturns the future of whether the store contains adirtyentry for the givenJobID.- Specified by:
hasDirtyJobResultEntryAsyncin interfaceJobResultStore- Parameters:
jobId- Ident of the job we wish to check the store for.- Returns:
- a successfully completed future with
true, if adirtyentry exists for the givenJobID; otherwisefalse.
-
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:JobResultStoreReturns the future of whether the store contains acleanentry for the givenJobID.- Specified by:
hasCleanJobResultEntryAsyncin interfaceJobResultStore- Parameters:
jobId- Ident of the job we wish to check the store for.- Returns:
- a successfully completed future with
true, if acleanentry exists for the givenJobID; otherwise a successfully completed future withfalse.
-
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:JobResultStoreGet the persistedJobResultinstances that are marked asdirty. This is useful for recovery of finalization steps.- Specified by:
getDirtyResultsin interfaceJobResultStore- Returns:
- A set of dirty
JobResultsfrom 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
-
-