Class FSEditLogOp.Reader
java.lang.Object
org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.Reader
- Enclosing class:
- FSEditLogOp
Class for reading editlog ops from a stream
-
Method Summary
Modifier and TypeMethodDescriptionstatic FSEditLogOp.Readercreate(DataInputStream in, org.apache.hadoop.hdfs.server.namenode.StreamLimiter limiter, int logVersion) abstract FSEditLogOpdecodeOp()Read an opcode from the input stream.readOp(boolean skipBrokenEdits) Read an operation from the input stream.abstract longscanOp()Similar to decodeOp(), but we only retrieve the transaction ID of the Op rather than reading it.voidsetMaxOpSize(int maxOpSize)
-
Method Details
-
create
public static FSEditLogOp.Reader create(DataInputStream in, org.apache.hadoop.hdfs.server.namenode.StreamLimiter limiter, int logVersion) -
setMaxOpSize
public void setMaxOpSize(int maxOpSize) -
readOp
Read an operation from the input stream. Note that the objects returned from this method may be re-used by future calls to the same method.- Parameters:
skipBrokenEdits- If true, attempt to skip over damaged parts of the input stream, rather than throwing an IOException- Returns:
- the operation read from the stream, or null at the end of the file
- Throws:
IOException- on error. This function should only throw an exception when skipBrokenEdits is false.
-
decodeOp
Read an opcode from the input stream.- Returns:
- the opcode, or null on EOF. If an exception is thrown, the stream's mark will be set to the first problematic byte. This usually means the beginning of the opcode.
- Throws:
IOException
-
scanOp
Similar to decodeOp(), but we only retrieve the transaction ID of the Op rather than reading it. If the edit log format supports length prefixing, this can be much faster than full decoding.- Returns:
- the last txid of the segment, or INVALID_TXID on EOF.
- Throws:
IOException
-