Add command to trigger moving GC of hotstore manually

This commit is contained in:
zenground0 2023-03-06 11:59:08 -07:00
parent 394a7dbb34
commit 5534755f2d
3 changed files with 22 additions and 1 deletions

View File

@ -1361,6 +1361,7 @@ type PruneOpts struct {
type HotGCOpts struct {
Threshold float64
Periodic bool
Moving bool
}
type EthTxReceipt struct {

View File

@ -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)

View File

@ -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",