org.apache.ignite.internal.pagemem.wal

## Interface IgniteWriteAheadLogManager

All Superinterfaces:
  GridCacheSharedManager, IgniteChangeGlobalStateSupport

All Known Implementing Classes:
  FileWriteAheadLogManager

    public interface IgniteWriteAheadLogManager
    extends GridCacheSharedManager, IgniteChangeGlobalStateSupport

### Method Summary

Methods
`void` `fsync(WALPointer ptr)` Makes sure that all log entries written to the log up until the specified pointer are actually persisted to the underlying storage.
`boolean` `isAlwaysWriteFullPages()`
`boolean` `isFullSync()`
`WALPointer` `log(WALRecord entry)` Appends the given log entry to the write-ahead log.
`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
`void` `resumeLogging(WALPointer lastWrittenPtr)` Resumes logging after start.
`int` `truncate(WALPointer ptr)` Gives a hint to WAL manager to clear entries logged before the given pointer.
`int` `walArchiveSegments()`

### Methods inherited from interface org.apache.ignite.internal.processors.cache.GridCacheSharedManager

`onDisconnected, onKernalStop, printMemoryStats, start, stop`

### Methods inherited from interface org.apache.ignite.internal.processors.cluster.IgniteChangeGlobalStateSupport

`onActivate, onDeActivate`

### Method Detail

#### isAlwaysWriteFullPages

    boolean isAlwaysWriteFullPages()

Returns:
  `true` If we have to always write full pages.

#### isFullSync

    boolean isFullSync()

Returns:
  `true` if WAL will perform fair syncs on fsync call.

#### resumeLogging

    void resumeLogging(WALPointer lastWrittenPtr)
                       throws IgniteCheckedException

Resumes logging after start. When WAL manager is started, it will skip logging any updates until this method is called to avoid logging changes induced by the state restore procedure.

Throws:
  `IgniteCheckedException`

#### log

    WALPointer log(WALRecord entry)
                   throws IgniteCheckedException,
                          StorageException

Appends the given log entry to the write-ahead log.

Parameters:
  `entry` - entry to log.
Returns:
  WALPointer that may be passed to `fsync(WALPointer)` method to make sure the record is written to the log.
Throws:
  `IgniteCheckedException` - If failed to construct log entry.
  `StorageException` - If IO error occurred while writing log entry.

#### fsync

    void fsync(WALPointer ptr)
               throws IgniteCheckedException,
                      StorageException

Makes sure that all log entries written to the log up until the specified pointer are actually persisted to the underlying storage.

Parameters:
  `ptr` - Optional pointer to sync. If `null`, will sync up to the latest record.
Throws:
  `IgniteCheckedException` - If failed to fsync.
  `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.

#### replay

    WALIterator replay(WALPointer start)
                       throws IgniteCheckedException,
                              StorageException

Invoke this method to iterate over the written log entries.

Parameters:
  `start` - Optional WAL pointer from which to start iteration.
Returns:
  Records iterator.
Throws:
  `IgniteException` - If failed to start iteration.
  `StorageException` - If IO error occurred while reading WAL entries.
  `IgniteCheckedException`

#### reserve

    boolean reserve(WALPointer start)
                    throws IgniteCheckedException

Invoke this method to reserve WAL history since provided pointer and prevent it's deletion.

Parameters:
  `start` - WAL pointer.
Throws:
  `IgniteException` - If failed to reserve.
  `IgniteCheckedException`

#### release

    void release(WALPointer start)
                 throws IgniteCheckedException

Invoke this method to release WAL history since provided pointer that was previously reserved.

Parameters:
  `start` - WAL pointer.
Throws:
  `IgniteException` - If failed to release.
  `IgniteCheckedException`

#### truncate

    int truncate(WALPointer ptr)

Gives a hint to WAL manager to clear entries logged before the given pointer. Some entries before the the given pointer will be kept because there is a configurable WAL history size. Those entries may be used for partial partition rebalancing.

Parameters:
  `ptr` - Pointer for which it is safe to clear the log.
Returns:
  Number of deleted WAL segments.

#### walArchiveSegments

    int walArchiveSegments()

Returns:
  Total number of segments in the WAL archive.

#### reserved

    boolean reserved(WALPointer ptr)

Checks if WAL segment is under lock or reserved

Parameters:
  `ptr` - Pointer to check.
Returns:
  True if given pointer is located in reserved segment.

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.1.0
Release Date | : July 20 2017