Search in sources :

Example 1 with PulsarUnorderedFetcherManager

use of org.apache.flink.connector.pulsar.source.reader.fetcher.PulsarUnorderedFetcherManager in project flink by apache.

the class PulsarUnorderedSourceReader method snapshotState.

@Override
public List<PulsarPartitionSplit> snapshotState(long checkpointId) {
    LOG.debug("Trigger the new transaction for downstream readers.");
    List<PulsarPartitionSplit> splits = ((PulsarUnorderedFetcherManager<OUT>) splitFetcherManager).snapshotState(checkpointId);
    if (coordinatorClient != null) {
        // Snapshot the transaction status and commit it after checkpoint finished.
        List<TxnID> txnIDs = transactionsToCommit.computeIfAbsent(checkpointId, id -> new ArrayList<>());
        for (PulsarPartitionSplit split : splits) {
            TxnID uncommittedTransactionId = split.getUncommittedTransactionId();
            if (uncommittedTransactionId != null) {
                txnIDs.add(uncommittedTransactionId);
            }
        }
    }
    return splits;
}
Also used : TxnID(org.apache.pulsar.client.api.transaction.TxnID) PulsarUnorderedFetcherManager(org.apache.flink.connector.pulsar.source.reader.fetcher.PulsarUnorderedFetcherManager) PulsarPartitionSplit(org.apache.flink.connector.pulsar.source.split.PulsarPartitionSplit)

Aggregations

PulsarUnorderedFetcherManager (org.apache.flink.connector.pulsar.source.reader.fetcher.PulsarUnorderedFetcherManager)1 PulsarPartitionSplit (org.apache.flink.connector.pulsar.source.split.PulsarPartitionSplit)1 TxnID (org.apache.pulsar.client.api.transaction.TxnID)1