MarvinCai commented on a change in pull request #12930:
URL: https://github.com/apache/pulsar/pull/12930#discussion_r756090386



##########
File path: 
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/AbstractMetadataStore.java
##########
@@ -300,7 +329,33 @@ public void invalidateAll() {
      */
     protected void execute(Runnable task, CompletableFuture<?> future) {
         try {
-            executor.execute(task);
+            // Wrap the original task, so we can record the thread on which it 
is running
+            TaskWrapper taskWrapper = new TaskWrapper(task);
+            executorWatchDog.execute(() -> {
+                // Delegate the running of the task to the executor
+                Future<?> f = executor.submit(taskWrapper);
+                long start = System.currentTimeMillis();
+                while (!f.isDone()) {
+                    try {
+                        f.get(5000, TimeUnit.MILLISECONDS);
+                    } catch (Exception e) {
+                        long now = System.currentTimeMillis();
+                        Thread taskThread = taskWrapper.getTaskThread();
+                        if (taskThread != null) {
+                            final StackTraceElement[] stackTrace = 
taskThread.getStackTrace();
+                            if (stackTrace.length > 0) {
+                                StringBuilder stackTraceString = new 
StringBuilder();
+                                for (StackTraceElement elem : stackTrace) {
+                                    stackTraceString.append(elem);
+                                    stackTraceString.append("\n");
+                                }
+                                log.info("Metadata store task took {} milli 
secs so far. Stack trace: {}",

Review comment:
       It looks like custom debug snippet, not sure if it's good to add to 
mainline.

##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -1434,7 +1434,7 @@ protected void internalDeleteSubscription(AsyncResponse 
asyncResponse, String su
             internalDeleteSubscriptionForNonPartitionedTopic(asyncResponse, 
subName, authoritative);
         } else {
             getPartitionedTopicMetadataAsync(topicName,
-                    authoritative, false).thenAccept(partitionMetadata -> {
+                    authoritative, false).thenAcceptAsync(partitionMetadata -> 
{

Review comment:
       I'm a bit confused, we're blocked here: 
https://github.com/apache/pulsar/blob/94736a43f1b9a6d1db75936032b94eb9a11b9c0d/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java#L1500
   which is within `internalDeleteSubscriptionForNonPartitionedTopic` method, 
how will making change in the else block solve this issue?




-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to