This message was deleted.
# general
s
This message was deleted.
a
Your expectation is correct, in the second example there should be no message returned for k1
How are you triggering compaction and are you sending messages as bytes or with a schema?
s
Copy code
userProducer.newMessage().keyBytes(("key"+i).getBytes(StandardCharsets.UTF_8))
         .value(msg1.getBytes(StandardCharsets.UTF_8)).sendAsync();
is the example produce and compaction is triggered as below using pulsar admin
Copy code
pulsarAdmin.topics().triggerCompaction(topic);
a
Strange, the code looks fine to me
cc @Lari Hotari
p
@sindhushree You can check the topic's internal stats to see how many entries are in the compacted ledger and how many entries are in the original topic.
s
@Penghui Compacted ledger has 3 entries and when i read am getting 3 entries .but on the subscription am getting this ack holes. "test" : { "markDeletePosition" : "66:-1", "readPosition" : "169:12", "waitingReadOp" : false, "pendingReadOps" : 0, "messagesConsumedCounter" : 80, "cursorLedger" : 174, "cursorLedgerLastEntry" : 0, "individuallyDeletedMessages" : "[(678..6711],(731..734],(762..7611],(857..8510],(1491..14910],(14913..14916],(1591..1594],(1652..1655],(1692..1695],(1698..16911]]", "lastLedgerSwitchTimestamp" : "2024-01-29T063126.116Z", "state" : "Open", "numberOfEntriesSinceFirstNotAckedMessage" : 91, "totalNonContiguousDeletedMessagesRange" : 10, "subscriptionHavePendingRead" : false, "subscriptionHavePendingReplayRead" : false, "properties" : { } }
p
Which subscription type are you using? only the failover or exclusive subscription types are supported on reading compacted data
s
Copy code
userConsumer = client.newConsumer()
      .topic(topic)
      .subscriptionName("test")
      .subscriptionType(SubscriptionType.Exclusive)
      //.subscriptionInitialPosition(SubscriptionInitialPosition.Earliest)
      .subscriptionMode(SubscriptionMode.Durable)
      .readCompacted(true)
      .subscribe();
its exclusive and i had subscription position set to earliest
p
Interesting. Do you have transaction enabled or replicated subscription enabled? Or could you please share the complete the topic stats and internal-stats?
s
we dont have transaction enabled nor replicated subscription .
p
Ok, can you reproduce the issue? Please help create a GitHub issue? From your description, the behavior doesn't look expected. We might need to investigate more on the Github issue.
cc @Cong Zhao It seems related to compacted topic.
s
I can create a github issue with sample produce and consume code along with stats and stats internal
c
Yes, Please help create an issue and I will investigate it.
when we read its its returning k1 value1 ,k2 value2 and k1 value1 ..
but understanding was it would only return k2 value2 since empty payload it would remove k1 .is the understanding correct ?
Not sure if the compaction task has been completed before reading topic.
s
Compaction is triggered before we read from topic . when we read we get correct values in consume but the subscription is having ack holes
@Cong Zhao if i produce while compaction is been triggered is their a condition we will end up with this ack holes?
c
@sindhushree For readcompacted=true,I think you should use acknowledgeCumulative to avoid ack holes.
👍 1
s
in doc its not mentioned ..so is the ack indivisual is the suspect ?
p
@Cong Zhao I think we need to improve the code or the documentation. If we’d better disable the individual ack for read compacted, it’s better to have a discussion under the mailing list.
👀 1
s
@Penghui @Cong Zhao cumulative ack is working ..we dont see ack holes
👍 1
Thanks alot
p
Thanks for confirming.