congbobo184 commented on code in PR #19201:
URL: https://github.com/apache/pulsar/pull/19201#discussion_r1090407844
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/TransactionMetadataStoreService.java:
##########
@@ -133,54 +134,71 @@ public CompletableFuture<Void>
handleTcClientConnect(TransactionCoordinatorID tc
return;
}
- openTransactionMetadataStore(tcId).thenAccept((store)
-> internalPinnedExecutor.execute(() -> {
- stores.put(tcId, store);
- LOG.info("Added new transaction meta store {}",
tcId);
- long endTime = System.currentTimeMillis() +
HANDLE_PENDING_CONNECT_TIME_OUT;
- while (true) {
- // prevent thread in a busy loop.
- if (System.currentTimeMillis() < endTime) {
- CompletableFuture<Void> future =
deque.poll();
- if (future != null) {
- // complete queue request future
- future.complete(null);
- } else {
- break;
+ TransactionTimeoutTracker timeoutTracker =
timeoutTrackerFactory.newTracker(tcId);
+ TransactionRecoverTracker recoverTracker =
+ new
TransactionRecoverTrackerImpl(TransactionMetadataStoreService.this,
+ timeoutTracker, tcId.getId());
+ openTransactionMetadataStore(tcId, timeoutTracker,
recoverTracker).thenAccept(
+ store -> internalPinnedExecutor.execute(() -> {
+ // TransactionMetadataStore initialization
+ // need to use TransactionMetadataStore
itself.
+ // we need to put store into stores map
before
+ // handle committing and aborting
transaction.
+ stores.put(tcId, store);
+ LOG.info("Added new transaction meta store
{}", tcId);
+
recoverTracker.handleCommittingAndAbortingTransaction();
+ if (store instanceof
MLTransactionMetadataStore) {
+ MLTransactionMetadataStore
mlTransactionMetadataStore =
+ (MLTransactionMetadataStore)
store;
+
mlTransactionMetadataStore.recoverTime.setRecoverEndTime(
Review Comment:
can move to MLTransactionMetadataStore.java, the setRecoverEndTime is
represent the store is ready don't need to wait the committing or aborting
transaction finish.
so don't need to move the setRecoverEndTime in
TransactionMetadataStoreService.java
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]