VOL-1468 : Fix to prevent kv watch updates to trigger callbacks
Change-Id: Iff8cdd686d61d9c5015b61624626f8e426cc12fe
diff --git a/db/model/persisted_revision.go b/db/model/persisted_revision.go
index b21deeb..39bef5e 100644
--- a/db/model/persisted_revision.go
+++ b/db/model/persisted_revision.go
@@ -136,9 +136,14 @@
if err := proto.Unmarshal(dataPair.Value.([]byte), data.Interface().(proto.Message)); err != nil {
log.Errorw("update-in-memory--unmarshal-failed", log.Fields{"key": pr.GetHash(), "error": err})
} else {
- // Traverse the node and update as necessary
- rev := pr.GetBranch().GetLatest()
- rev.GetBranch().Node.Update("", data.Interface(), false, "", nil)
+ // Apply changes to current revision
+ branch := pr.GetBranch()
+ rev := branch.GetLatest()
+ updatedRev := rev.UpdateData(data.Interface(), branch)
+
+ // The changeAnnouncement field should remain 'nil' to prevent
+ // update callbacks from being executed.
+ rev.GetNode().makeLatest(branch, updatedRev, nil)
}
}