Re: [PR] [fix][broker] Remove blocking calls from internalGetPartitionedStats [pulsar]

2025-01-12 Thread via GitHub


nodece merged PR #23832:
URL: https://github.com/apache/pulsar/pull/23832


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



Re: [PR] [fix][broker] Remove blocking calls from internalGetPartitionedStats [pulsar]

2025-01-12 Thread via GitHub


nodece commented on PR #23832:
URL: https://github.com/apache/pulsar/pull/23832#issuecomment-2585841988

   /pulsarbot rerun-failure-checks


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



Re: [PR] [fix][broker] Remove blocking calls from internalGetPartitionedStats [pulsar]

2025-01-10 Thread via GitHub


nodece commented on code in PR #23832:
URL: https://github.com/apache/pulsar/pull/23832#discussion_r1910064620


##
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##
@@ -1522,21 +1522,18 @@ protected void 
internalGetPartitionedStats(AsyncResponse asyncResponse, boolean
 }
 }
 if (perPartition && stats.partitions.isEmpty()) {
-try {
-boolean pathExists = 
namespaceResources().getPartitionedTopicResources()
-.partitionedTopicExists(topicName);
-if (pathExists) {
-stats.partitions.put(topicName.toString(), new 
TopicStatsImpl());
-} else {
-asyncResponse.resume(
-new RestException(Status.NOT_FOUND,
-"Internal topics have not been 
generated yet"));
-return null;
-}
-} catch (Exception e) {
-asyncResponse.resume(new RestException(e));
-return null;
-}
+return namespaceResources().getPartitionedTopicResources()
+.partitionedTopicExistsAsync(topicName).
+thenAccept(exists -> {
+if (exists) {
+stats.partitions.put(topicName.toString(), 
new TopicStatsImpl());
+asyncResponse.resume(stats);
+} else {
+asyncResponse.resume(
+new RestException(Status.NOT_FOUND,
+"Internal topics have not 
been generated yet"));
+}
+});

Review Comment:
   @lhotari Done.



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



Re: [PR] [fix][broker] Remove blocking calls from internalGetPartitionedStats [pulsar]

2025-01-10 Thread via GitHub


lhotari commented on code in PR #23832:
URL: https://github.com/apache/pulsar/pull/23832#discussion_r1910044930


##
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##
@@ -1522,21 +1522,18 @@ protected void 
internalGetPartitionedStats(AsyncResponse asyncResponse, boolean
 }
 }
 if (perPartition && stats.partitions.isEmpty()) {
-try {
-boolean pathExists = 
namespaceResources().getPartitionedTopicResources()
-.partitionedTopicExists(topicName);
-if (pathExists) {
-stats.partitions.put(topicName.toString(), new 
TopicStatsImpl());
-} else {
-asyncResponse.resume(
-new RestException(Status.NOT_FOUND,
-"Internal topics have not been 
generated yet"));
-return null;
-}
-} catch (Exception e) {
-asyncResponse.resume(new RestException(e));
-return null;
-}
+return namespaceResources().getPartitionedTopicResources()
+.partitionedTopicExistsAsync(topicName).
+thenAccept(exists -> {
+if (exists) {
+stats.partitions.put(topicName.toString(), 
new TopicStatsImpl());
+asyncResponse.resume(stats);
+} else {
+asyncResponse.resume(
+new RestException(Status.NOT_FOUND,
+"Internal topics have not 
been generated yet"));
+}
+});

Review Comment:
   I meant a different thing. The return on line 1525 should be removed and 
instead there should be a `return null;` after that expression.



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



Re: [PR] [fix][broker] Remove blocking calls from internalGetPartitionedStats [pulsar]

2025-01-09 Thread via GitHub


nodece commented on code in PR #23832:
URL: https://github.com/apache/pulsar/pull/23832#discussion_r1909733844


##
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##
@@ -1522,21 +1522,18 @@ protected void 
internalGetPartitionedStats(AsyncResponse asyncResponse, boolean
 }
 }
 if (perPartition && stats.partitions.isEmpty()) {
-try {
-boolean pathExists = 
namespaceResources().getPartitionedTopicResources()
-.partitionedTopicExists(topicName);
-if (pathExists) {
-stats.partitions.put(topicName.toString(), new 
TopicStatsImpl());
-} else {
-asyncResponse.resume(
-new RestException(Status.NOT_FOUND,
-"Internal topics have not been 
generated yet"));
-return null;
-}
-} catch (Exception e) {
-asyncResponse.resume(new RestException(e));
-return null;
-}
+return namespaceResources().getPartitionedTopicResources()
+.partitionedTopicExistsAsync(topicName).
+thenAccept(exists -> {
+if (exists) {
+stats.partitions.put(topicName.toString(), 
new TopicStatsImpl());
+asyncResponse.resume(stats);
+} else {
+asyncResponse.resume(
+new RestException(Status.NOT_FOUND,
+"Internal topics have not 
been generated yet"));
+}
+});

Review Comment:
   @lhotari Lines 1530 and 1538 are written the stats data to the HTTP client. 
   
   Do you happen to miss line 1530?
   



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



Re: [PR] [fix][broker] Remove blocking calls from internalGetPartitionedStats [pulsar]

2025-01-09 Thread via GitHub


lhotari commented on code in PR #23832:
URL: https://github.com/apache/pulsar/pull/23832#discussion_r1909562005


##
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##
@@ -1522,21 +1522,18 @@ protected void 
internalGetPartitionedStats(AsyncResponse asyncResponse, boolean
 }
 }
 if (perPartition && stats.partitions.isEmpty()) {
-try {
-boolean pathExists = 
namespaceResources().getPartitionedTopicResources()
-.partitionedTopicExists(topicName);
-if (pathExists) {
-stats.partitions.put(topicName.toString(), new 
TopicStatsImpl());
-} else {
-asyncResponse.resume(
-new RestException(Status.NOT_FOUND,
-"Internal topics have not been 
generated yet"));
-return null;
-}
-} catch (Exception e) {
-asyncResponse.resume(new RestException(e));
-return null;
-}
+return namespaceResources().getPartitionedTopicResources()
+.partitionedTopicExistsAsync(topicName).
+thenAccept(exists -> {
+if (exists) {
+stats.partitions.put(topicName.toString(), 
new TopicStatsImpl());
+asyncResponse.resume(stats);
+} else {
+asyncResponse.resume(
+new RestException(Status.NOT_FOUND,
+"Internal topics have not 
been generated yet"));
+}
+});

Review Comment:
   it seems that `return ` should be omitted from line 1525 and `return null;` 
should be before the block ends.



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