-
Notifications
You must be signed in to change notification settings - Fork 170
fix(spark): Strict check processed blockIds #2678
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |
| import java.net.Socket; | ||
| import java.util.Arrays; | ||
| import java.util.Collections; | ||
| import java.util.HashSet; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
| import java.util.Objects; | ||
|
|
@@ -59,6 +60,32 @@ | |
|
|
||
| public class RssUtilsTest { | ||
|
|
||
| @Test | ||
| public void testCheckProcessedBlockIds() throws Exception { | ||
| Roaring64NavigableMap exceptedBlockIds = new Roaring64NavigableMap(); | ||
|
||
| exceptedBlockIds.add(1); | ||
| exceptedBlockIds.add(2); | ||
|
|
||
| // case1: illegal should throw exception | ||
| Set<Long> processedBlockIds = new HashSet<>(); | ||
| processedBlockIds.add(1L); | ||
| processedBlockIds.add(2L); | ||
| processedBlockIds.add(3L); | ||
|
|
||
| try { | ||
| RssUtils.checkProcessedBlockIds(exceptedBlockIds, processedBlockIds); | ||
| fail(); | ||
|
Comment on lines
+76
to
+77
|
||
| } catch (Exception e) { | ||
| // ignore | ||
| } | ||
|
|
||
| // case2: legal invoke | ||
| processedBlockIds = new HashSet<>(); | ||
| processedBlockIds.add(1L); | ||
| processedBlockIds.add(2L); | ||
| RssUtils.checkProcessedBlockIds(exceptedBlockIds, processedBlockIds); | ||
| } | ||
|
|
||
| @Test | ||
| public void testGetPropertiesFromFile() { | ||
| final String filePath = | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method now mutates the input parameter
processedBlockIdsby callingremove(). This is a breaking behavioral change that could affect callers who reuse this Set. Consider either documenting this side effect clearly, cloning the Set before modification, or renaming the parameter to indicate it will be modified (e.g.,mutableProcessedBlockIds).