fix: clarify error for failed schema cache load
This commit is contained in:
committed by
Wolfgang Walther
parent
aa82d2e277
commit
51ee072f84
@@ -19,6 +19,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- #2077, Fix `is` not working with upper or mixed case values like `NULL, TrUe, FaLsE` - @steve-chavez
|
- #2077, Fix `is` not working with upper or mixed case values like `NULL, TrUe, FaLsE` - @steve-chavez
|
||||||
- #2024, Fix schema cache loading when views with XMLTABLE and DEFAULT are present - @wolfgangwalther
|
- #2024, Fix schema cache loading when views with XMLTABLE and DEFAULT are present - @wolfgangwalther
|
||||||
- #1724, Fix wrong CORS header Authentication -> Authorization - @wolfgangwalther
|
- #1724, Fix wrong CORS header Authentication -> Authorization - @wolfgangwalther
|
||||||
|
- #2107, Clarify error for failed schema cache load. - @steve-chavez
|
||||||
|
+ From `Database connection lost. Retrying the connection` to `Could not query the database for the schema cache. Retrying.`
|
||||||
|
|
||||||
## [9.0.0] - 2021-11-25
|
## [9.0.0] - 2021-11-25
|
||||||
|
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ postgrestResponse conf maybeDbStructure jsonDbS pgVer pool time req = do
|
|||||||
Just dbStructure ->
|
Just dbStructure ->
|
||||||
return dbStructure
|
return dbStructure
|
||||||
Nothing ->
|
Nothing ->
|
||||||
throwError Error.ConnectionLostError
|
throwError Error.NoSchemaCacheError
|
||||||
|
|
||||||
apiRequest@ApiRequest{..} <-
|
apiRequest@ApiRequest{..} <-
|
||||||
liftEither . mapLeft Error.ApiRequestError $
|
liftEither . mapLeft Error.ApiRequestError $
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ data Error
|
|||||||
= GucHeadersError
|
= GucHeadersError
|
||||||
| GucStatusError
|
| GucStatusError
|
||||||
| BinaryFieldError ContentType
|
| BinaryFieldError ContentType
|
||||||
| ConnectionLostError
|
| NoSchemaCacheError
|
||||||
| PutMatchingPkError
|
| PutMatchingPkError
|
||||||
| PutRangeNotAllowedError
|
| PutRangeNotAllowedError
|
||||||
| JwtTokenMissing
|
| JwtTokenMissing
|
||||||
@@ -294,7 +294,7 @@ instance PgrstError Error where
|
|||||||
status GucHeadersError = HTTP.status500
|
status GucHeadersError = HTTP.status500
|
||||||
status GucStatusError = HTTP.status500
|
status GucStatusError = HTTP.status500
|
||||||
status (BinaryFieldError _) = HTTP.status406
|
status (BinaryFieldError _) = HTTP.status406
|
||||||
status ConnectionLostError = HTTP.status503
|
status NoSchemaCacheError = HTTP.status503
|
||||||
status PutMatchingPkError = HTTP.status400
|
status PutMatchingPkError = HTTP.status400
|
||||||
status PutRangeNotAllowedError = HTTP.status400
|
status PutRangeNotAllowedError = HTTP.status400
|
||||||
status JwtTokenMissing = HTTP.status500
|
status JwtTokenMissing = HTTP.status500
|
||||||
@@ -317,8 +317,8 @@ instance JSON.ToJSON Error where
|
|||||||
"message" .= ("response.status guc must be a valid status code" :: Text)]
|
"message" .= ("response.status guc must be a valid status code" :: Text)]
|
||||||
toJSON (BinaryFieldError ct) = JSON.object [
|
toJSON (BinaryFieldError ct) = JSON.object [
|
||||||
"message" .= ((T.decodeUtf8 (ContentType.toMime ct) <> " requested but more than one column was selected") :: Text)]
|
"message" .= ((T.decodeUtf8 (ContentType.toMime ct) <> " requested but more than one column was selected") :: Text)]
|
||||||
toJSON ConnectionLostError = JSON.object [
|
toJSON NoSchemaCacheError = JSON.object [
|
||||||
"message" .= ("Database connection lost. Retrying the connection." :: Text)]
|
"message" .= ("Could not query the database for the schema cache. Retrying." :: Text)]
|
||||||
|
|
||||||
toJSON PutRangeNotAllowedError = JSON.object [
|
toJSON PutRangeNotAllowedError = JSON.object [
|
||||||
"message" .= ("Range header and limit/offset querystring parameters are not allowed for PUT" :: Text)]
|
"message" .= ("Range header and limit/offset querystring parameters are not allowed for PUT" :: Text)]
|
||||||
|
|||||||
@@ -787,12 +787,17 @@ def test_admin_ready_includes_schema_cache_state(defaultenv):
|
|||||||
"/rpc/no_schema_cache_for_limited_authenticator"
|
"/rpc/no_schema_cache_for_limited_authenticator"
|
||||||
)
|
)
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|
||||||
# force a reconnection so the new role setting is picked up
|
# force a reconnection so the new role setting is picked up
|
||||||
postgrest.process.send_signal(signal.SIGUSR1)
|
postgrest.process.send_signal(signal.SIGUSR1)
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
response = postgrest.admin.get("/ready")
|
response = postgrest.admin.get("/ready")
|
||||||
assert response.status_code == 503
|
assert response.status_code == 503
|
||||||
|
|
||||||
|
response = postgrest.session.get("/projects")
|
||||||
|
assert response.status_code == 503
|
||||||
|
|
||||||
|
|
||||||
def test_admin_not_found(defaultenv):
|
def test_admin_not_found(defaultenv):
|
||||||
"Should get a not found from a undefined endpoint on the admin server"
|
"Should get a not found from a undefined endpoint on the admin server"
|
||||||
|
|||||||
Reference in New Issue
Block a user