diff --git a/build/openrpc/worker.json.gz b/build/openrpc/worker.json.gz index 21c8bf5ee..72a40797a 100644 Binary files a/build/openrpc/worker.json.gz and b/build/openrpc/worker.json.gz differ diff --git a/storage/sealer/ffiwrapper/sealer_test.go b/storage/sealer/ffiwrapper/sealer_test.go index 654caf784..dd0c1e184 100644 --- a/storage/sealer/ffiwrapper/sealer_test.go +++ b/storage/sealer/ffiwrapper/sealer_test.go @@ -327,7 +327,7 @@ func TestSealAndVerify(t *testing.T) { post(t, sb, nil, s) - if err := sb.FinalizeSector(context.TODO(), si, nil); err != nil { + if err := sb.FinalizeSector(context.TODO(), si); err != nil { t.Fatalf("%+v", err) } @@ -390,7 +390,7 @@ func TestSealPoStNoCommit(t *testing.T) { precommit := time.Now() - if err := sb.FinalizeSector(context.TODO(), si, nil); err != nil { + if err := sb.FinalizeSector(context.TODO(), si); err != nil { t.Fatal(err) } diff --git a/storage/sealer/manager.go b/storage/sealer/manager.go index c919a4f5c..dda4bba08 100644 --- a/storage/sealer/manager.go +++ b/storage/sealer/manager.go @@ -642,12 +642,9 @@ func (m *Manager) FinalizeSector(ctx context.Context, sector storiface.SectorRef } /* - We want to: - * Trim cache - * (partially) free unsealed data - * Move stuff to long-term storage - + - Trim cache + - Move stuff to long-term storage */ // remove redundant copies if there are any diff --git a/storage/sealer/manager_test.go b/storage/sealer/manager_test.go index a633aaef4..2c58b6f39 100644 --- a/storage/sealer/manager_test.go +++ b/storage/sealer/manager_test.go @@ -148,7 +148,7 @@ func TestSimple(t *testing.T) { defer cleanup() localTasks := []sealtasks.TaskType{ - sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch, + sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTReleaseUnsealed, sealtasks.TTFetch, } err := m.AddWorker(ctx, newTestWorker(WorkerConfig{ @@ -207,7 +207,7 @@ func TestSnapDeals(t *testing.T) { localTasks := []sealtasks.TaskType{ sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTPreCommit2, sealtasks.TTCommit1, sealtasks.TTCommit2, sealtasks.TTFinalize, sealtasks.TTFetch, sealtasks.TTReplicaUpdate, sealtasks.TTProveReplicaUpdate1, sealtasks.TTProveReplicaUpdate2, sealtasks.TTUnseal, - sealtasks.TTRegenSectorKey, + sealtasks.TTRegenSectorKey, sealtasks.TTReleaseUnsealed, } wds := datastore.NewMapDatastore() @@ -304,13 +304,13 @@ func TestSnapDeals(t *testing.T) { fmt.Printf("Decode\n") // Remove unsealed data and decode for retrieval - require.NoError(t, m.FinalizeSector(ctx, sid, nil)) + require.NoError(t, m.ReleaseUnsealed(ctx, sid, nil)) startDecode := time.Now() require.NoError(t, m.SectorsUnsealPiece(ctx, sid, 0, p1.Size.Unpadded(), ticket, &out.NewUnsealed)) fmt.Printf("Decode duration (%s): %s\n", ss.ShortString(), time.Since(startDecode)) // Remove just the first piece and decode for retrieval - require.NoError(t, m.FinalizeSector(ctx, sid, []storiface.Range{{Offset: p1.Size.Unpadded(), Size: p2.Size.Unpadded()}})) + require.NoError(t, m.ReleaseUnsealed(ctx, sid, []storiface.Range{{Offset: p1.Size.Unpadded(), Size: p2.Size.Unpadded()}})) require.NoError(t, m.SectorsUnsealPiece(ctx, sid, 0, p1.Size.Unpadded(), ticket, &out.NewUnsealed)) fmt.Printf("GSK\n") @@ -320,7 +320,7 @@ func TestSnapDeals(t *testing.T) { fmt.Printf("GSK duration (%s): %s\n", ss.ShortString(), time.Since(startGSK)) fmt.Printf("Remove data\n") - require.NoError(t, m.FinalizeSector(ctx, sid, nil)) + require.NoError(t, m.ReleaseUnsealed(ctx, sid, nil)) fmt.Printf("Release Sector Key\n") require.NoError(t, m.ReleaseSectorKey(ctx, sid)) fmt.Printf("Unseal Replica\n") @@ -476,7 +476,7 @@ func TestRedoPC1(t *testing.T) { defer cleanup() localTasks := []sealtasks.TaskType{ - sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch, + sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTReleaseUnsealed, sealtasks.TTFetch, } tw := newTestWorker(WorkerConfig{ @@ -531,7 +531,7 @@ func TestRestartManager(t *testing.T) { defer cleanup() localTasks := []sealtasks.TaskType{ - sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch, + sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTReleaseUnsealed, sealtasks.TTFetch, } tw := newTestWorker(WorkerConfig{ @@ -702,7 +702,7 @@ func TestReenableWorker(t *testing.T) { defer cleanup() localTasks := []sealtasks.TaskType{ - sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch, + sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTReleaseUnsealed, sealtasks.TTFetch, } wds := datastore.NewMapDatastore() diff --git a/storage/sealer/piece_provider_test.go b/storage/sealer/piece_provider_test.go index 37102560e..4fdcec4a8 100644 --- a/storage/sealer/piece_provider_test.go +++ b/storage/sealer/piece_provider_test.go @@ -352,7 +352,8 @@ func (p *pieceProviderTestHarness) readPiece(t *testing.T, offset storiface.Unpa } func (p *pieceProviderTestHarness) finalizeSector(t *testing.T, keepUnseal []storiface.Range) { - require.NoError(t, p.mgr.FinalizeSector(p.ctx, p.sector, keepUnseal)) + require.NoError(t, p.mgr.ReleaseUnsealed(p.ctx, p.sector, keepUnseal)) + require.NoError(t, p.mgr.FinalizeSector(p.ctx, p.sector)) } func (p *pieceProviderTestHarness) shutdown(t *testing.T) { diff --git a/storage/sealer/sched.go b/storage/sealer/sched.go index 3314473be..335bb1249 100644 --- a/storage/sealer/sched.go +++ b/storage/sealer/sched.go @@ -202,7 +202,6 @@ func (sh *Scheduler) Schedule(ctx context.Context, sector storiface.SectorRef, t ret: ret, Ctx: ctx, }: - log.Debugw("sched request sent", "sector", sector, "task", taskType) case <-sh.closing: return xerrors.New("closing") case <-ctx.Done(): diff --git a/storage/sealer/sched_test.go b/storage/sealer/sched_test.go index 89a286bdc..6dc4ef9db 100644 --- a/storage/sealer/sched_test.go +++ b/storage/sealer/sched_test.go @@ -91,11 +91,11 @@ func (s *schedTestWorker) SealCommit2(ctx context.Context, sector storiface.Sect panic("implement me") } -func (s *schedTestWorker) FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) { +func (s *schedTestWorker) FinalizeSector(ctx context.Context, sector storiface.SectorRef) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) (storiface.CallID, error) { +func (s *schedTestWorker) ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) { panic("implement me") } @@ -127,7 +127,7 @@ func (s *schedTestWorker) GenerateSectorKeyFromData(ctx context.Context, sector panic("implement me") } -func (s *schedTestWorker) FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) { +func (s *schedTestWorker) FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef) (storiface.CallID, error) { panic("implement me") } diff --git a/storage/sealer/teststorage_test.go b/storage/sealer/teststorage_test.go index 4b30d5fff..a074dc20a 100644 --- a/storage/sealer/teststorage_test.go +++ b/storage/sealer/teststorage_test.go @@ -61,11 +61,11 @@ func (t *testExec) SealCommit2(ctx context.Context, sector storiface.SectorRef, panic("implement me") } -func (t *testExec) FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error { +func (t *testExec) FinalizeSector(ctx context.Context, sector storiface.SectorRef) error { panic("implement me") } -func (t *testExec) ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) error { +func (t *testExec) ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error { panic("implement me") } @@ -101,7 +101,7 @@ func (t *testExec) GenerateSectorKeyFromData(ctx context.Context, sector storifa panic("implement me") } -func (t *testExec) FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error { +func (t *testExec) FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef) error { panic("implement me") }