[ https://issues.apache.org/jira/browse/FLINK-7476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16138390#comment-16138390 ]
ASF GitHub Bot commented on FLINK-7476: --------------------------------------- Github user pnowojski commented on a diff in the pull request: https://github.com/apache/flink/pull/4561#discussion_r134759790 --- Diff: flink-streaming-java/src/test/java/org/apache/flink/streaming/api/functions/sink/TwoPhaseCommitSinkFunctionTest.java --- @@ -185,11 +253,44 @@ protected void recoverAndAbort(FileTransaction transaction) { private static class FileTransaction { private final File tmpFile; - private final transient Writer writer; + private final transient BufferedWriter writer; public FileTransaction(File tmpFile) throws IOException { this.tmpFile = tmpFile; this.writer = new BufferedWriter(new FileWriter(tmpFile)); } + + @Override + public String toString() { + return String.format("FileTransaction[%s]", tmpFile.getName()); + } + } + + private static class TestContext implements AutoCloseable { + public final File tmpDirectory = Files.createTempDirectory(TwoPhaseCommitSinkFunctionTest.class.getSimpleName() + "_tmp").toFile(); + public final File targetDirectory = Files.createTempDirectory(TwoPhaseCommitSinkFunctionTest.class.getSimpleName() + "_target").toFile(); + + public FileBasedSinkFunction sinkFunction; + public OneInputStreamOperatorTestHarness<String, Object> harness; + + private TestContext() throws Exception { + tmpDirectory.deleteOnExit(); --- End diff -- I think I wouldn't be able to use the `@Rule` here for those directories. I would have to write my own rule, that would wrap whole `TestContext`, right? If so, can we leave as it is for know, because currently I'm getting stack overflow exceptions with number of opened issues that I'm currently working on ;) > Try to recover from failure in TwoPhaseCommitSinkFunction.beginTransaction > -------------------------------------------------------------------------- > > Key: FLINK-7476 > URL: https://issues.apache.org/jira/browse/FLINK-7476 > Project: Flink > Issue Type: Bug > Components: Streaming > Affects Versions: 1.4.0 > Reporter: Piotr Nowojski > Assignee: Piotr Nowojski > Fix For: 1.4.0 > > > Currently when using TwoPhaseCommitSinkFunction, if there is some > intermittent failure in "beginTransaction", not only the snapshot that > triggered this call fail, but also any subsequent write requests will fail > also, rendering such sink unusable until application restart. > This issue is in code that hasn't been released yet. -- This message was sent by Atlassian JIRA (v6.4.14#64029)