Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix][client] Fix Reader.hasMessageAvailable might return true after seeking to latest #22201

Commits on Mar 5, 2024

  1. [fix][client] fix Reader.hasMessageAvailable might return true after …

    …seeking to latest
    
    ### Motivation
    
    Java client has the same issue with
    apache/pulsar-client-python#199
    
    After a seek operation is done, the `startMessageId` will be updated
    until the reconnection due to the seek is done in `connectionOpened`. So
    before it's updated, `hasMessageAvailable` could compare with an
    outdated `startMessageId` and return a wrong value.
    
    ### Modifications
    
    Replace `duringSeek` with a `SeekStatus` field:
    - `NOT_STARTED`: initial, or a seek operation is done. `seek` could only
      succeed in this status.
    - `IN_PROGRESS`: A seek operation has started but the client does not
      receive the response from broker.
    - `COMPLETED`: The client has received the seek response but the seek
      future is not done.
    
    After the status becomes `COMPLETED`, if the connection is not ready,
    next time the connection is established, the status will change from
    `COMPLETED` to `NOT_STARTED` and then seek future will be completed in
    the internal executor.
    
    Add `testHasMessageAvailableAfterSeek` to cover this change.
    BewareMyPower committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    5f09ec7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1a49118 View commit details
    Browse the repository at this point in the history
  3. Use != to compare enum

    BewareMyPower committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    4ba37b9 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    e062789 View commit details
    Browse the repository at this point in the history
  5. Fix tests

    BewareMyPower committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    fa4c9d7 View commit details
    Browse the repository at this point in the history
  6. Fix checkstyle

    BewareMyPower committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    9b65f62 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    901c6a9 View commit details
    Browse the repository at this point in the history