Alexey Goncharuk created IGNITE-4337:
----------------------------------------

             Summary: Introduce persistence interface to allow build reliable 
persistence plugins
                 Key: IGNITE-4337
                 URL: https://issues.apache.org/jira/browse/IGNITE-4337
             Project: Ignite
          Issue Type: Sub-task
          Components: general
            Reporter: Alexey Goncharuk
             Fix For: 2.0


If page memory interface is introduced, it may be possible to build a 
persistence layer around this architecture. I think we should add some form of 
persistence logging to allow us build a crash-resistant system in future.

Something like
{code}
public interface IgniteWriteAheadLogManager extends GridCacheSharedManager {
    /**
     * @return {@code true} If we have to always write full pages.
     */
    public boolean isAlwaysWriteFullPages();

    /**
     * @return {@code true} if WAL will perform fair syncs on fsync call.
     */
    public boolean isFullSync();

    /**
     * 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.
     */
    public void resumeLogging(WALPointer lastWrittenPtr) throws 
IgniteCheckedException;

    /**
     * Appends the given log entry to the write-ahead log.
     *
     * @param entry entry to log.
     * @return WALPointer that may be passed to {@link #fsync(WALPointer)} 
method to make sure the record is
     *      written to the log.
     * @throws IgniteCheckedException If failed to construct log entry.
     * @throws StorageException If IO error occurred while writing log entry.
     */
    public WALPointer log(WALRecord entry) 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.
     *
     * @param ptr Optional pointer to sync. If {@code null}, will sync up to 
the latest record.
     * @throws IgniteCheckedException If
     * @throws StorageException
     */
    public void fsync(WALPointer ptr) throws IgniteCheckedException, 
StorageException;

    /**
     * Invoke this method to iterate over the written log entries.
     *
     * @param start Optional WAL pointer from which to start iteration.
     * @return Records iterator.
     * @throws IgniteException If failed to start iteration.
     * @throws StorageException If IO error occurred while reading WAL entries.
     */
    public WALIterator replay(WALPointer start) throws IgniteCheckedException, 
StorageException;

    /**
     * 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.
     *
     * @param ptr Pointer for which it is safe to clear the log.
     * @return Number of deleted WAL segments.
     */
    public int truncate(WALPointer ptr);
}
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to