Skip to content

publish time non-monotonic on same partition #6276

@fernandezpablo85

Description

@fernandezpablo85

Describe the bug
Publish time is not monotonic on the same partition.

To Reproduce
Steps to reproduce the behavior:

  1. Publish events with a single producer to a topic with many partitions, with any partition key.
  2. Run a consumer on key_shared mode, for example:
client = pulsar.Client(pulsar_url)
    consumer = client.subscribe(
        topic=pulsar_topic,
        subscription_name="any_name_you_want",
        consumer_name="any_name_you_want",
        consumer_type=ConsumerType.KeyShared,
        initial_position=InitialPosition.Earliest,
    )

    for i in itertools.count():
        msg = consumer.receive()
        ts = msg.publish_timestamp()
        p_id = msg.message_id().partition()
        lpt = latest_partition_timestamp[p_id]
        assert ts >= lpt, f"latest timestamp of partition {p_id} was {lpt} and new event has timestamp {ts}"
        latest_partition_timestamp[p_id] = ts
        consumer.acknowledge(msg)
  1. See assertion error

Expected behavior
No error should be raised since publish_timestamp on the same partition must be monotonically increasing.

Desktop (please complete the following information):

  • OS: macOS 10.15.2

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions