Class FileSystemJobEventStore
- java.lang.Object
-
- org.apache.flink.runtime.jobmaster.event.FileSystemJobEventStore
-
- All Implemented Interfaces:
JobEventStore
public class FileSystemJobEventStore extends Object implements JobEventStore
Implementation ofJobEventStore
that stores allJobEvent
instances in aFileSystem
. Events are written and read sequentially, ensuring a consistent order of events.Write operations to the file system are primarily asynchronous, leveraging a
ScheduledExecutorService
to periodically flush the buffered output stream, which executes write tasks at an interval determined by the configure optionJobEventStoreOptions.FLUSH_INTERVAL
.Read operations are performed synchronously, with the calling thread directly interacting with the file system to fetch event data.
-
-
Constructor Summary
Constructors Constructor Description FileSystemJobEventStore(org.apache.flink.api.common.JobID jobID, org.apache.flink.configuration.Configuration configuration)
FileSystemJobEventStore(org.apache.flink.core.fs.Path workingDir, org.apache.flink.configuration.Configuration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ScheduledExecutorService
createJobEventWriterExecutor()
boolean
isEmpty()
Returns whether the store is empty.JobEvent
readEvent()
Read a job event.void
start()
Start the store.void
stop(boolean clearEventLogs)
Stop the store.void
writeEvent(JobEvent event, boolean cutBlock)
Write a job event.protected void
writeEventRunnable(JobEvent event, boolean cutBlock)
-
-
-
Constructor Detail
-
FileSystemJobEventStore
public FileSystemJobEventStore(org.apache.flink.api.common.JobID jobID, org.apache.flink.configuration.Configuration configuration) throws IOException
- Throws:
IOException
-
FileSystemJobEventStore
@VisibleForTesting public FileSystemJobEventStore(org.apache.flink.core.fs.Path workingDir, org.apache.flink.configuration.Configuration configuration) throws IOException
- Throws:
IOException
-
-
Method Detail
-
start
public void start() throws IOException
Description copied from interface:JobEventStore
Start the store. This method should be called before any other operations.- Specified by:
start
in interfaceJobEventStore
- Throws:
IOException
-
createJobEventWriterExecutor
protected ScheduledExecutorService createJobEventWriterExecutor()
-
stop
public void stop(boolean clearEventLogs)
Description copied from interface:JobEventStore
Stop the store.- Specified by:
stop
in interfaceJobEventStore
- Parameters:
clearEventLogs
- Whether to clear the job events that have been recorded in the store.
-
writeEvent
public void writeEvent(JobEvent event, boolean cutBlock)
Description copied from interface:JobEventStore
Write a job event.- Specified by:
writeEvent
in interfaceJobEventStore
- Parameters:
event
- The job event that will be recorded.cutBlock
- If set to true, the current output file will be closed after writing this event, and a new output file will be created for subsequent events. This parameter effectively controls the segmentation of event data into separate files.
-
writeEventRunnable
@VisibleForTesting protected void writeEventRunnable(JobEvent event, boolean cutBlock)
-
readEvent
public JobEvent readEvent() throws Exception
Description copied from interface:JobEventStore
Read a job event.- Specified by:
readEvent
in interfaceJobEventStore
- Returns:
- job event.
- Throws:
Exception
-
isEmpty
public boolean isEmpty() throws Exception
Description copied from interface:JobEventStore
Returns whether the store is empty.- Specified by:
isEmpty
in interfaceJobEventStore
- Returns:
- false if the store contains any job events, true otherwise.
- Throws:
Exception
-
-