private void testSingleFileFailedWriteHelper( SingleHDFSExactlyOnceWriter writer, ProcessingMode mode) { File meta = new File(testMeta.getDir()); writer.setFilePath(meta.getAbsolutePath()); writer.setup(new DummyContext(0, mode)); writer.beginWindow(0); writer.input.put(0); writer.input.put(1); writer.endWindow(); CheckPointWriter checkPointWriter = checkpoint(writer); writer.beginWindow(1); writer.input.put(2); writer.teardown(); restoreCheckPoint(checkPointWriter, writer); writer.setup(new DummyContext(0, mode)); writer.beginWindow(1); writer.input.put(4); writer.input.put(5); writer.endWindow(); writer.beginWindow(2); writer.input.put(6); writer.input.put(7); writer.endWindow(); writer.teardown(); }
private void testSingleRollingFileFailedWriteOverwriteHelper( SingleHDFSExactlyOnceWriter writer, ProcessingMode mode) { writer.setMaxLength(4); writer.setFilePath(testMeta.getDir()); writer.setup(new DummyContext(0, mode)); writer.beginWindow(0); writer.input.put(0); writer.input.put(1); writer.input.put(2); writer.endWindow(); writer.beginWindow(1); writer.input.put(3); writer.input.put(4); CheckPointWriter checkPointWriter = checkpoint(writer); writer.teardown(); restoreCheckPoint(checkPointWriter, writer); writer.setup(new DummyContext(0, mode)); writer.beginWindow(1); writer.input.put(3); writer.endWindow(); writer.beginWindow(2); writer.input.put(6); writer.input.put(7); writer.input.put(8); writer.endWindow(); writer.teardown(); }
private void singleFileMultiRollingFailureHelper( SingleHDFSExactlyOnceWriter writer, ProcessingMode mode) { writer.setup(new DummyContext(0, mode)); writer.beginWindow(0); writer.input.put(0); writer.input.put(1); writer.input.put(2); writer.endWindow(); writer.beginWindow(1); writer.input.put(3); writer.input.put(4); CheckPointWriter checkPointWriter = checkpoint(writer); writer.input.put(3); writer.input.put(4); writer.input.put(5); writer.endWindow(); writer.beginWindow(2); writer.input.put(6); writer.input.put(7); writer.input.put(8); writer.endWindow(); writer.teardown(); restoreCheckPoint(checkPointWriter, writer); writer.setup(new DummyContext(0, mode)); writer.beginWindow(1); writer.input.put(0); writer.input.put(1); writer.input.put(2); writer.endWindow(); writer.beginWindow(2); writer.input.put(3); writer.input.put(4); writer.input.put(5); writer.endWindow(); }
private void testSingleFileCompletedWriteHelper( SingleHDFSExactlyOnceWriter writer, ProcessingMode mode) { writer.setFilePath(testMeta.getDir()); writer.setup(new DummyContext(0, mode)); writer.beginWindow(0); writer.input.put(0); writer.input.put(1); writer.endWindow(); writer.beginWindow(1); writer.input.put(2); writer.input.put(3); writer.endWindow(); writer.teardown(); }
// @Ignore @Test public void testSingleRollingFileFailedWrite1() { prepareTest(); SingleHDFSExactlyOnceWriter writer = new SingleHDFSExactlyOnceWriter(); writer.setAppend(true); writer.setFilePath(testMeta.getDir()); writer.setMaxLength(4); writer.setup(new DummyContext(0, ProcessingMode.EXACTLY_ONCE)); writer.beginWindow(0); writer.input.put(0); writer.input.put(1); writer.input.put(2); writer.endWindow(); writer.beginWindow(1); writer.input.put(3); writer.input.put(4); writer.endWindow(); CheckPointWriter checkPointWriter = checkpoint(writer); CheckPointWriter checkPointWriter1 = checkpoint(writer); LOG.debug("Checkpoint endOffsets={}", checkPointWriter.endOffsets); writer.beginWindow(2); writer.input.put(5); writer.teardown(); restoreCheckPoint(checkPointWriter, writer); LOG.debug("Checkpoint endOffsets={}", checkPointWriter.endOffsets); writer.setup(new DummyContext(0, ProcessingMode.EXACTLY_ONCE)); writer.beginWindow(2); writer.input.put(5); writer.endWindow(); writer.beginWindow(3); writer.input.put(6); writer.input.put(7); writer.input.put(8); writer.endWindow(); writer.teardown(); restoreCheckPoint(checkPointWriter1, writer); writer.setup(new DummyContext(0, ProcessingMode.EXACTLY_ONCE)); String singleFilePath = testMeta.getDir() + File.separator + SINGLE_FILE; // Rolling file 0 String correctContents = "0\n" + "1\n" + "2\n"; checkOutput(0, singleFilePath, correctContents); // Rolling file 1 correctContents = "3\n" + "4\n"; checkOutput(1, singleFilePath, correctContents); }