congbobo184 commented on a change in pull request #9490:
URL: https://github.com/apache/pulsar/pull/9490#discussion_r575819294
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java
##########
@@ -83,12 +164,31 @@ public void addFailed(ManagedLedgerException exception,
Object ctx) {
return completableFuture;
}
+ private void handleTransactionMessage(TxnID txnId, Position position) {
+ if (!ongoingTxns.containsKey(txnId)) {
+ ongoingTxns.put(txnId, (PositionImpl) position);
+ PositionImpl firstPosition =
ongoingTxns.get(ongoingTxns.firstKey());
+ //max read position is less than first ongoing transaction message
position, so entryId -1
+ maxReadPosition = PositionImpl.get(firstPosition.getLedgerId(),
firstPosition.getEntryId() - 1);
+ }
+ }
+
+
@Override
public CompletableFuture<TransactionBufferReader>
openTransactionBufferReader(TxnID txnID, long startSequenceId) {
return null;
}
@Override
public CompletableFuture<Void> commitTxn(TxnID txnID, long lowWaterMark) {
+ if (!checkIfReady()) {
+ if (log.isDebugEnabled()) {
+ log.debug("[{}]Transaction buffer not recover complete!",
topic.getName());
+ }
+ return FutureUtil.failedFuture(
+ new ServiceUnitNotReadyException("[{" + topic.getName()
+ + "}]Transaction buffer not recover complete!"));
+ }
+
Review comment:
good idea
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]