BewareMyPower commented on issue #9317:
URL: https://github.com/apache/pulsar/issues/9317#issuecomment-768748293


   @fayce66 Sorry it's a new API. For the old client, you can use
   
   ```c++
           result = producer.send(msg);
           if (result == ResultOk) {
               LOG_INFO("Send " << msg << " to " << msg.getMessageId());
   ```
   
   In addition, I suspect it's not a client side problem but just your 
compaction failed. You can run a Java consumer to see whether it works. Could 
you check your broker logs when you did the topic compaction? Here's my logs:
   
   ```
   10:12:07.084 [pulsar-web-67-12] INFO  
org.apache.pulsar.broker.admin.impl.PersistentTopicsBase - [null] Trigger 
compaction on topic persistent://public/default/xyz-topic
   10:12:07.095 [ForkJoinPool.commonPool-worker-4] INFO  
org.apache.pulsar.client.impl.ConsumerStatsRecorderImpl - Starting Pulsar 
consumer status recorder with config:
   // ...
   10:12:07.103 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConnectionPool - [[id: 0xebd955fb, 
L:/127.0.0.1:50650 - R:localhost/127.0.0.1:6650]] Connected to server
   10:12:07.099 [ForkJoinPool.commonPool-worker-4] INFO  
org.apache.pulsar.client.impl.ConsumerStatsRecorderImpl - Pulsar client config: 
{
   // ...
   10:12:07.103 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConnectionPool - [[id: 0xebd955fb, 
L:/127.0.0.1:50650 - R:localhost/127.0.0.1:6650]] Connected to server
   10:12:07.106 [ForkJoinPool.commonPool-worker-4] INFO  
org.eclipse.jetty.server.RequestLog - 127.0.0.1 - - [28/一月/2021:10:12:07 +0800] 
"PUT /admin/v2/persistent/public/default/xyz-topic/compaction HTTP/1.1" 204 0 
"-" "Pulsar-Java-v2.8.0-SNAPSHOT" 24
   10:12:07.106 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.ServerCnx - New connection from 
/127.0.0.1:50650
   10:12:07.108 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic][__compaction] Subscribing to topic on 
cnx [id: 0xebd955fb, L:/127.0.0.1:50650 - R:localhost/127.0.0.1:6650], 
consumerId 0
   10:12:07.108 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:50650] Subscribing on 
topic persistent://public/default/xyz-topic / __compaction
   10:12:07.108 [pulsar-io-50-12] INFO  
org.apache.bookkeeper.mledger.impl.ManagedCursorImpl - 
[public/default/persistent/xyz-topic] Cursor __compaction recovered to position 
22:9
   10:12:07.109 [pulsar-io-50-12] INFO  
org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl - 
[public/default/persistent/xyz-topic] Creating ledger, metadata: 
{component=[109, 97, 110, 97, 103, 101, 100, 45, 108, 101, 100, 103, 101, 114], 
pulsar/managed-ledger=[112, 117, 98, 108, 105, 99, 47, 100, 101, 102, 97, 117, 
108, 116, 47, 112, 101, 114, 115, 105, 115, 116, 101, 110, 116, 47, 120, 121, 
122, 45, 116, 111, 112, 105, 99], pulsar/cursor=[95, 95, 99, 111, 109, 112, 97, 
99, 116, 105, 111, 110], application=[112, 117, 108, 115, 97, 114]} - metadata 
ops timeout : 60 seconds
   10:12:07.112 [main-EventThread] INFO  
org.apache.bookkeeper.client.LedgerCreateOp - Ensemble: [127.0.0.1:3181] for 
ledger: 23
   10:12:07.118 [BookKeeperClientWorker-OrderedExecutor-11-0] INFO  
org.apache.bookkeeper.mledger.impl.MetaStoreImpl - 
[public/default/persistent/xyz-topic] [__compaction] Updating cursor info 
ledgerId=23 mark-delete=22:9
   10:12:07.119 [bookkeeper-ml-workers-OrderedExecutor-3-0] INFO  
org.apache.bookkeeper.mledger.impl.ManagedCursorImpl - 
[public/default/persistent/xyz-topic] Updated cursor __compaction with ledger 
id 23 md-position=22:9 rd-position=22:10
   10:12:07.119 [bookkeeper-ml-workers-OrderedExecutor-3-0] INFO  
org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl - 
[public/default/persistent/xyz-topic] Opened new cursor: 
ManagedCursorImpl{ledger=public/default/persistent/xyz-topic, 
name=__compaction, ackPos=22:9, readPos=22:10}
   10:12:07.120 [bookkeeper-ml-workers-OrderedExecutor-3-0] INFO  
org.apache.bookkeeper.mledger.impl.ManagedCursorImpl - 
[public/default/persistent/xyz-topic-__compaction] Rewind from 22:10 to 22:10
   10:12:07.120 [bookkeeper-ml-workers-OrderedExecutor-3-0] INFO  
org.apache.pulsar.broker.service.persistent.PersistentTopic - 
[persistent://public/default/xyz-topic] There are no replicated subscriptions 
on the topic
   10:12:07.120 [bookkeeper-ml-workers-OrderedExecutor-3-0] INFO  
org.apache.pulsar.broker.service.persistent.PersistentTopic - 
[persistent://public/default/xyz-topic][__compaction] Created new subscription 
for 0
   10:12:07.120 [bookkeeper-ml-workers-OrderedExecutor-3-0] INFO  
org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:50650] Created 
subscription on topic persistent://public/default/xyz-topic / __compaction
   10:12:07.121 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic][__compaction] Subscribed to topic on 
localhost/127.0.0.1:6650 -- consumer: 0
   10:12:07.123 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic][__compaction] Seek subscription to 
message id -1:-1:-1
   10:12:07.125 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.Consumer - Disconnecting consumer: 
Consumer{subscription=CompactorSubscription{topic=persistent://public/default/xyz-topic,
 name=__compaction}, consumerId=0, consumerName=3ee4e, address=/127.0.0.1:50650}
   10:12:07.125 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.AbstractDispatcherSingleActiveConsumer - 
Removing consumer 
Consumer{subscription=CompactorSubscription{topic=persistent://public/default/xyz-topic,
 name=__compaction}, consumerId=0, consumerName=3ee4e, address=/127.0.0.1:50650}
   10:12:07.126 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.persistent.PersistentSubscription - 
[persistent://public/default/xyz-topic][__compaction] Successfully disconnected 
consumers from subscription, proceeding with cursor reset
   10:12:07.126 [bookkeeper-ml-workers-OrderedExecutor-3-0] INFO  
org.apache.bookkeeper.mledger.impl.ManagedCursorImpl - 
[public/default/persistent/xyz-topic] Initiate reset position to 22:-1 on 
cursor __compaction
   10:12:07.127 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ClientCnx - [localhost/127.0.0.1:6650] Broker 
notification of Closed consumer: 0
   10:12:07.127 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConnectionHandler - 
[persistent://public/default/xyz-topic] [__compaction] Closed connection [id: 
0xebd955fb, L:/127.0.0.1:50650 - R:localhost/127.0.0.1:6650] -- Will try again 
in 0.1 s
   10:12:07.130 [BookKeeperClientWorker-OrderedExecutor-11-0] INFO  
org.apache.bookkeeper.mledger.impl.ManagedCursorImpl - 
[public/default/persistent/xyz-topic] reset position to 22:-1 before current 
read position 22:10 on cursor __compaction
   10:12:07.132 [BookKeeperClientWorker-OrderedExecutor-11-0] INFO  
org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:50650] 
[persistent://public/default/xyz-topic][__compaction] Reset subscription to 
message id -1:-1
   10:12:07.133 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic][__compaction] Successfully reset 
subscription to message id -1:-1:-1
   10:12:07.228 [pulsar-timer-99-1] INFO  
org.apache.pulsar.client.impl.ConnectionHandler - 
[persistent://public/default/xyz-topic] [__compaction] Reconnecting after 
timeout
   10:12:07.230 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic][__compaction] Subscribing to topic on 
cnx [id: 0xebd955fb, L:/127.0.0.1:50650 - R:localhost/127.0.0.1:6650], 
consumerId 0
   10:12:07.230 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:50650] Subscribing on 
topic persistent://public/default/xyz-topic / __compaction
   10:12:07.231 [pulsar-io-50-12] INFO  
org.apache.bookkeeper.mledger.impl.ManagedCursorImpl - 
[public/default/persistent/xyz-topic-__compaction] Rewind from 22:-1 to 22:0
   10:12:07.231 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.persistent.PersistentTopic - 
[persistent://public/default/xyz-topic] There are no replicated subscriptions 
on the topic
   10:12:07.231 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.persistent.PersistentTopic - 
[persistent://public/default/xyz-topic][__compaction] Created new subscription 
for 0
   10:12:07.231 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:50650] Created 
subscription on topic persistent://public/default/xyz-topic / __compaction
   10:12:07.231 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic][__compaction] Subscribed to topic on 
localhost/127.0.0.1:6650 -- consumer: 0
   10:12:07.239 [pulsar-external-listener-97-1] WARN  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic] [__compaction] Could not get connection 
while getLastMessageId -- Will try again in 100 ms
   10:12:07.240 [pulsar-external-listener-97-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic][__compaction] Get topic last message Id
   10:12:07.243 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic][__compaction] Successfully 
getLastMessageId 22:9
   10:12:07.243 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic][__compaction] Get topic last message Id
   10:12:07.244 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic][__compaction] Successfully 
getLastMessageId 22:9
   10:12:07.245 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.compaction.TwoPhaseCompactor - Commencing phase one of 
compaction for persistent://public/default/xyz-topic, reading to 22:9:-1:0
   10:12:07.256 [main-EventThread] INFO  
org.apache.bookkeeper.client.LedgerCreateOp - Ensemble: [127.0.0.1:3181] for 
ledger: 24
   10:12:07.256 [main-EventThread] INFO  
org.apache.pulsar.compaction.TwoPhaseCompactor - Commencing phase two of 
compaction for persistent://public/default/xyz-topic, from 22:0:-1:-1 to 
22:9:-1:-1, compacting 1 keys to ledger 24
   10:12:07.258 [main-EventThread] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic][__compaction] Seek subscription to 
message id 22:0:-1:-1
   10:12:07.259 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.Consumer - Disconnecting consumer: 
Consumer{subscription=CompactorSubscription{topic=persistent://public/default/xyz-topic,
 name=__compaction}, consumerId=0, consumerName=3ee4e, address=/127.0.0.1:50650}
   10:12:07.259 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.AbstractDispatcherSingleActiveConsumer - 
Removing consumer 
Consumer{subscription=CompactorSubscription{topic=persistent://public/default/xyz-topic,
 name=__compaction}, consumerId=0, consumerName=3ee4e, address=/127.0.0.1:50650}
   10:12:07.259 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.persistent.PersistentSubscription - 
[persistent://public/default/xyz-topic][__compaction] Successfully disconnected 
consumers from subscription, proceeding with cursor reset
   10:12:07.259 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ClientCnx - [localhost/127.0.0.1:6650] Broker 
notification of Closed consumer: 0
   10:12:07.259 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConnectionHandler - 
[persistent://public/default/xyz-topic] [__compaction] Closed connection [id: 
0xebd955fb, L:/127.0.0.1:50650 - R:localhost/127.0.0.1:6650] -- Will try again 
in 0.1 s
   10:12:07.259 [bookkeeper-ml-workers-OrderedExecutor-3-0] INFO  
org.apache.bookkeeper.mledger.impl.ManagedCursorImpl - 
[public/default/persistent/xyz-topic] Initiate reset position to 22:0 on cursor 
__compaction
   10:12:07.261 [BookKeeperClientWorker-OrderedExecutor-11-0] INFO  
org.apache.bookkeeper.mledger.impl.ManagedCursorImpl - 
[public/default/persistent/xyz-topic] reset position to 22:0 before current 
read position 22:10 on cursor __compaction
   10:12:07.261 [BookKeeperClientWorker-OrderedExecutor-11-0] INFO  
org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:50650] 
[persistent://public/default/xyz-topic][__compaction] Reset subscription to 
message id 22:0
   10:12:07.261 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic][__compaction] Successfully reset 
subscription to message id 22:0:-1:-1
   10:12:07.360 [pulsar-timer-99-1] INFO  
org.apache.pulsar.client.impl.ConnectionHandler - 
[persistent://public/default/xyz-topic] [__compaction] Reconnecting after 
timeout
   10:12:07.361 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic][__compaction] Subscribing to topic on 
cnx [id: 0xebd955fb, L:/127.0.0.1:50650 - R:localhost/127.0.0.1:6650], 
consumerId 0
   10:12:07.361 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:50650] Subscribing on 
topic persistent://public/default/xyz-topic / __compaction
   10:12:07.362 [pulsar-io-50-12] INFO  
org.apache.bookkeeper.mledger.impl.ManagedCursorImpl - 
[public/default/persistent/xyz-topic-__compaction] Rewind from 22:0 to 22:0
   10:12:07.362 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.persistent.PersistentTopic - 
[persistent://public/default/xyz-topic] There are no replicated subscriptions 
on the topic
   10:12:07.362 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.persistent.PersistentTopic - 
[persistent://public/default/xyz-topic][__compaction] Created new subscription 
for 0
   10:12:07.362 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:50650] Created 
subscription on topic persistent://public/default/xyz-topic / __compaction
   10:12:07.362 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic][__compaction] Subscribed to topic on 
localhost/127.0.0.1:6650 -- consumer: 0
   10:12:07.382 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:50650] Closing 
consumer: consumerId=0
   10:12:07.382 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.AbstractDispatcherSingleActiveConsumer - 
Removing consumer 
Consumer{subscription=CompactorSubscription{topic=persistent://public/default/xyz-topic,
 name=__compaction}, consumerId=0, consumerName=3ee4e, address=/127.0.0.1:50650}
   10:12:07.382 [pulsar-io-50-12] INFO  
org.apache.pulsar.broker.service.ServerCnx - [/127.0.0.1:50650] Closed 
consumer, consumerId=0
   10:12:07.383 [pulsar-client-io-96-1] INFO  
org.apache.pulsar.client.impl.ConsumerImpl - 
[persistent://public/default/xyz-topic] [__compaction] Closed consumer
   ```


----------------------------------------------------------------
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:
[email protected]


Reply via email to