-
Notifications
You must be signed in to change notification settings - Fork 136
Add support for Oracle as backend database #89
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| CREATE TABLE gateway_backend ( | ||
| name VARCHAR(256) PRIMARY KEY, | ||
| routing_group VARCHAR (256), | ||
| backend_url VARCHAR (256), | ||
| external_url VARCHAR (256), | ||
| active NUMBER(1) | ||
| ); | ||
|
|
||
| CREATE TABLE query_history ( | ||
| query_id VARCHAR(256) PRIMARY KEY, | ||
| query_text VARCHAR (256), | ||
| created NUMBER, | ||
| backend_url VARCHAR (256), | ||
| user_name VARCHAR(256), | ||
| source VARCHAR(256) | ||
| ); | ||
| CREATE INDEX query_history_created_idx ON query_history(created); | ||
|
|
||
| CREATE TABLE resource_groups ( | ||
| resource_group_id NUMBER GENERATED ALWAYS as IDENTITY(START with 1 INCREMENT by 1), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know Oracle very well, but would a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. a I would vote to use
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After reviewing, I'd agree |
||
| name VARCHAR(250) NOT NULL, | ||
| -- OPTIONAL POLICY CONTROLS | ||
| parent NUMBER, | ||
| jmx_export CHAR(1), | ||
| scheduling_policy VARCHAR(128), | ||
| scheduling_weight NUMBER, | ||
| -- REQUIRED QUOTAS | ||
| soft_memory_limit VARCHAR(128) NOT NULL, | ||
| max_queued INT NOT NULL, | ||
| hard_concurrency_limit NUMBER NOT NULL, | ||
| -- OPTIONAL QUOTAS | ||
| soft_concurrency_limit NUMBER, | ||
| soft_cpu_limit VARCHAR(128), | ||
| hard_cpu_limit VARCHAR(128), | ||
| environment VARCHAR(128), | ||
| PRIMARY KEY(resource_group_id), | ||
| FOREIGN KEY (parent) REFERENCES resource_groups (resource_group_id) ON DELETE CASCADE | ||
| ); | ||
|
|
||
| CREATE TABLE selectors ( | ||
| resource_group_id NUMBER NOT NULL, | ||
| priority NUMBER NOT NULL, | ||
| -- Regex fields -- these will be used as a regular expression pattern to | ||
| -- match against the field of the same name on queries | ||
| user_regex VARCHAR(512), | ||
| source_regex VARCHAR(512), | ||
| -- Selector fields -- these must match exactly. | ||
| query_type VARCHAR(512), | ||
| client_tags VARCHAR(512), | ||
| selector_resource_estimate VARCHAR(1024), | ||
| FOREIGN KEY (resource_group_id) REFERENCES resource_groups (resource_group_id) ON DELETE CASCADE | ||
| ); | ||
|
|
||
| CREATE TABLE resource_groups_global_properties ( | ||
| name VARCHAR(128) NOT NULL PRIMARY KEY, | ||
| value VARCHAR(512) NULL, | ||
| CHECK (name in ('cpu_quota_period')) | ||
| ); | ||
|
|
||
| CREATE TABLE exact_match_source_selectors( | ||
| environment VARCHAR(256), | ||
| update_time TIMESTAMP NOT NULL, | ||
| -- Selector fields which must exactly match a query | ||
| source VARCHAR(512) NOT NULL, | ||
| query_type VARCHAR(512), | ||
| resource_group_id VARCHAR(256) NOT NULL, | ||
| PRIMARY KEY (environment, source, resource_group_id), | ||
| UNIQUE (source, environment, query_type, resource_group_id) | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ CREATE INDEX query_history_created_idx ON query_history(created); | |
|
|
||
| CREATE TABLE IF NOT EXISTS resource_groups ( | ||
| resource_group_id BIGINT NOT NULL AUTO_INCREMENT, | ||
| name VARCHAR(250) NOT NULL UNIQUE, | ||
| name VARCHAR(250) NOT NULL, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we changing the MySQL sql for this PR?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated it to match the schema in trino for consistency - https://github.com/trinodb/trino/blob/master/plugin/trino-resource-group-managers/src/main/resources/db/migration/mysql/V2__add_resource_groups.sql Happy to revert if unique names need to be enforced for gateway.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One use case for non-unique names I have had in the past with Trino is storing the same resource group definitions for different environments in the same database. This is possible since resource groups are determined by the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure. Trino clusters require an environment name set, while the gateway could front backends with different environment names. So environment could be less meaningful in the gateway context. OTOH, this is defined by the user, and they can choose not to complicate things. I guess being able to import a set of policies from Trino to the gateway probably wins out. |
||
|
|
||
| -- OPTIONAL POLICY CONTROLS | ||
| parent BIGINT NULL, | ||
|
|
@@ -75,4 +75,4 @@ CREATE TABLE IF NOT EXISTS exact_match_source_selectors ( | |
|
|
||
| PRIMARY KEY (environment, source, query_type), | ||
| UNIQUE (source, environment, query_type, resource_group_id) | ||
| ); | ||
| ); | ||
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.
that seems like a bad idea .. how would you know what number to use? An id should be created automatically. Also .. this change should be independent and separate