Class TableChunkProgress
java.lang.Object
io.debezium.pipeline.source.snapshot.chunked.TableChunkProgress
Thread-safe progress tracking for chunked table snapshots across all table chunks.
- Author:
- Chris Cranford
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CountDownLatchprivate final AtomicIntegerprivate final CountDownLatchprivate final TableIdprivate final intprivate final AtomicLong -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintintlongbooleanvoidmarkChunkComplete(long rowsScanned) voidSignals that a non-last chunk has completed all its records.voidSignals that the first record of this table has been emitted.voidWaits for the first record of this table (FIRST_IN_DATA_COLLECTION) to be emitted.booleanwaitForFirstRecord(long timeout, TimeUnit unit) Waits for the first record with a timeout.voidWaits for all chunks except the last one to complete.booleanwaitForOtherChunks(long timeout, TimeUnit unit) Waits for all chunks except the last one with a timeout.
-
Field Details
-
tableId
-
totalChunks
private final int totalChunks -
completedChunks
-
totalRowsScanned
-
firstRecordLatch
-
chunksBeforeLastLatch
-
-
Constructor Details
-
TableChunkProgress
-
-
Method Details
-
markChunkComplete
public void markChunkComplete(long rowsScanned) -
isTableComplete
public boolean isTableComplete() -
getTotalRowsScanned
public long getTotalRowsScanned() -
getCompletedChunks
public int getCompletedChunks() -
getTotalChunks
public int getTotalChunks() -
getTableId
-
waitForFirstRecord
Waits for the first record of this table (FIRST_IN_DATA_COLLECTION) to be emitted. Called by all records except the first record before emission.- Throws:
InterruptedException- if the wait is interrupted
-
waitForFirstRecord
Waits for the 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 first record of this table has been emitted. Called by the chunk processing the first record (chunk 0). -
waitForOtherChunks
Waits for all chunks except the last one to complete. Called by the LAST_IN_DATA_COLLECTION record before emission.- Throws:
InterruptedException- if the wait is interrupted
-
waitForOtherChunks
Waits for all chunks except the last one with a timeout.- Parameters:
timeout- the maximum time to waitunit- the time unit- Returns:
- true if all chunks completed, false if timeout elapsed
- Throws:
InterruptedException- if the wait is interrupted
-
signalChunkComplete
public void signalChunkComplete()Signals that a non-last chunk has completed all its records. Called by chunks 0 through N-2 after processing all their records.
-