set nomerge on delta reset (#1921)

## Description

Flag doNotMergeItems for exchange collections
where the delta token was marked as reset (ie,
expired or otherwise unusable).  Do this instead
of making a (delete, new) collection tuple for
that path.


## Does this PR need a docs update or release note?

- [x]  No 

## Type of change

- [x] 🌻 Feature

## Issue(s)

* #1914

## Test Plan

- [x] 💚 E2E
This commit is contained in:
Keepers 2022-12-22 15:52:47 -07:00 committed by GitHub
parent 6b689b76c1
commit 168ba1b88c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 19 deletions

View File

@ -87,18 +87,20 @@ func NewCollection(
service graph.Servicer, service graph.Servicer,
statusUpdater support.StatusUpdater, statusUpdater support.StatusUpdater,
ctrlOpts control.Options, ctrlOpts control.Options,
doNotMergeItems bool,
) Collection { ) Collection {
collection := Collection{ collection := Collection{
user: user, collectionType: collectionType,
data: make(chan data.Stream, collectionChannelBufferSize), ctrl: ctrlOpts,
jobs: make([]string, 0), data: make(chan data.Stream, collectionChannelBufferSize),
service: service, doNotMergeItems: doNotMergeItems,
statusUpdater: statusUpdater, fullPath: curr,
fullPath: curr, jobs: make([]string, 0),
prevPath: prev, prevPath: prev,
collectionType: collectionType, service: service,
ctrl: ctrlOpts, state: stateOf(prev, curr),
state: stateOf(prev, curr), statusUpdater: statusUpdater,
user: user,
} }
return collection return collection

View File

@ -151,7 +151,8 @@ func (suite *ExchangeDataCollectionSuite) TestNewCollection_state() {
c := NewCollection( c := NewCollection(
"u", "u",
test.curr, test.prev, test.curr, test.prev,
0, nil, nil, control.Options{}) 0, nil, nil, control.Options{},
false)
assert.Equal(t, test.expect, c.State()) assert.Equal(t, test.expect, c.State())
}) })
} }

View File

@ -117,14 +117,6 @@ func filterContainersAndFillCollections(
deltaURLs[cID] = newDelta.url deltaURLs[cID] = newDelta.url
} }
if newDelta.reset {
// the previous delta was invalid or otherwise unusable.
// We need to mark the collection as New, and tombstone
// the path to clear out any data for a clean refresh.
prevPath = nil
tombstones[currPath.String()] = struct{}{}
}
edc := NewCollection( edc := NewCollection(
qp.ResourceOwner, qp.ResourceOwner,
currPath, currPath,
@ -133,6 +125,7 @@ func filterContainersAndFillCollections(
service, service,
statusUpdater, statusUpdater,
ctrlOpts, ctrlOpts,
newDelta.reset,
) )
collections[cID] = &edc collections[cID] = &edc
@ -171,6 +164,7 @@ func filterContainersAndFillCollections(
service, service,
statusUpdater, statusUpdater,
ctrlOpts, ctrlOpts,
false,
) )
collections[p] = &edc collections[p] = &edc
} }