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

Enable Hibernate ORM multitenancy IT on CI #9390

Merged
merged 5 commits into from
May 20, 2020

Conversation

Sanne
Copy link
Member

@Sanne Sanne commented May 17, 2020

Fixes #9389

The multi-tenancy integration tests require root access to the MariaDB instance, so that it can create multiple databases to test the dybanamic DB switching ability.

The integration tests of these modules were not enabled so far.

@Sanne Sanne added the area/hibernate-orm Hibernate ORM label May 17, 2020
@Sanne Sanne requested a review from n1hility May 17, 2020 20:43
@boring-cyborg boring-cyborg bot added area/infra-automation anything related to CI, bots, etc. that are used to automated our infrastructure area/persistence OBSOLETE, DO NOT USE labels May 17, 2020
@Sanne
Copy link
Member Author

Sanne commented May 18, 2020

Pushed again, as Flyway needs to take into account that other integration tests might have used the DB before this module was run.

@Sanne Sanne removed the request for review from n1hility May 18, 2020 12:16
@gsmet
Copy link
Member

gsmet commented May 18, 2020

Could you put a slightly higher timeout for Data3? It's cancelled and considering the changes you made, I'm not comfortable merging this without it being green.

Thanks.

@Sanne
Copy link
Member Author

Sanne commented May 18, 2020 via email

@Sanne
Copy link
Member Author

Sanne commented May 18, 2020

Looks like @geoand already did something related: abb9b94

Either way, my tests are in Data1 so I don't think it relates - do you want me to increase it further?

LOG.debugv("selectConnectionProvider({0})", tenantIdentifier);

ConnectionProvider provider = providerMap.get(tenantIdentifier);
if (provider == null) {
return providerMap.computeIfAbsent(tenantIdentifier, tid -> resolveConnectionProvider(tid));
final ConnectionProvider connectionProvider = resolveConnectionProvider(tenantIdentifier);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure you want to do this? It could introduce a race condition, because multiple parallel requests will use the same object. I think this is not thread safe.

Copy link
Member Author

Choose a reason for hiding this comment

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

It seems fine to me - this is indeed a race condition but it's benign, as the end result doesn't change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is correct. I just thought the "computeIfAbsent" is a more accurate usage of the API and does not cause such questions, because it is defined by the API of the hash map implementation.

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree with you - your solution was more elegant. But we try to avoid lambdas for efficiency reasons. Of course we're not extreme about it: lambdas are a fine solution when they are a good solution, but I still tend to prefer avoiding them in such situations.

@Sanne Sanne mentioned this pull request May 20, 2020
@gsmet gsmet force-pushed the multitenancy-ci branch from b0fa53a to 3201928 Compare May 20, 2020 16:17
@gsmet
Copy link
Member

gsmet commented May 20, 2020

Rebased. Let's wait for CI.

@gsmet gsmet added this to the 1.5.0.Final milestone May 20, 2020
@gsmet gsmet added triage/backport? triage/waiting-for-ci Ready to merge when CI successfully finishes labels May 20, 2020
@gsmet gsmet merged commit a848498 into quarkusio:master May 20, 2020
@gsmet gsmet modified the milestones: 1.5.0.Final, 1.6.0 May 20, 2020
@gsmet gsmet modified the milestones: 1.6.0 - master, 1.5.0.Final May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-orm Hibernate ORM area/infra-automation anything related to CI, bots, etc. that are used to automated our infrastructure area/persistence OBSOLETE, DO NOT USE triage/waiting-for-ci Ready to merge when CI successfully finishes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable CI coverage for the Hibernate Multi-tenancy integration tests
3 participants