Technoboy- commented on issue #14079:
URL: https://github.com/apache/pulsar/issues/14079#issuecomment-1063769528


   > it is about 30 days. @mattisonchao @Technoboy- may i know is there any 
update? actually I am using 2.9.1, and some topic seems strange, and may have 
the similar issue as above.
   > 
   > Is it a good idea that downgrade it to 2.8.1 in a intranet?
   
   I don't reproduce in v.2.9.1. Add below test to PersistentTopicE2ETest to 
verify:
   
   ```
   @Test
       public void testConsumerAfterGC() throws Exception {
           // 1. Simple successful GC
           String topicName = "persistent://prop/ns-abc/topic-10";
           Producer<byte[]> producer = 
pulsarClient.newProducer().topic(topicName).create();
           for(int i = 0; i < 10; i ++) {
               producer.send(("msg " + i).getBytes(StandardCharsets.UTF_8));
           }
           producer.close();
   
           
assertTrue(pulsar.getBrokerService().getTopicReference(topicName).isPresent());
           runGC();
           
assertFalse(pulsar.getBrokerService().getTopicReference(topicName).isPresent());
   
           // 2. Topic is not GCed with live connection
           String subName = "sub1";
           Consumer<byte[]> consumer = pulsarClient
                   .newConsumer()
                   .topic(topicName)
                   .subscriptionName(subName)
                   .subscriptionType(SubscriptionType.Shared)
                   .subscribe();
   
           runGC();
           
assertTrue(pulsar.getBrokerService().getTopicReference(topicName).isPresent());
   
           new Thread(new Runnable() {
               @Override
               public void run() {
                   try {
                       while(true) {
                           Message<byte[]> message = consumer.receive();
                           System.out.println("received msg :" + new 
String(message.getValue()));
                       }
                   } catch (Throwable ex) {
                       ex.printStackTrace();
                   }
               }
           }).start();
   
           Producer<byte[]> producer2 = 
pulsarClient.newProducer().topic(topicName).create();
           for(int i = 0; i < 10; i ++) {
               producer2.send(("send msg " + 
i).getBytes(StandardCharsets.UTF_8));
           }
           producer2.close();
           CountDownLatch latch = new CountDownLatch(1);
           latch.await(5, TimeUnit.MINUTES);
       }
   ```
   
   Could you please share your test codes ? @james-bright-helix 


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