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.StateObject.StateObjectLocation, StateObject.StateObjectSizeStatsCollector| 限定符和类型 | 字段和说明 |
|---|---|
protected long |
stateSize
The size of the state in the file.
|
| 构造器和说明 |
|---|
SegmentFileStateHandle(org.apache.flink.core.fs.Path filePath,
long startPos,
long stateSize,
CheckpointedStateScope scope,
LogicalFile.LogicalFileId fileId)
Creates a new segment file state for the given file path.
|
| 限定符和类型 | 方法和说明 |
|---|---|
Optional<byte[]> |
asBytesIfInMemory() |
void |
collectSizeStats(StateObject.StateObjectSizeStatsCollector collector)
Collects statistics about state size and location from the state object.
|
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.
|
LogicalFile.LogicalFileId |
getLogicalFileId() |
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() |
public SegmentFileStateHandle(org.apache.flink.core.fs.Path filePath,
long startPos,
long stateSize,
CheckpointedStateScope scope,
LogicalFile.LogicalFileId fileId)
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.fileId - The corresponding logical file id.public void discardState()
discardState 在接口中 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 在接口中 StreamStateHandleIOExceptionpublic Optional<byte[]> asBytesIfInMemory()
asBytesIfInMemory 在接口中 StreamStateHandlepublic PhysicalStateHandleID getStreamStateHandleID()
getStreamStateHandleID 在接口中 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 在接口中 StateObjectpublic void collectSizeStats(StateObject.StateObjectSizeStatsCollector collector)
StateObjectcollectSizeStats 在接口中 StateObjectcollector - the statistics collector.public CheckpointedStateScope getScope()
public LogicalFile.LogicalFileId getLogicalFileId()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.