-
Notifications
You must be signed in to change notification settings - Fork 2.8k
recover from inconsistent database state (close #231) #1863
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
Conversation
Resolve Conflicts: server/src-lib/Hasura/GraphQL/Resolve.hs server/src-lib/Hasura/GraphQL/Resolve/Insert.hs server/src-lib/Hasura/GraphQL/Resolve/Mutation.hs server/src-lib/Hasura/RQL/DDL/Metadata.hs server/src-lib/Hasura/RQL/DDL/QueryTemplate.hs server/src-lib/Hasura/RQL/DDL/Schema/Table.hs server/src-lib/Hasura/RQL/DDL/Subscribe.hs server/src-lib/Hasura/RQL/DML/Count.hs server/src-lib/Hasura/RQL/DML/Delete.hs server/src-lib/Hasura/RQL/DML/QueryTemplate.hs server/src-lib/Hasura/RQL/DML/Select.hs server/src-lib/Hasura/RQL/DML/Update.hs server/src-lib/Hasura/Server/Query.hs
|
Deploy preview for hasura-docs ready! Built with commit 174be30 |
|
Review app for commit 2d69ab2 deployed to Heroku: https://hge-ci-pull-1863.herokuapp.com |
Resolve Conflicts: server/src-lib/Hasura/GraphQL/Resolve.hs server/src-lib/Hasura/GraphQL/Resolve/Context.hs server/src-lib/Hasura/GraphQL/Resolve/Mutation.hs server/src-lib/Hasura/GraphQL/Resolve/Select.hs server/src-lib/Hasura/GraphQL/Transport/HTTP.hs server/src-lib/Hasura/RQL/DDL/EventTrigger.hs server/src-lib/Hasura/RQL/DDL/Schema/Table.hs
|
Review app for commit 5b7678a deployed to Heroku: https://hge-ci-pull-1863.herokuapp.com |
|
Thanks for this! We were able to use the soft start feature to boot an app when our schema had changed externally. Previous Hasura wouldn't boot, so we couldn't reset or apply new metadata. This looks to be on the right track. I didn't try the API though, just using the CLI and the console. |
|
Review app for commit 5b7678a deployed to Heroku: https://hge-ci-pull-1863.herokuapp.com |
|
Review app for commit 5b8d129 deployed to Heroku: https://hge-ci-pull-1863.herokuapp.com |
…ngine into issue-231-incon-meta
rikinsk-zz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs + console approved
|
@dsandip @wawhal This will make https://docs.hasura.io/1.0/graphql/manual/troubleshooting/index.html redundant right? |
|
related #415 |
|
@rikinsk I think it should be there. Because finding those inconsistencies in the schema is not straight forward. We should just add a note at the top saying "If your version is above , you can look at all the inconsistencies at |
|
Review app for commit b365e23 deployed to Heroku: https://hge-ci-pull-1863.herokuapp.com |
Resolve Conflicts: server/src-exec/Main.hs server/src-lib/Hasura/Server/App.hs server/src-lib/Hasura/Server/Init.hs server/src-lib/Hasura/Server/Query.hs server/src-lib/Hasura/Server/SchemaUpdate.hs
…ngine into issue-231-incon-meta
|
Review app for commit 174be30 deployed to Heroku: https://hge-ci-pull-1863.herokuapp.com |
|
Review app https://hge-ci-pull-1863.herokuapp.com is deleted |
) Context: https://app.slack.com/client/T7GHF0SM9/C08PAUZG6F6 aside: this error message (or maybe it's `UnknownFieldInOutputPermissionsDefinition`) wasn't visible to the user. I couldn't immediately see how ErrorVisibility ultimately gets set for this type. Also looking at `set_span_attributes` it seems we don't have a mechanism for surfacing non-internal errors that end up in an internal span, is that what we want? If it is, should I make `build_metadata` user-visible? https://prod-gcp-grafana.hasura.io/d/a0aabf5f-9eb1-467b-8f5d-b7746a33c2a2/view-trace?orgId=1&var-traceId=1e444531ec996c040799e8ea9990de2b&from=now-6h&to=now&timezone=browser V3_GIT_ORIGIN_REV_ID: 28d76ac421a60994ef439f879794cc5e82af0e1f
Description
The server keeps track of all inconsistent metadata objects and reports them on
/v1/queryof typeget_inconsistent_metadata.API request:-
Response:-
{ "is_consistent": false, "inconsistent_objects": [ { "definition": { "role": "user", "comment": null, "permission": { "allow_aggregations": false, "columns": [ "author", "author_id", "id", "title" ], "filter": { "author": { "_eq": "X-Hasur\r\na-User-Id" } } }, "table": "article" }, "reason": "table \"article\" does not exist", "type": "select_permission" }, { "definition": { "using": { "foreign_key_constrai\r\nnt_on": "author_id" }, "name": "author_obj", "comment": null, "table": "article" }, "reason": "table \"article\" does not exist", "type": "object_relation" }, { "definition": { "using": { "foreign_key_constraint_on": { "column": "author_id", "table": "article" } }, "name": "articles", "comment": null, "table": "author" }, "reason": "t\r\nable \"article\" does not exist", "type": "array_relation" }, { "definition": "article", "reason": "no such table/view exists in postgres : \"article\"", "type": "table" } ] }Use
drop_inconsistent_metadataquery type to purge all inconsistent objects.API
Response:-
{ "message": "success" }Affected components
Related Issues
close #231
Solution and Design
buildSchemaCachefunction fromHasura.RQL.DDL.Schema.Tablemodule is updated to collect inconsistent objects and push to schema cache.get_inconsistent_metadataanddrop_inconsistent_metadataquery types in/v1/queryAPISteps to test and verify
psqloradminerdrop any table which is being tracked.reload metadatain settings section of console.get_inconsistent_metadataAPI query (spec given above), you'll get list of all inconsistent metadata objects.