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.
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
[536] [913] [910] SchemaMigrator/SchemaValidator support for PostgreSQL and CockroachDB #903
[536] [913] [910] SchemaMigrator/SchemaValidator support for PostgreSQL and CockroachDB #903
Changes from all commits
0223cb4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Could you remind us why you need the additional method?
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.
@DavideD , since
SchemaMigrator
executes select queries on system tables and executes DDL statements (which update system tables), I assumed that these queries should be executed outside of a transaction (i.e., withautocommit=true
). IIUC, this would help avoid contention with other work the DB is doing on schemas used by various applications.If you look at the corresponding ORM code in GenerationTargetToDatabase, you can see that the statement is created using a connection obtained from a
DdlTransactionIsolator
.Javadoc for
DdlTransactionIsolator
says:If you look at the
DdlTransactionIsolator
implementations, you will see thatautocommit
is set totrue
on theConnection
that is obtained:DdlTransactionIsolatorJtaImpl
DdlTransactionIsolatorNonJtaImpl
DdlTransactionIsolatorProvidedConnectionImpl
relies onJdbcConnectionAccessProvidedConnectionImpl
which setsautocommit
totrue
I didn't see any other way to execute a query outside of a transaction that returned a
CompletionStage<ResultSet>
, so I created a new method.Is there some other method that should be used instead?
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 don't think we had this requirement before. I don't see any problem adding a new method.
But I mainly wanted a bit of an explanation written somewhere so that others know as well (maybe it wasn't obvious only to me though ;-)
At some point, we will need to add some javadoc to that class. Anyway, not something you need to worry about at the moment.
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.
Yes, I know this stuff is lacking in documentation. I will be adding that.