Package org.gridgain.internal.dcr.table
Class TableReplication
java.lang.Object
org.gridgain.internal.dcr.table.TableReplication
One table replication controller.
-
Constructor Summary
ConstructorsConstructorDescriptionTableReplication(String nodeName, TableManager tableManager, Executor fstExecutionPool, @Nullable Instant flushPoint, ReplicationEventHandler<FstProgressEvent> progressHandler, DcrMetricSource metricSource, org.apache.ignite.internal.hlc.ClockService clockService) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidstart(ReplicationEventHandler<TableEvent> handler) Starts replication for the table.voidstop()Stop replication method.voidupdateFlushPoint(Instant flushPoint) Updates flush point.
-
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 nametableManager- Table manager.fstExecutionPool- Exception thread pool.progressHandler- Handles fst progress changes.metricSource- Metric source.
-
-
Method Details
-
updateFlushPoint
Updates flush point.- Parameters:
flushPoint- Replication flush point.
-
start
Starts replication for the table.Replication workflow consists of the following stages:
- Calculate Total Count: Executes COUNT(*) query without transaction to enable estimatedSize() optimization. Generates initial progress event with totalEntriesCount.
- Start FST Transaction: Creates a read-only transaction with infinite timeout. This transaction defines the consistent snapshot for both FST and CQ watermark.
- 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.
- Commit FST Transaction: Commits the FST transaction and triggers
fstFinishedevent on success. - Continuous Query (CQ): Starts continuous query with watermark based on FST transaction to capture
incremental changes. When CQ completes, triggers
finishedevent.
Error handling distinguishes between:
- Cancellations:
CancellationException(whenstop()is called). These do not triggerfailedevent, but rollback transactions if needed. - Actual errors: All other exceptions trigger
failedevent and rollback transactions.
All stages are asynchronous and registered with
InFlightFuturesto enable cancellation viastop().- Parameters:
handler- Event handler to receive replication lifecycle events (fstFinished, finished, failed).
-
stop
public void stop()Stop replication method.
-