congbobo184 commented on code in PR #19201:
URL: https://github.com/apache/pulsar/pull/19201#discussion_r1090308543


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/TransactionMetadataStoreService.java:
##########
@@ -133,54 +133,56 @@ public CompletableFuture<Void> 
handleTcClientConnect(TransactionCoordinatorID tc
                             return;
                         }
 
-                        openTransactionMetadataStore(tcId).thenAccept((store) 
-> internalPinnedExecutor.execute(() -> {
+                        openTransactionMetadataStore(tcId).thenAccept((store) 
-> {
                             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);
+                            internalPinnedExecutor.execute(() -> {
+                                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;
+                                        }
                                     } else {
+                                        deque.clear();
                                         break;
                                     }
-                                } else {
-                                    deque.clear();
-                                    break;
                                 }
-                            }
 
-                            completableFuture.complete(null);
-                            tcLoadSemaphore.release();
-                        })).exceptionally(e -> {
+                                completableFuture.complete(null);

Review Comment:
   
https://github.com/apache/pulsar/blob/3bab0997ffc71973c46abf229f61b6d24b6354e6/pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/MLTransactionMetadataStore.java#L108
   change to `public CompletableFuture<TransactionRecoverTracker> init()`
   
   `openTransactionMetadataStore(tcId)` only return the store, 
   
   then the store can add a interface `public 
CompletableFuture<TransactionRecoverTracker> init()`,
    
   `TransactionMetadataStoreService` can invoke the store.init() return 
TransactionRecoverTracker
   
   init completely, recoverTracker can do
   
https://github.com/apache/pulsar/blob/3bab0997ffc71973c46abf229f61b6d24b6354e6/pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/TransactionRecoverTracker.java#L47
   
https://github.com/apache/pulsar/blob/3bab0997ffc71973c46abf229f61b6d24b6354e6/pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/TransactionRecoverTracker.java#L52
   in the `TransactionMetadataStoreService`



-- 
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]

Reply via email to