From ba595a66c2d0cb367c113438f7e9bc39f7d7956d Mon Sep 17 00:00:00 2001 From: ashmrtn <3891298+ashmrtn@users.noreply.github.com> Date: Thu, 26 Oct 2023 14:09:17 -0700 Subject: [PATCH] Remove Controller stats for export (#4500) Export doesn't pull meaningful stats from the controller. Just remove the collection/usage of these stats since it's confusing. Substitute the check for not doing anything from a check on stats to a check on the number of collections returned by kopia. --- #### Does this PR need a docs update or release note? - [ ] :white_check_mark: Yes, it's included - [ ] :clock1: Yes, but in a later PR - [x] :no_entry: No #### Type of change - [ ] :sunflower: Feature - [ ] :bug: Bugfix - [ ] :world_map: Documentation - [ ] :robot: Supportability/Tests - [ ] :computer: CI/Deployment - [x] :broom: Tech Debt/Cleanup #### Issue(s) * #4254 #### Test Plan - [x] :muscle: Manual - [ ] :zap: Unit test - [ ] :green_heart: E2E --- src/internal/operations/export.go | 13 +------------ src/internal/operations/export_test.go | 6 ------ 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/internal/operations/export.go b/src/internal/operations/export.go index c9be0bbf8..ac7202512 100644 --- a/src/internal/operations/export.go +++ b/src/internal/operations/export.go @@ -97,7 +97,6 @@ func (op ExportOperation) validate() error { // get populated asynchronously. type exportStats struct { cs []data.RestoreCollection - ctrl *data.CollectionStats bytesRead *stats.ByteCounter resourceCount int @@ -274,10 +273,6 @@ func (op *ExportOperation) do( return nil, clues.Stack(err) } - opStats.ctrl = op.ec.Wait() - - logger.Ctx(ctx).Debug(opStats.ctrl) - if op.ExportCfg.Archive { zc, err := archive.ZipExportCollection(ctx, expCollections) if err != nil { @@ -309,17 +304,11 @@ func (op *ExportOperation) finalizeMetrics( op.Results.ItemsRead = len(opStats.cs) // TODO: file count, not collection count op.Results.ResourceOwners = opStats.resourceCount - if opStats.ctrl == nil { - op.Status = Failed - return clues.New("restoration never completed") - } - - if op.Status != Failed && opStats.ctrl.IsZero() { + if op.Status != Failed && op.Results.ItemsRead == 0 { op.Status = NoData } // We don't have data on what all items were written - // op.Results.ItemsWritten = opStats.ctrl.Successes return op.Errors.Failure() } diff --git a/src/internal/operations/export_test.go b/src/internal/operations/export_test.go index 21a25556b..f1cda2c20 100644 --- a/src/internal/operations/export_test.go +++ b/src/internal/operations/export_test.go @@ -65,10 +65,6 @@ func (suite *ExportUnitSuite) TestExportOperation_PersistResults() { Collection: &exchMock.DataCollection{}, }, }, - ctrl: &data.CollectionStats{ - Objects: 1, - Successes: 1, - }, }, }, { @@ -77,7 +73,6 @@ func (suite *ExportUnitSuite) TestExportOperation_PersistResults() { fail: assert.AnError, stats: exportStats{ bytesRead: &stats.ByteCounter{}, - ctrl: &data.CollectionStats{}, }, }, { @@ -86,7 +81,6 @@ func (suite *ExportUnitSuite) TestExportOperation_PersistResults() { stats: exportStats{ bytesRead: &stats.ByteCounter{}, cs: []data.RestoreCollection{}, - ctrl: &data.CollectionStats{}, }, }, }