public interface OLogSegment extends Comparable<OLogSegment>
WAL is split by segments. Segments are used to truncate WAL by portions. All transactions which are started inside of segment should not cross segment. So they should be finished before new segment will be started.
Main reason of creation of this interface is support of different binary formats of WAL in the same deployment.
To detect which version of binary format is stored we use value stored under OWALPage.MAGIC_NUMBER_OFFSET
Modifier and Type | Method and Description |
---|---|
OLogSequenceNumber |
begin() |
void |
close(boolean flush)
Writes buffer of the segment to the disk and closes all acquired resources.
|
void |
delete(boolean flush)
Clears the buffer and deletes file content.
|
OLogSequenceNumber |
end() |
long |
filledUpTo() |
void |
flush()
Writes buffer of the segment to the disk and performs
fsync of data. |
OLogSequenceNumber |
getNextLSN(OLogSequenceNumber lsn)
Returns LSN of the record which follows after the record with passed in LSN.
|
long |
getOrder() |
Path |
getPath() |
void |
init()
This method should be called before segment started to be used by WAL.
|
OLogSequenceNumber |
logRecord(byte[] record)
Appends new records to the WAL segment and returns LSN of it.
|
byte[] |
readRecord(OLogSequenceNumber lsn)
Reads WAL record from segment from position indicated by LSN.
|
void |
startBackgroundWrite()
Start background task which performs periodical write of background buffer to the disk.
|
void |
stopBackgroundWrite(boolean flush)
Stop background task which writes data from log segments buffer to the disk and writes the rest
of the buffer to the disk.
|
compareTo
long getOrder()
void init() throws IOException
IOException
long filledUpTo()
OLogSequenceNumber begin() throws IOException
IOException
OLogSequenceNumber end()
Path getPath()
OLogSequenceNumber logRecord(byte[] record)
byte[] readRecord(OLogSequenceNumber lsn) throws IOException
IOException
OLogSequenceNumber getNextLSN(OLogSequenceNumber lsn) throws IOException
null
is returned.IOException
void close(boolean flush) throws IOException
fsync
of data if necessary.IOException
void flush()
fsync
of data.void delete(boolean flush) throws IOException
IOException
void stopBackgroundWrite(boolean flush)
fsync
if necessary.void startBackgroundWrite()
Copyright © 2009–2020 OrientDB. All rights reserved.