apache / apache/pulsar-client-python
Reader.has_message_available() returns True when no more messages are available on a compacted topic with tombstone messages
- Langage dominant
- Python
- Étoiles
- 75
- Forks
- 53
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
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())
```
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par exécuter la reproduction Python fournie sur un topic compacté contenant un tombstone, en utilisant Reader.has_message_available() avec is_read_compacted=True. Confirmez que le reader signale la disponibilité après la lecture de tous les messages, puis vérifiez que l’ajout d’un autre message modifie le comportement. Le travail est terminé lorsque la méthode renvoie false une fois le topic compacté épuisé, y compris lorsque des messages tombstone sont présents.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- distributed-systems
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 48/100