use of com.hazelcast.jet.impl.JobRecord in project hazelcast-jet by hazelcast.
the class SplitBrainTest method when_newMemberJoinsToCluster_then_jobQuorumSizeIsUpdated.
@Test
public void when_newMemberJoinsToCluster_then_jobQuorumSizeIsUpdated() {
int clusterSize = 3;
JetConfig jetConfig = new JetConfig();
JetInstance[] instances = new JetInstance[clusterSize];
for (int i = 0; i < clusterSize; i++) {
instances[i] = createJetMember(jetConfig);
}
StuckProcessor.executionStarted = new CountDownLatch(clusterSize * PARALLELISM);
MockPS processorSupplier = new MockPS(StuckProcessor::new, clusterSize);
DAG dag = new DAG().vertex(new Vertex("test", processorSupplier));
Job job = instances[0].newJob(dag, new JobConfig().setSplitBrainProtection(true));
assertOpenEventually(StuckProcessor.executionStarted);
createJetMember(jetConfig);
assertTrueEventually(() -> {
JobRepository jobRepository = getJetService(instances[0]).getJobRepository();
JobRecord jobRecord = jobRepository.getJobRecord(job.getId());
assertEquals(3, jobRecord.getQuorumSize());
});
StuckProcessor.proceedLatch.countDown();
}
use of com.hazelcast.jet.impl.JobRecord in project hazelcast by hazelcast.
the class TopologyChangeTest method when_nodeIsNotJobParticipant_then_initFails.
@Test
public void when_nodeIsNotJobParticipant_then_initFails() throws Throwable {
final long jobId = 1;
final long executionId = 1;
HazelcastInstance master = instances[0];
int memberListVersion = Accessors.getClusterService(master).getMemberListVersion();
Set<MemberInfo> memberInfos = new HashSet<>();
for (int i = 1; i < instances.length; i++) {
memberInfos.add(new MemberInfo(getNode(instances[i]).getLocalMember()));
}
Version version = instances[0].getCluster().getLocalMember().getVersion().asVersion();
JobRecord jobRecord = new JobRecord(version, jobId, null, "", new JobConfig(), Collections.emptySet(), null);
instances[0].getMap(JOB_RECORDS_MAP_NAME).put(jobId, jobRecord);
InitExecutionOperation op = new InitExecutionOperation(jobId, executionId, memberListVersion, version, memberInfos, null, false);
Future<Object> future = Accessors.getOperationService(master).createInvocationBuilder(JetServiceBackend.SERVICE_NAME, op, Accessors.getAddress(master)).invoke();
try {
future.get();
fail();
} catch (ExecutionException e) {
assertInstanceOf(IllegalArgumentException.class, e.getCause());
assertTrue("Expected: contains 'is not in participants'\nActual: '" + e.getMessage() + "'", e.getMessage().contains("is not in participants"));
}
}
Aggregations