[
https://issues.apache.org/jira/browse/FLINK-7476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16138289#comment-16138289
]
ASF GitHub Bot commented on FLINK-7476:
---------------------------------------
Github user aljoscha commented on a diff in the pull request:
https://github.com/apache/flink/pull/4561#discussion_r134737971
--- 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 you could also use the `TemporaryFolder` rule for this:
```
@Rule
public TemporaryFolder tempFolder = new TemporaryFolder();
```
but this also seems fine.
> 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)