public class SegmentFileStateHandle extends Object implements StreamStateHandle
FileStateHandle for state that was written to a file segment. A SegmentFileStateHandle represents a LogicalFile, which has already been written to a
segment in a physical file.
TODO (FLINK-32079): serialization and deserialization of SegmentFileStateHandle.
StateObject.StateObjectLocation, StateObject.StateObjectSizeStatsCollector| Modifier and Type | Field and Description |
|---|---|
protected long |
stateSize
The size of the state in the file.
|
| Constructor and Description |
|---|
SegmentFileStateHandle(org.apache.flink.core.fs.Path filePath,
long startPos,
long stateSize,
CheckpointedStateScope scope)
Creates a new segment file state for the given file path.
|
| Modifier and Type | Method and Description |
|---|---|
Optional<byte[]> |
asBytesIfInMemory() |
void |
discardState()
This method should be empty, so that JM is not in charge of the lifecycle of files in a
file-merging checkpoint.
|
boolean |
equals(Object o) |
org.apache.flink.core.fs.Path |
getFilePath()
Gets the path where this handle's state is stored.
|
CheckpointedStateScope |
getScope() |
long |
getStartPos() |
long |
getStateSize()
Returns the size of the state in bytes.
|
PhysicalStateHandleID |
getStreamStateHandleID() |
int |
hashCode() |
org.apache.flink.core.fs.FSDataInputStream |
openInputStream()
Returns an
FSDataInputStream that can be used to read back the data that was
previously written to the stream. |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcollectSizeStatspublic SegmentFileStateHandle(org.apache.flink.core.fs.Path filePath,
long startPos,
long stateSize,
CheckpointedStateScope scope)
filePath - The path to the file that stores the state.startPos - Start position of the segment in the physical file.stateSize - Size of the segment.scope - The state's scope, whether it is exclusive or shared.public void discardState()
discardState in interface StateObjectpublic org.apache.flink.core.fs.Path getFilePath()
public org.apache.flink.core.fs.FSDataInputStream openInputStream()
throws IOException
StreamStateHandleFSDataInputStream that can be used to read back the data that was
previously written to the stream.openInputStream in interface StreamStateHandleIOExceptionpublic Optional<byte[]> asBytesIfInMemory()
asBytesIfInMemory in interface StreamStateHandlepublic PhysicalStateHandleID getStreamStateHandleID()
getStreamStateHandleID in interface StreamStateHandlepublic long getStartPos()
public long getStateSize()
StateObject0.
The values produced by this method are only used for informational purposes and for metrics/monitoring. If this method returns wrong values, the checkpoints and recovery will still behave correctly. However, efficiency may be impacted (wrong space pre-allocation) and functionality that depends on metrics (like monitoring) will be impacted.
Note for implementors: This method should not perform any I/O operations while obtaining
the state size (hence it does not declare throwing an IOException). Instead, the
state size should be stored in the state object, or should be computable from the state
stored in this object. The reason is that this method is called frequently by several parts
of the checkpointing and issuing I/O requests from this method accumulates a heavy I/O load
on the storage system at higher scale.
getStateSize in interface StateObjectpublic CheckpointedStateScope getScope()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.