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

Migration for address table of existing data #1887

Open
Cmdv opened this issue Oct 31, 2024 · 2 comments · May be fixed by #1888
Open

Migration for address table of existing data #1887

Cmdv opened this issue Oct 31, 2024 · 2 comments · May be fixed by #1888
Assignees

Comments

@Cmdv
Copy link
Contributor

Cmdv commented Oct 31, 2024

It was asked on our discord

Does turning on use_address_table config option require full resync?

The current answer is yes but we could provide some form of migration if the database is already populated.

Investigate if this is possible to do as part of the schema variation when using use_address_table config

@Cmdv Cmdv self-assigned this Oct 31, 2024
@kderme
Copy link
Contributor

kderme commented Oct 31, 2024

One possible way to implement this is to follow steps

  • Create a new table tx_out_use_address with the same schema as tx_out with enabled use_address_table
  • Query pages of the tx_out table. For each page, extract the address related fields and insert them into the address table and use the returned address.id to create a use_address_table page.
  • The (address.id, address) pairs should be cached. Since db-sync won't have parsed the ledger state yet, meaning enough available memory, it could cache all of the entries without evicting any.
  • When all pages are complete, drop the tx_out table and rename tx_out_use_address to tx_out
  • Clean the address pairs from the cache.
  • Start db-sync

It's not trivial at all and the migration will still take some time.

@Cmdv Cmdv linked a pull request Oct 31, 2024 that will close this issue
9 tasks
@rdlrt
Copy link

rdlrt commented Oct 31, 2024

Wouldnt this anyways touch each and every tx_out entry, making timeline similar (as in maybe 50-60%) to synching from scratch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

3 participants