diff --git a/builtin/v13/migration/market.go b/builtin/v13/migration/market.go index 012fd83e..6f122a8f 100644 --- a/builtin/v13/migration/market.go +++ b/builtin/v13/migration/market.go @@ -313,12 +313,13 @@ func (m *marketMigrator) migrateProviderSectorsAndStatesFromScratch(ctx context. var oldState market12.DealState var newState market13.DealState - + var cnt int err = oldStateArray.ForEach(&oldState, func(i int64) error { // Refresh proposals array periodically to avoid holding onto all ~10GB of memory // throughout whole migration. // This has limited impact on caching speedups because the access pattern is sequential. - if i%(int64(proposalsSize)/1000) == 0 { + cnt += 1 + if proposalsSize > 0 && cnt%(int(proposalsSize/1000)) == 0 { proposalsArr, err = adt.AsArray(ctxStore, proposals, market12.ProposalsAmtBitwidth) if err != nil { return xerrors.Errorf("failed to load proposals array: %w", err)