-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Multi tenancy support for hibernate search #20834
Comments
Note that starting with Hibernate Search 6.1 (currently 6.1.0.Alpha1), multi-tenancy no longer requires explicit settings. So this setting will become all but obsolete. However, I agree it would be a good idea to add the setting to Quarkus before we upgrade to Hibernate Search 6.1: if nothing else, the integration tests will remain useful after the upgrade. |
Mmh, happy to see that it will be supported in 6.1. But I think it would be beneficial to support extra tenants just for hibernate search (next to the tenants for OIDC and database). I'm currently investigating how we can do zero-downtime upgrades (even with schema changes) for a quarkus service that uses hibernate search. Having multi-tenant support could be a solution for this use case. Or is this use case (zero downtime upgrades) supported in another way? |
That's an interesting use case for multi-tenancy. I can't say I ever thought of it. It feels a bit like a hack as you will bloat your schema and documents with a tenant id just for schema updates, but I suppose it could work. The major problem with zero-downtime upgrades is the loss of index updates. You will need to make sure old pods are made read-only. Otherwise, index updates from old pods might result in out-of-sync indexes, since these updates will not be propagated to the indexes used by new pods. Another solution would be to perform two full reindexings: one while you're still having old and new pods in your cluster, before exposing the new pods, in order to get a somewhat decent index for your new pods ; and another after eliminating old pods, to make sure to catch up with whatever change the old pods made to the database. There's a solution to zero-downtime reindexing here in the reference documentation, but it doesn't work well if there are schema upgrades, unless you can 1) make your old pods read-only so they don't try to write documents anymore and 2) accept search query errors for a short time while switching. I think the best way to address your problem would be to use a custom index layout strategy (it's supported in Quarkus). Just suffix the read/write index aliases of new pods with some application-specific version, e.g. Note that all user-provided components in Hibernate Search can be CDI beans, so you can perfectly well make your custom index layout strategy a CDI bean and inject the version of your application into that bean using a configuration property. |
Thank you for pointing that out! I think that could work for us. |
@yrodiere is this an issue we should close with 6.1 coming soon? |
I guess we can leave this here to remind me to at least add an integration test with multi-tenancy + Hibernate Search? |
Description
Hibernate search has support for multi tenancy via the config property:
hibernate.search.backend.multi_tenancy.strategy = discriminator
However, this property is not mapped to quarkus configuration for hibernate search.
Quarkus already supports multi tenancy for hibernate ORM and OIDC, seems logical to extend this support to hibernate search.
Implementation ideas
No response
The text was updated successfully, but these errors were encountered: