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

Avoid creating unnecessary tables for Resource and DomainResource resource types #713

Closed
lmsurpre opened this issue Feb 18, 2020 · 5 comments
Assignees
Labels
bug Something isn't working P2 Priority 2 - Should Have schema-change a schema change

Comments

@lmsurpre
Copy link
Member

Describe the bug
Follow-on from #623

What about Resource_LOGICAL_RESOURCES, DomainResource_LOGICAL_RESOURCES, Resource_RESOURCES, and DomainResource_RESOURCES tables...are we generating those tables? Do we need them?

John tried to remove these, but something must be trying to use it because he saw a ForeignKeyException that he traced back to these missing tables.

To Reproduce

  1. deploy the schema
  2. look at the tables

Expected behavior
Abstract resources shouldn't have resource tables.

Additional context
The way its designed, we'd need to special case these somehow. Is there a cleaner way?

@lmsurpre
Copy link
Member Author

lmsurpre commented Oct 22, 2020

I added an "includeAbstract" boolean argument for ModelSupport.getResourceTypes() and so we could probably use that to avoid getting Resource and DomainResource. The hard part is investigation whether these tables are really used presently and why...

@lmsurpre
Copy link
Member Author

lmsurpre commented Feb 26, 2021

Robin found the offending lines: https://github.com/IBM/FHIR/blob/main/fhir-persistence-jdbc/src/main/java/com/ibm/fhir/persistence/jdbc/dao/impl/ParameterVisitorBatchDAO.java#L185-L204

It seems to be designed such that search parameter values with a base of Resource will be stored to these tables. However, it turns out that we never actually set the ExtractedParameterValue base (except for component params) and so they're never actually used. Furthermore, Robin points out that these RESOURCE_XXX_VALUES tables have a foreign key to the RESOURCE_LOGICAL_RESOURCES tables which are never populated...so its definitely not a usable design. This should get cleaned up as part of #1921.

@lmsurpre
Copy link
Member Author

lmsurpre commented Jun 1, 2021

Question: Should we remove these unneeded tables as part of schema migration?

team decision: yes. but we should ensure there is no data in these tables before we delete them. if there is data in these tables somehow, then fail the upgrade. (or finish the upgrade and just log as warning?)

Question: what to do with the corresponding entries in FHIR_ADMIN.VERSION_HISTORY ?

options:
A. add an audit trail to document what has been executed, and remove the corresponding rows for these tables in VERSION_HISTORY
B. just write the new version to this entry in the VERSION_HISTORY table and that version will mean "its deleted" for these particular tables. The concern here is that we want a freshly installed schema to look the same as a migrated one.

@lmsurpre
Copy link
Member Author

lmsurpre commented Nov 4, 2021

bumping to a P2 because, now that we are publishing multiple versions of all us-core and carin-bb search parameters, we get A LOT of warnings (on each request) if those are installed and the user hasn't disambiguated the versions.

@lmsurpre lmsurpre added P2 Priority 2 - Should Have and removed P3 Priority 3 - Nice To Have labels Nov 4, 2021
@prb112 prb112 self-assigned this Nov 4, 2021
@prb112 prb112 added the schema-change a schema change label Nov 4, 2021
prb112 added a commit that referenced this issue Nov 5, 2021
resource types #713

- Checks for DOMAINRESOURCE and RESOURCE tables view
- Removes the artifacts
- Bonus: added fix for null condition on a code in
DefaultMemberMatchStrategy

Signed-off-by: Paul Bastide <pbastide@us.ibm.com>
prb112 added a commit that referenced this issue Nov 9, 2021
Avoid creating unnecessary tables for Resource and DomainResource resource types #713
@d0roppe
Copy link
Collaborator

d0roppe commented Nov 9, 2021

verified that the targeted tables are not created in a update-schema, and are removed when issuing an update-schema on an older schema definition.

@d0roppe d0roppe closed this as completed Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P2 Priority 2 - Should Have schema-change a schema change
Projects
None yet
Development

No branches or pull requests

3 participants