michaeljmarshall opened a new issue #12261:
URL: https://github.com/apache/pulsar/issues/12261


   **Is your enhancement request related to a problem? Please describe.**
   The current implementation of `bin/pulsar-admin topics reset-cursor` is not 
as simple as it could be when resetting the cursor to the earliest or latest 
position. In order to achieve earliest/latest with the current implementation, 
a user must understand how message ids work. If you look at the implementation 
for the `MessageId` representation of `latest` and `earliest`, you can see that 
it is simply creating an arbitrary message id that is at the beginning or the 
end of the subscription.
   
   
https://github.com/apache/pulsar/blob/da5bac990042e86d339fc4cba431b555ec293d6d/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/MessageId.java#L77-L87
   
   **Describe the solution you'd like**
   
   Instead of asking users to understand the message id format and to know that 
`-1:-1` is the earliest and `Long.MAX_VALUE:Long.MAX_VALUE` is the latest, I 
think we could update the `reset-cursor` CLI tool so that it has an option to 
pass `--earliest` or `--latest` as an argument and then the tool can translate 
that appropriately.
   
   **Describe alternatives you've considered**
   Alternatively, we could improve the help message to indicate the message id 
values for earliest and latest. However, I don't think it will look very nice 
to recommend that users pass `9223372036854775807:9223372036854775807` as a 
message id to reset the cursor to the latest position.
   
   **Additional context**
   Here is the current help output for the command:
   
   ```shell
   root@54023afd0d71:/pulsar# bin/pulsar-admin topics reset-cursor --help
   The following option is required: [-s | --subscription]
   
   Reset position for subscription to a position that is closest to timestamp 
or messageId.
   Usage: reset-cursor [options] persistent://tenant/namespace/topic
     Options:
       -e, --exclude-reset-position
         Exclude the reset position, start consume messages from the next
         position.
         Default: false
       --messageId, -m
         messageId to reset back to (ledgerId:entryId)
     * -s, --subscription
         Subscription to reset position on
       --time, -t
         time in minutes to reset back to (or minutes, hours,days,weeks eg: 
100m,
         3h, 2d, 5w)
   ```
   


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