You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "coderzc (via GitHub)" <gi...@apache.org> on 2023/10/29 11:47:53 UTC

[I] [Bug] Consumer reads uncommitted messages from compacted topic [pulsar]

coderzc opened a new issue, #21464:
URL: https://github.com/apache/pulsar/issues/21464

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
   
   
   ### Version
   
   master
   
   ### Minimal reproduce step
   
   ```java
           final String topic = "test_transaction_topic_read_compacted";
           admin.topics().createNonPartitionedTopic(topic);
   
           admin.topicPolicies().setCompactionThreshold(topic, 100 * 1024 * 1024);
   
           @Cleanup
           Consumer<String> consumer = this.pulsarClient.newConsumer(Schema.STRING)
                   .topic(topic)
                   .subscriptionName("sub")
                   .subscriptionType(SubscriptionType.Exclusive)
                   .readCompacted(true)
                   .subscribe();
   
           @Cleanup
           Producer<String> producer = this.pulsarClient.newProducer(Schema.STRING)
                   .topic(topic)
                   .create();
   
           producer.newMessage().key("K1").value("V1").send();
   
           Transaction txn = pulsarClient.newTransaction()
                   .withTransactionTimeout(1, TimeUnit.MINUTES).build().get();
           producer.newMessage(txn).key("K2").value("V2").send();
           producer.newMessage(txn).key("K3").value("V3").send();
   
           List<String> messages = new ArrayList<>();
           while (true) {
               Message<String> message = consumer.receive(5, TimeUnit.SECONDS);
               if (message == null) {
                   break;
               }
               messages.add(message.getValue());
           }
   
           Assert.assertEquals(messages, List.of("V1"));
   ```
   
   ### What did you expect to see?
   
   Test pass, the consumer can't read uncommitted messages from compacted topic
   
   ### What did you see instead?
   
   Test failed, the consumer read uncommitted messages from compacted topic
   
   ### 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] Consumer reads uncommitted messages from compacted topic [pulsar]

Posted by "codelipenghui (via GitHub)" <gi...@apache.org>.
codelipenghui closed issue #21464: [Bug] Consumer reads uncommitted messages from compacted topic
URL: https://github.com/apache/pulsar/issues/21464


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