Add command to trigger gc
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
12a0dd3d0a
commit
108fe7823c
@ -74,6 +74,9 @@ var importBenchCmd = &cli.Command{
|
|||||||
Name: "no-import",
|
Name: "no-import",
|
||||||
Usage: "should we import the chain? if set to true chain has to be previously imported",
|
Usage: "should we import the chain? if set to true chain has to be previously imported",
|
||||||
},
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "only-gc",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
vm.BatchSealVerifyParallelism = cctx.Int("batch-seal-verify-threads")
|
vm.BatchSealVerifyParallelism = cctx.Int("batch-seal-verify-threads")
|
||||||
@ -103,11 +106,15 @@ var importBenchCmd = &cli.Command{
|
|||||||
bdgOpt.GcInterval = 0
|
bdgOpt.GcInterval = 0
|
||||||
bdgOpt.Options.SyncWrites = false
|
bdgOpt.Options.SyncWrites = false
|
||||||
bdgOpt.Options.Truncate = true
|
bdgOpt.Options.Truncate = true
|
||||||
|
bdgOpt.Options.DetectConflicts = false
|
||||||
|
bdgOpt.Options.MaxTableSize = 64 << 20
|
||||||
|
|
||||||
bds, err := badger.NewDatastore(tdir, &bdgOpt)
|
bds, err := badger.NewDatastore(tdir, &bdgOpt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bds.CollectGarbage()
|
||||||
bs := blockstore.NewBlockstore(bds)
|
bs := blockstore.NewBlockstore(bds)
|
||||||
cbs, err := blockstore.CachedBlockstore(context.TODO(), bs, blockstore.DefaultCacheOpts())
|
cbs, err := blockstore.CachedBlockstore(context.TODO(), bs, blockstore.DefaultCacheOpts())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -122,11 +129,15 @@ var importBenchCmd = &cli.Command{
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("opening syscall-cache datastore: %w", err)
|
return xerrors.Errorf("opening syscall-cache datastore: %w", err)
|
||||||
}
|
}
|
||||||
|
scds.CollectGarbage()
|
||||||
verifier = &cachingVerifier{
|
verifier = &cachingVerifier{
|
||||||
ds: scds,
|
ds: scds,
|
||||||
backend: verifier,
|
backend: verifier,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if cctx.Bool("only-gc") {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
cs := store.NewChainStore(bs, ds, vm.Syscalls(verifier))
|
cs := store.NewChainStore(bs, ds, vm.Syscalls(verifier))
|
||||||
stm := stmgr.NewStateManager(cs)
|
stm := stmgr.NewStateManager(cs)
|
||||||
|
Loading…
Reference in New Issue
Block a user