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 2020/10/02 02:01:21 UTC

[GitHub] [pulsar] sijie commented on a change in pull request #8181: fix peek message not supported for partitioned topic with topicname

sijie commented on a change in pull request #8181:
URL: https://github.com/apache/pulsar/pull/8181#discussion_r498590013



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -2089,20 +2089,23 @@ public void readEntryComplete(Entry entry, Object ctx) {
     }
 
     protected Response internalPeekNthMessage(String subName, int messagePosition, boolean authoritative) {
-        verifyReadOperation(authoritative);
+        verifyReadOperation();
+
+        TopicName partitionedTopicName = topicName;
         // If the topic name is a partition name, no need to get partition topic metadata again
         if (!topicName.isPartitioned() && getPartitionedTopicMetadata(topicName, authoritative, false).partitions > 0) {
-            throw new RestException(Status.METHOD_NOT_ALLOWED, "Peek messages on a partitioned topic is not allowed");
+            partitionedTopicName = topicName.getPartition(0);

Review comment:
       @hangc0276 I think it is true that we don't want to support peeking messages on a partitioned topic. But we want to support peeking messages on a partition of a partitioned topic.
   
   E.g. if topic `test-topic` is a partitioned topic, it should fail if a user attempts to peek messages on topic `test-topic`. But it should succeed if a users attempts to peek messages from its partitions like `test-topic-partition-0`.




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

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