-
Notifications
You must be signed in to change notification settings - Fork 583
Description
I realized that the initial ledger migration in the converting merkle tree is written with one set_batch_accounts
on all the accounts in the ledger:
mina/src/lib/merkle_ledger/converting_merkle_tree.ml
Lines 68 to 75 in 2c70f34
let of_ledgers_with_migration primary_ledger converting_ledger = | |
assert (Converting_ledger.num_accounts converting_ledger = 0) ; | |
let accounts = | |
Primary_ledger.foldi primary_ledger ~init:[] ~f:(fun addr acc account -> | |
(addr, convert account) :: acc ) | |
in | |
Converting_ledger.set_batch_accounts converting_ledger accounts ; | |
{ primary_ledger; converting_ledger } |
This is going to cause the daemon to become unresponsive for that entire operation, as it will have to rehash all the accounts and recreate the auxiliary tables in the database in a single async job. This could cause networking bugs like the one fixed in #17874; at the very least it will result in a poor user experience if the daemon randomly becomes unresponsive to commands.
We can likely fix this simply by having a new ledger interface method like set_batch_accounts
that returns a unit Deferred.t
, and which would do its various operations in chunks, giving the scheduler the opportunity to run other async jobs (like handling networking).
Metadata
Metadata
Assignees
Labels
Type
Projects
Status