Add command to trigger moving GC of hotstore manually
This commit is contained in:
parent
394a7dbb34
commit
5534755f2d
@ -1361,6 +1361,7 @@ type PruneOpts struct {
|
||||
type HotGCOpts struct {
|
||||
Threshold float64
|
||||
Periodic bool
|
||||
Moving bool
|
||||
}
|
||||
|
||||
type EthTxReceipt struct {
|
||||
|
@ -49,8 +49,12 @@ var (
|
||||
|
||||
// GCHotstore runs online GC on the chain state in the hotstore according the to options specified
|
||||
func (s *SplitStore) GCHotStore(opts api.HotGCOpts) error {
|
||||
gcOpts := []bstore.BlockstoreGCOption{bstore.WithThreshold(opts.Threshold)}
|
||||
if opts.Moving {
|
||||
gcOpts := []bstore.BlockstoreGCOption{bstore.WithFullGC(true)}
|
||||
return s.gcBlockstore(s.hot, gcOpts)
|
||||
}
|
||||
|
||||
gcOpts := []bstore.BlockstoreGCOption{bstore.WithThreshold(opts.Threshold)}
|
||||
var err error
|
||||
if opts.Periodic {
|
||||
err = s.gcBlockstore(s.hot, gcOpts)
|
||||
|
16
cli/chain.go
16
cli/chain.go
@ -1620,6 +1620,22 @@ var chainPruneHotGCCmd = &cli.Command{
|
||||
},
|
||||
}
|
||||
|
||||
var chainPruneHotMovingGCCmd = &cli.Command{
|
||||
Name: "hot-moving",
|
||||
Usage: "run moving gc on hotstore",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
api, closer, err := GetFullNodeAPIV1(cctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer closer()
|
||||
ctx := ReqContext(cctx)
|
||||
opts := lapi.HotGCOpts{}
|
||||
opts.Moving = true
|
||||
return api.ChainHotGC(ctx, opts)
|
||||
},
|
||||
}
|
||||
|
||||
var chainPruneColdCmd = &cli.Command{
|
||||
Name: "compact-cold",
|
||||
Usage: "force splitstore compaction on cold store state and run gc",
|
||||
|
Loading…
Reference in New Issue
Block a user