fix issue with vvector handling in ORSet.mergeRemoveDelta #22890
This commit is contained in:
parent
12196d674e
commit
9d7b81f11c
2 changed files with 16 additions and 1 deletions
|
|
@ -463,7 +463,8 @@ final class ORSet[A] private[akka] (
|
|||
elementsMap
|
||||
}
|
||||
clearAncestor()
|
||||
val newVvector = vvector.merge(that.vvector)
|
||||
|
||||
val newVvector = vvector.merge(thatDot)
|
||||
new ORSet(newElementsMap, newVvector)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -591,6 +591,20 @@ class ORSetSpec extends WordSpec with Matchers {
|
|||
b3.merge(a3).merge(c).elements should be(Set.empty)
|
||||
}
|
||||
|
||||
"not pollute the vvector of result during mergeRemoveDelta" in {
|
||||
val a = ORSet().add(nodeA, "a")
|
||||
val a1 = a.add(nodeB, "b").remove(nodeB, "b").resetDelta.remove(nodeA, "a") // a1 now contains dot from nodeB
|
||||
|
||||
a.vvector.contains(nodeA) should be(true)
|
||||
a.vvector.contains(nodeB) should be(false)
|
||||
a1.vvector.contains(nodeA) should be(true)
|
||||
a1.vvector.contains(nodeB) should be(true)
|
||||
|
||||
val a2 = ORSet().mergeDelta(a.delta.get).mergeDelta(a1.delta.get)
|
||||
a2.elements should be(Set.empty)
|
||||
a2.vvector.contains(nodeB) should be(false) // a2 should not be polluted by the nodeB dot, as all operations on it pertained only to elements from nodeA
|
||||
}
|
||||
|
||||
"have unapply extractor" in {
|
||||
val s1 = ORSet.empty.add(node1, "a").add(node2, "b")
|
||||
val s2: ORSet[String] = s1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue