Skip to content
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

spanner-jdbc: Metadata queries should be allowed during a DDL batch #6939

Conversation

olavloite
Copy link

A DDL batch would refuse any query that would be executed during an active batch. This causes problems for frameworks, such as Hibernate, that might execute such queries during datamodel generation to check which database objects (tables, indices, ...) already exist in the database. This change will allow specifically internally generated metadata queries to be executed during a DDL batch. All other queries will still be refused. The metadata queries will be executed using a
single use read-only transaction.

A DDL batch would refuse any query that would be executed during an
active batch. This causes problems for frameworks, such as Hibernate,
that might execute such queries during datamodel generation to check
which database objects (tables, indices, ...) already exist in the
database. This change will allow specifically internally generated
metadata queries to be executed during a DDL batch. All other queries
will still be refused. The metadata queries will be executed using a
single use read-only transaction.
@olavloite olavloite added the api: spanner Issues related to the Spanner API. label Nov 27, 2019
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 27, 2019
@codecov
Copy link

codecov bot commented Nov 27, 2019

Codecov Report

Merging #6939 into master will increase coverage by 0.13%.
The diff coverage is 84.44%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #6939      +/-   ##
============================================
+ Coverage     41.04%   41.18%   +0.13%     
- Complexity     5289     5310      +21     
============================================
  Files           360      360              
  Lines         50413    50436      +23     
  Branches       6913     6918       +5     
============================================
+ Hits          20692    20770      +78     
+ Misses        28244    28182      -62     
- Partials       1477     1484       +7
Impacted Files Coverage Δ Complexity Δ
.../com/google/cloud/spanner/jdbc/JdbcConnection.java 58.22% <ø> (+1.26%) 42 <0> (+1) ⬆️
.../com/google/cloud/spanner/jdbc/ConnectionImpl.java 82.66% <100%> (+0.07%) 155 <0> (ø) ⬇️
...oogle/cloud/spanner/jdbc/JdbcDatabaseMetaData.java 95.23% <100%> (+7.56%) 180 <5> (+15) ⬆️
...ogle/cloud/spanner/jdbc/JdbcPreparedStatement.java 69.23% <100%> (+10.89%) 7 <1> (+2) ⬆️
...ogle/cloud/spanner/jdbc/AbstractJdbcStatement.java 54.31% <40%> (-0.96%) 29 <1> (ø)
...n/java/com/google/cloud/spanner/jdbc/DdlBatch.java 85.41% <76.47%> (-1.93%) 28 <2> (+1)
.../com/google/cloud/pubsub/v1/MessageDispatcher.java 85.12% <0%> (+0.51%) 23% <0%> (ø) ⬇️
...com/google/cloud/spanner/jdbc/StatementParser.java 87.97% <0%> (+0.63%) 46% <0%> (+1%) ⬆️
...gle/cloud/spanner/jdbc/DirectExecuteResultSet.java 98.21% <0%> (+0.89%) 55% <0%> (+1%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a6ab05f...e5c24e3. Read the comment docs.

Copy link
Contributor

@dzou dzou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thank you, this is very helpful!

Copy link
Member

@meltsufin meltsufin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@olavloite olavloite merged commit 9f2651d into googleapis:master Dec 3, 2019
@olavloite olavloite deleted the spanner-jdbc-allow-metadata-queries-in-ddl-batch branch December 3, 2019 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Spanner API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants