=ddata Garbage collect valueDeltas tombstones at merge/mergeDelta #22974

This commit is contained in:
gosubpl 2017-11-03 16:25:13 +01:00
parent c8748e8cf0
commit cb6e9b1e49
4 changed files with 43 additions and 30 deletions

View file

@ -331,9 +331,13 @@ final class ORMap[A, B <: ReplicatedData] private[akka] (
val mergedValue = thisValue.merge(thatValue.asInstanceOf[thisValue.T]).asInstanceOf[B]
mergedValues = mergedValues.updated(key, mergedValue)
case (Some(thisValue), None)
mergedValues = mergedValues.updated(key, thisValue)
if (mergedKeys.contains(key))
mergedValues = mergedValues.updated(key, thisValue)
// else thisValue is a tombstone, but we don't want to carry it forward, as the other side does not have the element at all
case (None, Some(thatValue))
mergedValues = mergedValues.updated(key, thatValue)
if (mergedKeys.contains(key))
mergedValues = mergedValues.updated(key, thatValue)
// else thatValue is a tombstone, but we don't want to carry it forward, as the other side does not have the element at all
case (None, None) throw new IllegalStateException(s"missing value for $key")
}
}