You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "BewareMyPower (via GitHub)" <gi...@apache.org> on 2024/03/25 09:57:47 UTC

[I] [Bug] Regression of seeking by timestamp in 3.5.0 [pulsar-client-cpp]

BewareMyPower opened a new issue, #420:
URL: https://github.com/apache/pulsar-client-cpp/issues/420

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar-client-cpp/issues) and found nothing similar.
   
   
   ### Version
   
   Client 3.5.0
   
   ### Minimal reproduce step
   
   Create a `main.cc`
   
   ```c++
   #include <chrono>
   #include <pulsar/Client.h>
   using namespace pulsar;
   
   int main(int argc, char *argv[]) {
     Client client{"pulsar://localhost:6650"};
     std::string topic = (argc > 1) ? argv[1] : "my-topic";
     Producer producer;
     if (auto result = client.createProducer(topic, producer);
         result != ResultOk) {
       std::cerr << "Failed to create producer: " << result << std::endl;
       return 1;
     }
   
     producer.send(MessageBuilder().setContent("msg-0").build());
   
     Reader reader;
     if (auto result =
             client.createReader(topic, MessageId::latest(), {}, reader);
         result != ResultOk) {
       std::cerr << "Failed to create reader: " << result << std::endl;
       return 2;
     }
   
     using namespace std::chrono;
     reader.seek(
         duration_cast<milliseconds>(system_clock::now().time_since_epoch())
             .count());
   
     bool hasMessage;
     if (auto result = reader.hasMessageAvailable(hasMessage);
         result != ResultOk) {
       std::cerr << "hasMessageAvailable failed: " << result << std::endl;
       return 3;
     }
   
     std::cout << hasMessage << std::endl;
   
     return 0;
   }
   ```
   
   Key point: the start position must be `latest` for `Reader`.
   
   On macOS m1, install the the macos-arm64.zip and build with those artifacts.
   
   ```bash
   curl -O -L https://archive.apache.org/dist/pulsar/pulsar-client-cpp-3.5.0/macos-arm64.zip
   unzip -q macos-arm64.zip
   g++ main.cc -std=c++17 -I ./include -L ./lib -Wl,-rpath ./lib -lpulsar
   ./a.out
   ```
   
   ### What did you expect to see?
   
   Outputs (ignore the outputs from the library):
   
   ```
   1
   ```
   
   ### What did you see instead?
   
   The output should be 0 like the behavior with 3.4.2
   
   ```bash
   curl -O -L https://archive.apache.org/dist/pulsar/pulsar-client-cpp-3.4.2/macos-arm64.zip
   unzip -q macos-arm64.zip
   g++ main.cc -std=c++17 -I ./include -L ./lib -Wl,-rpath ./lib -lpulsar
   ./a.out
   ```
   
   Outputs:
   
   ```
   0
   ```
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


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

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


Re: [I] [Bug] Regression of seeking by timestamp in 3.5.0 [pulsar-client-cpp]

Posted by "BewareMyPower (via GitHub)" <gi...@apache.org>.
BewareMyPower closed issue #420: [Bug] Regression of seeking by timestamp in 3.5.0
URL: https://github.com/apache/pulsar-client-cpp/issues/420


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