-
Notifications
You must be signed in to change notification settings - Fork 2.8k
multiple postgres database & metadata storage separation #5797
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
Closed
rakeshkky
wants to merge
76
commits into
hasura:master
from
rakeshkky:metadata-separation-multi-source
Closed
multiple postgres database & metadata storage separation #5797
rakeshkky
wants to merge
76
commits into
hasura:master
from
rakeshkky:metadata-separation-multi-source
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-> move all essential metadata types from RQL/DDL/* to RQL/Types/*
Resolve Conflicts: server/graphql-engine.cabal server/src-lib/Hasura/GraphQL/Schema/Action.hs server/src-lib/Hasura/RQL/DDL/EventTrigger.hs server/src-lib/Hasura/RQL/DDL/Metadata.hs server/src-lib/Hasura/RQL/DDL/Metadata/Generator.hs server/src-lib/Hasura/RQL/DDL/Metadata/Types.hs server/src-lib/Hasura/RQL/DDL/Permission.hs server/src-lib/Hasura/RQL/DDL/RemoteRelationship.hs server/src-lib/Hasura/RQL/DDL/RemoteSchema.hs server/src-lib/Hasura/RQL/DDL/Schema/Cache.hs server/src-lib/Hasura/RQL/DDL/Schema/Cache/Fields.hs server/src-lib/Hasura/RQL/DDL/Schema/Rename.hs server/src-lib/Hasura/RQL/DDL/Schema/Table.hs server/src-lib/Hasura/RQL/Types/Action.hs server/src-lib/Hasura/RQL/Types/RemoteRelationship.hs server/src-lib/Hasura/Server/App.hs
Resolve Conflicts: server/src-lib/Hasura/App.hs server/src-lib/Hasura/RQL/DDL/ComputedField.hs server/src-lib/Hasura/RQL/DDL/Metadata.hs server/src-lib/Hasura/RQL/DDL/Metadata/Types.hs server/src-lib/Hasura/RQL/DDL/Permission.hs server/src-lib/Hasura/RQL/DDL/Permission/Internal.hs server/src-lib/Hasura/RQL/DDL/Relationship.hs server/src-lib/Hasura/RQL/DDL/RemoteRelationship.hs server/src-lib/Hasura/RQL/DDL/Schema.hs server/src-lib/Hasura/RQL/DDL/Schema/Cache.hs server/src-lib/Hasura/RQL/DDL/Schema/Cache/Fields.hs server/src-lib/Hasura/RQL/DDL/Schema/Catalog.hs server/src-lib/Hasura/RQL/DDL/Schema/Function.hs server/src-lib/Hasura/RQL/DDL/Schema/Rename.hs server/src-lib/Hasura/RQL/DDL/Schema/Table.hs server/src-lib/Hasura/RQL/Types.hs
…' into metadata-separation-multi-source
Resolve Conflicts: server/src-lib/Hasura/App.hs server/src-lib/Hasura/Db.hs server/src-lib/Hasura/Eventing/EventTrigger.hs server/src-lib/Hasura/Eventing/ScheduledTrigger.hs server/src-lib/Hasura/GraphQL/Execute/Insert.hs server/src-lib/Hasura/GraphQL/Execute/Mutation.hs server/src-lib/Hasura/GraphQL/Execute/Prepare.hs server/src-lib/Hasura/GraphQL/Execute/Query.hs server/src-lib/Hasura/GraphQL/Schema.hs server/src-lib/Hasura/GraphQL/Transport/HTTP.hs server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs server/src-lib/Hasura/RQL/DDL/EventTrigger.hs server/src-lib/Hasura/RQL/Types/EventTrigger.hs server/src-lib/Hasura/RQL/Types/SchemaCache.hs server/src-lib/Hasura/Server/App.hs
…metadata -> The export metadata dumps the configuration of the default source which is dependent on the --database-url configuration and bound to change always. We cannot stick to particular --database-url unless it is strictly instructed to start the server with one before running tests.
This was referenced Oct 29, 2020
6 tasks
This was referenced Nov 3, 2020
6 tasks
This was referenced Nov 4, 2020
11 tasks
hasura-bot
added a commit
that referenced
this pull request
Nov 25, 2020
An incremental PR towards #5797 * metadata storage abstraction for scheduled triggers Co-authored-by: rakeshkky <12475069+rakeshkky@users.noreply.github.com> Co-authored-by: Rakesh Emmadi <12475069+rakeshkky@users.noreply.github.com> Co-authored-by: Auke Booij <auke@hasura.io> GITHUB_PR_NUMBER: 6131 GITHUB_PR_URL: #6131 * update pro server code Co-authored-by: rakeshkky <12475069+rakeshkky@users.noreply.github.com> Co-authored-by: Auke Booij <auke@hasura.io> GitOrigin-RevId: 17244a4
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TODO
Avoid hdb_catalog.hdb_catalog.check_violation
Cron/Scheduled triggers
Console support - metadata storage data APIs
Backwards compatibilty of
DATABASE_URLv1/query API backwards compatibility
pg_dump API to accept source
Heterogeneous execution (i.e, merge master)
Action queries/mutations execution in appropriate source (when there are relationships defined)
Tests for multiple sources**
Add/modify column issue:
The server gets stuck with requests like the following one:
pg_invoke_event_triggerresults in the following error:can't set comments for computed fields. Request:
** - can be done in parallelDescription
Metadata:-
jsonblob inhdb_catalog.hdb_metadatatable in a single row. This reduces the Hasura footprint in thehdb_catalogschema.--metadata-database-urlorHASURA_GRAPHQL_METADATA_DATABASE_URLoption. By default it is stored in the database specified via--database-url. One can start the server with only metadata database specified and configure the postgres database as sources (see below).Multiple Databases
Source, a user Postgres database where alltables/viewsandfunctionscan reside in. We can configure multiple sources via Metadata API or console UI.Changelog
CHANGELOG.mdis updated with user-facing content relevant to this PR. If no changelog is required, then add theno-changelog-requiredlabel.Affected components
Limitations, known bugs & workarounds
Actions:-
Metadata
The metadata version is bumped to
3. The only difference from version2is that now thetablesandfunctionswill be present inside newsourcesfield for each time. The other top level fields remain as it is.Example:-
version
2:version
3:Where
defaultis the source configured via--database-urlserver option andchinookis newly added postgres source via metadata API.New APIs
It is recommended to use newly added
/v1/metadatato manage metadata and/v2/queryto query postgres sources via JSON DSL, instead of/v1/queryAPI./v1/metadata
It contains all query types in
/v1/queryexcept database DML operations likeinsert,selectetc.Query types for managing postgres related metadata are appended with
pg_.For example,
track_tableis changed topg_track_tableand similarly for all query types for managing tables, functions, relationships, remote relationships, event triggers and computed fields.This also supports
bulkquery type for running multiple metadata queries in a single request.APIs for console data requirements from metadata storage:
request,
{ "type": "get_catalog_state", "args": {} }response,
{ "id": "fc0bc750-b343-44cc-a7f4-46637b0067f7", "cli_state": {}, "console_state": {} }request,
{ "type": "set_catalog_state", "args": { "type": "console", "state": {"key": "value"} } }{ "message": "success" }is the response.request,
{ "type": "get_event_invocations", "args": { "type": "one_off", "limit": 10, "offset": 10 } }{ "type": "get_event_invocations", "args": { "type": "cron", "trigger_name": "some_trigger_name", "limit": 10, "offset": 10 } }By event id,
{ "type": "get_event_invocations", "args": { "type": "cron", "event_id": "some_event_id" } }response,
{ "invocations": <list of invocation objects>, "count": <count of total invocations" }By Event Id:
One off:-
pending
{ "type": "get_scheduled_events", "args": { "type": "one_off", "limit": 10, "offset": 10, "status": ["scheduled"] } }processed
{ "type": "get_scheduled_events", "args": { "type": "one_off", "limit": 10, "offset": 10, "status": ["delivered", "error", "dead"] } }Cron:-
{ "type": "get_scheduled_events", "args": { "type": "cron", "trigger_name": "test" } }trigger_nameis required iftypeiscron.Response:-
{ "events": <list of events, the object structure is different for cron and one_off>, "count": <total-count> }request:-
{ "type": "delete_scheduled_event", "args": { "type": "one_off", "event_id": "00a8d34c-de0d-417a-ac9f-22df310af989" } }{"message": "success"}is the response./v2/query
All database DML operations like
insert,select,delete,update,countandrun_sqlfrom/v1/query. An optional top level fieldsourceis accepted in payload and its absence treated asdefaultsource. These queries are run in the Postgres source specified.Example:-
Console issues:
get_invocation_logs: filter by cron trigger name, for one-off return all invocationsget_invocation_logs: paginationget_invocation_logs: count allget_scheduled_events: filter by status - pending/processedget_scheduled_events: paginationget_scheduled_events: count