use of com.hazelcast.jet.impl.SnapshotValidationRecord in project hazelcast by hazelcast.
the class SnapshotLargeChunk_IntegrationTest method test_snapshotRestoreLargeChunk.
@Test
public void test_snapshotRestoreLargeChunk() {
HazelcastInstance instance = createHazelcastInstance();
DAG dag = new DAG();
dag.newVertex("src", LargeStateP::new).localParallelism(1);
Job job = instance.getJet().newJob(dag, new JobConfig().setProcessingGuarantee(ProcessingGuarantee.EXACTLY_ONCE).setSnapshotIntervalMillis(DAYS.toMillis(1)));
assertJobStatusEventually(job, RUNNING);
job.restart();
assertJobStatusEventually(job, RUNNING);
// assert that the snapshot exists and that the chunk was large enough
IMap<Object, Object> map = instance.getMap(JobRepository.snapshotDataMapName(job.getId(), 0));
SnapshotValidationRecord validationRec = (SnapshotValidationRecord) map.get(SnapshotValidationRecord.KEY);
assertEquals(1, validationRec.numChunks());
IntSummaryStatistics stats = map.values().stream().filter(v -> v instanceof byte[]).collect(summarizingInt(v -> ((byte[]) v).length));
assertTrue("min=" + stats.getMin(), stats.getMin() > AsyncSnapshotWriterImpl.DEFAULT_CHUNK_SIZE);
}
Aggregations