Class FileSystemJobEventStore
- java.lang.Object
-
- org.apache.flink.runtime.jobmaster.event.FileSystemJobEventStore
-
- All Implemented Interfaces:
JobEventStore
public class FileSystemJobEventStore extends Object implements JobEventStore
Implementation ofJobEventStorethat stores allJobEventinstances 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
ScheduledExecutorServiceto 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 ScheduledExecutorServicecreateJobEventWriterExecutor()booleanisEmpty()Returns whether the store is empty.JobEventreadEvent()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 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 IOExceptionDescription copied from interface:JobEventStoreStart the store. This method should be called before any other operations.- Specified by:
startin interfaceJobEventStore- Throws:
IOException
-
createJobEventWriterExecutor
protected ScheduledExecutorService 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
public void writeEvent(JobEvent event, boolean cutBlock)
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
@VisibleForTesting protected void writeEventRunnable(JobEvent event, boolean cutBlock)
-
readEvent
public JobEvent readEvent() throws Exception
Description copied from interface:JobEventStoreRead a job event.- Specified by:
readEventin interfaceJobEventStore- Returns:
- job event.
- Throws:
Exception
-
isEmpty
public boolean isEmpty() throws ExceptionDescription 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
-
-