From 98e2bfa491ade09cd9a96e1bdd3908b52d3d60e4 Mon Sep 17 00:00:00 2001 From: ryanfkeepers Date: Thu, 22 Dec 2022 14:13:43 -0700 Subject: [PATCH 1/2] set nomerge on delta reset 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. --- .../exchange/exchange_data_collection.go | 22 ++++++++++--------- .../connector/exchange/service_iterators.go | 10 ++------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/internal/connector/exchange/exchange_data_collection.go b/src/internal/connector/exchange/exchange_data_collection.go index 9157f8f479..fc7cfef9bd 100644 --- a/src/internal/connector/exchange/exchange_data_collection.go +++ b/src/internal/connector/exchange/exchange_data_collection.go @@ -87,18 +87,20 @@ func NewCollection( service graph.Servicer, statusUpdater support.StatusUpdater, ctrlOpts control.Options, + doNotMergeItems bool, ) Collection { collection := Collection{ - user: user, - data: make(chan data.Stream, collectionChannelBufferSize), - jobs: make([]string, 0), - service: service, - statusUpdater: statusUpdater, - fullPath: curr, - prevPath: prev, - collectionType: collectionType, - ctrl: ctrlOpts, - state: stateOf(prev, curr), + collectionType: collectionType, + ctrl: ctrlOpts, + data: make(chan data.Stream, collectionChannelBufferSize), + doNotMergeItems: doNotMergeItems, + fullPath: curr, + jobs: make([]string, 0), + prevPath: prev, + service: service, + state: stateOf(prev, curr), + statusUpdater: statusUpdater, + user: user, } return collection diff --git a/src/internal/connector/exchange/service_iterators.go b/src/internal/connector/exchange/service_iterators.go index 85190de47d..b9e04aa6cd 100644 --- a/src/internal/connector/exchange/service_iterators.go +++ b/src/internal/connector/exchange/service_iterators.go @@ -117,14 +117,6 @@ func filterContainersAndFillCollections( 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( qp.ResourceOwner, currPath, @@ -133,6 +125,7 @@ func filterContainersAndFillCollections( service, statusUpdater, ctrlOpts, + newDelta.reset, ) collections[cID] = &edc @@ -171,6 +164,7 @@ func filterContainersAndFillCollections( service, statusUpdater, ctrlOpts, + false, ) collections[p] = &edc } From c69cbc6028e759261111c1d324a230921d195f60 Mon Sep 17 00:00:00 2001 From: ryanfkeepers Date: Thu, 22 Dec 2022 14:18:26 -0700 Subject: [PATCH 2/2] fix missing test prop --- .../connector/exchange/exchange_data_collection_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/internal/connector/exchange/exchange_data_collection_test.go b/src/internal/connector/exchange/exchange_data_collection_test.go index 7192729e83..9547e39dd2 100644 --- a/src/internal/connector/exchange/exchange_data_collection_test.go +++ b/src/internal/connector/exchange/exchange_data_collection_test.go @@ -151,7 +151,8 @@ func (suite *ExchangeDataCollectionSuite) TestNewCollection_state() { c := NewCollection( "u", test.curr, test.prev, - 0, nil, nil, control.Options{}) + 0, nil, nil, control.Options{}, + false) assert.Equal(t, test.expect, c.State()) }) }