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

Multiple Hibernate ORM multitenancy fixes #40680

Merged
merged 3 commits into from
May 17, 2024

Conversation

yrodiere
Copy link
Member

Fixes #18564 and then some.

See commits for details:

  1. Avoid unnecessary copying of datasources for SCHEMA multi-tenancy
    This is undocumented behavior and I have no idea what the point would be.
  2. Avoid unnecessary definition of a DataSourceTenantConnectionResolver bean for discriminator multi-tenancy
    The only consumer of this bean is HibernateMultiTenantConnectionProvider and that consumer is not enabled with discriminator multi-tenancy.
    See
    if (multiTenancyStrategy != null && multiTenancyStrategy != MultiTenancyStrategy.NONE
    && multiTenancyStrategy != MultiTenancyStrategy.DISCRIMINATOR) {
    // We need to initialize the multi tenant connection provider
    // on static init as it is used in MetadataBuildingOptionsImpl
    // to determine if multi-tenancy is enabled.
    // Adding the service on runtime init would lead to unpredictable behavior
    // (metadata generated for a single-tenant application but runtime using multi-tenancy...).
    // Nothing is expected to actually retrieve a connection from the provider until runtime init, though.
    cfg.put(AvailableSettings.MULTI_TENANT_CONNECTION_PROVIDER,
    new HibernateMultiTenantConnectionProvider(puDefinition.getName()));
    }
  3. Deprecate quarkus.hibernate-orm.multitenant-schema-datasource
    There are no tests involving this configuration property.
    quarkus.hibernate-orm.datasource serves the exact same purpose and is more standardized and better handled (e.g. in Dev UI).

This is undocumented behavior and I have no idea what the point would
be.
…bean for discriminator multi-tenancy

The only consumer of this bean is HibernateMultiTenantConnectionProvider
and that consumer is not enabled with discriminator multi-tenancy.

See https://github.com/quarkusio/quarkus/blob/78952bcd4193042c2f569c3cf3b13d95be618b9a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootMetadataBuilder.java#L253-L263
There are no tests involving this configuration property.

`quarkus.hibernate-orm.datasource` serves the exact same purpose and is
more standardized and better handled (e.g. in Dev UI).

See quarkusio#18564
@quarkus-bot
Copy link

quarkus-bot bot commented May 16, 2024

/cc @gsmet (hibernate-orm)

@quarkus-bot quarkus-bot bot added this to To do in Quarkus Documentation May 16, 2024
@quarkus-bot
Copy link

quarkus-bot bot commented May 16, 2024

Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit a1a0ecd.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

⚠️ There are other workflow runs running, you probably need to wait for their status before merging.

Copy link

github-actions bot commented May 16, 2024

🙈 The PR is closed and the preview is expired.

Quarkus Documentation automation moved this from To do to Reviewer approved May 16, 2024
Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

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

Makes sense to me.
The datasource copying is indeed very weird. I don't see why we would do that but I also don't why it would have been done in the first place...

@quarkus-bot
Copy link

quarkus-bot bot commented May 16, 2024

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit a1a0ecd.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.


Flaky tests - Develocity

⚙️ JVM Tests - JDK 21

📦 extensions/smallrye-reactive-messaging-kafka/deployment

io.quarkus.smallrye.reactivemessaging.kafka.deployment.dev.KafkaDevServicesDevModeTestCase.sseStream - History

  • Assertion condition defined as a Lambda expression in io.quarkus.smallrye.reactivemessaging.kafka.deployment.dev.KafkaDevServicesDevModeTestCase Expecting size of: [] to be greater than or equal to 2 but was 0 within 10 seconds. - org.awaitility.core.ConditionTimeoutException
org.awaitility.core.ConditionTimeoutException: 
Assertion condition defined as a Lambda expression in io.quarkus.smallrye.reactivemessaging.kafka.deployment.dev.KafkaDevServicesDevModeTestCase 
Expecting size of:
  []
to be greater than or equal to 2 but was 0 within 10 seconds.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:119)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:31)

⚙️ JVM Tests - JDK 17 Windows

📦 integration-tests/grpc-hibernate

com.example.grpc.hibernate.BlockingRawTest.shouldAdd - History

  • Condition with Lambda expression in com.example.grpc.hibernate.BlockingRawTestBase was not fulfilled within 30 seconds. - org.awaitility.core.ConditionTimeoutException
org.awaitility.core.ConditionTimeoutException: Condition with Lambda expression in com.example.grpc.hibernate.BlockingRawTestBase was not fulfilled within 30 seconds.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:26)
	at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:1006)
	at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:975)
	at com.example.grpc.hibernate.BlockingRawTestBase.shouldAdd(BlockingRawTestBase.java:59)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)

@gsmet gsmet merged commit a76952c into quarkusio:main May 17, 2024
43 checks passed
Quarkus Documentation automation moved this from Reviewer approved to Done May 17, 2024
@quarkus-bot quarkus-bot bot added this to the 3.12 - main milestone May 17, 2024
@quarkus-bot quarkus-bot bot added the kind/enhancement New feature or request label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Property quarkus.hibernate-orm.multitenant-schema-datasource is apparently pointless
2 participants