apache / apache/pulsar-client-python

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

オープン
#221 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
75
フォーク
53
PR マージ指標
30日以内にマージされた PR はありません

説明

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())
```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start by running the provided Python reproduction against a compacted topic containing a tombstone, using Reader.has_message_available() with is_read_compacted=True. Confirm that the reader reports availability after all messages are read, then verify that adding another message changes the behavior. Done means the method returns false once the compacted topic is exhausted, including when tombstone messages are present.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
distributed-systems
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。