public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter implements IgniteWriteAheadLogManager
| Modifier and Type | Class and Description |
|---|---|
static class |
FileWriteAheadLogManager.ReadFileHandle |
| Modifier and Type | Field and Description |
|---|---|
static long |
DFLT_WAL_SEGMENT_SYNC_TIMEOUT
Dfault wal segment sync timeout.
|
static Pattern |
WAL_NAME_PATTERN
Pattern for segment file names
|
static FileFilter |
WAL_SEGMENT_COMPACTED_OR_RAW_FILE_FILTER
WAL segment file filter, see
WAL_NAME_PATTERN |
static Pattern |
WAL_SEGMENT_FILE_COMPACTED_PATTERN |
static FileFilter |
WAL_SEGMENT_FILE_FILTER
WAL segment file filter, see
WAL_NAME_PATTERN |
static Pattern |
WAL_TEMP_NAME_PATTERN |
cctx, diagnosticLog, log| Constructor and Description |
|---|
FileWriteAheadLogManager(GridKernalContext ctx) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanupWalDirectories()
Cleanup all directories relating to WAL (e.g. work WAL dir, archive WAL dir).
|
boolean |
disabled(int grpId)
Checks WAL disabled for cache group.
|
void |
flush(WALPointer ptr,
boolean explicitFsync)
Makes sure that all log entries written to the log up until the specified pointer are actually written
to the underlying storage.
|
Collection<File> |
getAndReserveWalFiles(FileWALPointer low,
FileWALPointer high)
Collect wal segment files from low pointer (include) to high pointer (not include) and reserve low pointer.
|
boolean |
isAlwaysWriteFullPages() |
boolean |
isFullSync() |
long |
lastArchivedSegment() |
long |
lastCompactedSegment() |
static FileDescriptor[] |
loadFileDescriptors(File walFilesDir)
Scans provided folder for a WAL segment files
|
WALPointer |
log(WALRecord rec)
Appends the given log entry to the write-ahead log.
|
long |
maxArchivedSegmentToDelete() |
long |
maxWalSegmentSize() |
void |
notchLastCheckpointPtr(WALPointer ptr)
Notifies
this about latest checkpoint pointer. |
void |
onActivate(GridKernalContext kctx)
Called when cluster performing activation.
|
void |
onDeActivate(GridKernalContext kctx)
Called when cluster performing deactivation.
|
void |
release(WALPointer start)
Invoke this method to release WAL history since provided pointer that was previously reserved.
|
WALIterator |
replay(WALPointer start)
Invoke this method to iterate over the written log entries.
|
boolean |
reserve(WALPointer start)
Invoke this method to reserve WAL history since provided pointer and prevent it's deletion.
|
boolean |
reserved(WALPointer ptr)
Checks if WAL segment is under lock or reserved
|
int |
reserved(WALPointer low,
WALPointer high)
Checks if WAL segments is under lock or reserved.
|
void |
resumeLogging(WALPointer lastPtr)
Resumes logging after start.
|
static FileDescriptor[] |
scan(File[] allFiles) |
int |
serializerVersion() |
void |
setCreateWalFileListener(IgniteInClosure<FileIO> createWalFileListener)
Setup listener for WAL segment write File IO creation.
|
void |
setFileIOFactory(FileIOFactory ioFactory)
For test purposes only.
|
void |
start0() |
protected void |
stop0(boolean cancel) |
int |
truncate(WALPointer low,
WALPointer high)
Gives a hint to WAL manager to clear entries logged before the given pointer.
|
int |
walArchiveSegments() |
context, isStopping, kernalStartInfo, kernalStopInfo, log, onDisconnected, onKernalStop, onKernalStop0, onReconnected, printMemoryStats, start, startInfo, stop, stopInfo, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitonDisconnected, onKernalStop, onReconnected, printMemoryStats, start, stoppublic static final long DFLT_WAL_SEGMENT_SYNC_TIMEOUT
public static final Pattern WAL_NAME_PATTERN
public static final Pattern WAL_TEMP_NAME_PATTERN
public static final FileFilter WAL_SEGMENT_FILE_FILTER
WAL_NAME_PATTERNpublic static final Pattern WAL_SEGMENT_FILE_COMPACTED_PATTERN
public static final FileFilter WAL_SEGMENT_COMPACTED_OR_RAW_FILE_FILTER
WAL_NAME_PATTERNpublic FileWriteAheadLogManager(@NotNull
GridKernalContext ctx)
ctx - Kernal context.public void setFileIOFactory(FileIOFactory ioFactory)
ioFactory - IO factory.public void start0()
throws IgniteCheckedException
start0 in class GridCacheSharedManagerAdapterIgniteCheckedException - If failed.public Collection<File> getAndReserveWalFiles(FileWALPointer low, FileWALPointer high) throws IgniteCheckedException
low - Low bound.high - High bound.IgniteCheckedExceptionprotected void stop0(boolean cancel)
stop0 in class GridCacheSharedManagerAdaptercancel - Cancel flag.public void onActivate(GridKernalContext kctx) throws IgniteCheckedException
onActivate in interface IgniteChangeGlobalStateSupportkctx - Kernal context.IgniteCheckedException - If failed.public void onDeActivate(GridKernalContext kctx)
onDeActivate in interface IgniteChangeGlobalStateSupportkctx - Kernal context.public boolean isAlwaysWriteFullPages()
isAlwaysWriteFullPages in interface IgniteWriteAheadLogManagertrue If we have to always write full pages.public boolean isFullSync()
isFullSync in interface IgniteWriteAheadLogManagertrue if WAL will perform fair syncs on fsync call.public void resumeLogging(WALPointer lastPtr) throws IgniteCheckedException
resumeLogging in interface IgniteWriteAheadLogManagerIgniteCheckedExceptionpublic int serializerVersion()
serializerVersion in interface IgniteWriteAheadLogManagerpublic WALPointer log(WALRecord rec) throws IgniteCheckedException, StorageException
log in interface IgniteWriteAheadLogManagerrec - entry to log.IgniteWriteAheadLogManager.flush(WALPointer, boolean) method to make sure the record is
written to the log.IgniteCheckedException - If failed to construct log entry.StorageException - If IO error occurred while writing log entry.public void flush(WALPointer ptr, boolean explicitFsync) throws IgniteCheckedException, StorageException
flush in interface IgniteWriteAheadLogManagerptr - Optional pointer to write. If null, will sync up to the latest record.explicitFsync - If true, data will be synced to the storage device on hardware level.IgniteCheckedException - If failed to write.StorageException - If IO exception occurred during the write. If an exception is thrown from this
method, the WAL will be invalidated and the node will be stopped.public WALIterator replay(WALPointer start) throws IgniteCheckedException, StorageException
replay in interface IgniteWriteAheadLogManagerstart - Optional WAL pointer from which to start iteration.StorageException - If IO error occurred while reading WAL entries.IgniteCheckedExceptionpublic boolean reserve(WALPointer start) throws IgniteCheckedException
reserve in interface IgniteWriteAheadLogManagerstart - WAL pointer.IgniteCheckedExceptionpublic void release(WALPointer start)
release in interface IgniteWriteAheadLogManagerstart - WAL pointer.public int truncate(WALPointer low, WALPointer high)
truncate in interface IgniteWriteAheadLogManagerlow - Pointer since which WAL will be truncated. If null, WAL will be truncated from the oldest segment.high - Pointer for which it is safe to clear the log.public void notchLastCheckpointPtr(WALPointer ptr)
this about latest checkpoint pointer.
Current implementations, in fact, react by keeping all WAL segments uncompacted starting from index prior to
the index of ptr. Compaction implies filtering out physical records and ZIP compression.
notchLastCheckpointPtr in interface IgniteWriteAheadLogManagerptr - Pointer for which it is safe to compact the log.public int walArchiveSegments()
walArchiveSegments in interface IgniteWriteAheadLogManagerpublic long lastArchivedSegment()
lastArchivedSegment in interface IgniteWriteAheadLogManagerpublic long lastCompactedSegment()
lastCompactedSegment in interface IgniteWriteAheadLogManagerpublic boolean reserved(WALPointer ptr)
reserved in interface IgniteWriteAheadLogManagerptr - Pointer to check.public int reserved(WALPointer low, WALPointer high)
reserved in interface IgniteWriteAheadLogManagerlow - Pointer since which WAL is locked or reserved. If null, checks from the oldest segment.high - Pointer for which WAL is locked or reserved.public boolean disabled(int grpId)
disabled in interface IgniteWriteAheadLogManagergrpId - Group id.public void cleanupWalDirectories()
throws IgniteCheckedException
cleanupWalDirectories in interface IgniteWriteAheadLogManagerIgniteCheckedExceptionpublic long maxArchivedSegmentToDelete()
maxArchivedSegmentToDelete in interface IgniteWriteAheadLogManagerpublic static FileDescriptor[] scan(File[] allFiles)
public void setCreateWalFileListener(@Nullable
IgniteInClosure<FileIO> createWalFileListener)
createWalFileListener - Listener to be invoked for new segment file IO creation.public long maxWalSegmentSize()
maxWalSegmentSize.public static FileDescriptor[] loadFileDescriptors(@NotNull File walFilesDir) throws IgniteCheckedException
walFilesDir - directory to scanIgniteCheckedException
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.5 Release Date : June 4 2019