-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add PostgreSQL and Oracle migration files for DB backed resource group manager #9812
Add PostgreSQL and Oracle migration files for DB backed resource group manager #9812
Conversation
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.
I found this image: https://hub.docker.com/r/gvenzl/oracle-xe. Looks decent and it's used by the Testcontainers project.
...group-managers/src/main/resources/db/migration/postgresql/V1__add_resource_groups_schema.sql
Outdated
Show resolved
Hide resolved
54aeec5
to
8574806
Compare
@nineinchnick thanks! I added a test using that Oracle image. |
8574806
to
8e0b0ea
Compare
...rce-group-managers/src/main/resources/db/migration/oracle/V1__add_resource_groups_schema.sql
Outdated
Show resolved
Hide resolved
d41f5d4
to
2c646b3
Compare
@aalbu this is ready for another review whenever you get a chance. thanks! |
...ers/src/test/java/io/trino/plugin/resourcegroups/db/TestDbResourceGroupsFlywayMigration.java
Outdated
Show resolved
Hide resolved
2c646b3
to
e0ee7f6
Compare
@aalbu thanks for the review! All suggestions have been applied. |
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.
Why does Postgres have a single migration? Is it because DDL is transactional in Postgres? (hint: should be a code comment or in the commit message - I'd prefer to have separate migrations just to make it easier to compare across databases but existing is fine as well).
Looks good % comments.
Thanks for working on this @posulliv.
...resource-group-managers/src/main/java/io/trino/plugin/resourcegroups/db/FlywayMigration.java
Outdated
Show resolved
Hide resolved
...ers/src/test/java/io/trino/plugin/resourcegroups/db/TestDbResourceGroupsFlywayMigration.java
Outdated
Show resolved
Hide resolved
...ers/src/test/java/io/trino/plugin/resourcegroups/db/TestDbResourceGroupsFlywayMigration.java
Outdated
Show resolved
Hide resolved
@Override | ||
protected final JdbcDatabaseContainer<?> startContainer() | ||
{ | ||
JdbcDatabaseContainer<?> container = new MySQLContainer<>("mysql:8.0.12"); |
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.
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.
An alternative is to make versions injectable either from environment or system properties. That has the benefit that it's easier to test arbitrary versions via a matrix.
...c/test/java/io/trino/plugin/resourcegroups/db/TestDbResourceGroupsOracleFlywayMigration.java
Outdated
Show resolved
Hide resolved
e0ee7f6
to
13c7581
Compare
Yes, that's correct. I agree though that it would be more consistent to have a separate migration per table. So I updated the PostgreSQL migrations to be 1 file per table. |
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.
Thanks for adding this @posulliv .
Hmmm, seems like a test if failing now due to tests using H2.
cc: @posulliv can you fix this? I'm fine with reverting the change suggested in #9812 (comment) and adding a comment why the validation is not done in the config class itself. |
13c7581
to
4dc2c90
Compare
thanks @hashhar. I updated and added a comment. I forgot the unit tests use the h2 database. Perhaps some future work could be to update those unit tests to use one of the supported database engines instead of h2 and then we can add the validation back to the config class itself. |
@aalbu / @nineinchnick Could you maybe take another look at the migrations being added since once added we won't get a chance to edit them - we can only add new migrations. This looks good to me otherwise and ready to merge. |
@hashhar LGTM |
Thanks @posulliv for seeing this to the finish line. Can you PTAL at suggested release note at #10552 (comment)? Feel free to suggest changes. also we should add some docs to help users to use DB backed resource groups. I don't think there is anything existing already? cc: @mosabua do you know? |
Awesome @posulliv .. ping me when you want some input for the docs PR and anything related. |
I was unable to add an automated test for Oracle migrations. I wanted to use the image used in other tests
wnameless/oracle-xe-11g-r2
but Flyway community edition will not run migrations with versions of Oracle that old. If someone knows of a newer Oracle image that can be used, I will be happy to add a test.