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

Add operations for clearing terminology caches #2421

Closed
csandersdev opened this issue May 24, 2021 · 4 comments
Closed

Add operations for clearing terminology caches #2421

csandersdev opened this issue May 24, 2021 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@csandersdev
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The terminology subsystem caches terminology resources (e.g. CodeSystems and ValueSets) such that when a resource change is made to the same URL and version, the resource changes are not immediately reflected in all operation results (e.g. validate-code).

Describe the solution you'd like
I would like for the server to either clear the cache automatically on resource update (difficult to do right now because the cache is not shared between clustered nodes) or provide mechanism through which a client application can clear the cache on demand.

Describe alternatives you've considered
This isn't an issue if the client application does not try to reuse the same URL and version, but that is common at dev time. There is a server flag fhirServer/term/disableCaching that was introduced that will disable caching in the terminology subsystem, but is not desirable for a production application. We have a production use case that wants caching, but also wants to be able to clear the cache after updating a single resource url + version.

Acceptance Criteria

  1. GIVEN a valueset resource exists
    AND the valueset cache has been populated (e.g. $validate-code operation called)
    WHEN the valueset resource is updated
    AND the clear-cache operation is called on that resource
    THEN the next valueset operation returns the correct result for the new resource.

  2. GIVEN a codesystem resource exists
    AND the codesystem cache has been populated (e.g. $validate-code operation called)
    WHEN the codesystem resource is updated
    AND the clear-cache operation is called on that resource
    THEN the next codesystem operation returns the correct result for the new resource.

  3. GIVEN an intensional valueset resource exists
    AND the codesystem cache has been populated (e.g. ValueSet/xxx/$expand operation called)
    WHEN the codesystem resource is updated
    AND the clear-cache operation is called on that resource
    THEN the next valuset expand operation returns the correct result for the new resource.

Additional Context
It is a known constraint that the FHIR server caches are JVM-local. In the event that a clear-cache operation is needed, the client application will need to call clear-cache on each FHIR server in a cluster.

@prb112 prb112 added the enhancement New feature or request label May 24, 2021
csandersdev added a commit to csandersdev/FHIR that referenced this issue May 24, 2021
The terminology subsystem caches terminology resources by URL and/or URL
+ version. If the user tries to update a CodeSystem or ValueSet resource
keeping the same URL + version, the cache does not get cleared and some
operations (e.g. validate-code) do not return the expected results after
update. This change adds an operation ($clear-cache) that can be called
on either terminology resource and will clear the appropriate caches.

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>
@lmsurpre
Copy link
Member

A potential workaround for this is to do a rolling restart of the fhir-server pods if you really need to clear the caches.

@JohnTimm
Copy link
Collaborator

JohnTimm commented May 24, 2021

A potential workaround for this is to do a rolling restart of the fhir-server pods if you really need to clear the caches.

@lmsurpre the other option we discussed is using the fhirServer/term/disableCaching configuration option during CodeSystem and ValueSet development. The clear cache operations give finer-grained control over what gets invalidated down to specific value sets.

csandersdev added a commit to csandersdev/FHIR that referenced this issue May 24, 2021
The terminology subsystem caches terminology resources by URL and/or URL
+ version. If the user tries to update a CodeSystem or ValueSet resource
keeping the same URL + version, the cache does not get cleared and some
operations (e.g. validate-code) do not return the expected results after
update. This change adds an operation ($clear-cache) that can be called
on either terminology resource and will clear the appropriate caches.

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>
JohnTimm pushed a commit that referenced this issue Jun 4, 2021
* #2421 - Add terminology clear-cache operations

The terminology subsystem caches terminology resources by URL and/or URL
+ version. If the user tries to update a CodeSystem or ValueSet resource
keeping the same URL + version, the cache does not get cleared and some
operations (e.g. validate-code) do not return the expected results after
update. This change adds an operation ($clear-cache) that can be called
on either terminology resource and will clear the appropriate caches.

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Address test failure due to unexpected test interactions.

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Fix issue with operation ordering on clean database

All my testing has been done on a dirty database. There are automated
build failures that appear to be related to test order and a resource
not existing yet on a clean database. Flipping the order of the resource
puts and initial clear cache operations so that the resource is
guaranteed to be in place.

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Address code format issues

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Split term cache operations into a separate module

Per discussion with the team, the cache operations are being split into
a separate module that will not be included in the default server build.
Since it isn't automatically included, the build automation scripts
needed to be updated.

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Update POM version for new module

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Fix Windows integration, update README

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Apply suggested change

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Apply suggested change

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

Co-authored-by: Lee Surprenant <lmsurpre@us.ibm.com>

* change package name from javax.json to jakarta.json

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

Co-authored-by: Lee Surprenant <lmsurpre@us.ibm.com>
@prb112
Copy link
Contributor

prb112 commented Jun 7, 2021

Corey implemented this feature, I've marked as QA

tbieste pushed a commit that referenced this issue Jun 9, 2021
* #2421 - Add terminology clear-cache operations

The terminology subsystem caches terminology resources by URL and/or URL
+ version. If the user tries to update a CodeSystem or ValueSet resource
keeping the same URL + version, the cache does not get cleared and some
operations (e.g. validate-code) do not return the expected results after
update. This change adds an operation ($clear-cache) that can be called
on either terminology resource and will clear the appropriate caches.

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Address test failure due to unexpected test interactions.

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Fix issue with operation ordering on clean database

All my testing has been done on a dirty database. There are automated
build failures that appear to be related to test order and a resource
not existing yet on a clean database. Flipping the order of the resource
puts and initial clear cache operations so that the resource is
guaranteed to be in place.

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Address code format issues

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Split term cache operations into a separate module

Per discussion with the team, the cache operations are being split into
a separate module that will not be included in the default server build.
Since it isn't automatically included, the build automation scripts
needed to be updated.

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Update POM version for new module

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Fix Windows integration, update README

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Apply suggested change

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

* Apply suggested change

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

Co-authored-by: Lee Surprenant <lmsurpre@us.ibm.com>

* change package name from javax.json to jakarta.json

Signed-off-by: Corey Sanders <corey.thecolonel@gmail.com>

Co-authored-by: Lee Surprenant <lmsurpre@us.ibm.com>
@prb112
Copy link
Contributor

prb112 commented Jul 3, 2021

No further references/Updates, I am closing it as complete.

@prb112 prb112 closed this as completed Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants