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

Enable deletion of dangling document_views and related document_view_fields from db #491

Merged
merged 11 commits into from
Aug 9, 2023

Conversation

sandreae
Copy link
Member

@sandreae sandreae commented Aug 8, 2023

  • add fk relation with cascading delete between document_view_fields and document_views
  • introduce method to DocumentStore which takes a DocumentId and deletes any unpinned+not current views

📋 Checklist

  • Add tests that cover your changes
  • Add this PR to the Unreleased section in CHANGELOG.md
  • Link this PR to any issues it closes
  • New files contain a SPDX license header

@codecov
Copy link

codecov bot commented Aug 8, 2023

Codecov Report

Patch coverage: 95.75% and project coverage change: +3.47% 🎉

Comparison is base (c5123aa) 88.60% compared to head (55aac32) 92.07%.
Report is 213 commits behind head on development.

❗ Current head 55aac32 differs from pull request most recent head 9255ddc. Consider uploading reports for the commit 9255ddc to get more accurate results

Additional details and impacted files
@@               Coverage Diff               @@
##           development     #491      +/-   ##
===============================================
+ Coverage        88.60%   92.07%   +3.47%     
===============================================
  Files               42      100      +58     
  Lines             2202    16022   +13820     
===============================================
+ Hits              1951    14752   +12801     
- Misses             251     1270    +1019     
Files Changed Coverage Δ
aquadoggo/src/db/errors.rs 0.00% <0.00%> (ø)
aquadoggo/src/db/models/operation.rs 33.33% <ø> (ø)
aquadoggo/src/db/stores/query.rs 96.13% <ø> (ø)
aquadoggo/src/graphql/input_values/meta_filter.rs 0.00% <0.00%> (ø)
aquadoggo/src/materializer/input.rs 10.00% <0.00%> (+10.00%) ⬆️
aquadoggo/src/materializer/tasks/reduce.rs 95.28% <ø> (+95.28%) ⬆️
aquadoggo/src/materializer/tasks/schema.rs 88.23% <ø> (+88.23%) ⬆️
aquadoggo/src/materializer/worker.rs 92.04% <ø> (+3.58%) ⬆️
aquadoggo/src/network/behaviour.rs 59.45% <ø> (ø)
aquadoggo/src/network/config.rs 100.00% <ø> (ø)
... and 90 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sandreae sandreae marked this pull request as ready for review August 8, 2023 14:12
@sandreae sandreae changed the base branch from main to development August 8, 2023 15:08
@sandreae sandreae changed the title Store method for deleting dangling document_views rows and related document_view_fields from db Store method for deleting dangling document_views and related document_view_fields from db Aug 8, 2023
@sandreae sandreae changed the title Store method for deleting dangling document_views and related document_view_fields from db Implement deleting dangling document_views and related document_view_fields from db Aug 8, 2023
@sandreae sandreae changed the title Implement deleting dangling document_views and related document_view_fields from db Implement deletion of dangling document_views and related document_view_fields from db Aug 8, 2023
@sandreae sandreae changed the title Implement deletion of dangling document_views and related document_view_fields from db Enable deletion of dangling document_views and related document_view_fields from db Aug 8, 2023
@sandreae
Copy link
Member Author

sandreae commented Aug 8, 2023

Need to make it work with postgres...

@adzialocha
Copy link
Member

Need to make it work with postgres...

Maybe drop PostgreSQL Support? 🙈

@sandreae sandreae merged commit a6981fd into development Aug 9, 2023
8 checks passed
@adzialocha adzialocha deleted the document-view-garbage-collection branch August 17, 2023 12:48
sandreae added a commit that referenced this pull request Aug 31, 2023
…ew_fields` from db (#491)

* Add fk to document_view_fields with cascading DELETE

* Introduce `prune_document_views` method to `DocumentStore`

* Test for pruning document views

* Test that pinned views don't get deleted

* Update CHANGELOG

* Clippy

* Remove fk constraint on `operation_id` in `document_view_fields` table

* Change table creation order in documents migration

* Use IS NULL in SQL conditional

* Don't use alias in SQL query
adzialocha added a commit that referenced this pull request Sep 8, 2023
* development:
  Make sure `/tmp` directory does not run out of scope before application ends (#557)
  Integrate `Bytes` value (#554)
  Stream blob data in chunks to files to not occupy too much memory (#551)
  Blobs directory configuration (#549)
  Use correct MAX_BLOB_PIECE_LENGTH from p2panda_rs
  Build a byte buffer over paginated pieces when assembling blobs (#547)
  HTTP routes to serve files with correct content type and etag headers (#544)
  Task for automatic garbage collection of unused documents and views (#500)
  Refactor tmp blob dir creation after rebase
  Fix after rebase
  "blob" materializer task (#493)
  Add static file server to `http` service (#483)
  Enable deletion of dangling `document_views` and related `document_view_fields` from db  (#491)
  BlobStore for retrieving raw blob data from the db (#484)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Method on DocumentStore for deleting dangling document_views and document_view_fields
2 participants