public class FlushedScan extends java.lang.Object implements StreamLogScan
4 bytes - length of user data, i.e. N 8 bytes - long representing log instant N bytes of supplied data 4 bytes - length of user data, i.e. N
Modifier and Type | Field and Description |
---|---|
(package private) long |
currentInstant |
(package private) long |
currentLogFileFirstUnflushedPosition |
(package private) long |
currentLogFileNumber |
(package private) long |
firstUnflushed |
(package private) long |
firstUnflushedFileNumber |
(package private) long |
firstUnflushedFilePosition |
(package private) static int |
LOG_REC_LEN_BYTE_LENGTH |
(package private) LogToFile |
logFactory |
(package private) int |
nextRecordLength
The length of the next record.
|
(package private) boolean |
open |
(package private) boolean |
readNextRecordLength
Flag to indicate that the length of the next log record has been read by
currentLogFileHasUnflushedRecord.
|
private StorageRandomAccessFile |
scan |
Constructor and Description |
---|
FlushedScan(LogToFile logFactory,
long startAt) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the scan.
|
private boolean |
currentLogFileHasUnflushedRecord() |
long |
getInstant()
Return the log instant (as an integer) the scan is currently on - this is the log
instant of the log record that was returned by getNextRecord.
|
LogInstant |
getLogInstant()
Return the log instant the scan is currently on - this is the log
instant of the log record that was returned by getNextRecord.
|
long |
getLogRecordEnd()
Get the log instant that is right after the record just retrived
|
LogRecord |
getNextRecord(ArrayInputStream input,
TransactionId tranId,
int groupmask)
Read a log record into the byte array provided.
|
boolean |
isLogEndFuzzy()
returns true if there is partially writen log records before the crash
in the last log file.
|
private boolean |
positionToNextRecord() |
void |
resetPosition(LogInstant instant)
Reset the scan to the given LogInstant.
|
private void |
setCurrentLogFileFirstUnflushedPosition() |
private void |
setFirstUnflushed() |
private void |
switchLogFile() |
private StorageRandomAccessFile scan
LogToFile logFactory
boolean open
long currentLogFileNumber
long currentLogFileFirstUnflushedPosition
long currentInstant
long firstUnflushed
long firstUnflushedFileNumber
long firstUnflushedFilePosition
static final int LOG_REC_LEN_BYTE_LENGTH
int nextRecordLength
boolean readNextRecordLength
public FlushedScan(LogToFile logFactory, long startAt) throws StandardException
StandardException
public LogRecord getNextRecord(ArrayInputStream input, TransactionId tranId, int groupmask) throws StandardException
getNextRecord
in interface StreamLogScan
input
- the ArrayInputStream to put the log recordtranId
- if non-null, only log record that equals tranId
will be returned. If null, log records are not
filtered on transaction Id.groupmask
- if non-zero, only log record whose Loggable's group
value is included in the groupmask is returned.
groupmask can be a bit wise OR of many Loggable
groups. If zero, log records are not filtered on
the Loggable's group.StandardException
- Standard Derby error policypublic void resetPosition(LogInstant instant) throws java.io.IOException
resetPosition
in interface StreamLogScan
instant
- the position to reset tojava.io.IOException
- scan cannot access the log at the new position.public long getLogRecordEnd()
getLogRecordEnd
in interface StreamLogScan
public boolean isLogEndFuzzy()
isLogEndFuzzy
in interface StreamLogScan
public long getInstant()
getInstant
in interface StreamLogScan
public LogInstant getLogInstant()
getLogInstant
in interface StreamLogScan
public void close()
close
in interface StreamLogScan
private void setFirstUnflushed() throws StandardException, java.io.IOException
StandardException
java.io.IOException
private void setCurrentLogFileFirstUnflushedPosition() throws java.io.IOException
java.io.IOException
private void switchLogFile() throws StandardException
StandardException
private boolean currentLogFileHasUnflushedRecord() throws java.io.IOException
java.io.IOException
private boolean positionToNextRecord() throws StandardException, java.io.IOException
StandardException
java.io.IOException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.