
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()
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() |
String |
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.
|
compareTolong getOrder()
void init() throws IOException
IOExceptionlong filledUpTo()
OLogSequenceNumber begin() throws IOException
IOExceptionOLogSequenceNumber end()
String getPath()
OLogSequenceNumber logRecord(byte[] record)
byte[] readRecord(OLogSequenceNumber lsn) throws IOException
IOExceptionOLogSequenceNumber getNextLSN(OLogSequenceNumber lsn) throws IOException
null is returned.IOExceptionvoid close(boolean flush)
throws IOException
fsync of data if necessary.IOExceptionvoid flush()
fsync of data.void delete()
throws IOException
IOExceptionvoid stopBackgroundWrite(boolean flush)
fsync if necessary.void startBackgroundWrite()
Copyright © 2009–2025 OrientDB. All rights reserved.