diff --git a/pkg/super_node/btc/cleaner.go b/pkg/super_node/btc/cleaner.go index 6d686a51..cf39cd5b 100644 --- a/pkg/super_node/btc/cleaner.go +++ b/pkg/super_node/btc/cleaner.go @@ -86,7 +86,9 @@ func (c *Cleaner) vacuumAnalyze(t shared.DataType) error { if err := c.vacuumTxInputs(); err != nil { return err } - return c.vacuumTxOutputs() + if err := c.vacuumTxOutputs(); err != nil { + return err + } case shared.Transactions: if err := c.vacuumTxs(); err != nil { return err @@ -94,10 +96,13 @@ func (c *Cleaner) vacuumAnalyze(t shared.DataType) error { if err := c.vacuumTxInputs(); err != nil { return err } - return c.vacuumTxOutputs() + if err := c.vacuumTxOutputs(); err != nil { + return err + } default: return fmt.Errorf("btc cleaner unrecognized type: %s", t.String()) } + return c.vacuumIPLDs() } func (c *Cleaner) vacuumHeaders() error { @@ -120,6 +125,11 @@ func (c *Cleaner) vacuumTxOutputs() error { return err } +func (c *Cleaner) vacuumIPLDs() error { + _, err := c.db.Exec(`VACUUM ANALYZE public.blocks`) + return err +} + func (c *Cleaner) cleanFull(tx *sqlx.Tx, rng [2]uint64) error { if err := c.cleanTransactionIPLDs(tx, rng); err != nil { return err diff --git a/pkg/super_node/eth/cleaner.go b/pkg/super_node/eth/cleaner.go index b7ccaf87..c3496504 100644 --- a/pkg/super_node/eth/cleaner.go +++ b/pkg/super_node/eth/cleaner.go @@ -105,14 +105,20 @@ func (c *Cleaner) vacuumAnalyze(t shared.DataType) error { case shared.Full, shared.Headers: return c.vacuumFull() case shared.Uncles: - return c.vacuumUncles() + if err := c.vacuumUncles(); err != nil { + return err + } case shared.Transactions: if err := c.vacuumTxs(); err != nil { return err } - return c.vacuumRcts() + if err := c.vacuumRcts(); err != nil { + return err + } case shared.Receipts: - return c.vacuumRcts() + if err := c.vacuumRcts(); err != nil { + return err + } case shared.State: if err := c.vacuumState(); err != nil { return err @@ -120,12 +126,17 @@ func (c *Cleaner) vacuumAnalyze(t shared.DataType) error { if err := c.vacuumAccounts(); err != nil { return err } - return c.vacuumStorage() + if err := c.vacuumStorage(); err != nil { + return err + } case shared.Storage: - return c.vacuumStorage() + if err := c.vacuumStorage(); err != nil { + return err + } default: return fmt.Errorf("eth cleaner unrecognized type: %s", t.String()) } + return c.vacuumIPLDs() } func (c *Cleaner) vacuumFull() error { @@ -185,6 +196,11 @@ func (c *Cleaner) vacuumStorage() error { return err } +func (c *Cleaner) vacuumIPLDs() error { + _, err := c.db.Exec(`VACUUM ANALYZE public.blocks`) + return err +} + func (c *Cleaner) cleanFull(tx *sqlx.Tx, rng [2]uint64) error { if err := c.cleanStorageIPLDs(tx, rng); err != nil { return err