mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-11 13:30:05 +00:00
mdbx_to_mdbx: clean table before load
This commit is contained in:
parent
bf8c916afe
commit
82b8455635
@ -413,7 +413,7 @@ func mdbxToMdbx(ctx context.Context, logger log.Logger, from, to string) error {
|
|||||||
src := mdbx2.NewMDBX(logger).Path(from).Flags(func(flags uint) uint { return mdbx.Readonly | mdbx.Accede }).MustOpen()
|
src := mdbx2.NewMDBX(logger).Path(from).Flags(func(flags uint) uint { return mdbx.Readonly | mdbx.Accede }).MustOpen()
|
||||||
dst := mdbx2.NewMDBX(logger).Path(to).
|
dst := mdbx2.NewMDBX(logger).Path(to).
|
||||||
WriteMap().
|
WriteMap().
|
||||||
Flags(func(flags uint) uint { return flags | mdbx.NoMemInit | mdbx.WriteMap }).
|
Flags(func(flags uint) uint { return flags | mdbx.NoMemInit | mdbx.WriteMap | mdbx.Accede }).
|
||||||
MustOpen()
|
MustOpen()
|
||||||
return kv2kv(ctx, src, dst)
|
return kv2kv(ctx, src, dst)
|
||||||
}
|
}
|
||||||
@ -430,7 +430,7 @@ func kv2kv(ctx context.Context, src, dst kv.RwDB) error {
|
|||||||
}
|
}
|
||||||
defer dstTx.Rollback()
|
defer dstTx.Rollback()
|
||||||
|
|
||||||
commitEvery := time.NewTicker(30 * time.Second)
|
commitEvery := time.NewTicker(5 * time.Minute)
|
||||||
defer commitEvery.Stop()
|
defer commitEvery.Stop()
|
||||||
|
|
||||||
var total uint64
|
var total uint64
|
||||||
@ -440,6 +440,7 @@ func kv2kv(ctx context.Context, src, dst kv.RwDB) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rawdbreset.WarmupTable(ctx, src, name)
|
rawdbreset.WarmupTable(ctx, src, name)
|
||||||
|
_ = dstTx.ClearBucket(name)
|
||||||
c, err := dstTx.RwCursor(name)
|
c, err := dstTx.RwCursor(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user