Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Fix flaky test testLookupDynamicPartition #3447

Merged
merged 2 commits into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
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;
Expand Down Expand Up @@ -250,15 +251,15 @@ public String toString() {
}

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it's also traversed once, is there any difference?

Copy link
Contributor Author

@Zouxxyy Zouxxyy May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy out to avoid ConcurrentModificationException, see https://github.com/apache/paimon/actions/runs/9305326341/job/25611978740

.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}. */
Expand Down
Loading