Class FileSystemJobEventStore
java.lang.Object
org.apache.flink.runtime.jobmaster.event.FileSystemJobEventStore
- All Implemented Interfaces:
JobEventStore
Implementation of
JobEventStore that stores all JobEvent instances in a FileSystem. 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 option JobEventStoreOptions.FLUSH_INTERVAL.
Read operations are performed synchronously, with the calling thread directly interacting with the file system to fetch event data.
-
Constructor Summary
ConstructorsConstructorDescriptionFileSystemJobEventStore(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
Modifier and TypeMethodDescriptionprotected ScheduledExecutorServicebooleanisEmpty()Returns whether the store is empty.Read a job event.voidstart()Start the store.voidstop(boolean clearEventLogs) Stop the store.voidwriteEvent(JobEvent event, boolean cutBlock) Write a job event.protected voidwriteEventRunnable(JobEvent event, boolean cutBlock)
-
Constructor Details
-
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 Details
-
start
Description copied from interface:JobEventStoreStart the store. This method should be called before any other operations.- Specified by:
startin interfaceJobEventStore- Throws:
IOException
-
createJobEventWriterExecutor
-
stop
public void stop(boolean clearEventLogs) Description copied from interface:JobEventStoreStop the store.- Specified by:
stopin interfaceJobEventStore- Parameters:
clearEventLogs- Whether to clear the job events that have been recorded in the store.
-
writeEvent
Description copied from interface:JobEventStoreWrite a job event.- Specified by:
writeEventin 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
-
readEvent
Description copied from interface:JobEventStoreRead a job event.- Specified by:
readEventin interfaceJobEventStore- Returns:
- job event.
- Throws:
Exception
-
isEmpty
Description copied from interface:JobEventStoreReturns whether the store is empty.- Specified by:
isEmptyin interfaceJobEventStore- Returns:
- false if the store contains any job events, true otherwise.
- Throws:
Exception
-