Skip to content

Commit 71fc574

Browse files
committed
cleanup old explicit Deletes
1 parent e819787 commit 71fc574

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

pkg/datastore/transaction_rpc.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ func (d *Datastore) lowlevelTransactionSet(ctx context.Context, transaction *typ
214214
if err != nil {
215215
return nil, err
216216
}
217+
// clear the owners existing explicit delete entries
218+
root.RemoveExplicitDeletes(intent.GetName())
217219

218220
// store the old intent content in the transaction as the old intent.
219221
err = transaction.AddIntentContent(intent.GetName(), types.TransactionIntentOld, oldIntentContent.GetFirstPriorityValue(), oldIntentContent)

pkg/tree/intent_path_mapping.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ func (dp *DeletePathSet) DeepCopy() *DeletePathSet {
2525
return result
2626
}
2727

28+
func (dp *DeletePathSet) RemoveIntentDeletes(intentName string) {
29+
delete(dp.data, intentName)
30+
}
31+
2832
func (dp *DeletePathSet) Add(intentName string, prio int32, pathset *sdcpb.PathSet) {
2933
dpp, exists := dp.data[intentName]
3034
if !exists {

pkg/tree/root_entry.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ func (r *RootEntry) DeepCopy(ctx context.Context) (*RootEntry, error) {
7171
return result, nil
7272
}
7373

74+
func (r *RootEntry) RemoveExplicitDeletes(intentName string) {
75+
r.explicitDeletes.RemoveIntentDeletes(intentName)
76+
}
77+
7478
func (r *RootEntry) AddUpdatesRecursive(ctx context.Context, us types.UpdateSlice, flags *types.UpdateInsertFlags) error {
7579
var err error
7680
for idx, u := range us {

0 commit comments

Comments
 (0)