Class SnapshotProgress
java.lang.Object
io.debezium.pipeline.source.snapshot.chunked.SnapshotProgress
Thread-safe coordination for global snapshot progress across all tables.
Ensures correct emission ordering of FIRST and LAST snapshot markers.
- Author:
- Chris Cranford
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CountDownLatchprivate final intprivate final CountDownLatch -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintvoidSignals that the global FIRST record has been emitted.voidSignals that a table has completed all its records (including LAST_IN_DATA_COLLECTION).voidWaits for the global FIRST record to be emitted.booleanwaitForFirstRecord(long timeout, TimeUnit unit) Waits for the global FIRST record with a timeout.voidWaits for all tables except the last one to complete.booleanwaitForOtherTables(long timeout, TimeUnit unit) Waits for all tables except the last one with a timeout.
-
Field Details
-
tableCount
private final int tableCount -
firstRecordLatch
-
tablesBeforeLastLatch
-
-
Constructor Details
-
SnapshotProgress
public SnapshotProgress(int tableCount) Creates a new SnapshotProgress instance.- Parameters:
tableCount- the total number of tables in the snapshot
-
-
Method Details
-
waitForFirstRecord
Waits for the global FIRST record to be emitted. Called by all records except the FIRST record before emission.- Throws:
InterruptedException- if the wait is interrupted
-
waitForFirstRecord
Waits for the global FIRST record with a timeout.- Parameters:
timeout- the maximum time to waitunit- the time unit- Returns:
- true if the latch was signaled, false if timeout elapsed
- Throws:
InterruptedException- if the wait is interrupted
-
signalFirstRecordEmitted
public void signalFirstRecordEmitted()Signals that the global FIRST record has been emitted. Called by the chunk processing the first record of the first table. -
waitForOtherTables
Waits for all tables except the last one to complete. Called by the LAST record before emission.- Throws:
InterruptedException- if the wait is interrupted
-
waitForOtherTables
Waits for all tables except the last one with a timeout.- Parameters:
timeout- the maximum time to waitunit- the time unit- Returns:
- true if all tables completed, false if timeout elapsed
- Throws:
InterruptedException- if the wait is interrupted
-
signalTableComplete
public void signalTableComplete()Signals that a table has completed all its records (including LAST_IN_DATA_COLLECTION). Called by non-last tables after emitting their final record. -
getTableCount
public int getTableCount()- Returns:
- the total number of tables in the snapshot
-