Skip to content

fix: Do not clear the schema cache during retries#4869

Open
mkleczek wants to merge 1 commit into
PostgREST:mainfrom
mkleczek:push-olktzqvzkonu
Open

fix: Do not clear the schema cache during retries#4869
mkleczek wants to merge 1 commit into
PostgREST:mainfrom
mkleczek:push-olktzqvzkonu

Conversation

@mkleczek

@mkleczek mkleczek commented May 4, 2026

Copy link
Copy Markdown
Collaborator

DISCLAIMER:
This commit was authored entirely by a human without the assistance of LLMs.

retryingSchemaCacheLoad should not clear existing schema cache upon failure - there is no reason to do that.
If there is a communication issue with the database server or db is down, clients are going to get 502 anyway. If it was a glitch when loading the schema cache - the clients are going to use old (stale) schema cache for some time until next retry re-loads it successfully.

Fixes #4873

@mkleczek mkleczek requested a review from steve-chavez May 4, 2026 07:49
@mkleczek mkleczek force-pushed the push-olktzqvzkonu branch from c468e80 to 36be579 Compare May 4, 2026 17:35
@steve-chavez

Copy link
Copy Markdown
Member

Clarifying the motivation on #4873

Comment thread CHANGELOG.md Outdated
@mkleczek mkleczek force-pushed the push-olktzqvzkonu branch 2 times, most recently from 5201ea9 to 82cf2e7 Compare May 4, 2026 18:08
@steve-chavez

Copy link
Copy Markdown
Member

Follow up question on #4873 (comment), not sure if it's correct to do the fix like this.

Comment thread test/io/test_io.py
Comment thread test/io/fixtures/roles.sql
@mkleczek mkleczek force-pushed the push-olktzqvzkonu branch 3 times, most recently from 02f8fbc to 4d6a87d Compare May 12, 2026 06:29
@mkleczek

Copy link
Copy Markdown
Collaborator Author

Follow up question on #4873 (comment), not sure if it's correct to do the fix like this.

@steve-chavez - So what's the conclusion after #4873 (comment), #4873 (comment) and all discussions in #4873 ?

Are we going to proceed with this PR?

@steve-chavez

Copy link
Copy Markdown
Member

@mkleczek We need to clarify what are we going to do with the request "waiting" (not sure how to call this) mentioned on #4873 (comment) because there's also a scenario here where we void the schema cache and we force clients to wait while the schema cache is reloaded again. If that "waiting" is useless, let's settle it on #4873 (comment).

@mkleczek mkleczek force-pushed the push-olktzqvzkonu branch 8 times, most recently from f92122f to 3b60b73 Compare May 20, 2026 10:35
@steve-chavez

steve-chavez commented May 20, 2026

Copy link
Copy Markdown
Member

Now that we clarified the "waiting" was ineffective on #4937, let's proceed with reviewing this.

Comment thread test/io/test_io.py
@mkleczek mkleczek force-pushed the push-olktzqvzkonu branch 3 times, most recently from e685d2f to 5f3f373 Compare May 31, 2026 06:04
@mkleczek mkleczek force-pushed the push-olktzqvzkonu branch 2 times, most recently from 8a684e0 to 0bbfaf9 Compare May 31, 2026 21:32
retryingSchemaCacheLoad should not clear existing schema cache upon failure - there is no reason to do that. If there is a communication issue with the database server or db is down, clients are going to get 502 anyway. If it was a glitch when loading the schema cache - the clients are going to use old (stale) schema cache for some time until next retry re-loads it successfully.
Comment thread CHANGELOG.md
- Shutdown should wait for in flight requests by @mkleczek in #4702
- Remove automatic transaction retries on `40001 (serialization_failure)` errors to prevent replication lag by @laurenceisla in #3673
- Fix unexpected results when embedding and filtering the same table more than once by @laurenceisla in #4075
- PostgREST no longer returns voids schema cache during loading retries by @mkleczek in #4873 #4869

@steve-chavez steve-chavez Jun 3, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be more user facing, currently it mentions an implementation detail. Maybe:

Suggested change
- PostgREST no longer returns voids schema cache during loading retries by @mkleczek in #4873 #4869
- If the schema cache fails to reload, PostgREST will no longer stop serving requests and will continue doing so in a "best effort" basis by @mkleczek in #4873 #4869

@steve-chavez steve-chavez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only thing missing is addressing the feedback on the CHANGELOG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

A statement timeout can void the schema cache

4 participants