LogScan, StreamLogScanpublic 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 | 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 | Description |
|---|---|
FlushedScan(LogToFile logFactory,
long startAt) |
| Modifier and Type | Method | 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
StandardExceptionpublic LogRecord getNextRecord(ArrayInputStream input, TransactionId tranId, int groupmask) throws StandardException
getNextRecord in interface StreamLogScaninput - 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 StreamLogScaninstant - the position to reset tojava.io.IOException - scan cannot access the log at the new position.public long getLogRecordEnd()
getLogRecordEnd in interface StreamLogScanpublic boolean isLogEndFuzzy()
isLogEndFuzzy in interface StreamLogScanpublic long getInstant()
getInstant in interface StreamLogScanpublic LogInstant getLogInstant()
getLogInstant in interface StreamLogScanpublic void close()
close in interface StreamLogScanprivate void setFirstUnflushed()
throws StandardException,
java.io.IOException
StandardExceptionjava.io.IOExceptionprivate void setCurrentLogFileFirstUnflushedPosition()
throws java.io.IOException
java.io.IOExceptionprivate void switchLogFile()
throws StandardException
StandardExceptionprivate boolean currentLogFileHasUnflushedRecord()
throws java.io.IOException
java.io.IOExceptionprivate boolean positionToNextRecord()
throws StandardException,
java.io.IOException
StandardExceptionjava.io.IOExceptionApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.