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

R3SOL-0 - remove hibernate from uniqueness #6378

Conversation

driessamyn
Copy link

Create new backing store that just uses SQL.
Targetting Nandor's branch.

Hibernate/JPA dependencies can be pulled out after verification.

nkovacsx and others added 30 commits October 17, 2024 12:42
Created a copy of `HoldingIdentity` named `UniquenessHoldingIdentity`.
@corda-jenkins-ci02
Copy link
Contributor

corda-jenkins-ci02 bot commented Nov 1, 2024

Jenkins build for PR 6378 build 9

Build Successful:
Jar artifact version produced by this PR: 5.3.0.0-alpha-1730733250349
Helm chart version produced by this PR: 5.3.0-alpha.1730733250349
Helm chart pushed to: oci://corda-os-docker-dev.software.r3.com/helm-charts/pr-6378/corda
Helm chart Polaris score: 82

@corda-jenkins-ci02
Copy link
Contributor

corda-jenkins-ci02 bot commented Nov 3, 2024

Building E2E Tests on PR-6378

Succeeded

@ronanbrowne
Copy link
Contributor

build e2e

@driessamyn driessamyn marked this pull request as ready for review November 4, 2024 11:24
@driessamyn driessamyn requested review from a team as code owners November 4, 2024 11:24
@lankydan
Copy link
Contributor

lankydan commented Nov 4, 2024

Should target feature/ledger-library.

Copy link
Contributor

@lankydan lankydan left a comment

Choose a reason for hiding this comment

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

@nkovacsx can you review.

) : this(
JPABackingStoreImpl(
getEntityManagerFactory = { getEntityManagerFactory(virtualNodeInfoReadService, dbConnectionManager, jpaEntitiesRegistry, it) },
SqlBackingStoreImpl(
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably leave this one as the JpaBackingStoreImpl and have another implementation of JPABackingStoreOsgiImpl, or, renamed JPABackingStoreOsgiImpl to BackingStoreImpl

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm somewhat leaning towards leaving the jpa implementation as the default implementation. We can then leverage the sql implementation as needed to remove the hibernate dep. I want to reduce the "risk" of this change and deal with it later on, if at all.

Copy link
Author

Choose a reason for hiding this comment

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

We can do, but you'll end up having to maintain a lot more code (and tests).
It also means pulling the jpa backing store implementation in a separate module (or moving it back tocomponents/uniqueness/backing-store-impl)

)
init {
// uncomment this to run the test against local Postgres
System.setProperty("databaseType", "POSTGRES")
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean this line should be commented out?

statement.setBytes(5, details.consumingId.bytes)

statement.addBatch()
println(statement)
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove println.

Copy link
Contributor

Choose a reason for hiding this comment

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

There are a few in this file.

Copy link
Author

Choose a reason for hiding this comment

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

They are all in the test, which I though may be ok?

uniquenessSecureHashFactory
)
)
connection.close()
Copy link
Contributor

Choose a reason for hiding this comment

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

Put the connection.close only in the finally?

Copy link
Author

Choose a reason for hiding this comment

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

I copied the existing structure, but you're right, it doesn't need to be there.
I actually refactored it now to use use on the connection which is a bit more idiomatic.
The try/finaly is still there for the metrics.

@@ -0,0 +1,87 @@
package net.corda.ledger.libs.uniqueness.backingstore.impl

class DefaultSqlQueryProvider : SqlQueryProvider {
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this only runs against postgres, not sure what the tests were doing beforehand.

Copy link
Author

Choose a reason for hiding this comment

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

Correct. It could be made to work against the in-memory DB, but I haven't had time yet to do that.
The tests that are not working against the in-memory DB are skipped

Copy link

sonarqubecloud bot commented Nov 4, 2024

@driessamyn driessamyn changed the base branch from nandor/R3SOL-372/extract-uniqueness-2 to feature/ledger-library November 4, 2024 15:22
@driessamyn driessamyn requested a review from a team as a code owner November 4, 2024 15:22
@driessamyn
Copy link
Author

New PR: #6380

@driessamyn driessamyn closed this Nov 4, 2024
@github-actions github-actions bot deleted the driessamyn/remove-hibernate-from-uniqueness branch December 20, 2024 00:22
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.

4 participants