Skip to content

[Bug] KoP: brokerIndex Ordering Issues in Ledger Entries Due to Write Failure #24109

Open
@zhaizhibo

Description

@zhaizhibo

Search before asking

  • 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.

Version

OS: centos
Pulsar version: 3.3.3
KoP: 2.10.2.2

Minimal reproduce step

Request A calls interceptor.beforeAddEntry(), successfully obtains and assigns index index1, then proceeds with the write operation.

Request B arrives concurrently, calls interceptor.beforeAddEntry(), successfully obtains and assigns index index2, then proceeds with the write operation.

Request A fails, causing its write operation to roll back, and the index generator (indexGenerator) is rolled back.

Request B’s write operation succeeds, and index index2 is written into the ledger and retained.

Request C arrives, obtains index index3, and finds that index3 is smaller than index2.

What did you expect to see?

All ledger entry indexes should be strictly monotonically increasing, with no later index being smaller than a previous one.

Even if Request A fails and is rolled back, the index generator should not result in a non-monotonic sequence

What did you see instead?

After Request A fails and is rolled back, index2 is written and retained in the ledger as a valid index, causing Request C to obtain index3, which is smaller than index2. This results in a non-monotonic sequence of indexes.

This non-monotonic sequence causes issues with binary search operations, as they rely on the assumption of strictly increasing indexes and fail to correctly find entries by offset.

Anything else?

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