NodeGroupConfig cfg = new NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg);
@Override public void handleStart(Operation startPost) { NodeGroupState initState = null; if (startPost.hasBody()) { initState = startPost.getBody(NodeGroupState.class); } else { initState = new NodeGroupState(); } initState.documentOwner = getHost().getId(); if (initState.config == null) { initState.config = new NodeGroupConfig(); } NodeState self = initState.nodes.get(getHost().getId()); self = buildLocalNodeState(self); if (!validateNodeOptions(startPost, self.options)) { return; } initState.nodes.put(self.id, self); this.cachedState = Utils.clone(initState); startPost.setBody(this.cachedState).complete(); }
private void stopOwnerNode(ExampleServiceState serviceState) { // find owner and stop it VerificationHost owner = null; for (VerificationHost h : this.cluster.getInProcessHostMap().values()) { if (!h.getId().equals(serviceState.documentOwner)) { peerHost = h; } else { owner = h; } } owner.log(Level.INFO, "Stopping owner node %s...", owner.getId()); // Patching the NodeGroupConfig so the stopped node get "kicked" from the group faster. NodeGroupConfig cfg = new NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(2); this.cluster.setNodeGroupConfig(cfg); this.cluster.stopHost(owner); cluster.waitForReplicatedFactoryServiceAvailable(UriUtils.buildUri(peerHost, ExampleService.FACTORY_LINK)); }
NodeGroupConfig cfg = new NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg);
NodeGroupConfig cfg = new NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg);
NodeGroupService.NodeGroupConfig cfg = new NodeGroupService.NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg);
NodeGroupService.NodeGroupConfig cfg = new NodeGroupService.NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg);
this.replicationTargetFactoryLink = Replication1xExampleFactoryService.SELF_LINK; this.host.joinNodesAndVerifyConvergence(this.host.getPeerCount() - 1); NodeGroupService.NodeGroupConfig cfg = new NodeGroupService.NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg);
NodeGroupConfig cfg = new NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg);
NodeGroupService.NodeGroupConfig cfg = new NodeGroupService.NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg);
this.replicationTargetFactoryLink = Replication1xExampleFactoryService.SELF_LINK; this.host.joinNodesAndVerifyConvergence(this.host.getPeerCount() - 1); NodeGroupService.NodeGroupConfig cfg = new NodeGroupService.NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg);
setUp(this.nodeCount); NodeGroupService.NodeGroupConfig cfg = new NodeGroupService.NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.MINUTES.toMicros(5); this.host.setNodeGroupConfig(cfg);
NodeGroupService.NodeGroupConfig cfg = new NodeGroupService.NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg);
setUp(this.nodeCount); NodeGroupService.NodeGroupConfig cfg = new NodeGroupService.NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.MINUTES.toMicros(5); this.host.setNodeGroupConfig(cfg);
public void setUp(int nodeCount) throws Throwable { CommandLineArgumentParser.parseFromProperties(this); if (this.host.getInProcessHostMap().isEmpty()) { this.host.setStressTest(this.host.isStressTest); this.host.setPeerSynchronizationEnabled(true); this.host.setUpPeerHosts(nodeCount); NodeGroupService.NodeGroupConfig cfg = new NodeGroupService.NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg); for (VerificationHost host : this.host.getInProcessHostMap().values()) { host.setMaintenanceIntervalMicros(TimeUnit.MILLISECONDS.toMicros( VerificationHost.FAST_MAINT_INTERVAL_MILLIS)); host.waitForServiceAvailable(ExampleService.FACTORY_LINK); CheckpointService.CheckpointState s = new CheckpointService.CheckpointState(); s.timestamp = 0L; s.factoryLink = TEST_FACTORY_LINK; Operation op = Operation.createPost(host, CheckpointService.FACTORY_LINK) .setBody(s); this.host.getTestRequestSender().sendAndWait(op); } this.host.joinNodesAndVerifyConvergence(nodeCount, true); this.host.waitForReplicatedFactoryServiceAvailable( UriUtils.buildUri(this.host.getPeerHost(), ExampleService.FACTORY_LINK)); } }
private void doVerifyOwnerSelection(Class<? extends Service> factoryType, String factoryLink) throws Throwable { Map<String, ExampleServiceState> exampleServices; this.replicationTargetFactoryLink = factoryLink; setUp(this.nodeCount); this.host.joinNodesAndVerifyConvergence(this.host.getPeerCount()); NodeGroupConfig cfg = new NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg); this.host.waitForNodeGroupConvergence(); for (VerificationHost h1 : this.host.getInProcessHostMap().values()) { h1.startServiceAndWait(FactoryService.create(factoryType), factoryLink, null); } this.host.waitForReplicatedFactoryServiceAvailable( UriUtils.buildUri(this.host.getPeerHost(), factoryLink), ServiceUriPaths.DEFAULT_NODE_SELECTOR); exampleServices = createExampleServices(this.host.getPeerHostUri()); // Verify that all services are replicated with with replication factor of 1. this.host.waitForReplicatedFactoryChildServiceConvergence( getFactoriesPerNodeGroup(factoryLink), exampleServices, this.exampleStateConvergenceChecker, exampleServices.size(), 0, 1); }
public void setUp(int nodeCount) throws Throwable { CommandLineArgumentParser.parseFromProperties(this); if (this.host.getInProcessHostMap().isEmpty()) { this.host.setStressTest(this.host.isStressTest); this.host.setPeerSynchronizationEnabled(true); this.host.setUpPeerHosts(nodeCount); NodeGroupService.NodeGroupConfig cfg = new NodeGroupService.NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg); for (VerificationHost host : this.host.getInProcessHostMap().values()) { host.setMaintenanceIntervalMicros(TimeUnit.MILLISECONDS.toMicros( VerificationHost.FAST_MAINT_INTERVAL_MILLIS)); host.waitForServiceAvailable(ExampleService.FACTORY_LINK); CheckpointService.CheckpointState s = new CheckpointService.CheckpointState(); s.timestamp = 0L; s.factoryLink = TEST_FACTORY_LINK; Operation op = Operation.createPost(host, CheckpointService.FACTORY_LINK) .setBody(s); this.host.getTestRequestSender().sendAndWait(op); } this.host.joinNodesAndVerifyConvergence(nodeCount, true); this.host.waitForReplicatedFactoryServiceAvailable( UriUtils.buildUri(this.host.getPeerHost(), ExampleService.FACTORY_LINK)); } }
private void doVerifyOwnerSelection(Class<? extends Service> factoryType, String factoryLink) throws Throwable { Map<String, ExampleServiceState> exampleServices; this.replicationTargetFactoryLink = factoryLink; setUp(this.nodeCount); this.host.joinNodesAndVerifyConvergence(this.host.getPeerCount()); NodeGroupConfig cfg = new NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg); this.host.waitForNodeGroupConvergence(); for (VerificationHost h1 : this.host.getInProcessHostMap().values()) { h1.startServiceAndWait(FactoryService.create(factoryType), factoryLink, null); } this.host.waitForReplicatedFactoryServiceAvailable( UriUtils.buildUri(this.host.getPeerHost(), factoryLink), ServiceUriPaths.DEFAULT_NODE_SELECTOR); exampleServices = createExampleServices(this.host.getPeerHostUri()); // Verify that all services are replicated with with replication factor of 1. this.host.waitForReplicatedFactoryChildServiceConvergence( getFactoriesPerNodeGroup(factoryLink), exampleServices, this.exampleStateConvergenceChecker, exampleServices.size(), 0, 1); }
private void setUpMultiNode() throws Throwable { this.host.setUpPeerHosts(this.nodeCount); this.host.joinNodesAndVerifyConvergence(this.nodeCount); URI exampleFactoryUri = UriUtils.buildUri( this.host.getPeerServiceUri(ExampleService.FACTORY_LINK)); this.host.waitForReplicatedFactoryServiceAvailable(exampleFactoryUri); // expire node that went away quickly to avoid alot of log spam from gossip failures NodeGroupService.NodeGroupConfig cfg = new NodeGroupService.NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg); for (VerificationHost h : this.host.getInProcessHostMap().values()) { h.addPrivilegedService(InMemoryLuceneDocumentIndexService.class); h.startCoreServicesSynchronously(new InMemoryLuceneDocumentIndexService()); h.startFactory(new InMemoryExampleService()); h.startFactory(new ExampleODLService()); } URI inMemoryExampleFactoryUri = UriUtils.buildUri( this.host.getPeerServiceUri(InMemoryExampleService.FACTORY_LINK)); this.host.waitForReplicatedFactoryServiceAvailable(inMemoryExampleFactoryUri); URI ODLExampleFactoryUri = UriUtils.buildUri( this.host.getPeerServiceUri(ExampleODLService.FACTORY_LINK)); this.host.waitForReplicatedFactoryServiceAvailable(ODLExampleFactoryUri); }
private void setUpMultiNode() throws Throwable { this.host.setUpPeerHosts(this.nodeCount); this.host.joinNodesAndVerifyConvergence(this.nodeCount); URI exampleFactoryUri = UriUtils.buildUri( this.host.getPeerServiceUri(ExampleService.FACTORY_LINK)); this.host.waitForReplicatedFactoryServiceAvailable(exampleFactoryUri); // expire node that went away quickly to avoid alot of log spam from gossip failures NodeGroupService.NodeGroupConfig cfg = new NodeGroupService.NodeGroupConfig(); cfg.nodeRemovalDelayMicros = TimeUnit.SECONDS.toMicros(1); this.host.setNodeGroupConfig(cfg); for (VerificationHost h : this.host.getInProcessHostMap().values()) { h.addPrivilegedService(InMemoryLuceneDocumentIndexService.class); h.startCoreServicesSynchronously(new InMemoryLuceneDocumentIndexService()); h.startFactory(new InMemoryExampleService()); h.startFactory(new ExampleODLService()); } URI inMemoryExampleFactoryUri = UriUtils.buildUri( this.host.getPeerServiceUri(InMemoryExampleService.FACTORY_LINK)); this.host.waitForReplicatedFactoryServiceAvailable(inMemoryExampleFactoryUri); URI ODLExampleFactoryUri = UriUtils.buildUri( this.host.getPeerServiceUri(ExampleODLService.FACTORY_LINK)); this.host.waitForReplicatedFactoryServiceAvailable(ODLExampleFactoryUri); }