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

Forward parameters to compute in proxy #1287

Open
Tracked by #7059 ...
LizardWizzard opened this issue Feb 16, 2022 · 7 comments
Open
Tracked by #7059 ...

Forward parameters to compute in proxy #1287

LizardWizzard opened this issue Feb 16, 2022 · 7 comments
Assignees
Labels
c/cloud/proxy Component: cloud: proxy c/control-plane Component: Control Plane t/bug Issue Type: Bug

Comments

@LizardWizzard
Copy link
Contributor

Currently proxy eats parameters that are not needed for it e.g it doesn't pass application name to compute.

The other question is what is a precise list of parameters we need to support? Are there any parameters that we fundamentally cannot support?

@LizardWizzard LizardWizzard added c/cloud/proxy Component: cloud: proxy t/bug Issue Type: Bug labels Feb 16, 2022
@hlinnaka
Copy link
Contributor

hlinnaka commented Feb 16, 2022

The proxy should pass through everything, and let Postgres reject invalid ones. It's not the proxy's job to guess which ones are valid, IMHO.

If necessary, the proxy could recognize some options to control the proxy itself, though. I don't know if we have any such options today, or if that's needed in the future.

@LizardWizzard
Copy link
Contributor Author

Plus one on passthrough except authentication parameters that proxy changes because it performs the mapping via console.

Also such parameters as encryption settings for connection from proxy to compute are controlled by us and user cannot affect them.

@funbringer funbringer self-assigned this Feb 22, 2022
@funbringer
Copy link
Contributor

I'm going to tackle this.

@stepashka
Copy link
Member

Are there any paramenters that are critical to pass through for the nearest milestones?
Sending to backlog because we don't seem to have those

@kelvich kelvich mentioned this issue May 19, 2022
19 tasks
@kelvich kelvich added the c/control-plane Component: Control Plane label Aug 22, 2022
funbringer added a commit that referenced this issue Aug 30, 2022
Previously, proxy didn't forward auxiliary `options` parameter
and other ones to the client's compute node, e.g.

```
$ psql "user=john host=localhost dbname=postgres options='-cgeqo=off'"
postgres=# show geqo;
┌──────┐
│ geqo │
├──────┤
│ on   │
└──────┘
(1 row)
```

With this patch we now forward `options`, `application_name` and `replication`.

Further reading: https://www.postgresql.org/docs/current/libpq-connect.html

Fixes #1287.
@hlinnaka
Copy link
Contributor

I tested this on staging with this little test program (from https://community.neon.tech/t/error-connecting-edgedb-intervalstyle-parameter-ignored/107/6):

import asyncpg
import asyncio

async def main():
    conn = await asyncpg.connect("postgres://hlinnaka:redacted@throbbing-limit-293198.cloud.stage.neon.tech:5432/main?sslmode=require", server_settings={"IntervalStyle": "iso_8601"})
    #conn = await asyncpg.connect("postgres://localhost/postgres", server_settings={"IntervalStyle": "iso_8601"})
    print(await conn.fetchval("select to_json('0 seconds'::interval)"))
    await conn.close()

asyncio.run(main())

It prints:

"00:00:00"

But against a local postgres installation, it prints:

"PT0S"

The latter is expected. It seems to me that the IntervalStyle option is still not passed through.

@hlinnaka hlinnaka reopened this Sep 20, 2022
@funbringer
Copy link
Contributor

Huh... I guess it's time to bite the bullet and lift the limitations imposed by tokio-postgres.

@conradludgate
Copy link
Contributor

TODO: tokio-postgres Config needs to accept an arbitrary "options" parameter that we can feed in our options into. The Config::params function is a good candidate. It currently errors on unknown parameter but we can instead save them to a vec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/cloud/proxy Component: cloud: proxy c/control-plane Component: Control Plane t/bug Issue Type: Bug
Projects
None yet
Development

No branches or pull requests

7 participants