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

Grafbase next #11

Draft
wants to merge 22 commits into
base: grafbase
Choose a base branch
from
Draft

Grafbase next #11

wants to merge 22 commits into from

Conversation

pimeys
Copy link
Collaborator

@pimeys pimeys commented Nov 27, 2023

wip

funbringer and others added 22 commits November 27, 2023 09:42
We'd like to check our patches.
This patch was implemented by Petros Angelatos and Jeff Davis
to support physical and logical replication in rust-postgres
(see sfackler#752).

The original PR never made it to the upstream, but we
(Neon) still use it in our own fork of rust-postgres.

The following commits were squashed together:

* Image configuration updates.

* Make simple_query::encode() pub(crate).

* decoding logic for replication protocol

* Connection string config for replication.

* add copy_both_simple method

* helper ReplicationStream type for replication protocol

This can be optionally used with a CopyBoth stream to decode the
replication protocol

* decoding logic for logical replication protocol

* helper LogicalReplicationStream type to decode logical replication

* add postgres replication integration test

* add simple query versions of copy operations

* replication: use SystemTime for timestamps at API boundary

Co-authored-by: Petros Angelatos <[email protected]>
Co-authored-by: Jeff Davis <[email protected]>
Co-authored-by: Dmitry Ivanov <[email protected]>
According to https://datatracker.ietf.org/doc/html/rfc5802#section-3,
SCRAM protocol explicitly allows client to use a `ClientKey` & `ServerKey`
pair instead of a password to perform authentication. This is also useful
for proxy implementations which would like to leverage `rust-postgres`.

This patch adds the ability to do that.
We need this to enable parameter forwarding in Neon Proxy.
This is less than ideal, but we'll probably revert the patch
once a proper fix has been implemented.
That way our proxy can take back stream for proxying.
Add query_raw_txt client method

It takes all the extended protocol params as text and passes them to
postgres to sort out types. With that we can avoid situations when
postgres derived different type compared to what was passed in arguments.
There is also propare_typed method, but since we receive data in text
format anyway it makes more sense to avoid dealing with types in params.

This way we also can save on roundtrip and send Parse+Bind+Describe+Execute
right away without waiting for params description before Bind.

Use text protocol for responses -- that allows to grab
postgres-provided serializations for types.

Catch command tag.

Expose row buffer size and add `max_backend_message_size` option to
prevent handling and storing in memory large messages from the backend.

Co-authored-by: Arthur Petukhovsky <[email protected]>
Previous coding only allowed passing vector of text values as params,
but that does not allow to distinguish between nulls and 4-byte
strings with "null" written in them. Change query_raw_txt params
argument to accept Vec<Option<String>> instead.
As we are trying to match client-side behaviour with node-postgres we
need to return this fields as well because node-postgres returns them.
* refactor query_raw_txt to use a pre-prepared statement

* expose ready_status on RowStream
* add ready_status on simple queries

* add correct socket2 features
This is useful / needed to build a Rust client for the Pageserver's
GetPage@LSN API, which uses CopyBoth mode.
Added getter for process_id
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.

None yet

8 participants