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

refactor(katana-db): convert StorageChangeSet into a normal table #1774

Merged
merged 4 commits into from
Apr 6, 2024

Conversation

kariy
Copy link
Member

@kariy kariy commented Apr 5, 2024

Resolves #1762

Convert StorageChangeSet into a normal table instead of dupsort.

This change is so to allow the block list of the StorageChangeSet to grow without being bounded by the value size of a DUPSORT table.

The max size for a DUPSORT table value is equal to the max size of the table key. So, when the list cardinality increases too much, the resulting subkey size will become larger than the max size. This will result in a MDBX_BAD_VALSIZE error.

@kariy
Copy link
Member Author

kariy commented Apr 5, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @kariy and the rest of your teammates on Graphite Graphite

@kariy kariy changed the title make StorageChangeSet table a normal non-dupsort table refactor(katana-db: make StorageChangeSet table a normal non-dupsort table Apr 5, 2024
@kariy kariy changed the title refactor(katana-db: make StorageChangeSet table a normal non-dupsort table refactor(katana-db): make StorageChangeSet table a normal non-dupsort table Apr 5, 2024
@kariy kariy changed the title refactor(katana-db): make StorageChangeSet table a normal non-dupsort table refactor(katana-db): convert StorageChangeSet into a normal table Apr 5, 2024
@kariy kariy added the katana This issue is related to Katana label Apr 5, 2024
@kariy kariy marked this pull request as ready for review April 5, 2024 09:58
Copy link

codecov bot commented Apr 5, 2024

Codecov Report

Attention: Patch coverage is 85.07463% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 67.19%. Comparing base (9c8b3b0) to head (bf93d45).
Report is 1 commits behind head on main.

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

Files Patch % Lines
...es/katana/storage/provider/src/providers/db/mod.rs 73.07% 7 Missing ⚠️
.../katana/storage/provider/src/providers/db/state.rs 85.71% 2 Missing ⚠️
crates/katana/storage/db/src/codecs/postcard.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1774      +/-   ##
==========================================
- Coverage   67.42%   67.19%   -0.24%     
==========================================
  Files         305      305              
  Lines       33523    33607      +84     
==========================================
- Hits        22603    22582      -21     
- Misses      10920    11025     +105     

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

Copy link
Collaborator

@glihm glihm left a comment

Choose a reason for hiding this comment

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

So normal tables should not be limited at all, right? Or is there any other boundary we need to be aware of in testing?

@kariy
Copy link
Member Author

kariy commented Apr 6, 2024

So normal tables should not be limited at all, right?

Basically yes. In this context, value size of a normal table will have a much higher upper bound than that of a dupsort table.

Or is there any other boundary we need to be aware of in testing?

These are the limitations set by mdbx for key/value size:

Key size: minimum 0, maximum ≈½ pagesize (2022 bytes for default 4K pagesize, 32742 bytes for 64K pagesize).
Value size: minimum 0, maximum 2146435072 (0x7FF00000) bytes for maps, ≈½ pagesize for multimaps (2022 bytes for default 4K pagesize, 32742 bytes for 64K pagesize).

but for DUPSORT, iiuc the data item in a DUPSORT is just another key in the underlying BTree map and thus must follow the key size constraint.

but because subkey of a dusport table is

@kariy
Copy link
Member Author

kariy commented Apr 6, 2024

Merge activity

  • Apr 5, 9:34 PM EDT: @kariy started a stack merge that includes this pull request via Graphite.
  • Apr 5, 9:35 PM EDT: Graphite rebased this pull request as part of a merge.
  • Apr 5, 9:36 PM EDT: @kariy merged this pull request with Graphite.

Base automatically changed from fix/storage-change-set to main April 6, 2024 01:34
@kariy kariy merged commit 2de878e into main Apr 6, 2024
10 checks passed
@kariy kariy deleted the change-dupsort branch April 6, 2024 01:36
kariy added a commit that referenced this pull request Apr 24, 2024
bump database version to `1` for the next release due to breaking changes introduced in #1773, #1774, #1775
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
katana This issue is related to Katana
Projects
None yet
Development

Successfully merging this pull request may close these issues.

StorageChangeSet value exceeding the libmdx max value size
2 participants