Class TableReplication

java.lang.Object
org.gridgain.internal.dcr.table.TableReplication

public class TableReplication extends Object
One table replication controller.
  • Constructor Details

    • TableReplication

      public TableReplication(String nodeName, TableManager tableManager, Executor fstExecutionPool, @Nullable @Nullable Instant flushPoint, ReplicationEventHandler<FstProgressEvent> progressHandler, DcrMetricSource metricSource, org.apache.ignite.internal.hlc.ClockService clockService)
      Constructor.
      Parameters:
      nodeName - Node name
      tableManager - Table manager.
      fstExecutionPool - Exception thread pool.
      progressHandler - Handles fst progress changes.
      metricSource - Metric source.
  • Method Details

    • updateFlushPoint

      public void updateFlushPoint(Instant flushPoint)
      Updates flush point.
      Parameters:
      flushPoint - Replication flush point.
    • start

      public void start(ReplicationEventHandler<TableEvent> handler)
      Starts replication for the table.

      Replication workflow consists of the following stages:

      1. Calculate Total Count: Executes COUNT(*) query without transaction to enable estimatedSize() optimization. Generates initial progress event with totalEntriesCount.
      2. Start FST Transaction: Creates a read-only transaction with infinite timeout. This transaction defines the consistent snapshot for both FST and CQ watermark.
      3. Full State Transfer (FST): Queries all existing data from remote table using the FST transaction and streams it to the local table. Progress events are generated during transfer.
      4. Commit FST Transaction: Commits the FST transaction and triggers fstFinished event on success.
      5. Continuous Query (CQ): Starts continuous query with watermark based on FST transaction to capture incremental changes. When CQ completes, triggers finished event.

      Error handling distinguishes between:

      • Cancellations: CancellationException (when stop() is called). These do not trigger failed event, but rollback transactions if needed.
      • Actual errors: All other exceptions trigger failed event and rollback transactions.

      All stages are asynchronous and registered with InFlightFutures to enable cancellation via stop().

      Parameters:
      handler - Event handler to receive replication lifecycle events (fstFinished, finished, failed).
    • stop

      public void stop()
      Stop replication method.