Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

fix: make the order of commands the same as with node-pg #9

Merged
merged 1 commit into from
Nov 17, 2023

Conversation

pimeys
Copy link
Collaborator

@pimeys pimeys commented Nov 16, 2023

2023-11-16_17-11-1700153667

So, wireshark has been super helpful today, here's what I found out (see the image):

The first 16 packets are from node-pg library, which is guaranteed to work perfectly with HyperDrive. The next four packets are from our fork of tokio-postgres, the version that runs right now in production. The last four packets are from my fixed version of tokio-postgres. We see here, how there is our login to postgres, the first >, then a normal series of packets back <R/S/S/S/S/S/S/S/S/S/S/S.../K/Z. After that node-postgres sends packets in this order, in separate packages:

  • P (Parse)
  • B (Bind)
  • D (Describe)
  • E (Execute)
  • S (Flush)

Now, what we send is P/D/B/E/S, we can see that describe and bind are in the wrong order, and we also send the whole series in one package (which should be possible per docs, and faster).

This PR changes the order of describe and bind, so we bind first and describe right after that. It also removes matches of CloseComplete from two spots, which were added when we explicitly closed after the flush.

The next step is to test this with the script from @tomhoule, and if it succeeds, then we deploy to production and pray.

@pimeys pimeys merged commit 5e75a39 into grafbase Nov 17, 2023
@pimeys pimeys deleted the client-closed-fixes branch November 17, 2023 14:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants