Skip to content

Fixes to read buffer draining after queries #578

Closed

Description

@roji

In #252, we discussed a bug that occurred when a notification arrived while reading query results. That bug was fixed by @Emill, but a few issues remain:

  • The current implementation drains notifications correctly, but not other types of asynchronous messages that may arrive. For example, if a ParameterStatus or Notice message arrives while we're reading a query result, ReadSingleMessage will block forever: it knows not to ignore notifications, but it does ignore other async messages.
  • The draining is currently is currently in the NotificationBlock class, and is therefore linked to async notifications - not so good. We should actually not be using NotificationBlock at all if async notifications aren't turned on, but draining should still happen. We should probably perform the draining whenever the connector state is set to Ready.
  • Add an invariant (code contracts) that when the connector state is Ready, the buffer is empty.

One elegant solution would be to manage this would be to do draining, but also NotificationBlock management, as part of the connector state transition mechanism. So when someone does State=Ready we drain and release the async notification semaphore, and when someone transitions us out of Ready to Executing/Fetching/Copy we acquire the async notification semaphore.

Activity

  1. added this to the 3.0-beta1 milestone on Apr 15, 2015
  2. changed the title [-]Drain read buffer of messages after queries[/-] [+]Fixes to read buffer draining after queries[/+] on Apr 15, 2015
  3. self-assigned this
    on Apr 15, 2015
  4. added a commit that references this issue on Apr 15, 2015
  5. modified the milestones: 3.0-beta1, on Aug 7, 2015
  6. added theissue type on Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions