replace unicode arrows
* ⇒, →, ← * because we don't want to show them in documentation snippets and then it's complicated to avoid that when snippets are located in src/test/scala in individual modules * dont replace object `→` in FSM.scala and PersistentFSM.scala
This commit is contained in:
parent
e4d38f92a4
commit
5c96a5f556
1521 changed files with 18846 additions and 18786 deletions
|
|
@ -44,20 +44,20 @@ object DurableDataSpec {
|
|||
class TestDurableStore(failLoad: Boolean, failStore: Boolean) extends Actor {
|
||||
import DurableStore._
|
||||
def receive = {
|
||||
case LoadAll ⇒
|
||||
case LoadAll =>
|
||||
if (failLoad)
|
||||
throw new LoadFailed("failed to load durable distributed-data") with NoStackTrace
|
||||
else
|
||||
sender() ! LoadAllCompleted
|
||||
|
||||
case Store(_, _, reply) ⇒
|
||||
case Store(_, _, reply) =>
|
||||
if (failStore) reply match {
|
||||
case Some(StoreReply(_, failureMsg, replyTo)) ⇒ replyTo ! failureMsg
|
||||
case None ⇒
|
||||
case Some(StoreReply(_, failureMsg, replyTo)) => replyTo ! failureMsg
|
||||
case None =>
|
||||
}
|
||||
else reply match {
|
||||
case Some(StoreReply(successMsg, _, replyTo)) ⇒ replyTo ! successMsg
|
||||
case None ⇒
|
||||
case Some(StoreReply(successMsg, _, replyTo)) => replyTo ! successMsg
|
||||
case None =>
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ class JepsenInspiredInsertSpec extends MultiNodeSpec(JepsenInspiredInsertSpec) w
|
|||
// val totalCount = 2000
|
||||
val expectedData = (0 until totalCount).toSet
|
||||
val data: Map[RoleName, Seq[Int]] = {
|
||||
val nodeIndex = nodes.zipWithIndex.map { case (n, i) ⇒ i → n }.toMap
|
||||
(0 until totalCount).groupBy(i ⇒ nodeIndex(i % nodeCount))
|
||||
val nodeIndex = nodes.zipWithIndex.map { case (n, i) => i -> n }.toMap
|
||||
(0 until totalCount).groupBy(i => nodeIndex(i % nodeCount))
|
||||
}
|
||||
lazy val myData: Seq[Int] = data(myself)
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ class JepsenInspiredInsertSpec extends MultiNodeSpec(JepsenInspiredInsertSpec) w
|
|||
}
|
||||
|
||||
runOn(controller) {
|
||||
nodes.foreach { n ⇒ enterBarrier(n.name + "-joined") }
|
||||
nodes.foreach { n => enterBarrier(n.name + "-joined") }
|
||||
}
|
||||
|
||||
enterBarrier("after-setup")
|
||||
|
|
@ -113,13 +113,13 @@ class JepsenInspiredInsertSpec extends MultiNodeSpec(JepsenInspiredInsertSpec) w
|
|||
val key = ORSetKey[Int]("A")
|
||||
runOn(nodes: _*) {
|
||||
val writeProbe = TestProbe()
|
||||
val writeAcks = myData.map { i ⇒
|
||||
val writeAcks = myData.map { i =>
|
||||
sleepDelay()
|
||||
replicator.tell(Update(key, ORSet(), WriteLocal, Some(i))(_ :+ i), writeProbe.ref)
|
||||
writeProbe.receiveOne(3.seconds)
|
||||
}
|
||||
val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] ⇒ success }
|
||||
val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] ⇒ fail }
|
||||
val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] => success }
|
||||
val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] => fail }
|
||||
successWriteAcks.map(_.request.get).toSet should be(myData.toSet)
|
||||
successWriteAcks.size should be(myData.size)
|
||||
failureWriteAcks should be(Nil)
|
||||
|
|
@ -130,7 +130,7 @@ class JepsenInspiredInsertSpec extends MultiNodeSpec(JepsenInspiredInsertSpec) w
|
|||
awaitAssert {
|
||||
val readProbe = TestProbe()
|
||||
replicator.tell(Get(key, ReadLocal), readProbe.ref)
|
||||
val result = readProbe.expectMsgPF() { case g @ GetSuccess(`key`, _) ⇒ g.get(key) }
|
||||
val result = readProbe.expectMsgPF() { case g @ GetSuccess(`key`, _) => g.get(key) }
|
||||
result.elements should be(expectedData)
|
||||
}
|
||||
}
|
||||
|
|
@ -146,13 +146,13 @@ class JepsenInspiredInsertSpec extends MultiNodeSpec(JepsenInspiredInsertSpec) w
|
|||
val writeMajority = WriteMajority(timeout)
|
||||
runOn(nodes: _*) {
|
||||
val writeProbe = TestProbe()
|
||||
val writeAcks = myData.map { i ⇒
|
||||
val writeAcks = myData.map { i =>
|
||||
sleepDelay()
|
||||
replicator.tell(Update(key, ORSet(), writeMajority, Some(i))(_ :+ i), writeProbe.ref)
|
||||
writeProbe.receiveOne(timeout + 1.second)
|
||||
}
|
||||
val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] ⇒ success }
|
||||
val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] ⇒ fail }
|
||||
val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] => success }
|
||||
val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] => fail }
|
||||
successWriteAcks.map(_.request.get).toSet should be(myData.toSet)
|
||||
successWriteAcks.size should be(myData.size)
|
||||
failureWriteAcks should be(Nil)
|
||||
|
|
@ -163,7 +163,7 @@ class JepsenInspiredInsertSpec extends MultiNodeSpec(JepsenInspiredInsertSpec) w
|
|||
// read from majority of nodes, which is enough to retrieve all data
|
||||
val readProbe = TestProbe()
|
||||
replicator.tell(Get(key, readMajority), readProbe.ref)
|
||||
val result = readProbe.expectMsgPF() { case g @ GetSuccess(`key`, _) ⇒ g.get(key) }
|
||||
val result = readProbe.expectMsgPF() { case g @ GetSuccess(`key`, _) => g.get(key) }
|
||||
//val survivors = result.elements.size
|
||||
result.elements should be(expectedData)
|
||||
|
||||
|
|
@ -180,23 +180,23 @@ class JepsenInspiredInsertSpec extends MultiNodeSpec(JepsenInspiredInsertSpec) w
|
|||
val key = ORSetKey[Int]("C")
|
||||
runOn(controller) {
|
||||
sleepBeforePartition()
|
||||
for (a ← List(n1, n4, n5); b ← List(n2, n3))
|
||||
for (a <- List(n1, n4, n5); b <- List(n2, n3))
|
||||
testConductor.blackhole(a, b, Direction.Both).await
|
||||
sleepDuringPartition()
|
||||
for (a ← List(n1, n4, n5); b ← List(n2, n3))
|
||||
for (a <- List(n1, n4, n5); b <- List(n2, n3))
|
||||
testConductor.passThrough(a, b, Direction.Both).await
|
||||
enterBarrier("partition-healed-3")
|
||||
}
|
||||
|
||||
runOn(nodes: _*) {
|
||||
val writeProbe = TestProbe()
|
||||
val writeAcks = myData.map { i ⇒
|
||||
val writeAcks = myData.map { i =>
|
||||
sleepDelay()
|
||||
replicator.tell(Update(key, ORSet(), WriteLocal, Some(i))(_ :+ i), writeProbe.ref)
|
||||
writeProbe.receiveOne(3.seconds)
|
||||
}
|
||||
val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] ⇒ success }
|
||||
val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] ⇒ fail }
|
||||
val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] => success }
|
||||
val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] => fail }
|
||||
successWriteAcks.map(_.request.get).toSet should be(myData.toSet)
|
||||
successWriteAcks.size should be(myData.size)
|
||||
failureWriteAcks should be(Nil)
|
||||
|
|
@ -209,7 +209,7 @@ class JepsenInspiredInsertSpec extends MultiNodeSpec(JepsenInspiredInsertSpec) w
|
|||
awaitAssert {
|
||||
val readProbe = TestProbe()
|
||||
replicator.tell(Get(key, ReadLocal), readProbe.ref)
|
||||
val result = readProbe.expectMsgPF() { case g @ GetSuccess(`key`, _) ⇒ g.get(key) }
|
||||
val result = readProbe.expectMsgPF() { case g @ GetSuccess(`key`, _) => g.get(key) }
|
||||
result.elements should be(expectedData)
|
||||
}
|
||||
}
|
||||
|
|
@ -225,23 +225,23 @@ class JepsenInspiredInsertSpec extends MultiNodeSpec(JepsenInspiredInsertSpec) w
|
|||
val writeMajority = WriteMajority(timeout)
|
||||
runOn(controller) {
|
||||
sleepBeforePartition()
|
||||
for (a ← List(n1, n4, n5); b ← List(n2, n3))
|
||||
for (a <- List(n1, n4, n5); b <- List(n2, n3))
|
||||
testConductor.blackhole(a, b, Direction.Both).await
|
||||
sleepDuringPartition()
|
||||
for (a ← List(n1, n4, n5); b ← List(n2, n3))
|
||||
for (a <- List(n1, n4, n5); b <- List(n2, n3))
|
||||
testConductor.passThrough(a, b, Direction.Both).await
|
||||
enterBarrier("partition-healed-4")
|
||||
}
|
||||
|
||||
runOn(nodes: _*) {
|
||||
val writeProbe = TestProbe()
|
||||
val writeAcks = myData.map { i ⇒
|
||||
val writeAcks = myData.map { i =>
|
||||
sleepDelay()
|
||||
replicator.tell(Update(key, ORSet(), writeMajority, Some(i))(_ :+ i), writeProbe.ref)
|
||||
writeProbe.receiveOne(timeout + 1.second)
|
||||
}
|
||||
val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] ⇒ success }
|
||||
val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] ⇒ fail }
|
||||
val successWriteAcks = writeAcks.collect { case success: UpdateSuccess[_] => success }
|
||||
val failureWriteAcks = writeAcks.collect { case fail: UpdateFailure[_] => fail }
|
||||
runOn(n1, n4, n5) {
|
||||
successWriteAcks.map(_.request.get).toSet should be(myData.toSet)
|
||||
successWriteAcks.size should be(myData.size)
|
||||
|
|
@ -260,7 +260,7 @@ class JepsenInspiredInsertSpec extends MultiNodeSpec(JepsenInspiredInsertSpec) w
|
|||
runOn(n2, n3) {
|
||||
val readProbe = TestProbe()
|
||||
replicator.tell(Get(key, readMajority), readProbe.ref)
|
||||
val result = readProbe.expectMsgPF() { case g @ GetSuccess(`key`, _) ⇒ g.get(key) }
|
||||
val result = readProbe.expectMsgPF() { case g @ GetSuccess(`key`, _) => g.get(key) }
|
||||
//val survivors = result.elements.size
|
||||
result.elements should be(expectedData)
|
||||
}
|
||||
|
|
@ -272,7 +272,7 @@ class JepsenInspiredInsertSpec extends MultiNodeSpec(JepsenInspiredInsertSpec) w
|
|||
awaitAssert {
|
||||
val readProbe = TestProbe()
|
||||
replicator.tell(Get(key, ReadLocal), readProbe.ref)
|
||||
val result = readProbe.expectMsgPF() { case g @ GetSuccess(`key`, _) ⇒ g.get(key) }
|
||||
val result = readProbe.expectMsgPF() { case g @ GetSuccess(`key`, _) => g.get(key) }
|
||||
result.elements should be(expectedData)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ object PerformanceSpec extends MultiNodeConfig {
|
|||
|
||||
class CountDown(latch: TestLatch) extends Actor {
|
||||
def receive = {
|
||||
case _ ⇒
|
||||
case _ =>
|
||||
latch.countDown()
|
||||
if (latch.isOpen)
|
||||
context.stop(self)
|
||||
|
|
@ -85,9 +85,9 @@ class PerformanceSpec extends MultiNodeSpec(PerformanceSpec) with STMultiNodeSpe
|
|||
|
||||
def repeat(description: String, keys: Iterable[ORSetKey[Int]], n: Int,
|
||||
expectedAfterReplication: Option[Set[Int]] = None, oneByOne: Boolean = false)(
|
||||
block: (ORSetKey[Int], Int, ActorRef) ⇒ Unit, afterEachKey: ORSetKey[Int] ⇒ Unit = _ ⇒ ()): Unit = {
|
||||
block: (ORSetKey[Int], Int, ActorRef) => Unit, afterEachKey: ORSetKey[Int] => Unit = _ => ()): Unit = {
|
||||
|
||||
keys.foreach { key ⇒
|
||||
keys.foreach { key =>
|
||||
val startTime = System.nanoTime()
|
||||
runOn(n1) {
|
||||
val latch = TestLatch(n)
|
||||
|
|
@ -106,7 +106,7 @@ class PerformanceSpec extends MultiNodeSpec(PerformanceSpec) with STMultiNodeSpe
|
|||
if (!oneByOne)
|
||||
Await.ready(latch, 10.seconds + (2.second * factor))
|
||||
}
|
||||
expectedAfterReplication.foreach { expected ⇒
|
||||
expectedAfterReplication.foreach { expected =>
|
||||
enterBarrier("repeat-" + key + "-before-awaitReplicated")
|
||||
awaitReplicated(key, expected)
|
||||
enterBarrier("repeat-" + key + "-after-awaitReplicated")
|
||||
|
|
@ -124,14 +124,14 @@ class PerformanceSpec extends MultiNodeSpec(PerformanceSpec) with STMultiNodeSpe
|
|||
}
|
||||
|
||||
def awaitReplicated(keys: Iterable[ORSetKey[Int]], expectedData: Set[Int]): Unit =
|
||||
keys.foreach { key ⇒ awaitReplicated(key, expectedData) }
|
||||
keys.foreach { key => awaitReplicated(key, expectedData) }
|
||||
|
||||
def awaitReplicated(key: ORSetKey[Int], expectedData: Set[Int]): Unit = {
|
||||
within(20.seconds) {
|
||||
awaitAssert {
|
||||
val readProbe = TestProbe()
|
||||
replicator.tell(Get(key, ReadLocal), readProbe.ref)
|
||||
val result = readProbe.expectMsgPF() { case g @ GetSuccess(`key`, _) ⇒ g.get(key) }
|
||||
val result = readProbe.expectMsgPF() { case g @ GetSuccess(`key`, _) => g.get(key) }
|
||||
result.elements should be(expectedData)
|
||||
}
|
||||
}
|
||||
|
|
@ -153,50 +153,50 @@ class PerformanceSpec extends MultiNodeSpec(PerformanceSpec) with STMultiNodeSpe
|
|||
}
|
||||
|
||||
"be great for ORSet Update WriteLocal" taggedAs PerformanceTest in {
|
||||
val keys = (1 to repeatCount).map(n ⇒ ORSetKey[Int]("A" + n))
|
||||
val keys = (1 to repeatCount).map(n => ORSetKey[Int]("A" + n))
|
||||
val n = 1000 * factor
|
||||
val expectedData = (0 until n).toSet
|
||||
repeat("ORSet Update WriteLocal", keys, n)({ (key, i, replyTo) ⇒
|
||||
repeat("ORSet Update WriteLocal", keys, n)({ (key, i, replyTo) =>
|
||||
replicator.tell(Update(key, ORSet(), WriteLocal)(_ :+ i), replyTo)
|
||||
}, key ⇒ awaitReplicated(key, expectedData))
|
||||
}, key => awaitReplicated(key, expectedData))
|
||||
|
||||
enterBarrier("after-1")
|
||||
}
|
||||
|
||||
"be blazingly fast for ORSet Get ReadLocal" taggedAs PerformanceTest in {
|
||||
val keys = (1 to repeatCount).map(n ⇒ ORSetKey[Int]("A" + n))
|
||||
repeat("Get ReadLocal", keys, 100000 * factor) { (key, _, replyTo) ⇒
|
||||
val keys = (1 to repeatCount).map(n => ORSetKey[Int]("A" + n))
|
||||
repeat("Get ReadLocal", keys, 100000 * factor) { (key, _, replyTo) =>
|
||||
replicator.tell(Get(key, ReadLocal), replyTo)
|
||||
}
|
||||
enterBarrier("after-2")
|
||||
}
|
||||
|
||||
"be good for ORSet Update WriteLocal and gossip replication" taggedAs PerformanceTest in {
|
||||
val keys = (1 to repeatCount).map(n ⇒ ORSetKey[Int]("B" + n))
|
||||
val keys = (1 to repeatCount).map(n => ORSetKey[Int]("B" + n))
|
||||
val n = 200 * factor
|
||||
val expected = Some((0 until n).toSet)
|
||||
repeat("ORSet Update WriteLocal + gossip", keys, n, expected) { (key, i, replyTo) ⇒
|
||||
repeat("ORSet Update WriteLocal + gossip", keys, n, expected) { (key, i, replyTo) =>
|
||||
replicator.tell(Update(key, ORSet(), WriteLocal)(_ :+ i), replyTo)
|
||||
}
|
||||
enterBarrier("after-3")
|
||||
}
|
||||
|
||||
"be good for ORSet Update WriteLocal and gossip of existing keys" taggedAs PerformanceTest in {
|
||||
val keys = (1 to repeatCount).map(n ⇒ ORSetKey[Int]("B" + n))
|
||||
val keys = (1 to repeatCount).map(n => ORSetKey[Int]("B" + n))
|
||||
val n = 200 * factor
|
||||
val expected = Some((0 until n).toSet ++ (0 until n).map(-_).toSet)
|
||||
repeat("ORSet Update WriteLocal existing + gossip", keys, n, expected) { (key, i, replyTo) ⇒
|
||||
repeat("ORSet Update WriteLocal existing + gossip", keys, n, expected) { (key, i, replyTo) =>
|
||||
replicator.tell(Update(key, ORSet(), WriteLocal)(_ :+ (-i)), replyTo)
|
||||
}
|
||||
enterBarrier("after-4")
|
||||
}
|
||||
|
||||
"be good for ORSet Update WriteTwo and gossip replication" taggedAs PerformanceTest in {
|
||||
val keys = (1 to repeatCount).map(n ⇒ ORSetKey[Int]("C" + n))
|
||||
val keys = (1 to repeatCount).map(n => ORSetKey[Int]("C" + n))
|
||||
val n = 200 * factor
|
||||
val expected = Some((0 until n).toSet)
|
||||
val writeTwo = WriteTo(2, timeout)
|
||||
repeat("ORSet Update WriteTwo + gossip", keys, n, expected) { (key, i, replyTo) ⇒
|
||||
repeat("ORSet Update WriteTwo + gossip", keys, n, expected) { (key, i, replyTo) =>
|
||||
replicator.tell(Update(key, ORSet(), writeTwo)(_ :+ i), replyTo)
|
||||
}
|
||||
enterBarrier("after-5")
|
||||
|
|
@ -209,7 +209,7 @@ class PerformanceSpec extends MultiNodeSpec(PerformanceSpec) with STMultiNodeSpe
|
|||
runOn(n1, n2, n3) {
|
||||
val latch = TestLatch(n)
|
||||
val replyTo = system.actorOf(countDownProps(latch))
|
||||
for (_ ← 0 until n)
|
||||
for (_ <- 0 until n)
|
||||
replicator.tell(Update(key, GCounter(), WriteLocal)(_ :+ 1), replyTo)
|
||||
Await.ready(latch, 5.seconds + (1.second * factor))
|
||||
enterBarrier("update-done-6")
|
||||
|
|
@ -228,7 +228,7 @@ class PerformanceSpec extends MultiNodeSpec(PerformanceSpec) with STMultiNodeSpe
|
|||
awaitAssert {
|
||||
val readProbe = TestProbe()
|
||||
replicator.tell(Get(key, ReadLocal), readProbe.ref)
|
||||
val result = readProbe.expectMsgPF() { case g @ GetSuccess(`key`, _) ⇒ g.get(key) }
|
||||
val result = readProbe.expectMsgPF() { case g @ GetSuccess(`key`, _) => g.get(key) }
|
||||
result.value should be(3 * n)
|
||||
}
|
||||
}
|
||||
|
|
@ -244,20 +244,20 @@ class PerformanceSpec extends MultiNodeSpec(PerformanceSpec) with STMultiNodeSpe
|
|||
}
|
||||
|
||||
"be good for ORSet one-by-one deltas" taggedAs PerformanceTest in {
|
||||
val keys = (1 to repeatCount).map(n ⇒ ORSetKey[Int]("E" + n))
|
||||
val keys = (1 to repeatCount).map(n => ORSetKey[Int]("E" + n))
|
||||
val n = 300 * factor
|
||||
val writeMajority = WriteMajority(timeout)
|
||||
repeat("ORSet Update one-by-one deltas", keys, n, oneByOne = true) { (key, i, replyTo) ⇒
|
||||
repeat("ORSet Update one-by-one deltas", keys, n, oneByOne = true) { (key, i, replyTo) =>
|
||||
replicator.tell(Update(key, ORSet(), writeMajority)(_ :+ i), replyTo)
|
||||
}
|
||||
enterBarrier("after-7")
|
||||
}
|
||||
|
||||
"be good for ORSet deltas" taggedAs PerformanceTest in {
|
||||
val keys = (1 to repeatCount).map(n ⇒ ORSetKey[Int]("F" + n))
|
||||
val keys = (1 to repeatCount).map(n => ORSetKey[Int]("F" + n))
|
||||
val n = 200 * factor
|
||||
val writeMajority = WriteMajority(timeout)
|
||||
repeat("ORSet Update deltas", keys, n, oneByOne = false) { (key, i, replyTo) ⇒
|
||||
repeat("ORSet Update deltas", keys, n, oneByOne = false) { (key, i, replyTo) =>
|
||||
replicator.tell(Update(key, ORSet(), writeMajority)(_ :+ i), replyTo)
|
||||
}
|
||||
enterBarrier("after-8")
|
||||
|
|
|
|||
|
|
@ -69,11 +69,11 @@ class ReplicatorChaosSpec extends MultiNodeSpec(ReplicatorChaosSpec) with STMult
|
|||
awaitAssert {
|
||||
replicator ! Get(key, ReadLocal)
|
||||
val value = expectMsgPF() {
|
||||
case g @ GetSuccess(`key`, _) ⇒ g.dataValue match {
|
||||
case c: GCounter ⇒ c.value
|
||||
case c: PNCounter ⇒ c.value
|
||||
case c: GSet[_] ⇒ c.elements
|
||||
case c: ORSet[_] ⇒ c.elements
|
||||
case g @ GetSuccess(`key`, _) => g.dataValue match {
|
||||
case c: GCounter => c.value
|
||||
case c: PNCounter => c.value
|
||||
case c: GSet[_] => c.elements
|
||||
case c: ORSet[_] => c.elements
|
||||
}
|
||||
}
|
||||
value should be(expected)
|
||||
|
|
@ -105,7 +105,7 @@ class ReplicatorChaosSpec extends MultiNodeSpec(ReplicatorChaosSpec) with STMult
|
|||
}
|
||||
|
||||
runOn(first) {
|
||||
for (_ ← 0 until 5) {
|
||||
for (_ <- 0 until 5) {
|
||||
replicator ! Update(KeyA, GCounter(), WriteLocal)(_ :+ 1)
|
||||
replicator ! Update(KeyB, PNCounter(), WriteLocal)(_ decrement 1)
|
||||
replicator ! Update(KeyC, GCounter(), WriteAll(timeout))(_ :+ 1)
|
||||
|
|
@ -163,7 +163,7 @@ class ReplicatorChaosSpec extends MultiNodeSpec(ReplicatorChaosSpec) with STMult
|
|||
val side1 = Seq(first, second)
|
||||
val side2 = Seq(third, fourth, fifth)
|
||||
runOn(first) {
|
||||
for (a ← side1; b ← side2)
|
||||
for (a <- side1; b <- side2)
|
||||
testConductor.blackhole(a, b, Direction.Both).await
|
||||
}
|
||||
enterBarrier("split")
|
||||
|
|
@ -216,7 +216,7 @@ class ReplicatorChaosSpec extends MultiNodeSpec(ReplicatorChaosSpec) with STMult
|
|||
val side1 = Seq(first, second)
|
||||
val side2 = Seq(third, fifth) // fourth was shutdown
|
||||
runOn(first) {
|
||||
for (a ← side1; b ← side2)
|
||||
for (a <- side1; b <- side2)
|
||||
testConductor.passThrough(a, b, Direction.Both).await
|
||||
}
|
||||
enterBarrier("split-repaired")
|
||||
|
|
|
|||
|
|
@ -73,25 +73,25 @@ object ReplicatorDeltaSpec extends MultiNodeConfig {
|
|||
|
||||
def consistency(): WriteConsistency = {
|
||||
rnd.nextInt(100) match {
|
||||
case n if n < 90 ⇒ WriteLocal
|
||||
case n if n < 95 ⇒ writeTwo
|
||||
case n if n < 100 ⇒ writeMajority
|
||||
case n if n < 90 => WriteLocal
|
||||
case n if n < 95 => writeTwo
|
||||
case n if n < 100 => writeMajority
|
||||
}
|
||||
}
|
||||
|
||||
def rndPnCounterkey(): PNCounterKey = {
|
||||
rnd.nextInt(3) match {
|
||||
case 0 ⇒ KeyA
|
||||
case 1 ⇒ KeyB
|
||||
case 2 ⇒ KeyC
|
||||
case 0 => KeyA
|
||||
case 1 => KeyB
|
||||
case 2 => KeyC
|
||||
}
|
||||
}
|
||||
|
||||
def rndOrSetkey(): ORSetKey[String] = {
|
||||
rnd.nextInt(3) match {
|
||||
case 0 ⇒ KeyD
|
||||
case 1 ⇒ KeyE
|
||||
case 2 ⇒ KeyF
|
||||
case 0 => KeyD
|
||||
case 1 => KeyE
|
||||
case 2 => KeyF
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -111,12 +111,12 @@ object ReplicatorDeltaSpec extends MultiNodeConfig {
|
|||
availableForRemove.toVector(rnd.nextInt(availableForRemove.size))
|
||||
}
|
||||
|
||||
(0 to (30 + rnd.nextInt(10))).map { _ ⇒
|
||||
(0 to (30 + rnd.nextInt(10))).map { _ =>
|
||||
rnd.nextInt(4) match {
|
||||
case 0 ⇒ Delay(rnd.nextInt(500))
|
||||
case 1 ⇒ Incr(rndPnCounterkey(), rnd.nextInt(100), consistency())
|
||||
case 2 ⇒ Decr(rndPnCounterkey(), rnd.nextInt(10), consistency())
|
||||
case 3 ⇒
|
||||
case 0 => Delay(rnd.nextInt(500))
|
||||
case 1 => Incr(rndPnCounterkey(), rnd.nextInt(100), consistency())
|
||||
case 2 => Decr(rndPnCounterkey(), rnd.nextInt(10), consistency())
|
||||
case 3 =>
|
||||
// ORSet
|
||||
val key = rndOrSetkey()
|
||||
// only removals for KeyF on node first
|
||||
|
|
@ -199,11 +199,11 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult
|
|||
|
||||
runOn(first) {
|
||||
// by setting something for each key we don't have to worry about NotFound
|
||||
List(KeyA, KeyB, KeyC).foreach { key ⇒
|
||||
List(KeyA, KeyB, KeyC).foreach { key =>
|
||||
fullStateReplicator ! Update(key, PNCounter.empty, WriteLocal)(_ :+ 1)
|
||||
deltaReplicator ! Update(key, PNCounter.empty, WriteLocal)(_ :+ 1)
|
||||
}
|
||||
List(KeyD, KeyE, KeyF).foreach { key ⇒
|
||||
List(KeyD, KeyE, KeyF).foreach { key =>
|
||||
fullStateReplicator ! Update(key, ORSet.empty[String], WriteLocal)(_ :+ "a")
|
||||
deltaReplicator ! Update(key, ORSet.empty[String], WriteLocal)(_ :+ "a")
|
||||
}
|
||||
|
|
@ -213,14 +213,14 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult
|
|||
within(5.seconds) {
|
||||
awaitAssert {
|
||||
val p = TestProbe()
|
||||
List(KeyA, KeyB, KeyC).foreach { key ⇒
|
||||
List(KeyA, KeyB, KeyC).foreach { key =>
|
||||
fullStateReplicator.tell(Get(key, ReadLocal), p.ref)
|
||||
p.expectMsgType[GetSuccess[PNCounter]].dataValue.getValue.intValue should be(1)
|
||||
}
|
||||
}
|
||||
awaitAssert {
|
||||
val p = TestProbe()
|
||||
List(KeyD, KeyE, KeyF).foreach { key ⇒
|
||||
List(KeyD, KeyE, KeyF).foreach { key =>
|
||||
deltaReplicator.tell(Get(key, ReadLocal), p.ref)
|
||||
p.expectMsgType[GetSuccess[ORSet[String]]].dataValue.elements should ===(Set("a"))
|
||||
}
|
||||
|
|
@ -336,7 +336,7 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult
|
|||
// NoDeltaPlaceholder from previous updates and the incr(4) delta will also
|
||||
// be folded into NoDeltaPlaceholder and not propagated as delta. A few DeltaPropagationTick
|
||||
// are needed to send to all and flush buffer.
|
||||
roles.foreach { _ ⇒
|
||||
roles.foreach { _ =>
|
||||
deltaReplicator ! Replicator.Internal.DeltaPropagationTick
|
||||
}
|
||||
deltaReplicator.tell(Update(KeyHigh, Highest(0), WriteLocal)(_.incr(4)), p1.ref)
|
||||
|
|
@ -362,24 +362,24 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult
|
|||
// perform random operations with both delta and full-state replicators
|
||||
// and compare that the end result is the same
|
||||
|
||||
for (op ← operations) {
|
||||
for (op <- operations) {
|
||||
log.debug("operation: {}", op)
|
||||
op match {
|
||||
case Delay(d) ⇒ Thread.sleep(d)
|
||||
case Incr(key, n, consistency) ⇒
|
||||
case Delay(d) => Thread.sleep(d)
|
||||
case Incr(key, n, consistency) =>
|
||||
fullStateReplicator ! Update(key, PNCounter.empty, consistency)(_ :+ n)
|
||||
deltaReplicator ! Update(key, PNCounter.empty, consistency)(_ :+ n)
|
||||
case Decr(key, n, consistency) ⇒
|
||||
case Decr(key, n, consistency) =>
|
||||
fullStateReplicator ! Update(key, PNCounter.empty, consistency)(_ decrement n)
|
||||
deltaReplicator ! Update(key, PNCounter.empty, consistency)(_ decrement n)
|
||||
case Add(key, elem, consistency) ⇒
|
||||
case Add(key, elem, consistency) =>
|
||||
// to have an deterministic result when mixing add/remove we can only perform
|
||||
// the ORSet operations from one node
|
||||
runOn((if (key == KeyF) List(first) else List(first, second, third)): _*) {
|
||||
fullStateReplicator ! Update(key, ORSet.empty[String], consistency)(_ :+ elem)
|
||||
deltaReplicator ! Update(key, ORSet.empty[String], consistency)(_ :+ elem)
|
||||
}
|
||||
case Remove(key, elem, consistency) ⇒
|
||||
case Remove(key, elem, consistency) =>
|
||||
runOn(first) {
|
||||
fullStateReplicator ! Update(key, ORSet.empty[String], consistency)(_ remove elem)
|
||||
deltaReplicator ! Update(key, ORSet.empty[String], consistency)(_ remove elem)
|
||||
|
|
@ -389,7 +389,7 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult
|
|||
|
||||
enterBarrier("updated-2")
|
||||
|
||||
List(KeyA, KeyB, KeyC).foreach { key ⇒
|
||||
List(KeyA, KeyB, KeyC).foreach { key =>
|
||||
within(5.seconds) {
|
||||
awaitAssert {
|
||||
val p = TestProbe()
|
||||
|
|
@ -402,7 +402,7 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult
|
|||
}
|
||||
}
|
||||
|
||||
List(KeyD, KeyE, KeyF).foreach { key ⇒
|
||||
List(KeyD, KeyE, KeyF).foreach { key =>
|
||||
within(5.seconds) {
|
||||
awaitAssert {
|
||||
val p = TestProbe()
|
||||
|
|
@ -417,7 +417,7 @@ class ReplicatorDeltaSpec extends MultiNodeSpec(ReplicatorDeltaSpec) with STMult
|
|||
|
||||
enterBarrierAfterTestStep()
|
||||
} catch {
|
||||
case e: Throwable ⇒
|
||||
case e: Throwable =>
|
||||
info(s"random operations on [${myself.name}]: ${operations.mkString(", ")}")
|
||||
throw e
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,41 +77,41 @@ object ReplicatorMapDeltaSpec extends MultiNodeConfig {
|
|||
|
||||
def consistency(): WriteConsistency = {
|
||||
rnd.nextInt(100) match {
|
||||
case n if n < 90 ⇒ WriteLocal
|
||||
case n if n < 95 ⇒ writeTwo
|
||||
case n if n < 100 ⇒ writeMajority
|
||||
case n if n < 90 => WriteLocal
|
||||
case n if n < 95 => writeTwo
|
||||
case n if n < 100 => writeMajority
|
||||
}
|
||||
}
|
||||
|
||||
def rndPnCounterkey(): (PNCounterMapKey[String], String) = {
|
||||
rnd.nextInt(3) match {
|
||||
case 0 ⇒ KeyA
|
||||
case 1 ⇒ KeyB
|
||||
case 2 ⇒ KeyC
|
||||
case 0 => KeyA
|
||||
case 1 => KeyB
|
||||
case 2 => KeyC
|
||||
}
|
||||
}
|
||||
|
||||
def rndOrSetkeyVD(): (ORMultiMapKey[String, String], String) = {
|
||||
rnd.nextInt(3) match {
|
||||
case 0 ⇒ KeyD
|
||||
case 1 ⇒ KeyE
|
||||
case 2 ⇒ KeyF
|
||||
case 0 => KeyD
|
||||
case 1 => KeyE
|
||||
case 2 => KeyF
|
||||
}
|
||||
}
|
||||
|
||||
def rndOrSetkeyNoVD(): (ORMultiMapKey[String, String], String) = {
|
||||
rnd.nextInt(3) match {
|
||||
case 0 ⇒ KeyG
|
||||
case 1 ⇒ KeyH
|
||||
case 2 ⇒ KeyI
|
||||
case 0 => KeyG
|
||||
case 1 => KeyH
|
||||
case 2 => KeyI
|
||||
}
|
||||
}
|
||||
|
||||
def rndOrSetkeyOM(): (ORMapKey[String, ORSet[String]], String) = {
|
||||
rnd.nextInt(3) match {
|
||||
case 0 ⇒ KeyJ
|
||||
case 1 ⇒ KeyK
|
||||
case 2 ⇒ KeyL
|
||||
case 0 => KeyJ
|
||||
case 1 => KeyK
|
||||
case 2 => KeyL
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -131,12 +131,12 @@ object ReplicatorMapDeltaSpec extends MultiNodeConfig {
|
|||
availableForRemove.toVector(rnd.nextInt(availableForRemove.size))
|
||||
}
|
||||
|
||||
(0 to (50 + rnd.nextInt(10))).map { _ ⇒
|
||||
(0 to (50 + rnd.nextInt(10))).map { _ =>
|
||||
rnd.nextInt(6) match {
|
||||
case 0 ⇒ Delay(rnd.nextInt(500))
|
||||
case 1 ⇒ Incr(rndPnCounterkey(), rnd.nextInt(100), consistency())
|
||||
case 2 ⇒ Decr(rndPnCounterkey(), rnd.nextInt(10), consistency())
|
||||
case 3 ⇒
|
||||
case 0 => Delay(rnd.nextInt(500))
|
||||
case 1 => Incr(rndPnCounterkey(), rnd.nextInt(100), consistency())
|
||||
case 2 => Decr(rndPnCounterkey(), rnd.nextInt(10), consistency())
|
||||
case 3 =>
|
||||
// ORMultiMap.withValueDeltas
|
||||
val key = rndOrSetkeyVD()
|
||||
// only removals for KeyF on node first
|
||||
|
|
@ -144,7 +144,7 @@ object ReplicatorMapDeltaSpec extends MultiNodeConfig {
|
|||
RemoveVD(key, rndRemoveElement(), consistency())
|
||||
else
|
||||
AddVD(key, rndAddElement(), consistency())
|
||||
case 4 ⇒
|
||||
case 4 =>
|
||||
// ORMultiMap - vanilla variant - without Value Deltas
|
||||
val key = rndOrSetkeyNoVD()
|
||||
// only removals for KeyI on node first
|
||||
|
|
@ -152,7 +152,7 @@ object ReplicatorMapDeltaSpec extends MultiNodeConfig {
|
|||
RemoveNoVD(key, rndRemoveElement(), consistency())
|
||||
else
|
||||
AddNoVD(key, rndAddElement(), consistency())
|
||||
case 5 ⇒
|
||||
case 5 =>
|
||||
// Vanilla ORMap - with ORSet inside
|
||||
val key = rndOrSetkeyOM()
|
||||
// only removals for KeyL on node first
|
||||
|
|
@ -241,21 +241,21 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
|
|||
|
||||
runOn(first) {
|
||||
// by setting something for each key we don't have to worry about NotFound
|
||||
List(KeyA, KeyB, KeyC).foreach { key ⇒
|
||||
List(KeyA, KeyB, KeyC).foreach { key =>
|
||||
fullStateReplicator ! Update(key._1, PNCounterMap.empty[String], WriteLocal)(_.incrementBy(key._2, 1))
|
||||
deltaReplicator ! Update(key._1, PNCounterMap.empty[String], WriteLocal)(_.incrementBy(key._2, 1))
|
||||
}
|
||||
List(KeyD, KeyE, KeyF).foreach { key ⇒
|
||||
fullStateReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ :+ (key._2 → Set("a")))
|
||||
deltaReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ :+ (key._2 → Set("a")))
|
||||
List(KeyD, KeyE, KeyF).foreach { key =>
|
||||
fullStateReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ :+ (key._2 -> Set("a")))
|
||||
deltaReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ :+ (key._2 -> Set("a")))
|
||||
}
|
||||
List(KeyG, KeyH, KeyI).foreach { key ⇒
|
||||
fullStateReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ :+ (key._2 → Set("a")))
|
||||
deltaReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ :+ (key._2 → Set("a")))
|
||||
List(KeyG, KeyH, KeyI).foreach { key =>
|
||||
fullStateReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ :+ (key._2 -> Set("a")))
|
||||
deltaReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ :+ (key._2 -> Set("a")))
|
||||
}
|
||||
List(KeyJ, KeyK, KeyL).foreach { key ⇒
|
||||
fullStateReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(_ :+ (key._2 → (ORSet.empty :+ "a")))
|
||||
deltaReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(_ :+ (key._2 → (ORSet.empty :+ "a")))
|
||||
List(KeyJ, KeyK, KeyL).foreach { key =>
|
||||
fullStateReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(_ :+ (key._2 -> (ORSet.empty :+ "a")))
|
||||
deltaReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(_ :+ (key._2 -> (ORSet.empty :+ "a")))
|
||||
}
|
||||
}
|
||||
enterBarrier("updated-1")
|
||||
|
|
@ -263,28 +263,28 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
|
|||
within(5.seconds) {
|
||||
awaitAssert {
|
||||
val p = TestProbe()
|
||||
List(KeyA, KeyB, KeyC).foreach { key ⇒
|
||||
List(KeyA, KeyB, KeyC).foreach { key =>
|
||||
fullStateReplicator.tell(Get(key._1, ReadLocal), p.ref)
|
||||
p.expectMsgType[GetSuccess[PNCounterMap[String]]].dataValue.get(key._2).get.intValue should be(1)
|
||||
}
|
||||
}
|
||||
awaitAssert {
|
||||
val p = TestProbe()
|
||||
List(KeyD, KeyE, KeyF).foreach { key ⇒
|
||||
List(KeyD, KeyE, KeyF).foreach { key =>
|
||||
fullStateReplicator.tell(Get(key._1, ReadLocal), p.ref)
|
||||
p.expectMsgType[GetSuccess[ORMultiMap[String, String]]].dataValue.get(key._2) should ===(Some(Set("a")))
|
||||
}
|
||||
}
|
||||
awaitAssert {
|
||||
val p = TestProbe()
|
||||
List(KeyG, KeyH, KeyI).foreach { key ⇒
|
||||
List(KeyG, KeyH, KeyI).foreach { key =>
|
||||
fullStateReplicator.tell(Get(key._1, ReadLocal), p.ref)
|
||||
p.expectMsgType[GetSuccess[ORMultiMap[String, String]]].dataValue.get(key._2) should ===(Some(Set("a")))
|
||||
}
|
||||
}
|
||||
awaitAssert {
|
||||
val p = TestProbe()
|
||||
List(KeyJ, KeyK, KeyL).foreach { key ⇒
|
||||
List(KeyJ, KeyK, KeyL).foreach { key =>
|
||||
fullStateReplicator.tell(Get(key._1, ReadLocal), p.ref)
|
||||
val res = p.expectMsgType[GetSuccess[ORMap[String, ORSet[String]]]].dataValue.get(key._2)
|
||||
res.map(_.elements) should ===(Some(Set("a")))
|
||||
|
|
@ -300,7 +300,7 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
|
|||
val errorLogProbe = TestProbe()
|
||||
system.eventStream.subscribe(errorLogProbe.ref, classOf[Error])
|
||||
runOn(first) {
|
||||
for (_ ← 1 to N; key ← List(KeyA, KeyB)) {
|
||||
for (_ <- 1 to N; key <- List(KeyA, KeyB)) {
|
||||
ordinaryReplicator ! Update(key._1, PNCounterMap.empty[String], WriteLocal)(_.incrementBy(key._2, 1))
|
||||
}
|
||||
}
|
||||
|
|
@ -309,7 +309,7 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
|
|||
within(5.seconds) {
|
||||
awaitAssert {
|
||||
val p = TestProbe()
|
||||
List(KeyA, KeyB).foreach { key ⇒
|
||||
List(KeyA, KeyB).foreach { key =>
|
||||
ordinaryReplicator.tell(Get(key._1, ReadLocal), p.ref)
|
||||
p.expectMsgType[GetSuccess[PNCounterMap[String]]].dataValue.get(key._2).get.intValue should be(N)
|
||||
}
|
||||
|
|
@ -330,58 +330,58 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
|
|||
// perform random operations with both delta and full-state replicators
|
||||
// and compare that the end result is the same
|
||||
|
||||
for (op ← operations) {
|
||||
for (op <- operations) {
|
||||
log.debug("operation: {}", op)
|
||||
op match {
|
||||
case Delay(d) ⇒ Thread.sleep(d)
|
||||
case Incr(key, n, _) ⇒
|
||||
case Delay(d) => Thread.sleep(d)
|
||||
case Incr(key, n, _) =>
|
||||
fullStateReplicator ! Update(key._1, PNCounterMap.empty[String], WriteLocal)(_ incrementBy (key._2, n))
|
||||
deltaReplicator ! Update(key._1, PNCounterMap.empty[String], WriteLocal)(_ incrementBy (key._2, n))
|
||||
case Decr(key, n, _) ⇒
|
||||
case Decr(key, n, _) =>
|
||||
fullStateReplicator ! Update(key._1, PNCounterMap.empty[String], WriteLocal)(_ decrementBy (key._2, n))
|
||||
deltaReplicator ! Update(key._1, PNCounterMap.empty[String], WriteLocal)(_ decrementBy (key._2, n))
|
||||
case AddVD(key, elem, _) ⇒
|
||||
case AddVD(key, elem, _) =>
|
||||
// to have an deterministic result when mixing add/remove we can only perform
|
||||
// the ORSet operations from one node
|
||||
runOn((if (key == KeyF) List(first) else List(first, second, third)): _*) {
|
||||
fullStateReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ addBindingBy (key._2, elem))
|
||||
deltaReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ addBindingBy (key._2, elem))
|
||||
}
|
||||
case RemoveVD(key, elem, _) ⇒
|
||||
case RemoveVD(key, elem, _) =>
|
||||
runOn(first) {
|
||||
fullStateReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ removeBindingBy (key._2, elem))
|
||||
deltaReplicator ! Update(key._1, ORMultiMap.emptyWithValueDeltas[String, String], WriteLocal)(_ removeBindingBy (key._2, elem))
|
||||
}
|
||||
case AddNoVD(key, elem, _) ⇒
|
||||
case AddNoVD(key, elem, _) =>
|
||||
// to have an deterministic result when mixing add/remove we can only perform
|
||||
// the ORSet operations from one node
|
||||
runOn((if (key == KeyI) List(first) else List(first, second, third)): _*) {
|
||||
fullStateReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ addBindingBy (key._2, elem))
|
||||
deltaReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ addBindingBy (key._2, elem))
|
||||
}
|
||||
case RemoveNoVD(key, elem, _) ⇒
|
||||
case RemoveNoVD(key, elem, _) =>
|
||||
runOn(first) {
|
||||
fullStateReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ removeBindingBy (key._2, elem))
|
||||
deltaReplicator ! Update(key._1, ORMultiMap.empty[String, String], WriteLocal)(_ removeBindingBy (key._2, elem))
|
||||
}
|
||||
case AddOM(key, elem, _) ⇒
|
||||
case AddOM(key, elem, _) =>
|
||||
// to have an deterministic result when mixing add/remove we can only perform
|
||||
// the ORSet operations from one node
|
||||
runOn((if (key == KeyL) List(first) else List(first, second, third)): _*) {
|
||||
fullStateReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om ⇒ addElementToORMap(om, key._2, elem))
|
||||
deltaReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om ⇒ addElementToORMap(om, key._2, elem))
|
||||
fullStateReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om => addElementToORMap(om, key._2, elem))
|
||||
deltaReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om => addElementToORMap(om, key._2, elem))
|
||||
}
|
||||
case RemoveOM(key, elem, _) ⇒
|
||||
case RemoveOM(key, elem, _) =>
|
||||
runOn(first) {
|
||||
fullStateReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om ⇒ removeElementFromORMap(om, key._2, elem))
|
||||
deltaReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om ⇒ removeElementFromORMap(om, key._2, elem))
|
||||
fullStateReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om => removeElementFromORMap(om, key._2, elem))
|
||||
deltaReplicator ! Update(key._1, ORMap.empty[String, ORSet[String]], WriteLocal)(om => removeElementFromORMap(om, key._2, elem))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enterBarrier("updated-3")
|
||||
|
||||
List(KeyA, KeyB, KeyC).foreach { key ⇒
|
||||
List(KeyA, KeyB, KeyC).foreach { key =>
|
||||
within(5.seconds) {
|
||||
awaitAssert {
|
||||
val p = TestProbe()
|
||||
|
|
@ -394,7 +394,7 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
|
|||
}
|
||||
}
|
||||
|
||||
List(KeyD, KeyE, KeyF).foreach { key ⇒
|
||||
List(KeyD, KeyE, KeyF).foreach { key =>
|
||||
within(5.seconds) {
|
||||
awaitAssert {
|
||||
val p = TestProbe()
|
||||
|
|
@ -407,7 +407,7 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
|
|||
}
|
||||
}
|
||||
|
||||
List(KeyG, KeyH, KeyI).foreach { key ⇒
|
||||
List(KeyG, KeyH, KeyI).foreach { key =>
|
||||
within(5.seconds) {
|
||||
awaitAssert {
|
||||
val p = TestProbe()
|
||||
|
|
@ -420,7 +420,7 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
|
|||
}
|
||||
}
|
||||
|
||||
List(KeyJ, KeyK, KeyL).foreach { key ⇒
|
||||
List(KeyJ, KeyK, KeyL).foreach { key =>
|
||||
within(5.seconds) {
|
||||
awaitAssert {
|
||||
val p = TestProbe()
|
||||
|
|
@ -435,7 +435,7 @@ class ReplicatorMapDeltaSpec extends MultiNodeSpec(ReplicatorMapDeltaSpec) with
|
|||
|
||||
enterBarrierAfterTestStep()
|
||||
} catch {
|
||||
case e: Throwable ⇒
|
||||
case e: Throwable =>
|
||||
info(s"random operations on [${myself.name}]: ${operations.mkString(", ")}")
|
||||
throw e
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@ class ReplicatorORSetDeltaSpec extends MultiNodeSpec(ReplicatorORSetDeltaSpec) w
|
|||
awaitAssert {
|
||||
replicator ! Get(key, ReadLocal)
|
||||
val value = expectMsgPF() {
|
||||
case g @ GetSuccess(`key`, _) ⇒ g.dataValue match {
|
||||
case c: ORSet[_] ⇒ c.elements
|
||||
case g @ GetSuccess(`key`, _) => g.dataValue match {
|
||||
case c: ORSet[_] => c.elements
|
||||
}
|
||||
}
|
||||
value should be(expected)
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ class ReplicatorPruningSpec extends MultiNodeSpec(ReplicatorPruningSpec) with ST
|
|||
cluster.subscribe(memberProbe.ref, initialStateMode = InitialStateAsEvents, classOf[MemberUp])
|
||||
val thirdUniqueAddress = {
|
||||
val member = memberProbe.fishForMessage(3.seconds) {
|
||||
case MemberUp(m) if m.address == node(third).address ⇒ true
|
||||
case _ ⇒ false
|
||||
case MemberUp(m) if m.address == node(third).address => true
|
||||
case _ => false
|
||||
}.asInstanceOf[MemberUp].member
|
||||
member.uniqueAddress
|
||||
}
|
||||
|
|
@ -93,10 +93,10 @@ class ReplicatorPruningSpec extends MultiNodeSpec(ReplicatorPruningSpec) with ST
|
|||
replicator ! Update(KeyC, PNCounterMap.empty[String], WriteAll(timeout)) { _.incrementBy("x", 1).incrementBy("y", 1) }
|
||||
expectMsg(UpdateSuccess(KeyC, None))
|
||||
|
||||
replicator ! Update(KeyD, ORMultiMap.empty[String, String], WriteAll(timeout)) { _ :+ ("a" → Set("A")) }
|
||||
replicator ! Update(KeyD, ORMultiMap.empty[String, String], WriteAll(timeout)) { _ :+ ("a" -> Set("A")) }
|
||||
expectMsg(UpdateSuccess(KeyD, None))
|
||||
|
||||
replicator ! Update(KeyE, ORMap.empty[String, GSet[String]], WriteAll(timeout)) { _ :+ ("a" → GSet.empty[String].add("A")) }
|
||||
replicator ! Update(KeyE, ORMap.empty[String, GSet[String]], WriteAll(timeout)) { _ :+ ("a" -> GSet.empty[String].add("A")) }
|
||||
expectMsg(UpdateSuccess(KeyE, None))
|
||||
|
||||
enterBarrier("updates-done")
|
||||
|
|
@ -152,7 +152,7 @@ class ReplicatorPruningSpec extends MultiNodeSpec(ReplicatorPruningSpec) with ST
|
|||
awaitAssert {
|
||||
replicator ! Get(KeyA, ReadLocal)
|
||||
expectMsgPF() {
|
||||
case g @ GetSuccess(KeyA, _) ⇒
|
||||
case g @ GetSuccess(KeyA, _) =>
|
||||
val value = g.get(KeyA).value.toInt
|
||||
values += value
|
||||
value should be(9)
|
||||
|
|
@ -165,7 +165,7 @@ class ReplicatorPruningSpec extends MultiNodeSpec(ReplicatorPruningSpec) with ST
|
|||
awaitAssert {
|
||||
replicator ! Get(KeyB, ReadLocal)
|
||||
expectMsgPF() {
|
||||
case g @ GetSuccess(KeyB, _) ⇒
|
||||
case g @ GetSuccess(KeyB, _) =>
|
||||
g.get(KeyB).elements should be(Set("a", "b", "c"))
|
||||
g.get(KeyB).needPruningFrom(thirdUniqueAddress) should be(false)
|
||||
}
|
||||
|
|
@ -175,8 +175,8 @@ class ReplicatorPruningSpec extends MultiNodeSpec(ReplicatorPruningSpec) with ST
|
|||
awaitAssert {
|
||||
replicator ! Get(KeyC, ReadLocal)
|
||||
expectMsgPF() {
|
||||
case g @ GetSuccess(KeyC, _) ⇒
|
||||
g.get(KeyC).entries should be(Map("x" → 3L, "y" → 3L))
|
||||
case g @ GetSuccess(KeyC, _) =>
|
||||
g.get(KeyC).entries should be(Map("x" -> 3L, "y" -> 3L))
|
||||
g.get(KeyC).needPruningFrom(thirdUniqueAddress) should be(false)
|
||||
}
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ class ReplicatorPruningSpec extends MultiNodeSpec(ReplicatorPruningSpec) with ST
|
|||
awaitAssert {
|
||||
replicator ! Get(KeyD, ReadLocal)
|
||||
expectMsgPF() {
|
||||
case g @ GetSuccess(KeyD, _) ⇒
|
||||
case g @ GetSuccess(KeyD, _) =>
|
||||
g.get(KeyD).entries("a") should be(Set("A"))
|
||||
g.get(KeyD).needPruningFrom(thirdUniqueAddress) should be(false)
|
||||
}
|
||||
|
|
@ -195,7 +195,7 @@ class ReplicatorPruningSpec extends MultiNodeSpec(ReplicatorPruningSpec) with ST
|
|||
awaitAssert {
|
||||
replicator ! Get(KeyE, ReadLocal)
|
||||
expectMsgPF() {
|
||||
case g @ GetSuccess(KeyE, _) ⇒
|
||||
case g @ GetSuccess(KeyE, _) =>
|
||||
g.get(KeyE).needPruningFrom(thirdUniqueAddress) should be(false)
|
||||
}
|
||||
}
|
||||
|
|
@ -205,12 +205,12 @@ class ReplicatorPruningSpec extends MultiNodeSpec(ReplicatorPruningSpec) with ST
|
|||
|
||||
// after pruning performed we should not be able to update with data from removed node
|
||||
def updateAfterPruning(expectedValue: Int): Unit = {
|
||||
replicator ! Update(KeyA, GCounter(), WriteAll(timeout), None) { existing ⇒
|
||||
replicator ! Update(KeyA, GCounter(), WriteAll(timeout), None) { existing =>
|
||||
// inject data from removed node to simulate bad data
|
||||
existing.merge(oldCounter) :+ 1
|
||||
}
|
||||
expectMsgPF() {
|
||||
case UpdateSuccess(KeyA, _) ⇒
|
||||
case UpdateSuccess(KeyA, _) =>
|
||||
replicator ! Get(KeyA, ReadLocal)
|
||||
val retrieved = expectMsgType[GetSuccess[GCounter]].dataValue
|
||||
retrieved.value should be(expectedValue)
|
||||
|
|
|
|||
|
|
@ -164,10 +164,10 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
// in case user is not using the passed in existing value
|
||||
replicator ! Update(KeyJ, GSet(), WriteLocal)(_ + "a" + "b")
|
||||
expectMsg(UpdateSuccess(KeyJ, None))
|
||||
replicator ! Update(KeyJ, GSet(), WriteLocal)(_ ⇒ GSet.empty[String] + "c") // normal usage would be `_ + "c"`
|
||||
replicator ! Update(KeyJ, GSet(), WriteLocal)(_ => GSet.empty[String] + "c") // normal usage would be `_ + "c"`
|
||||
expectMsg(UpdateSuccess(KeyJ, None))
|
||||
replicator ! Get(KeyJ, ReadLocal)
|
||||
val s = expectMsgPF() { case g @ GetSuccess(KeyJ, _) ⇒ g.get(KeyJ) }
|
||||
val s = expectMsgPF() { case g @ GetSuccess(KeyJ, _) => g.get(KeyJ) }
|
||||
s should ===(GSet.empty[String] + "a" + "b" + "c")
|
||||
}
|
||||
enterBarrierAfterTestStep()
|
||||
|
|
@ -175,7 +175,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
|
||||
"reply with ModifyFailure if exception is thrown by modify function" in {
|
||||
val e = new RuntimeException("errr")
|
||||
replicator ! Update(KeyA, GCounter(), WriteLocal)(_ ⇒ throw e)
|
||||
replicator ! Update(KeyA, GCounter(), WriteLocal)(_ => throw e)
|
||||
expectMsgType[ModifyFailure[_]].cause should be(e)
|
||||
}
|
||||
|
||||
|
|
@ -200,11 +200,11 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
within(5.seconds) {
|
||||
awaitAssert {
|
||||
replicator ! Get(KeyA, ReadLocal)
|
||||
val c = expectMsgPF() { case g @ GetSuccess(KeyA, _) ⇒ g.get(KeyA) }
|
||||
val c = expectMsgPF() { case g @ GetSuccess(KeyA, _) => g.get(KeyA) }
|
||||
c.value should be(6)
|
||||
}
|
||||
}
|
||||
val c = changedProbe.expectMsgPF() { case c @ Changed(KeyA) ⇒ c.get(KeyA) }
|
||||
val c = changedProbe.expectMsgPF() { case c @ Changed(KeyA) => c.get(KeyA) }
|
||||
c.value should be(6)
|
||||
}
|
||||
|
||||
|
|
@ -225,7 +225,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
// the total, after replication should be 42
|
||||
awaitAssert {
|
||||
replicator ! Get(KeyB, readTwo)
|
||||
val c = expectMsgPF() { case g @ GetSuccess(KeyB, _) ⇒ g.get(KeyB) }
|
||||
val c = expectMsgPF() { case g @ GetSuccess(KeyB, _) => g.get(KeyB) }
|
||||
c.value should be(42)
|
||||
}
|
||||
}
|
||||
|
|
@ -239,7 +239,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
// the total, after replication should be 44
|
||||
awaitAssert {
|
||||
replicator ! Get(KeyB, readAll)
|
||||
val c = expectMsgPF() { case g @ GetSuccess(KeyB, _) ⇒ g.get(KeyB) }
|
||||
val c = expectMsgPF() { case g @ GetSuccess(KeyB, _) => g.get(KeyB) }
|
||||
c.value should be(44)
|
||||
}
|
||||
}
|
||||
|
|
@ -253,7 +253,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
// the total, after replication should be 46
|
||||
awaitAssert {
|
||||
replicator ! Get(KeyB, readMajority)
|
||||
val c = expectMsgPF() { case g @ GetSuccess(KeyB, _) ⇒ g.get(KeyB) }
|
||||
val c = expectMsgPF() { case g @ GetSuccess(KeyB, _) => g.get(KeyB) }
|
||||
c.value should be(46)
|
||||
}
|
||||
}
|
||||
|
|
@ -270,7 +270,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
runOn(first) {
|
||||
replicator ! Update(KeyC, GCounter(), writeTwo)(_ :+ 30)
|
||||
expectMsg(UpdateSuccess(KeyC, None))
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyC) ⇒ c.get(KeyC).value } should be(30)
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyC) => c.get(KeyC).value } should be(30)
|
||||
|
||||
replicator ! Update(KeyY, GCounter(), writeTwo)(_ :+ 30)
|
||||
expectMsg(UpdateSuccess(KeyY, None))
|
||||
|
|
@ -282,20 +282,20 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
|
||||
runOn(second) {
|
||||
replicator ! Get(KeyC, ReadLocal)
|
||||
val c30 = expectMsgPF() { case g @ GetSuccess(KeyC, _) ⇒ g.get(KeyC) }
|
||||
val c30 = expectMsgPF() { case g @ GetSuccess(KeyC, _) => g.get(KeyC) }
|
||||
c30.value should be(30)
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyC) ⇒ c.get(KeyC).value } should be(30)
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyC) => c.get(KeyC).value } should be(30)
|
||||
|
||||
// replicate with gossip after WriteLocal
|
||||
replicator ! Update(KeyC, GCounter(), WriteLocal)(_ :+ 1)
|
||||
expectMsg(UpdateSuccess(KeyC, None))
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyC) ⇒ c.get(KeyC).value } should be(31)
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyC) => c.get(KeyC).value } should be(31)
|
||||
|
||||
replicator ! Delete(KeyY, WriteLocal, Some(777))
|
||||
expectMsg(DeleteSuccess(KeyY, Some(777)))
|
||||
|
||||
replicator ! Get(KeyZ, readMajority)
|
||||
expectMsgPF() { case g @ GetSuccess(KeyZ, _) ⇒ g.get(KeyZ).value } should be(30)
|
||||
expectMsgPF() { case g @ GetSuccess(KeyZ, _) => g.get(KeyZ).value } should be(30)
|
||||
}
|
||||
enterBarrier("update-c31")
|
||||
|
||||
|
|
@ -304,21 +304,21 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
within(5.seconds) {
|
||||
awaitAssert {
|
||||
replicator ! Get(KeyC, ReadLocal)
|
||||
val c = expectMsgPF() { case g @ GetSuccess(KeyC, _) ⇒ g.get(KeyC) }
|
||||
val c = expectMsgPF() { case g @ GetSuccess(KeyC, _) => g.get(KeyC) }
|
||||
c.value should be(31)
|
||||
|
||||
replicator ! Get(KeyY, ReadLocal, Some(777))
|
||||
expectMsg(DataDeleted(KeyY, Some(777)))
|
||||
}
|
||||
}
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyC) ⇒ c.get(KeyC).value } should be(31)
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyC) => c.get(KeyC).value } should be(31)
|
||||
}
|
||||
enterBarrier("verified-c31")
|
||||
|
||||
// and also for concurrent updates
|
||||
runOn(first, second) {
|
||||
replicator ! Get(KeyC, ReadLocal)
|
||||
val c31 = expectMsgPF() { case g @ GetSuccess(KeyC, _) ⇒ g.get(KeyC) }
|
||||
val c31 = expectMsgPF() { case g @ GetSuccess(KeyC, _) => g.get(KeyC) }
|
||||
c31.value should be(31)
|
||||
|
||||
replicator ! Update(KeyC, GCounter(), WriteLocal)(_ :+ 1)
|
||||
|
|
@ -327,7 +327,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
within(5.seconds) {
|
||||
awaitAssert {
|
||||
replicator ! Get(KeyC, ReadLocal)
|
||||
val c = expectMsgPF() { case g @ GetSuccess(KeyC, _) ⇒ g.get(KeyC) }
|
||||
val c = expectMsgPF() { case g @ GetSuccess(KeyC, _) => g.get(KeyC) }
|
||||
c.value should be(33)
|
||||
}
|
||||
}
|
||||
|
|
@ -347,7 +347,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
|
||||
runOn(first, second) {
|
||||
replicator ! Get(KeyD, ReadLocal)
|
||||
val c40 = expectMsgPF() { case g @ GetSuccess(KeyD, _) ⇒ g.get(KeyD) }
|
||||
val c40 = expectMsgPF() { case g @ GetSuccess(KeyD, _) => g.get(KeyD) }
|
||||
c40.value should be(40)
|
||||
replicator ! Update(KeyD, GCounter() :+ 1, writeTwo)(_ :+ 1)
|
||||
expectMsg(timeout + 1.second, UpdateTimeout(KeyD, None))
|
||||
|
|
@ -355,7 +355,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
expectMsg(timeout + 1.second, UpdateTimeout(KeyD, None))
|
||||
}
|
||||
runOn(first) {
|
||||
for (n ← 1 to 30) {
|
||||
for (n <- 1 to 30) {
|
||||
val KeyDn = GCounterKey("D" + n)
|
||||
replicator ! Update(KeyDn, GCounter(), WriteLocal)(_ :+ n)
|
||||
expectMsg(UpdateSuccess(KeyDn, None))
|
||||
|
|
@ -370,15 +370,15 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
|
||||
runOn(first, second) {
|
||||
replicator ! Get(KeyD, readTwo)
|
||||
val c44 = expectMsgPF() { case g @ GetSuccess(KeyD, _) ⇒ g.get(KeyD) }
|
||||
val c44 = expectMsgPF() { case g @ GetSuccess(KeyD, _) => g.get(KeyD) }
|
||||
c44.value should be(44)
|
||||
|
||||
within(10.seconds) {
|
||||
awaitAssert {
|
||||
for (n ← 1 to 30) {
|
||||
for (n <- 1 to 30) {
|
||||
val KeyDn = GCounterKey("D" + n)
|
||||
replicator ! Get(KeyDn, ReadLocal)
|
||||
expectMsgPF() { case g @ GetSuccess(KeyDn, _) ⇒ g.get(KeyDn) }.value should be(n)
|
||||
expectMsgPF() { case g @ GetSuccess(KeyDn, _) => g.get(KeyDn) }.value should be(n)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -408,7 +408,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
|
||||
runOn(first, second, third) {
|
||||
replicator ! Get(KeyE, readMajority)
|
||||
val c150 = expectMsgPF() { case g @ GetSuccess(KeyE, _) ⇒ g.get(KeyE) }
|
||||
val c150 = expectMsgPF() { case g @ GetSuccess(KeyE, _) => g.get(KeyE) }
|
||||
c150.value should be(150)
|
||||
}
|
||||
enterBarrier("read-initial-majority")
|
||||
|
|
@ -431,7 +431,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
val probe2 = TestProbe()
|
||||
replicator.tell(Get(KeyE, readMajority), probe2.ref)
|
||||
probe2.expectMsgType[GetSuccess[_]]
|
||||
replicator.tell(Update(KeyE, GCounter(), writeMajority, None) { data ⇒
|
||||
replicator.tell(Update(KeyE, GCounter(), writeMajority, None) { data =>
|
||||
probe1.ref ! data.value
|
||||
data :+ 1
|
||||
}, probe2.ref)
|
||||
|
|
@ -441,7 +441,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
replicator.tell(Get(KeyE, readMajority), probe3.ref)
|
||||
probe1.expectMsg(151)
|
||||
probe2.expectMsg(UpdateSuccess(KeyE, None))
|
||||
val c152 = probe3.expectMsgPF() { case g @ GetSuccess(KeyE, _) ⇒ g.get(KeyE) }
|
||||
val c152 = probe3.expectMsgPF() { case g @ GetSuccess(KeyE, _) => g.get(KeyE) }
|
||||
c152.value should be(152)
|
||||
}
|
||||
enterBarrier("majority-update-from-first")
|
||||
|
|
@ -462,7 +462,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
probe1.expectMsg(UpdateSuccess(KeyE, Some(153)))
|
||||
probe2.expectMsg(UpdateSuccess(KeyE, Some(154)))
|
||||
probe3.expectMsg(UpdateSuccess(KeyE, Some(155)))
|
||||
val c155 = probe5.expectMsgPF() { case g @ GetSuccess(KeyE, _) ⇒ g.get(KeyE) }
|
||||
val c155 = probe5.expectMsgPF() { case g @ GetSuccess(KeyE, _) => g.get(KeyE) }
|
||||
c155.value should be(155)
|
||||
}
|
||||
enterBarrier("majority-update-from-second")
|
||||
|
|
@ -483,7 +483,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
|
||||
runOn(third) {
|
||||
replicator ! Get(KeyE, readMajority)
|
||||
val c155 = expectMsgPF() { case g @ GetSuccess(KeyE, _) ⇒ g.get(KeyE) }
|
||||
val c155 = expectMsgPF() { case g @ GetSuccess(KeyE, _) => g.get(KeyE) }
|
||||
c155.value should be(155)
|
||||
}
|
||||
|
||||
|
|
@ -493,7 +493,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
"converge after many concurrent updates" in within(10.seconds) {
|
||||
runOn(first, second, third) {
|
||||
var c = GCounter()
|
||||
for (_ ← 0 until 100) {
|
||||
for (_ <- 0 until 100) {
|
||||
c :+= 1
|
||||
replicator ! Update(KeyF, GCounter(), writeTwo)(_ :+ 1)
|
||||
}
|
||||
|
|
@ -503,7 +503,7 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
enterBarrier("100-updates-done")
|
||||
runOn(first, second, third) {
|
||||
replicator ! Get(KeyF, readTwo)
|
||||
val c = expectMsgPF() { case g @ GetSuccess(KeyF, _) ⇒ g.get(KeyF) }
|
||||
val c = expectMsgPF() { case g @ GetSuccess(KeyF, _) => g.get(KeyF) }
|
||||
c.value should be(3 * 100)
|
||||
}
|
||||
enterBarrierAfterTestStep()
|
||||
|
|
@ -517,9 +517,9 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
enterBarrier("a-b-added-to-G")
|
||||
runOn(second) {
|
||||
replicator ! Get(KeyG, readAll)
|
||||
expectMsgPF() { case g @ GetSuccess(KeyG, _) ⇒ g.get(KeyG).elements } should be(Set("a", "b"))
|
||||
expectMsgPF() { case g @ GetSuccess(KeyG, _) => g.get(KeyG).elements } should be(Set("a", "b"))
|
||||
replicator ! Get(KeyG, ReadLocal)
|
||||
expectMsgPF() { case g @ GetSuccess(KeyG, _) ⇒ g.get(KeyG).elements } should be(Set("a", "b"))
|
||||
expectMsgPF() { case g @ GetSuccess(KeyG, _) => g.get(KeyG).elements } should be(Set("a", "b"))
|
||||
}
|
||||
enterBarrierAfterTestStep()
|
||||
}
|
||||
|
|
@ -529,22 +529,22 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
|
||||
runOn(second) {
|
||||
replicator ! Subscribe(KeyH, changedProbe.ref)
|
||||
replicator ! Update(KeyH, ORMap.empty[String, Flag], writeTwo)(_ :+ ("a" → Flag.Disabled))
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyH) ⇒ c.get(KeyH).entries } should be(Map("a" → Flag.Disabled))
|
||||
replicator ! Update(KeyH, ORMap.empty[String, Flag], writeTwo)(_ :+ ("a" -> Flag.Disabled))
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyH) => c.get(KeyH).entries } should be(Map("a" -> Flag.Disabled))
|
||||
}
|
||||
|
||||
enterBarrier("update-h1")
|
||||
|
||||
runOn(first) {
|
||||
replicator ! Update(KeyH, ORMap.empty[String, Flag], writeTwo)(_ :+ ("a" → Flag.Enabled))
|
||||
replicator ! Update(KeyH, ORMap.empty[String, Flag], writeTwo)(_ :+ ("a" -> Flag.Enabled))
|
||||
}
|
||||
|
||||
runOn(second) {
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyH) ⇒ c.get(KeyH).entries } should be(Map("a" → Flag.Enabled))
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyH) => c.get(KeyH).entries } should be(Map("a" -> Flag.Enabled))
|
||||
|
||||
replicator ! Update(KeyH, ORMap.empty[String, Flag], writeTwo)(_ :+ ("b" → Flag.Enabled))
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyH) ⇒ c.get(KeyH).entries } should be(
|
||||
Map("a" → Flag.Enabled, "b" → Flag.Enabled))
|
||||
replicator ! Update(KeyH, ORMap.empty[String, Flag], writeTwo)(_ :+ ("b" -> Flag.Enabled))
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyH) => c.get(KeyH).entries } should be(
|
||||
Map("a" -> Flag.Enabled, "b" -> Flag.Enabled))
|
||||
}
|
||||
|
||||
enterBarrierAfterTestStep()
|
||||
|
|
@ -556,11 +556,11 @@ class ReplicatorSpec extends MultiNodeSpec(ReplicatorSpec) with STMultiNodeSpec
|
|||
enterBarrier("subscribed-I")
|
||||
|
||||
runOn(second) {
|
||||
replicator ! Update(KeyI, GSet.empty[String], writeTwo)(a ⇒ a.add("a"))
|
||||
replicator ! Update(KeyI, GSet.empty[String], writeTwo)(a => a.add("a"))
|
||||
}
|
||||
|
||||
within(5.seconds) { // gossip to third
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyI) ⇒ c.get(KeyI).elements } should be(Set("a"))
|
||||
changedProbe.expectMsgPF() { case c @ Changed(KeyI) => c.get(KeyI).elements } should be(Set("a"))
|
||||
}
|
||||
|
||||
enterBarrier("update-I")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue