Skip to content

[Bug] First entry will be skipped if opening NonDurableCursor while ledger is adding first entry after trimmed. #24737

@zhouyifan279

Description

@zhouyifan279

Search before reporting

  • I searched in the issues and found nothing similar.

Read release policy

  • I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

User environment

Broker version: 3.1.1

Issue Description

In KoP Test OffsetResetTest#testLessThanStartOffset, there is a test case:

  1. Trim Topic ledger
  2. Send 5 messages to Topic.
  3. Set consumer offset to 0.
  4. Consume messages from Topic.

Expect consumed message num to be 5. But some times, actual consumed message num is 0.

After debugging, I found it is related to pulsar NonDurableCursor.

Error messages


Reproducing the issue

Run KoP Test OffsetResetTest#testLessThanStartOffset. A machine with high load may increase the chances to reproduce.

Or run NonDurableCursorTest#testOpenNonDurableCursorWhileLedgerIsAddingFirstEntryAfterTrimmed.

Additional information

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/bugThe PR fixed a bug or issue reported a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions