VOL-1372 : Fixed core crash due to how revisions are updated
- UpdateChildren merges new and existing entries
- proxy access control singleton now uses sync.Map since the
entry was intermittently losing its content
- Switch to AddWithID in the device_agent to ensure thread safety
Change-Id: Ifcb2374f48b612a487a00f4a952aeec21d1c4af1
diff --git a/db/model/branch.go b/db/model/branch.go
index 3408f18..d7fa092 100644
--- a/db/model/branch.go
+++ b/db/model/branch.go
@@ -16,7 +16,10 @@
package model
-import "sync"
+import (
+ "github.com/opencord/voltha-go/common/log"
+ "sync"
+)
// TODO: implement weak references or something equivalent
// TODO: missing proper logging
@@ -48,6 +51,14 @@
b.Lock()
defer b.Unlock()
+ if b.Latest != nil {
+ log.Debugf("Switching latest from <%s> to <%s>", b.Latest.GetHash(), latest.GetHash())
+ b.Latest.Drop(b.Txid, false)
+ } else {
+ log.Debugf("Switching latest from <NIL> to <%s>", latest.GetHash())
+ }
+
+
b.Latest = latest
}