-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
multiple postgres database & metadata storage separation #5797
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 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_URL
v1/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_trigger
results in the following error:can't set comments for computed fields. Request:
** - can be done in parallel
Description
Metadata:-
json
blob inhdb_catalog.hdb_metadata
table in a single row. This reduces the Hasura footprint in thehdb_catalog
schema.--metadata-database-url
orHASURA_GRAPHQL_METADATA_DATABASE_URL
option. 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/views
andfunctions
can reside in. We can configure multiple sources via Metadata API or console UI.Changelog
CHANGELOG.md
is updated with user-facing content relevant to this PR. If no changelog is required, then add theno-changelog-required
label.Affected components
Limitations, known bugs & workarounds
Actions:-
Metadata
The metadata version is bumped to
3
. The only difference from version2
is that now thetables
andfunctions
will be present inside newsources
field for each time. The other top level fields remain as it is.Example:-
version
2
:version
3
:Where
default
is the source configured via--database-url
server option andchinook
is newly added postgres source via metadata API.New APIs
It is recommended to use newly added
/v1/metadata
to manage metadata and/v2/query
to query postgres sources via JSON DSL, instead of/v1/query
API./v1/metadata
It contains all query types in
/v1/query
except database DML operations likeinsert
,select
etc.Query types for managing postgres related metadata are appended with
pg_
.For example,
track_table
is changed topg_track_table
and similarly for all query types for managing tables, functions, relationships, remote relationships, event triggers and computed fields.This also supports
bulk
query type for running multiple metadata queries in a single request.APIs for console data requirements from metadata storage:
request,
response,
request,
{ "message": "success" }
is the response.request,
By event id,
response,
By Event Id:
One off:-
pending
processed
Cron:-
trigger_name
is required iftype
iscron
.Response:-
request:-
{"message": "success"}
is the response./v2/query
All database DML operations like
insert
,select
,delete
,update
,count
andrun_sql
from/v1/query
. An optional top level fieldsource
is accepted in payload and its absence treated asdefault
source. 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