Class SnapshotCoordinatorRole
java.lang.Object
org.gridgain.internal.snapshots.coordinator.SnapshotCoordinatorRole
Class encapsulating the logic specific to the Snapshot Coordinator Role.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiononBecomeCoordinator(long term) Callback that gets invoked when the node becomes a Snapshot Coordinator.prepareSnapshotDeletion(long term, UUID targetSnapshotId) Initiates the deletion of a Snapshot.prepareSnapshotRestoration(long term, UUID targetSnapshotId, Set<String> tablesToRestore, Set<String> structuresToRestore, @Nullable String source, @Nullable String encryptionProviderName, boolean force) Initiates the restoration of a Snapshot.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 String destination, @Nullable String encryptionProviderName) Initiates the creation of a Snapshot.
-
Constructor Details
-
SnapshotCoordinatorRole
-
-
Method Details
-
onBecomeCoordinator
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.
- If a snapshot’s status is COMPLETED, check that no Local State records are present in the Meta Storage. Otherwise they must be removed.
- If a snapshot’s status is FAILED, check that no Local State records are present in the Meta Storage. Otherwise they must be removed.
-
If a snapshot’s status is STARTED, register a Watch related to this snapshot and check all present Local State records:
- 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.
- 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.
- 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 ornullfor 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 ornullfor default.- Returns:
- Future that will complete with the operation ID.
-
prepareSnapshotDeletion
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.
-