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 protected
AbstractThreadsafeJobResultStore(Executor ioExecutor)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description CompletableFuture<Void>
createDirtyResultAsync(JobResultEntry jobResultEntry)
Registers the passedJobResultEntry
instance asdirty
which indicates that clean-up operations still need to be performed.protected abstract void
createDirtyResultInternal(JobResultEntry jobResultEntry)
Set<JobResult>
getDirtyResults()
Get the persistedJobResult
instances that are marked asdirty
.protected abstract Set<JobResult>
getDirtyResultsInternal()
CompletableFuture<Boolean>
hasCleanJobResultEntryAsync(JobID jobId)
Returns the future of whether the store contains aclean
entry for the givenJobID
.protected abstract boolean
hasCleanJobResultEntryInternal(JobID jobId)
CompletableFuture<Boolean>
hasDirtyJobResultEntryAsync(JobID jobId)
Returns the future of whether the store contains adirty
entry for the givenJobID
.protected abstract boolean
hasDirtyJobResultEntryInternal(JobID jobId)
CompletableFuture<Boolean>
hasJobResultEntryAsync(JobID jobId)
Returns the future of whether the store already contains an entry for a job.CompletableFuture<Void>
markResultAsCleanAsync(JobID jobId)
Marks an existingJobResultEntry
asclean
.protected abstract void
markResultAsCleanInternal(JobID jobId)
-
-
-
Constructor Detail
-
AbstractThreadsafeJobResultStore
protected AbstractThreadsafeJobResultStore(Executor ioExecutor)
-
-
Method Detail
-
createDirtyResultAsync
public CompletableFuture<Void> createDirtyResultAsync(JobResultEntry jobResultEntry)
Description copied from interface:JobResultStore
Registers the passedJobResultEntry
instance asdirty
which indicates that clean-up operations still need to be performed. Once the job resource cleanup has been finalized, we can mark theJobResultEntry
asclean
result usingJobResultStore.markResultAsCleanAsync(JobID)
.- Specified by:
createDirtyResultAsync
in 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
IllegalStateException
if the passedjobResultEntry
has aJobID
attached that is already registered in thisJobResultStore
.
-
createDirtyResultInternal
protected abstract void createDirtyResultInternal(JobResultEntry jobResultEntry) throws IOException
- Throws:
IOException
-
markResultAsCleanAsync
public CompletableFuture<Void> markResultAsCleanAsync(JobID jobId)
Description copied from interface:JobResultStore
Marks an existingJobResultEntry
asclean
. This indicates that no more resource cleanup steps need to be performed. No actions should be triggered if the passedJobID
belongs to a job that was already marked as clean.- Specified by:
markResultAsCleanAsync
in 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 correspondingdirty
job present in the store for the givenJobID
.
-
markResultAsCleanInternal
protected abstract void markResultAsCleanInternal(JobID jobId) throws IOException, NoSuchElementException
- Throws:
IOException
NoSuchElementException
-
hasJobResultEntryAsync
public CompletableFuture<Boolean> hasJobResultEntryAsync(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 interfaceJobResultStore
- Parameters:
jobId
- Ident of the job we wish to check the store for.- Returns:
- a successfully completed future with
true
if adirty
orclean
JobResultEntry
exists for the givenJobID
; otherwisefalse
.
-
hasDirtyJobResultEntryAsync
public CompletableFuture<Boolean> hasDirtyJobResultEntryAsync(JobID jobId)
Description copied from interface:JobResultStore
Returns the future of whether the store contains adirty
entry for the givenJobID
.- Specified by:
hasDirtyJobResultEntryAsync
in interfaceJobResultStore
- Parameters:
jobId
- Ident of the job we wish to check the store for.- Returns:
- a successfully completed future with
true
, if adirty
entry exists for the givenJobID
; otherwisefalse
.
-
hasDirtyJobResultEntryInternal
protected abstract boolean hasDirtyJobResultEntryInternal(JobID jobId) throws IOException
- Throws:
IOException
-
hasCleanJobResultEntryAsync
public CompletableFuture<Boolean> hasCleanJobResultEntryAsync(JobID jobId)
Description copied from interface:JobResultStore
Returns the future of whether the store contains aclean
entry for the givenJobID
.- Specified by:
hasCleanJobResultEntryAsync
in interfaceJobResultStore
- Parameters:
jobId
- Ident of the job we wish to check the store for.- Returns:
- a successfully completed future with
true
, if aclean
entry exists for the givenJobID
; otherwise a successfully completed future withfalse
.
-
hasCleanJobResultEntryInternal
protected abstract boolean hasCleanJobResultEntryInternal(JobID jobId) throws IOException
- Throws:
IOException
-
getDirtyResults
public Set<JobResult> getDirtyResults() throws IOException
Description copied from interface:JobResultStore
Get the persistedJobResult
instances that are marked asdirty
. This is useful for recovery of finalization steps.- Specified by:
getDirtyResults
in interfaceJobResultStore
- 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
-
-