Skip to content

Commit

Permalink
address all last nits and concerns (@walldiss @vgonkivs)
Browse files Browse the repository at this point in the history
  • Loading branch information
renaynay committed Jan 17, 2025
1 parent fce29c6 commit 8654085
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nodebuilder/pruner/migration_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (

var (
storePrefix = datastore.NewKey("full_avail")
previousModeKey = datastore.NewKey("previous_run")
previousModeKey = datastore.NewKey("previous_mode")
)

// detectFirstRun is a temporary function that serves to assist migration to the refactored pruner
Expand Down
6 changes: 5 additions & 1 deletion nodebuilder/pruner/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ func convertToPruned() fx.Option {
return err
}

// if we convert the node from archival to pruned, we need to reset the checkpoint
// to ensure the node goes back and deletes *all* blocks older than the
// availability window, as archival "pruning" only trims the .q4 file,
// but retains the ODS.
if convert {
return p.ClearCheckpoint(ctx)
return p.ResetCheckpoint(ctx)
}

return nil
Expand Down
2 changes: 2 additions & 0 deletions nodebuilder/tests/prune_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build pruning || integration

package tests

import (
Expand Down
2 changes: 1 addition & 1 deletion pruner/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (s *Service) LastPruned(ctx context.Context) (uint64, error) {
return s.checkpoint.LastPrunedHeight, nil
}

func (s *Service) ClearCheckpoint(ctx context.Context) error {
func (s *Service) ResetCheckpoint(ctx context.Context) error {
s.checkpoint = newCheckpoint()
return storeCheckpoint(ctx, s.ds, s.checkpoint)
}
Expand Down
2 changes: 1 addition & 1 deletion pruner/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ func TestService_ClearCheckpoint(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, oldCp, serv.checkpoint)

err = serv.ClearCheckpoint(ctx)
err = serv.ResetCheckpoint(ctx)
require.NoError(t, err)

err = serv.loadCheckpoint(ctx)
Expand Down
2 changes: 1 addition & 1 deletion share/availability/full/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

var (
storePrefix = datastore.NewKey("full_avail")
previousModeKey = datastore.NewKey("previous_run")
previousModeKey = datastore.NewKey("previous_mode")
pruned = []byte("pruned")
archival = []byte("archival")
)
Expand Down

0 comments on commit 8654085

Please sign in to comment.