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

Implement the delete-history Command #1382

Closed
alexanderkiel opened this issue Jan 3, 2024 · 0 comments · Fixed by #2047
Closed

Implement the delete-history Command #1382

alexanderkiel opened this issue Jan 3, 2024 · 0 comments · Fixed by #2047
Assignees
Labels
enhancement New feature or request module:db
Milestone

Comments

@alexanderkiel
Copy link
Member

alexanderkiel commented Jan 3, 2024

We only like to delete the whole history (except for the current version). So we will implement:

DELETE /:type/:id/_history

Current draft FHIR spec: https://build.fhir.org/http.html#delete-history

Docs: https://github.com/samply/blaze/blob/main/docs/api.md#delete-history

We have to do:

  • we will add a delete-history transaction command
  • add a new entry to the ResourceAsOf index with the t of the new transaction and the identical value except for num-changes set to 1
    • for this we will use d/resource-handle to determine the current value (hash, num-changes and op)
    • if num-changes is already 1 or the resource handle isn't found at all, we will do nothing
    • index entries are build in blaze.db.impl.index.rts-as-of
  • override all history entries in the TypeAsOf and SystemAsOf indices with the t of the new transaction appended to the value
    • this t value is called purged-at
    • we will use d/instance-history to get all resource handles but drop the first one
    • the purged-at value means that the particular history entry was purged at this point in time
  • we have to decrement the num-changes of TypeStats and SystemStats with the amount the deleted history entries
    • this amount will be the difference of num-changes of the resource handle found minus 1
    • if the difference is zero, we won't write new stats index entries
  • for the search parameter indices, there entries will be deleted by Implement Index Garbage Collection #1505
  • d/instance-history will just stop outputting resource handles if num-changes is 1
  • d/type-history and d/system-history will not output a resource handle if it's purged-at value is less or equal the t of the current database state
  • for the read interaction we have to decide wether we like to implement the difference on database layer or interaction layer
  • we need also a new interaction delete-history which will be called on DELETE on the history endpoint
  • we need a new route in blaze.rest-api.routes
  • remove all resource content from the resource store by content hash, except the newest one

This issue is part of the Epic: #399

@alexanderkiel alexanderkiel added enhancement New feature or request module:db labels Jan 3, 2024
@alexanderkiel alexanderkiel added this to the v0.25 milestone Jan 3, 2024
@alexanderkiel alexanderkiel modified the milestones: v0.25, v0.26 Mar 15, 2024
@alexanderkiel alexanderkiel modified the milestones: v0.26, v1.0.0 Apr 15, 2024
@alexanderkiel alexanderkiel modified the milestones: v1.0.0, v0.30.0 Aug 26, 2024
@alexanderkiel alexanderkiel modified the milestones: v0.30.0, v1.0.0 Sep 5, 2024
@alexanderkiel alexanderkiel linked a pull request Sep 15, 2024 that will close this issue
alexanderkiel added a commit that referenced this issue Sep 16, 2024
We need that functions in #1382 for the Jepsen tests.
github-merge-queue bot pushed a commit that referenced this issue Sep 16, 2024
We need that functions in #1382 for the Jepsen tests.
alexanderkiel added a commit that referenced this issue Sep 16, 2024
Before some reducible collections like from the iterators namespace and
such created by the with-open-coll macro did not implement Counted. So
they could not directly counted and instead had to be converted into a
vector first.

Needed by #1382
github-merge-queue bot pushed a commit that referenced this issue Sep 16, 2024
Before some reducible collections like from the iterators namespace and
such created by the with-open-coll macro did not implement Counted. So
they could not directly counted and instead had to be converted into a
vector first.

Needed by #1382
alexanderkiel added a commit that referenced this issue Sep 16, 2024
alexanderkiel added a commit that referenced this issue Sep 16, 2024
github-merge-queue bot pushed a commit that referenced this issue Sep 16, 2024
@alexanderkiel alexanderkiel self-assigned this Sep 30, 2024
@alexanderkiel alexanderkiel modified the milestones: v1.0.0, v0.31.0 Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request module:db
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant