Stream: hapi
Topic: Multitenancy on jpaserver-starter seems buggy: tips?
Rob Whelan (Dec 01 2020 at 14:25):
Hello!
I've been exploring hapi-fhir's new multitenancy support using the JPA starter project.
It's been tricky, though:
- it took quite a while to figure out how to create partitions/tenants (the docs don't mention you must refer to a "DEFAULT" tenant for these operations)
- Resource creation fails if auto_create_placeholder_reference_targets is true and your resource refers to something not yet created (it looks like that makes an update call that doesn't include the request, so the tenant can't be extracted)
- ...and there's a bug in jpa starter where that flag ^ is set to the value of a different, similarly-named config flag
- now that I've gotten this far (with local fixes), I can create tenants :thumbs_up: but when I create a patient & condition for tenant A, then query tenant B for that condition... it comes back. :(
Is anyone else working with this feature? Is there anything other than the 5.2.0 release I should be working with? Are there other feature I just need to disable, because they don't play nicely with multi-tenancy yet?
Any guidance at all would be very welcome. :)
I'll of course be happy to contribute my little fixes back, but I really need to know if this is a feature that just isn't usable yet.
Thanks!
EDIT: next issue found: I'm disabling reuse of cached search results, but there's an issue in Spring Boot passing a null from yaml into config... but that's what DaoConfig.setReuseCachedSearchResultsForMillis() requires to disable this feature.
Hmm; and even with search caching disabled, any tenant in the URL returns the same resources. Back to the debugger.
Jens Villadsen (Dec 01 2020 at 21:05):
if there are problems with thee starter project, then please submit an issue on the github page
Jens Villadsen (Dec 01 2020 at 21:05):
a lot of stuff in regards to configuration has moved a lot
Jens Villadsen (Dec 01 2020 at 21:05):
@Rob Whelan
Rob Whelan (Dec 02 2020 at 07:37):
Thanks @Jens Villadsen , I will — at this point, I'm just hoping to find out how stable this feature is in hapi-fhir, itself.
So far I've found that (once the config issues in jpaserver-starter are fixed) the multi-tenancy works fine for creating resources and fetching them back by ID. This correctly returns empty (this condition was created in TENANT_A, and I can fetch it there):
http GET localhost:8080/fhir/TENANT_B/Condition/2
But this returns the Condition, even though it's the wrong tenant:
http GET localhost:8080/fhir/TENANT_B/Condition?_id=2
There's a config setting, getAllowReferencesAcrossPartitions
that I've also set to false (and double-checked in the debugger), but there's nothing else in config that seems at all relevant.
I'll raise an issue in the hapi-fhir project once I've verified this a bit more.
It does seem like there are real issues, and not just mis-config.
That may be the best way to get some input from someone working on the project, if this feature is still at a stage where basic bugs like this are expected, or if there are known workarounds that'll provide something usable.
Rob Whelan (Dec 03 2020 at 08:28):
Update for anyone following here: James A fixed the blocking bug I hit in core (yesterday), so the fix will be in the next release. :celebration:
Last updated: Apr 12 2022 at 19:14 UTC