Github user pnowojski commented on a diff in the pull request:
https://github.com/apache/flink/pull/4910#discussion_r147659966
--- Diff:
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/sink/TwoPhaseCommitSinkFunction.java
---
@@ -58,18 +61,37 @@
extends RichSinkFunction<IN>
implements CheckpointedFunction, CheckpointListener {
- private static final Logger LOG =
LoggerFactory.getLogger(TwoPhaseCommitSinkFunction.class);
+ private final Logger log;
- protected final ListStateDescriptor<State<TXN, CONTEXT>>
stateDescriptor;
+ private final Clock clock;
- protected final LinkedHashMap<Long, TXN> pendingCommitTransactions =
new LinkedHashMap<>();
+ protected final LinkedHashMap<Long, TransactionHolder<TXN>>
pendingCommitTransactions = new LinkedHashMap<>();
- @Nullable
- protected TXN currentTransaction;
protected Optional<CONTEXT> userContext;
protected ListState<State<TXN, CONTEXT>> state;
+ private final ListStateDescriptor<State<TXN, CONTEXT>> stateDescriptor;
+
+ private TransactionHolder<TXN> currentTransaction;
--- End diff --
please rename this field, it's clashing with `currentTransaction()` method,
which is confusing, especially that they have different types.
---