apache / apache/pulsar-client-python

Reader.has_message_available() returns True when no more messages are available on a compacted topic with tombstone messages

Aperta
#221 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
75
Fork
53
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

When reading a compacted topic with `is_read_compacted=True` `has_message_available` returns true even after all messages have been read when there is a tombstone message. This might be related to #199. As soon as any messages are added after compaction it behaves correctly again.

Python 3.12.4
pulsar-client 3.5.0

```python
url = "localhost"
topic = "tenant/namespace/topic"
client = pulsar.Client(pulsar_url)

producer = client.create_producer(topic)
producer.send(
b'message',
partition_key="1",
)
# tombstone message
producer.send(
b'',
partition_key="1",
)
# If there is only the tombstone message, then it returns False, presumably because the compacted topic is empty
producer.send(
b'message2',
partition_key="2",
)

# compact the topic here with "bin/pulsar-admin topics compact tenant/namespace/topic"

reader = client.create_reader(
topic=topic,
start_message_id=pulsar.MessageId.earliest,
is_read_compacted=True,
)

while reader.has_message_available():
msg = reader.read_next()
print(msg.data())
```
Once another message has been sent, the reader operates correctly again.

```python
producer.send(
b'message3',
partition_key="3",
)
while reader.has_message_available():
msg = reader.read_next()
print(msg.data())
```

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia eseguendo la riproduzione Python fornita su un topic compattato contenente un tombstone, usando Reader.has_message_available() con is_read_compacted=True. Conferma che il reader segnali la disponibilità dopo la lettura di tutti i messaggi, quindi verifica che l’aggiunta di un altro messaggio cambi il comportamento. Il lavoro è completato quando il metodo restituisce false una volta esaurito il topic compattato, anche quando sono presenti messaggi tombstone.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
distributed-systems
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.