This is an automated email from the ASF dual-hosted git repository.
lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git
The following commit(s) were added to refs/heads/master by this push:
new 9615fc4ca [test] Fix flaky test testLookupDynamicPartition (#3447)
9615fc4ca is described below
commit 9615fc4caad41b0328c0e89c57f165336a85d77e
Author: Zouxxyy <[email protected]>
AuthorDate: Fri May 31 13:19:10 2024 +0800
[test] Fix flaky test testLookupDynamicPartition (#3447)
---
.../test/java/org/apache/paimon/utils/TraceableFileIO.java | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git
a/paimon-core/src/test/java/org/apache/paimon/utils/TraceableFileIO.java
b/paimon-core/src/test/java/org/apache/paimon/utils/TraceableFileIO.java
index b3d3a937c..623fe3147 100644
--- a/paimon-core/src/test/java/org/apache/paimon/utils/TraceableFileIO.java
+++ b/paimon-core/src/test/java/org/apache/paimon/utils/TraceableFileIO.java
@@ -32,6 +32,7 @@ import org.apache.paimon.fs.local.LocalFileIO;
import javax.annotation.concurrent.GuardedBy;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -250,15 +251,15 @@ public class TraceableFileIO implements FileIO {
}
public static List<SeekableInputStream> openInputStreams(Predicate<Path>
filter) {
- return OPEN_INPUT_STREAMS.stream()
- .filter(s -> filter.test(s.file))
- .collect(Collectors.toList());
+ // copy out to avoid ConcurrentModificationException
+ return new ArrayList<>(OPEN_INPUT_STREAMS)
+ .stream().filter(s ->
filter.test(s.file)).collect(Collectors.toList());
}
public static List<PositionOutputStream> openOutputStreams(Predicate<Path>
filter) {
- return OPEN_OUTPUT_STREAMS.stream()
- .filter(s -> filter.test(s.file))
- .collect(Collectors.toList());
+ // copy out to avoid ConcurrentModificationException
+ return new ArrayList<>(OPEN_OUTPUT_STREAMS)
+ .stream().filter(s ->
filter.test(s.file)).collect(Collectors.toList());
}
/** Loader for {@link TraceableFileIO}. */