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

Backport jdbc #362

Merged
merged 2 commits into from
May 10, 2022
Merged

Backport jdbc #362

merged 2 commits into from
May 10, 2022

Conversation

michalskrivanek
Copy link
Member

backport #322

emesika and others added 2 commits May 10, 2022 16:38
oVirt stopped working after upgrading from postgrsql-jdbc 42.2.3 to
42.2.14

The reason for that was that in 42.2.11
PgDatabaseMetaData.java:getProcedures stopped to return Functions and
returns only Procedures.
The difference in Postgres between a Function and a Procedure is that a
Function returns a value to the caller while a Procedure only executes
commands and does not has a return value.
We are using only Functions and if we have nothing to return we still
return VOID which makes this code to be categorized as a Function.

We are using spring-jdbc 5.0.4.RELEASE, but this version is not aligned
with the postgresql >= 42.2.11 changes and  calls only PgDatabaseMetaData.getProcedures() in spring-jdbc
GenericCallMetaDataProvider::initializeWithProcedureColumnMetaData
and therefor brings an empty results.

We have to upgrade to  spring-jdbc 5.2.10.RELEASE which calls also
PgDatabaseMetaData.getFunctions and builds a complete metadata.

However, upgarding to postgrsql 42.2.14 and spring-jdbc 5.2.10.RELEASE
was not enough. Now we have some errors in our DB testing :

[ERROR] Errors:
[ERROR]   ClusterDaoTest.testClearAllUpgradeRunning:433 » InvalidDataAccessApiUsage Requ...
[ERROR]   ClusterDaoTest.testClearUpgradeRunning:418 » InvalidDataAccessApiUsage Require...
[ERROR]   ClusterDaoTest.testFailureSetUpgradeRunning:409 » InvalidDataAccessApiUsage Re...
[ERROR]   ClusterDaoTest.testSetUpgradeRunning:397 » InvalidDataAccessApiUsage Required ...
[ERROR]   VmDynamicDaoTest.testUpdateConsoleUserWithOptimisticLockingFailure:123 » InvalidDataAccessApiUsage
[ERROR]   VmDynamicDaoTest.testUpdateConsoleUserWithOptimisticLockingSuccess:109 » InvalidDataAccessApiUsage

All those methods calls a function that returns a value that is stored
in OUT parameter.
The reason for the failure is that the upgraded versions now requires to define
explicitly any OUT parameter, complaining that the parameter is not
recognized.

In order to solve that now we have a new
SimpleJdbcCallsHandler::executeModification signature that can accept
also 2 additional parameters as the OUT parameter name and its
java.sqlTypes type value (int) and defines the OUT parameter as
required.

Any other call to executeModification is not affected including batch
processing that is used only for async calls and don't use return
values.

This patch affect other projects that uses postgresql-jdbc and
spring-jdbc to handle DB calls.

The changes required are:

1. change postgresql-jdbc to use version 42.2.14
2. change spring-jdbc to use version 5.2.10.RELEASE
3. for each Function that uses OUT parameter use SimpleJdbcCallsHandler.
executeModification(final String procedureName,
            final MapSqlParameterSource paramSource,
            String outParamName,
            Integer outParamType)
instead of:
executeModification(final String procedureName, final MapSqlParameterSource paramSource)

Signed-off-by: Eli Mesika <emesika@redhat.com>
Bug-Url: https://bugzilla.redhat.com/2077794
Bumps Spring Framework to 5.3.19 and adds requirement for
ovirt-dependencies >= 4.5.2 which contains that Spring Framework
version.

Bug-Url: https://bugzilla.redhat.com/2077794
Signed-off-by: Martin Perina <mperina@redhat.com>
Copy link
Member

@mwperina mwperina left a comment

Choose a reason for hiding this comment

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

+1

@michalskrivanek michalskrivanek merged commit cba896f into ovirt-engine-4.5.0.z May 10, 2022
@sandrobonazzola sandrobonazzola deleted the backport-jdbc branch May 11, 2022 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants