Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
awskii committed Jan 7, 2024
1 parent 3adb48f commit db5fdbf
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions erigon-lib/state/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -2114,16 +2114,16 @@ func (dc *DomainContext) Prune(ctx context.Context, rwTx kv.RwTx, step, txFrom,
// "keys until limit", limit,
// "pruned steps", fmt.Sprintf("%d-%d", prunedMinStep, prunedMaxStep))
//}()
pruningStep, prunedKey, err := GetExecV3PruneProgress(rwTx, dc.d.keysTable)
_, prunedKey, err := GetExecV3PruneProgress(rwTx, dc.d.keysTable)
if err != nil {
dc.d.logger.Error("get domain pruning progress", "name", dc.d.filenameBase, "error", err)
err = nil
}

srcStep := step
//srcStep := step
var k, v []byte
if prunedKey != nil {
step = pruningStep
//step = pruningStep
k, v, err = keysCursor.Seek(prunedKey)
} else {
k, v, err = keysCursor.Last()
Expand All @@ -2134,19 +2134,16 @@ func (dc *DomainContext) Prune(ctx context.Context, rwTx kv.RwTx, step, txFrom,

var seek = make([]byte, 0, 256)

withNewStep:
//withNewStep:
for k != nil {
if err != nil {
return stat, fmt.Errorf("iterate over %s domain keys: %w", dc.d.filenameBase, err)
}

is := ^binary.BigEndian.Uint64(v)
if is > step {
if err := SaveExecV3PruneProgress(rwTx, dc.d.keysTable, step, k); err != nil {
dc.d.logger.Error("save domain pruning progress", "name", dc.d.filenameBase, "error", err)
}

k, v, err = keysCursor.PrevNoDup()
mxPruneDbgSizeDomainSkipBeforeFirst.Inc()
continue
}
if limit == 0 {
Expand Down Expand Up @@ -2196,10 +2193,10 @@ withNewStep:
if err := SaveExecV3PruneProgress(rwTx, dc.d.keysTable, 0, nil); err != nil {
dc.d.logger.Error("reset domain pruning progress", "name", dc.d.filenameBase, "error", err)
}
if limit > 0 && srcStep > step {
step = srcStep
goto withNewStep
}
//if limit > 0 && srcStep > step {
// step = srcStep
// goto withNewStep
//}
mxPruneTookDomain.ObserveDuration(st)
return stat, nil
}
Expand Down

0 comments on commit db5fdbf

Please sign in to comment.