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

Integrate Bytes operation value #552

Closed
wants to merge 16 commits into from
Closed

Conversation

sandreae
Copy link
Member

@sandreae sandreae commented Sep 6, 2023

MIGRATED TO: #554

  • store Bytes in the database in a new "data" column in the operation_field_v1 table (not supported by Postgres....)
  • when handling fields of the type Bytes we look at this column instead of "value"
  • in the GraphQL bytes are represented by HexBytesScalar

📋 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

@sandreae sandreae changed the base branch from main to development September 6, 2023 22:21
@codecov
Copy link

codecov bot commented Sep 6, 2023

Codecov Report

Patch coverage: 87.79% and project coverage change: -0.17% ⚠️

Comparison is base (a404d0c) 92.50% compared to head (47c902f) 92.34%.
Report is 3 commits behind head on development.

❗ Current head 47c902f differs from pull request most recent head b55ebcd. Consider uploading reports for the commit b55ebcd to get more accurate results

Additional details and impacted files
@@               Coverage Diff               @@
##           development     #552      +/-   ##
===============================================
- Coverage        92.50%   92.34%   -0.17%     
===============================================
  Files              105      106       +1     
  Lines            17932    18027      +95     
===============================================
+ Hits             16588    16647      +59     
- Misses            1344     1380      +36     
Files Changed Coverage Δ
aquadoggo/src/db/models/document.rs 100.00% <ø> (ø)
aquadoggo/src/db/models/operation.rs 33.33% <ø> (ø)
aquadoggo/src/db/models/query.rs 100.00% <ø> (ø)
aquadoggo/src/db/stores/entry.rs 99.40% <ø> (ø)
aquadoggo/src/db/stores/schema.rs 98.37% <ø> (ø)
aquadoggo/src/db/types/entry.rs 90.00% <ø> (ø)
aquadoggo/src/db/types/operation.rs 88.00% <ø> (ø)
aquadoggo/src/graphql/queries/collection.rs 99.60% <ø> (ø)
...ggo/src/graphql/scalars/document_view_id_scalar.rs 78.57% <ø> (ø)
aquadoggo/src/graphql/scalars/hex_bytes_scalar.rs 0.00% <0.00%> (ø)
... and 29 more

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

@sandreae
Copy link
Member Author

sandreae commented Sep 6, 2023

SQLite has BLOB type for binary data, Postgres has Large Object or bytea....

Comment on lines +48 to +50
/// Data field used to store blob_piece_v1 bytes
#[sqlx(default)]
pub data: Option<Vec<u8>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting pattern! I wonder if we have other types there one day as well.

I'd name this column value_bytes to underline it's origin from an operation field and maybe keep the door open to have other field types as well.

@adzialocha
Copy link
Member

adzialocha commented Sep 7, 2023

SQLite has BLOB type for binary data, Postgres has Large Object or bytea....

Time to drop support? 😥 Or we use hexadecimal strings for now until we find a better solution anyhow (see my comment below)?

@adzialocha
Copy link
Member

adzialocha commented Sep 7, 2023

Did you consider not storing blob pieces values at all in the database and retrieve the bytes from the file instead during replication?

https://doc.rust-lang.org/std/io/trait.Seek.html 😎 .. and interesting for writing: https://doc.rust-lang.org/std/io/struct.Cursor.html

I don't think it is too hard but also definitely not required for this development period, I've made a ticket here: #553

@sandreae
Copy link
Member Author

sandreae commented Sep 7, 2023

Did you consider not storing blob pieces values at all in the database and retrieve the bytes from the file instead during replication?

https://doc.rust-lang.org/std/io/trait.Seek.html 😎 .. and interesting for writing: https://doc.rust-lang.org/std/io/struct.Cursor.html

I don't think it is too hard but also definitely not required for this development period, I've made a ticket here: #553

Yeh, this would be ideal. We still store the encoded operation in the db, so we wouldn't actually need to grab the bytes during replication either. Don't know if I want to tackle it right now though but it could be soon 👍 .

@sandreae sandreae mentioned this pull request Sep 7, 2023
4 tasks
@sandreae sandreae closed this Sep 7, 2023
@adzialocha adzialocha deleted the integrate-bytes-value branch September 8, 2023 09:45
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.

2 participants