public ReplicatorResiliencySpec(ITestOutputHelper helper) : base(SpecConfig, helper) { _sys1 = Sys; _sys3 = ActorSystem.Create(Sys.Name, Sys.Settings.Config); _sys2 = ActorSystem.Create(Sys.Name, Sys.Settings.Config); var settings = ReplicatorSettings.Create(Sys) .WithGossipInterval(TimeSpan.FromSeconds(1.0)) .WithMaxDeltaElements(10) .WithRestartReplicatorOnFailure(true); var props = BackoffSupervisor.Props( Backoff.OnStop( childProps: Replicator.Props(settings), childName: "replicator", minBackoff: TimeSpan.FromSeconds(3), maxBackoff: TimeSpan.FromSeconds(300), randomFactor: 0.2, maxNrOfRetries: -1) .WithFinalStopMessage(m => m is Terminate)) .WithDeploy(Deploy.Local).WithDispatcher(settings.Dispatcher); _replicator1 = _sys1.ActorOf(props, "replicatorSuper"); _replicator2 = _sys2.ActorOf(props, "replicatorSuper"); _replicator3 = _sys3.ActorOf(props, "replicatorSuper"); }
private IActorRef StartReplicator(ActorSystem system) { return(system.ActorOf(Replicator.Props( ReplicatorSettings.Create(system) .WithGossipInterval(TimeSpan.FromSeconds(1)) .WithPruning(TimeSpan.FromSeconds(1), maxPruningDissemination)), "replicator")); }
protected ReplicatorChaosSpec(ReplicatorChaosSpecConfig config) : base(config, typeof(ReplicatorChaosSpec)) { _cluster = Akka.Cluster.Cluster.Get(Sys); _timeout = Dilated(TimeSpan.FromSeconds(3)); _replicator = Sys.ActorOf(Replicator.Props(ReplicatorSettings.Create(Sys) .WithRole("backend") .WithGossipInterval(TimeSpan.FromSeconds(1))), "replicator"); }
public ReplicatorPruningSpec(ReplicatorPruningSpecConfig config) : base(config) { _cluster = Cluster.Cluster.Get(Sys); _timeout = Dilated(TimeSpan.FromSeconds(3)); _replicator = Sys.ActorOf(Replicator.Props(ReplicatorSettings.Create(Sys) .WithGossipInterval(TimeSpan.FromSeconds(1)) .WithPruning(pruningInterval: TimeSpan.FromSeconds(1), maxPruningDissemination: _maxPruningDissemination)), "replicator"); }
private IActorRef NewReplicator(ActorSystem system = null) { if (system == null) { system = Sys; } return(system.ActorOf(Replicator.Props( ReplicatorSettings.Create(system).WithGossipInterval(TimeSpan.FromSeconds(1))), "replicator-" + testStepCounter)); }
public void Cluster_CRDT_should_support_prefer_oldest_members() { // disable gossip and delta replication to only verify the write and read operations var oldestReplicator = Sys.ActorOf( Replicator.Props( ReplicatorSettings.Create(Sys).WithPreferOldest(true).WithGossipInterval(TimeSpan.FromMinutes(1))),//.withDeltaCrdtEnabled(false)), "oldestReplicator"); Within(TimeSpan.FromSeconds(5), () => { var countProbe = CreateTestProbe(); AwaitAssert(() => { oldestReplicator.Tell(GetReplicaCount.Instance, countProbe.Ref); countProbe.ExpectMsg(new ReplicaCount(3)); }); }); EnterBarrier("oldest-replicator-started"); var probe = CreateTestProbe(); RunOn(() => { oldestReplicator.Tell( Dsl.Update(KeyK, new LWWRegister <string>(Cluster.SelfUniqueAddress, "0"), _writeTwo, a => a.WithValue(Cluster.SelfUniqueAddress, "1")), probe.Ref); probe.ExpectMsg(new UpdateSuccess(KeyK, null)); }, _second); EnterBarrier("updated-1"); RunOn(() => { // replicated to oldest oldestReplicator.Tell(new Get(KeyK, ReadLocal.Instance), probe.Ref); var msg = probe.ExpectMsg <GetSuccess>(m => m.Data is LWWRegister <string>); ((LWWRegister <string>)msg.Data).Value.Should().Be("1"); //probe.ExpectMsg<GetSuccess[LWWRegister[String]]>.dataValue.value should === ("1"); }, _first); RunOn(() => { // not replicated to third (not among the two oldest) oldestReplicator.Tell(Dsl.Get(KeyK, ReadLocal.Instance), probe.Ref); probe.ExpectMsg(new NotFound(KeyK, null)); // read from oldest oldestReplicator.Tell(Dsl.Get(KeyK, _readTwo), probe.Ref); var msg = probe.ExpectMsg <GetSuccess>(m => m.Data is LWWRegister <string>); ((LWWRegister <string>)msg.Data).Value.Should().Be("1"); //probe.ExpectMsg<GetSuccess[LWWRegister[String]]>.dataValue.value should === ("1"); }, _third); EnterBarrierAfterTestStep(); }
public void Durable_CRDT_should_stop_Replicator_if_Load_fails() { RunOn(() => { var r = Sys.ActorOf(Replicator.Props( ReplicatorSettings.Create(Sys).WithDurableStoreProps(TestDurableStoreProps(failLoad: true))), "replicator-" + testStepCounter); Watch(r); ExpectTerminated(r); }, first); EnterBarrierAfterTestStep(); }
public void Durable_CRDT_should_reply_with_StoreFailure_if_store_fails() { RunOn(() => { var r = Sys.ActorOf(Replicator.Props( ReplicatorSettings.Create(Sys).WithDurableStoreProps(TestDurableStoreProps(failStore: true))), "replicator-" + testStepCounter); r.Tell(Dsl.Update(keyA, GCounter.Empty, WriteLocal.Instance, "a", c => c.Increment(cluster))); ExpectMsg(new StoreFailure(keyA, "a")); }, first); EnterBarrierAfterTestStep(); }
protected ReplicatorPruningSpec(ReplicatorPruningSpecConfig config) : base(config, typeof(ReplicatorPruningSpec)) { _cluster = Akka.Cluster.Cluster.Get(Sys); _timeout = Dilated(TimeSpan.FromSeconds(3)); _replicator = Sys.ActorOf(Replicator.Props(ReplicatorSettings.Create(Sys) .WithGossipInterval(TimeSpan.FromSeconds(1)) .WithPruning(pruningInterval: TimeSpan.FromSeconds(1), maxPruningDissemination: _maxPruningDissemination)), "replicator"); First = config.First; Second = config.Second; Third = config.Third; }
public ReplicatorSpec(ReplicatorSpecConfig config) : base(config) { _config = config; _cluster = Cluster.Cluster.Get(Sys); var settings = ReplicatorSettings.Create(Sys).WithGossipInterval(TimeSpan.FromSeconds(1.0)).WithMaxDeltaElements(10); var props = Replicator.Props(settings); _replicator = Sys.ActorOf(props, "replicator"); _timeOut = Dilated(TimeSpan.FromSeconds(2.0)); _writeTwo = new WriteTo(2, _timeOut); _writeMajority = new WriteMajority(_timeOut); _writeAll = new WriteAll(_timeOut); _readTwo = new ReadFrom(2, _timeOut); _readMajority = new ReadMajority(_timeOut); _readAll = new ReadAll(_timeOut); }
protected ReplicatorSpec(ReplicatorSpecConfig config) : base(config, typeof(ReplicatorSpec)) { _config = config; _first = config.First; _second = config.Second; _third = config.Third; _cluster = Akka.Cluster.Cluster.Get(Sys); var settings = ReplicatorSettings.Create(Sys) .WithGossipInterval(TimeSpan.FromSeconds(1.0)) .WithMaxDeltaElements(10); var props = Replicator.Props(settings); _replicator = Sys.ActorOf(props, "replicator"); _timeOut = Dilated(TimeSpan.FromSeconds(3.0)); _writeTwo = new WriteTo(2, _timeOut); _writeMajority = new WriteMajority(_timeOut); _writeAll = new WriteAll(_timeOut); _readTwo = new ReadFrom(2, _timeOut); _readMajority = new ReadMajority(_timeOut); _readAll = new ReadAll(_timeOut); }
public ReplicatorSpecs(ITestOutputHelper helper) : base(SpecConfig, helper) { _sys1 = Sys; _sys3 = ActorSystem.Create(Sys.Name, Sys.Settings.Config); _sys2 = ActorSystem.Create(Sys.Name, Sys.Settings.Config); _timeOut = Dilated(TimeSpan.FromSeconds(3.0)); _writeTwo = new WriteTo(2, _timeOut); _writeMajority = new WriteMajority(_timeOut); _writeAll = new WriteAll(_timeOut); _readTwo = new ReadFrom(2, _timeOut); _readMajority = new ReadMajority(_timeOut); _readAll = new ReadAll(_timeOut); var settings = ReplicatorSettings.Create(Sys) .WithGossipInterval(TimeSpan.FromSeconds(1.0)) .WithMaxDeltaElements(10); var props = Replicator.Props(settings); _replicator1 = _sys1.ActorOf(props, "replicator"); _replicator2 = _sys2.ActorOf(props, "replicator"); _replicator3 = _sys3.ActorOf(props, "replicator"); }