Class SnapshotCoordinatorRole

java.lang.Object
org.gridgain.internal.snapshots.coordinator.SnapshotCoordinatorRole

public class SnapshotCoordinatorRole extends Object
Class encapsulating the logic specific to the Snapshot Coordinator Role.
  • Constructor Details

  • Method Details

    • onBecomeCoordinator

      public CompletableFuture<Void> onBecomeCoordinator(long term)
      Callback that gets invoked when the node becomes a Snapshot Coordinator.

      When a node becomes a coordinator, it should check all available Global Snapshot states and perform the following actions.

      1. If a snapshot’s status is COMPLETED, check that no Local State records are present in the Meta Storage. Otherwise they must be removed.
      2. If a snapshot’s status is FAILED, check that no Local State records are present in the Meta Storage. Otherwise they must be removed.
      3. If a snapshot’s status is STARTED, register a Watch related to this snapshot and check all present Local State records:
        1. If Local State records are present for all target nodes and all of their states are COMPLETED, then transfer the global snapshot status to COMPLETED and remove the Local State records.
        2. If Local State records are present for all target nodes and any of their states is FAILED, then transfer the global snapshot status to FAILED and remove the Local State records.
        3. If not all Local State records are present for all target nodes and any of their states are FAILED, then transfer the global snapshot status to FAILED and initiate canceling of the corresponding Snapshot operation.
      Parameters:
      term - Coordinator term.
      Returns:
      Future that will complete when the Coordinator Role is fully initialized.
    • startSnapshotCreation

      public CompletableFuture<UUID> startSnapshotCreation(long term, org.apache.ignite.internal.rest.api.snapshot.SnapshotType snapshotType, Instant startTime, org.apache.ignite.internal.hlc.HybridTimestamp timestamp, Set<String> tablesToSave, Set<String> structuresToSave, @Nullable @Nullable String destination, @Nullable @Nullable String encryptionProviderName)
      Initiates the creation of a Snapshot.
      Parameters:
      term - Snapshot Coordinator term.
      snapshotType - Type of the Snapshot to be created.
      timestamp - Timestamp of the Snapshot to be created.
      tablesToSave - Table names that need to participate in the Snapshot. If both this and structuresToSave are empty, all existing tables will be used.
      structuresToSave - Structure names that need to participate in the Snapshot. If both this and tablesToSave are empty, all structures will be used.
      destination - Name of the snapshot URI in configuration or null for default.
      Returns:
      Future that will complete with the Operation ID which will be the same as Snapshot ID.
    • prepareSnapshotRestoration

      public CompletableFuture<UUID> prepareSnapshotRestoration(long term, UUID targetSnapshotId, Set<String> tablesToRestore, Set<String> structuresToRestore, @Nullable @Nullable String source, @Nullable @Nullable String encryptionProviderName, boolean force)
      Initiates the restoration of a Snapshot.
      Parameters:
      term - Snapshot Coordinator term.
      targetSnapshotId - Snapshot ID to be restored.
      tablesToRestore - Tables to restore from the snapshot. If empty, all tables from the snapshot will be used.
      source - Name of the snapshot URI in configuration or null for default.
      Returns:
      Future that will complete with the operation ID.
    • prepareSnapshotDeletion

      public CompletableFuture<UUID> prepareSnapshotDeletion(long term, UUID targetSnapshotId)
      Initiates the deletion of a Snapshot.
      Parameters:
      term - Snapshot Coordinator term.
      targetSnapshotId - Snapshot ID to be restored.
      Returns:
      Future that will complete with the Operation ID.