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?

- [ ]  Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x]  No

#### Type of change

- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [x] 🧹 Tech Debt/Cleanup

#### Issue(s)

* #4254

#### Test Plan

- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
ashmrtn 2023-10-26 14:09:17 -07:00 committed by GitHub
parent c824a0b23e
commit ba595a66c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 18 deletions

View File

@ -97,7 +97,6 @@ func (op ExportOperation) validate() error {
// get populated asynchronously. // get populated asynchronously.
type exportStats struct { type exportStats struct {
cs []data.RestoreCollection cs []data.RestoreCollection
ctrl *data.CollectionStats
bytesRead *stats.ByteCounter bytesRead *stats.ByteCounter
resourceCount int resourceCount int
@ -274,10 +273,6 @@ func (op *ExportOperation) do(
return nil, clues.Stack(err) return nil, clues.Stack(err)
} }
opStats.ctrl = op.ec.Wait()
logger.Ctx(ctx).Debug(opStats.ctrl)
if op.ExportCfg.Archive { if op.ExportCfg.Archive {
zc, err := archive.ZipExportCollection(ctx, expCollections) zc, err := archive.ZipExportCollection(ctx, expCollections)
if err != nil { 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.ItemsRead = len(opStats.cs) // TODO: file count, not collection count
op.Results.ResourceOwners = opStats.resourceCount op.Results.ResourceOwners = opStats.resourceCount
if opStats.ctrl == nil { if op.Status != Failed && op.Results.ItemsRead == 0 {
op.Status = Failed
return clues.New("restoration never completed")
}
if op.Status != Failed && opStats.ctrl.IsZero() {
op.Status = NoData op.Status = NoData
} }
// We don't have data on what all items were written // We don't have data on what all items were written
// op.Results.ItemsWritten = opStats.ctrl.Successes
return op.Errors.Failure() return op.Errors.Failure()
} }

View File

@ -65,10 +65,6 @@ func (suite *ExportUnitSuite) TestExportOperation_PersistResults() {
Collection: &exchMock.DataCollection{}, Collection: &exchMock.DataCollection{},
}, },
}, },
ctrl: &data.CollectionStats{
Objects: 1,
Successes: 1,
},
}, },
}, },
{ {
@ -77,7 +73,6 @@ func (suite *ExportUnitSuite) TestExportOperation_PersistResults() {
fail: assert.AnError, fail: assert.AnError,
stats: exportStats{ stats: exportStats{
bytesRead: &stats.ByteCounter{}, bytesRead: &stats.ByteCounter{},
ctrl: &data.CollectionStats{},
}, },
}, },
{ {
@ -86,7 +81,6 @@ func (suite *ExportUnitSuite) TestExportOperation_PersistResults() {
stats: exportStats{ stats: exportStats{
bytesRead: &stats.ByteCounter{}, bytesRead: &stats.ByteCounter{},
cs: []data.RestoreCollection{}, cs: []data.RestoreCollection{},
ctrl: &data.CollectionStats{},
}, },
}, },
} }