Class FsyncFileHandleManagerImpl
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.persistence.wal.filehandle.FsyncFileHandleManagerImpl
-
- All Implemented Interfaces:
FileHandleManager
public class FsyncFileHandleManagerImpl extends Object implements FileHandleManager
Implementation ofFileWriteHandlefor FSYNC mode.
-
-
Field Summary
Fields Modifier and Type Field Description protected GridCacheSharedContextcctxContext.protected IgniteLoggerlogLogger.protected RecordSerializerserializer
-
Constructor Summary
Constructors Constructor Description FsyncFileHandleManagerImpl(GridCacheSharedContext cctx, DataStorageMetricsImpl metrics, RecordSerializer serializer, Supplier<FileWriteHandle> handle, WALMode mode, long maxWalSegmentSize, long fsyncDelay, int tlbSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WALPointerflush(WALPointer ptr, boolean explicitFsync)FileWriteHandleinitHandle(SegmentIO fileIO, long position, RecordSerializer serializer)InitializeFileWriteHandlefor first time.FileWriteHandlenextHandle(SegmentIO fileIO, RecordSerializer serializer)Create next file handle.voidonDeactivate()On deactivate.voidresumeLogging()Resume logging.
-
-
-
Field Detail
-
cctx
protected final GridCacheSharedContext cctx
Context.
-
log
protected final IgniteLogger log
Logger.
-
serializer
protected final RecordSerializer serializer
-
-
Constructor Detail
-
FsyncFileHandleManagerImpl
public FsyncFileHandleManagerImpl(GridCacheSharedContext cctx, DataStorageMetricsImpl metrics, RecordSerializer serializer, Supplier<FileWriteHandle> handle, WALMode mode, long maxWalSegmentSize, long fsyncDelay, int tlbSize)
- Parameters:
cctx- Context.metrics- Data storage metrics.serializer- Serializer.handle- Current handle supplier.mode- WAL mode.maxWalSegmentSize- Max WAL segment size.fsyncDelay- Fsync delay.tlbSize- Thread local byte buffer size.
-
-
Method Detail
-
initHandle
public FileWriteHandle initHandle(SegmentIO fileIO, long position, RecordSerializer serializer) throws IOException
InitializeFileWriteHandlefor first time.- Specified by:
initHandlein interfaceFileHandleManager- Parameters:
fileIO- FileIO.position- Init position.serializer- Serializer for file handle.- Returns:
- Created file handle.
- Throws:
IOException- if creation was not success.
-
nextHandle
public FileWriteHandle nextHandle(SegmentIO fileIO, RecordSerializer serializer) throws IOException
Create next file handle.- Specified by:
nextHandlein interfaceFileHandleManager- Parameters:
fileIO- FileIO.serializer- Serializer for file handle.- Returns:
- Created file handle.
- Throws:
IOException- if creation was not success.
-
onDeactivate
public void onDeactivate() throws IgniteCheckedExceptionOn deactivate.- Specified by:
onDeactivatein interfaceFileHandleManager- Throws:
IgniteCheckedException- if fail.
-
resumeLogging
public void resumeLogging()
Resume logging.- Specified by:
resumeLoggingin interfaceFileHandleManager
-
flush
public WALPointer flush(WALPointer ptr, boolean explicitFsync) throws IgniteCheckedException, StorageException
- Specified by:
flushin interfaceFileHandleManager- Parameters:
ptr- Pointer until need to flush.explicitFsync-trueif fsync required.- Returns:
- Last WAL position which was flushed to WAL segment file. May be greater than or equal to a
ptr. May benull, it means nothing has been flushed. - Throws:
IgniteCheckedException- if fail.StorageException- if storage was fail.
-
-