hasura / hasura/graphql-engine
Stored metadata connection string overwritres environmental variable (v2)
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
**Version:** 2.0.1
**Database:** Postgres 12.6
**Version:** Self-hosted
We are using a docker-image and we regularly change databases, and we regularly copy databases between postgres instances (pg_dump and pg_restore). With v1 we were using an env vars to change between databases.
However since v2, hasura will now use the environment variable to connect to a database, then read the metadata stored in `hdb_metadata` and proceed to update the database connection to what is stored in the meta data.
This causes hasura to be looking at the incorrect database. Worse for us, is because these databases are identical there is no way for us to know without manually checking the connection string.
We've had to write a script that will drop `hdb_catalog` after each pg_dump.
I am not sure of the best solution to this. But it seems very strange behaviour to use the connection string, connect to the database, read the metadata, and instantly connect to entirely different database (the logs also do not show this reconnection. It just shows the initial database connection)
Contributor guide
Research direction
No source files or tests are identified. Start by reproducing the connection switch with a Docker image, a Postgres database, an environment-variable connection string, and restored hdb_metadata; inspect the resulting hdb_catalog state and logs. Done means the expected connection precedence and visible reconnection behavior are defined and covered by a reproducible test or documented resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, postgres
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100