Skip to content

Change account layout #451

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

Merged
merged 6 commits into from
Jul 15, 2025
Merged

Change account layout #451

merged 6 commits into from
Jul 15, 2025

Conversation

bmuddha
Copy link
Contributor

@bmuddha bmuddha commented Jul 12, 2025

Modify account layout in accounts database:

  1. reuse slack space which is available in block allocation if possible,
    this avoids reallocation of accounts if the data field grows
    insignificantly.
  2. track account owner change to avoid index checks in happy path

depends on #419
closes #443
closes #441

Greptile Summary

Major refactoring of AccountsDB storage and indexing system to optimize account data storage and improve performance through block space reuse and owner tracking.

  • Consolidated multiple LMDB environments into a single environment and introduced new Table abstraction in magicblock-accounts-db/src/index/table.rs for better database operation encapsulation
  • Modified account serialization in magicblock-accounts-db/src/lib.rs to reuse slack space in block allocations, reducing unnecessary reallocations for small data growth
  • Added owner change tracking to optimize index checks by skipping them in the happy path when owner hasn't changed
  • Improved LMDB iteration safety and efficiency in magicblock-accounts-db/src/index/iterator.rs by removing manual cursor management
  • Changed program account iteration behavior to return empty iterators instead of NotFound errors for better API consistency

@bmuddha bmuddha self-assigned this Jul 12, 2025
@Dodecahedr0x Dodecahedr0x added documentation Improvements or additions to documentation feature labels Jul 12, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

10 files reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

@bmuddha bmuddha force-pushed the bmuddha/feat/change-account-layout branch from 87a0614 to 034fee7 Compare July 12, 2025 07:42
@bmuddha bmuddha changed the base branch from master to dev July 12, 2025 09:44
bmuddha added 6 commits July 12, 2025 17:04
1. reuse slack space which is available in block allocation if possible,
   this avoids reallocation of accounts if the data field grows
   insignificantly.
2. track account owner change to avoid index checks in happy path
@bmuddha bmuddha force-pushed the bmuddha/feat/change-account-layout branch from c5951a2 to 9ca8678 Compare July 12, 2025 13:05
@bmuddha bmuddha changed the title Draft: change account layout Change account layout Jul 12, 2025
@bmuddha bmuddha merged commit 1ce6943 into dev Jul 15, 2025
4 checks passed
@bmuddha bmuddha deleted the bmuddha/feat/change-account-layout branch July 15, 2025 15:18
thlorenz added a commit that referenced this pull request Jul 17, 2025
* dev:
  feat: CLI configuration (#447)
  Track delegation status (#452)
  Change account layout (#451)
thlorenz added a commit that referenced this pull request Jul 23, 2025
* master:
  Special case for "fat" ledger. Use compaction + CompactionFilter (#413)
  feat: make eager lookup table preparation configurable (#470)
  feat: improve lookup table overhead for cloning pipeline (#457)
  feat: CLI configuration (#447)
  Track delegation status (#452)
  Change account layout (#451)
  fix: prevent new subscriptions if no free connections exist (#456)
  chore: avoid CU budget exceeded for lookup table management (#455)
thlorenz added a commit that referenced this pull request Jul 24, 2025
* master:
  Special case for "fat" ledger. Use compaction + CompactionFilter (#413)
  feat: make eager lookup table preparation configurable (#470)
  feat: improve lookup table overhead for cloning pipeline (#457)
  feat: CLI configuration (#447)
  Track delegation status (#452)
  Change account layout (#451)
  fix: prevent new subscriptions if no free connections exist (#456)
  chore: avoid CU budget exceeded for lookup table management (#455)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation feature
Projects
None yet
3 participants