You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/07/07 13:26:36 UTC

[GitHub] [pulsar] AnonHxy opened a new pull request, #16446: [improve][broker][PIP-149]Make GetMessageIdByTimestamp async

AnonHxy opened a new pull request, #16446:
URL: https://github.com/apache/pulsar/pull/16446

   Master Issue: https://github.com/apache/pulsar/issues/14365
   
   ### Motivation
   
   
   * See https://github.com/apache/pulsar/issues/14365
   
   ### Modifications
   
   * Make `internalGetMessageIdByTimestamp` async
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   ### Documentation
   
     
   - [x] `doc-not-needed` 
   


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] AnonHxy commented on pull request #16446: [improve][broker][PIP-149]Make GetMessageIdByTimestamp pure async

Posted by GitBox <gi...@apache.org>.
AnonHxy commented on PR #16446:
URL: https://github.com/apache/pulsar/pull/16446#issuecomment-1177773033

   /pulsarbot run-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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] AnonHxy commented on a diff in pull request #16446: [improve][broker][PIP-149]Make GetMessageIdByTimestamp pure async

Posted by GitBox <gi...@apache.org>.
AnonHxy commented on code in PR #16446:
URL: https://github.com/apache/pulsar/pull/16446#discussion_r917501016


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##########
@@ -2740,53 +2740,50 @@ public void readEntryComplete(Entry entry, Object ctx) {
                 });
     }
 
-    protected CompletableFuture<MessageId> internalGetMessageIdByTimestamp(long timestamp, boolean authoritative) {
-        try {
-            if (topicName.isGlobal()) {
-                validateGlobalNamespaceOwnership(namespaceName);
-            }
+    protected CompletableFuture<MessageId> internalGetMessageIdByTimestampAsync(long timestamp, boolean authoritative) {
+        CompletableFuture<Void> future;
+        if (topicName.isGlobal()) {
+            future = validateGlobalNamespaceOwnershipAsync(namespaceName);
+        } else {
+            future = CompletableFuture.completedFuture(null);
+        }
 
-            if (!topicName.isPartitioned() && getPartitionedTopicMetadata(topicName,
-                    authoritative, false).partitions > 0) {
-                throw new RestException(Status.METHOD_NOT_ALLOWED,
+        return future.thenCompose(__ -> getPartitionedTopicMetadataAsync(topicName, authoritative, false))

Review Comment:
   Nice catch. Updated, PTAL @Technoboy- @Jason918 



-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] Technoboy- commented on a diff in pull request #16446: [improve][broker][PIP-149]Make GetMessageIdByTimestamp pure async

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on code in PR #16446:
URL: https://github.com/apache/pulsar/pull/16446#discussion_r917480075


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##########
@@ -2740,53 +2740,50 @@ public void readEntryComplete(Entry entry, Object ctx) {
                 });
     }
 
-    protected CompletableFuture<MessageId> internalGetMessageIdByTimestamp(long timestamp, boolean authoritative) {
-        try {
-            if (topicName.isGlobal()) {
-                validateGlobalNamespaceOwnership(namespaceName);
-            }
+    protected CompletableFuture<MessageId> internalGetMessageIdByTimestampAsync(long timestamp, boolean authoritative) {
+        CompletableFuture<Void> future;
+        if (topicName.isGlobal()) {
+            future = validateGlobalNamespaceOwnershipAsync(namespaceName);
+        } else {
+            future = CompletableFuture.completedFuture(null);
+        }
 
-            if (!topicName.isPartitioned() && getPartitionedTopicMetadata(topicName,
-                    authoritative, false).partitions > 0) {
-                throw new RestException(Status.METHOD_NOT_ALLOWED,
+        return future.thenCompose(__ -> getPartitionedTopicMetadataAsync(topicName, authoritative, false))

Review Comment:
   If topicName.isPartitioned() = true, we don't need to `getPartitionedTopicMetadataAsync`.



-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] Technoboy- commented on pull request #16446: [improve][broker][PIP-149]Make GetMessageIdByTimestamp pure async

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on PR #16446:
URL: https://github.com/apache/pulsar/pull/16446#issuecomment-1181768020

   /pulsarbot run-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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] AnonHxy commented on pull request #16446: [improve][broker][PIP-149]Make GetMessageIdByTimestamp pure async

Posted by GitBox <gi...@apache.org>.
AnonHxy commented on PR #16446:
URL: https://github.com/apache/pulsar/pull/16446#issuecomment-1180011286

   /pulsarbot run-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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] AnonHxy commented on pull request #16446: [improve][broker][PIP-149]Make GetMessageIdByTimestamp pure async

Posted by GitBox <gi...@apache.org>.
AnonHxy commented on PR #16446:
URL: https://github.com/apache/pulsar/pull/16446#issuecomment-1178496886

   /pulsarbot run-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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] AnonHxy commented on pull request #16446: [improve][broker][PIP-149]Make GetMessageIdByTimestamp pure async

Posted by GitBox <gi...@apache.org>.
AnonHxy commented on PR #16446:
URL: https://github.com/apache/pulsar/pull/16446#issuecomment-1178587506

   /pulsarbot run-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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] Technoboy- merged pull request #16446: [improve][broker][PIP-149]Make GetMessageIdByTimestamp pure async

Posted by GitBox <gi...@apache.org>.
Technoboy- merged PR #16446:
URL: https://github.com/apache/pulsar/pull/16446


-- 
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-unsubscribe@pulsar.apache.org

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