public void markCommitted()

in core/src/main/java/org/apache/ignite/activestore/impl/subscriber/lead/LeadPlanner.java [140:169]


    public void markCommitted(UUID consumerId, LongList txIds) {
        LongIterator txIdIt = txIds.longIterator();
        ListIterator<TxInfo> txInfoIterator = state.txInfoListIterator();
        long currentTxId = txIdIt.next(); // Should always be at least one value.

        // As in case of failover lead can get metadata of currently waiting transactions from consumers
        // only through the regular poll-apply cycle and transaction can be committed asynchronously
        // there is possibility to receive notification on committed transactions before receiving
        // metadata about currently available transaction on consumer.
        while (currentTxId != -1 && txInfoIterator.hasNext()) {
            TxInfo txInfo = txInfoIterator.next();

            if (currentTxId == txInfo.id()) {
                txInfoIterator.remove();
                if (consumerId.equals(txInfo.consumerId())) {
                    state.inProgressTransactions().remove(currentTxId);
                }
                else if (!state.inProgressTransactions().contains(currentTxId)) {
                    state.toRemove().add(txInfo);
                }
            }
            else if (currentTxId < txInfo.id()) {
                currentTxId = txIdIt.hasNext() ? txIdIt.next() : -1;
                txInfoIterator.previous();
            }
        }
        long lastDenseCommitted = MergeHelper.mergeWithDenseCompaction(txIds, state.sparseCommitted(),
            state.lastDenseCommitted());
        state.setLastDenseCommitted(lastDenseCommitted);
    }