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

Upgrade postgresql-jdbc and spring-jdbc versions #322

Merged
merged 2 commits into from
May 10, 2022

Conversation

emesika
Copy link
Member

@emesika emesika commented May 2, 2022

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

@mwperina
Copy link
Member

mwperina commented May 3, 2022

It needs to be tested together with oVirt/ovirt-dependencies#10 and oVirt/ovirt-system-tests#137

@mwperina
Copy link
Member

mwperina commented May 3, 2022

OST run 35865 using #322 and oVirt/ovirt-dependencies#10 and oVirt/ovirt-system-tests#137 failed on some UI test, but not database errors in the log, so the patch seems to be OK.

@didib
Copy link
Member

didib commented May 4, 2022

Current patch is for master branch, right? Why wait?

@michalskrivanek
Copy link
Member

Current patch is for master branch, right? Why wait?

because we want to sort out RHV builds too

@michalskrivanek
Copy link
Member

fixes #334

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>
@michalskrivanek michalskrivanek merged commit 2b75893 into oVirt:master May 10, 2022
This was referenced May 10, 2022
mwperina added a commit to mwperina/ovirt-engine that referenced this pull request May 13, 2022
As a part of oVirt#322 ovirt-engine
now requires postgresql-jdbc >= 42.2.14, whih should be the latest
version available. But unfortunately we forgot to add RPM requires for
this version, which caused issues around upgrade.

Bug-Url: https://bugzilla.redhat.com/2077794
Signed-off-by: Martin Perina <mperina@redhat.com>
michalskrivanek pushed a commit that referenced this pull request May 13, 2022
As a part of #322 ovirt-engine
now requires postgresql-jdbc >= 42.2.14, whih should be the latest
version available. But unfortunately we forgot to add RPM requires for
this version, which caused issues around upgrade.

Bug-Url: https://bugzilla.redhat.com/2077794
Signed-off-by: Martin Perina <mperina@redhat.com>
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.

Upgrade postgresql-jdbc to 42.2.14-1.el8 (last) broke engine
5 participants