Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It is recommended to add the ability to load SnapshotLifecycleListener user extensions that will implement custom checks.

Code Block
languagejava
collapsetrue
/

...

**
 * Snapshot lifecycle listener.
 */
public interface SnapshotLifecycleListener extends Extension {
    /** Default listener priority. */
    public static final int DEFAULT_PRIORITY = 0;

    /** Listener name (must be unique). */
    public String name();

    /** Listener invocation priority (ascending order is used). */
    public default int priority() {
        return DEFAULT_PRIORITY;
    }

    /**
     * Called locally after the snapshot files have been created on the node.
     *
     * @param snpName Snapshot name.
     * @throws IgniteCheckedException If failed.
     */
    public default void afterCreate(String snpName) throws IgniteCheckedException {
        // No-op.
    }

    /**
     * Called locally before restore snapshot files.
     *
     * @param snpName Snapshot name.
     * @param consId Consistent snapshot metadata file name.
     * @param grps Cache groups to be restored ({@code null} if all cache groups are restored from the snapshot).
     * @param <T> Type of the result.
     * @return Local node result, or {@code null} if cluster-wide aggregation is not required.
     * @throws IgniteCheckedException If failed.
     */
    @Nullable public default <T> T beforeRestore(
        String snpName,
        String consId,
        @Nullable Collection<String> grps
    ) throws IgniteCheckedException {
        return null;
    }

    /**
     * Process the results of a pre-restore operation across the cluster.
     *
     * @param res Results from all nodes.
     * @throws IgniteCheckedException If failed.
     */
    public default void handlePreRestoreResults(List<ComputeJobResult> res) throws IgniteCheckedException {
        // No-op.
    }
}


Snapshot requirements

  1. Users must have the ability to create a snapshot of persisted user data (in-memory is out of the scope).
  2. Users must have the ability to create a snapshot from the cluster under the load without cluster deactivation.
  3. The snapshot process must not block for a long time any of the user transactions (short-time blocks are acceptable).
  4. The snapshot process must allow creating a data snapshot on each node and transfer it to any of the remote nodes for internal cluster needs.
  5. The created snapshot at the cluster-level must be fully consistent from cluster-wide terms, there should not be any incomplete transactions inside.
  6. The snapshot of each node must be consistent – cache partitions, binary meta, etc. must not have unnecessary changes.

...