LinuxForHealth / FHIR

The LinuxForHealth FHIR® Server and related projects
https://linuxforhealth.github.io/FHIR
Apache License 2.0
331 stars 157 forks source link

Don't lookup default datasource when it doesn't exist #3927

Open lmsurpre opened 2 years ago

lmsurpre commented 2 years ago

Is your feature request related to a problem? Please describe. I went through some of the CI test logs and I noticed we're getting an awful lot of exceptions like this in the logs:

Caused by: java.lang.IllegalStateException: Missing datasource configuration for fhirServer/persistence/datasources/default
    at org.linuxforhealth.fhir.persistence.jdbc.cache.FHIRPersistenceJDBCTenantCache.createCache(FHIRPersistenceJDBCTenantCache.java:72)
    at org.linuxforhealth.fhir.persistence.jdbc.cache.FHIRPersistenceJDBCTenantCache.lambda$getCacheForTenantAndDatasource$0(FHIRPersistenceJDBCTenantCache.java:38)
    at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1737)
    at org.linuxforhealth.fhir.persistence.jdbc.cache.FHIRPersistenceJDBCTenantCache.getCacheForTenantAndDatasource(FHIRPersistenceJDBCTenantCache.java:38)
    at org.linuxforhealth.fhir.persistence.jdbc.FHIRPersistenceJDBCFactory.getInstance(FHIRPersistenceJDBCFactory.java:30)
    ... 73 more

Describe the solution you'd like I assume something is looking for the default datasource under tenant1, but this datasource doesn't exist there. Its apparently benign, but we should see if we can hunt this down.

Describe alternatives you've considered

Acceptance Criteria

this IllegalStateException should not appear in the server logs unless its explicitly being tested (negative test for error handling)

Additional context Add any other context or screenshots about the feature request here.

lmsurpre commented 2 years ago

TODO: confirm that this is specific to our tests and noisy logs, not end user visible. i.e. what happens when a user makes a request for a tenant / dsid combo that isn't defined?