Skip to content

Commit bb35b55

Browse files
committed
consider paths with keys when building deleted paths
1 parent b0c1175 commit bb35b55

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

pkg/datastore/intent_rpc_set_update.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,12 @@ func (ic *intentContext) buildRemovedPaths(ctx context.Context) error {
413413
}
414414
// query current paths from new tree
415415
// the ones that don't exist are added to removedPaths
416-
for _, p := range ic.currentPaths {
417-
cp, _ := utils.CompletePath(nil, p)
418-
if t.GetLeaf(cp) == nil {
419-
ic.removedPathsMap[strings.Join(cp, ",")] = struct{}{}
416+
for _, rmps := range [][]*sdcpb.Path{ic.currentPaths, ic.currentKeyAsLeafPaths} {
417+
for _, p := range rmps {
418+
cp, _ := utils.CompletePath(nil, p)
419+
if t.GetLeaf(cp) == nil {
420+
ic.removedPathsMap[strings.Join(cp, ",")] = struct{}{}
421+
}
420422
}
421423
}
422424
return nil
@@ -490,26 +492,26 @@ func (d *Datastore) newIntentContext(ctx context.Context, req *sdcpb.SetIntentRe
490492
// debug start
491493
log.Debug()
492494
for i, upd := range ic.newUpdates {
493-
log.Debugf("set intent expanded update.%d: %s", i, upd)
495+
log.Infof("set intent expanded update.%d: %s", i, upd)
494496
}
495497
// logger.Debug()
496498
log.Debug()
497499
for i, upd := range ic.currentUpdates {
498-
log.Debugf("set intent current update.%d: %s", i, upd)
500+
log.Infof("set intent current update.%d: %s", i, upd)
499501
}
500502
log.Debug()
501503
for i, p := range ic.currentPaths {
502-
log.Debugf("set intent current path.%d: %s", i, p)
504+
log.Infof("set intent current path.%d: %s", i, p)
503505
}
504506
log.Debug()
505507
for i, p := range ic.currentKeyAsLeafPaths {
506-
log.Debugf("set intent currentKeyAsLeaf path.%d: %s", i, p)
508+
log.Infof("set intent currentKeyAsLeaf path.%d: %s", i, p)
507509
}
508510
log.Debug()
509511

510512
log.Debugf("has %d removed paths", len(ic.removedPathsMap))
511513
for rmp := range ic.removedPathsMap {
512-
log.Debugf("removed path: %s", rmp)
514+
log.Infof("removed path: %s", rmp)
513515
}
514516
// debug stop
515517
return ic, nil

0 commit comments

Comments
 (0)