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

The schema cache load is not retried with exponential backoff #3523

Closed
steve-chavez opened this issue May 15, 2024 · 2 comments · Fixed by #3654 · May be fixed by #3545
Closed

The schema cache load is not retried with exponential backoff #3523

steve-chavez opened this issue May 15, 2024 · 2 comments · Fixed by #3654 · May be fixed by #3545
Labels

Comments

@steve-chavez
Copy link
Member

Problem

Adding the following on test/spec/fixtures/schema.sql:

alter role postgrest_test_authenticator set statement_timeout to '10'

Makes the schema cache retry load on an endless loop without backoff:

# $ postgrest-with-postgresql-16 -f test/spec/fixtures/load.sql postgrest-run 
# ...
08/May/2024:21:06:46 +0200: Attempting to connect to the database...
08/May/2024:21:06:46 +0200: Attempting to connect to the database...
08/May/2024:21:06:46 +0200: Attempting to connect to the database...
08/May/2024:21:06:46 +0200: Attempting to connect to the database...
08/May/2024:21:06:46 +0200: Attempting to connect to the database...
08/May/2024:21:06:46 +0200: Attempting to connect to the database...
08/May/2024:21:06:46 +0200: Attempting to connect to the database...
08/May/2024:21:06:46 +0200: Attempting to connect to the database...
08/May/2024:21:06:46 +0200: Attempting to connect to the database...
08/May/2024:21:06:46 +0200: Attempting to connect to the database...

Previously reported on #3424 (comment)

@steve-chavez
Copy link
Member Author

Still an issue, this was incorrectly closed by #3536

@wolfgangwalther
Copy link
Member

After #3644's 785ae4f, this can easily reproduced by starting PostgREST with an invalid db-schemas setting - your log output will be flooded with errror messages.

steve-chavez added a commit to steve-chavez/postgrest that referenced this issue Jul 11, 2024
Fixes PostgREST#3523.

Now if obtaining the pg version or schema cache fails,
we do the same retrying process. This way we don't get two retries.

Refactors and renames the "connectionWorker" to "schemaCacheLoader".
This makes more sense since what we really want is the schema cache,
the version is the pre-requisite for ensuring our
schema cache queries will work.

Additionally, we no longer log ` Attempting to connect to the database...`
at startup unnecessarily. This is only logged whenever there's a retry attempt.
steve-chavez added a commit to steve-chavez/postgrest that referenced this issue Jul 11, 2024
Fixes PostgREST#3523.

Now if there's a failure when obtaining the pg version OR schema cache,
we do the same retrying process. This way we don't add two retries.

Refactors and renames the "connectionWorker" to "schemaCacheLoader".
This makes more sense since what we really want is the schema cache,
the version is the pre-requisite for ensuring our
schema cache queries work.

Additionally, we no longer log ` Attempting to connect to the database...`
at startup unnecessarily. This is only logged whenever there's a retry attempt.
steve-chavez added a commit that referenced this issue Jul 11, 2024
Fixes #3523.

Now if there's a failure when obtaining the pg version OR schema cache,
we do the same retrying process. This way we don't add two retries.

Refactors and renames the "connectionWorker" to "schemaCacheLoader".
This makes more sense since what we really want is the schema cache,
the version is the pre-requisite for ensuring our
schema cache queries work.

Additionally, we no longer log ` Attempting to connect to the database...`
at startup unnecessarily. This is only logged whenever there's a retry attempt.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants