Interface DoubleWriteLog
- All Known Implementing Classes:
DoubleWriteLogGL,DoubleWriteLogNoOP
public interface DoubleWriteLog
Interface for the log which keeps data of pages before they will be finally fsync-ed to the data
files. This log is used to implement double write pattern.
At the first step we perform fsync of the data to the log using single sequential write
calling write(ByteBuffer[], int[], int[]) method.
As the second step we write pages to the data files.
At third step we fsync data files in background process and then truncate log calling truncate() method. Write to the file and truncation of data should be done in single lock to
prevent situation when data are written to the log but not to the pages and then truncated. That
is typically not a problem because write cache uses single thread model.
If during the write of pages we reach log threshold write(ByteBuffer[], int[], int[])
method will return true. If that happens fsync of pages should be called to truncate page log.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidloadPage(int fileId, int pageIndex, OByteBufferPool bufferPool) voidvoidvoidvoidvoidtruncate()booleanwrite(ByteBuffer[] buffers, int[] fileId, int[] pageIndex)
-
Method Details
-
write
- Throws:
IOException
-
truncate
- Throws:
IOException
-
open
- Throws:
IOException
-
loadPage
- Throws:
IOException
-
restoreModeOn
- Throws:
IOException
-
restoreModeOff
void restoreModeOff() -
close
- Throws:
IOException
-
startCheckpoint
- Throws:
IOException
-
endCheckpoint
void endCheckpoint()
-