You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@uniffle.apache.org by GitBox <gi...@apache.org> on 2022/07/08 05:42:55 UTC
[GitHub] [incubator-uniffle] kaijchen opened a new pull request, #38: Enable spotbugs and fix high priority bugs
kaijchen opened a new pull request, #38:
URL: https://github.com/apache/incubator-uniffle/pull/38
### What changes were proposed in this pull request?
1. Enable (previously experimental) spotbugs check in CI.
2. Set spotbugs to only check high priority bugs.
Because currently there are too many medium (default) priority bugs,
and many of them are difficult to fix.
3. Fix bugs reported by spotbugs.
### Why are the changes needed?
To improve code quality.
### Does this PR introduce _any_ user-facing change?
There is one notable change, see: a994cffed033158bfbd84d5b83e900892b739c18
We can revert it, if it's not desired.
### How was this patch tested?
1. `mvn test-compile spotbugs:check -Pspark3`
2. `mvn test-compile spotbugs:check -Pspark2`
3. `mvn test-compile spotbugs:check -Pmr`
Also by CI: https://github.com/kaijchen/incubator-uniffle/actions/runs/2634089750
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] kaijchen commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
kaijchen commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r916691332
##########
common/src/main/java/org/apache/uniffle/common/config/RssConf.java:
##########
@@ -532,9 +532,9 @@ public String getValue(ConfigOption<?> configOption) {
// --------------------------------------------------------------------------------------------
@Override
- public RssConf clone() {
- RssConf config = new RssConf();
- config.addAll(this);
+ public RssConf clone() throws CloneNotSupportedException {
+ RssConf config = (RssConf) super.clone();
Review Comment:
https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html#cn-clone-method-does-not-call-super-clone-cn-idiom-no-super-call
> This non-final class defines a clone() method that does not call super.clone(). If this class ("A") is extended by a subclass ("B"), and the subclass B calls super.clone(), then it is likely that B's clone() method will return an object of type A, which violates the standard contract for clone().
>
> If all clone() methods call super.clone(), then they are guaranteed to use Object.clone(), which always returns an object of the correct type.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] jerqi commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
jerqi commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r919630160
##########
common/src/main/java/org/apache/uniffle/common/config/RssConf.java:
##########
@@ -532,9 +532,9 @@ public String getValue(ConfigOption<?> configOption) {
// --------------------------------------------------------------------------------------------
@Override
- public RssConf clone() {
- RssConf config = new RssConf();
- config.addAll(this);
+ public RssConf clone() throws CloneNotSupportedException {
+ RssConf config = (RssConf) super.clone();
Review Comment:
OK.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] jerqi commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
jerqi commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r916687497
##########
common/src/main/java/org/apache/uniffle/common/config/RssConf.java:
##########
@@ -532,9 +532,9 @@ public String getValue(ConfigOption<?> configOption) {
// --------------------------------------------------------------------------------------------
@Override
- public RssConf clone() {
- RssConf config = new RssConf();
- config.addAll(this);
+ public RssConf clone() throws CloneNotSupportedException {
+ RssConf config = (RssConf) super.clone();
Review Comment:
Why do we need this change?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] frankliee commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
frankliee commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r919771019
##########
common/src/main/java/org/apache/uniffle/common/config/RssConf.java:
##########
@@ -27,12 +27,12 @@
import org.apache.uniffle.common.util.UnitConverter;
-public class RssConf {
+public class RssConf implements Cloneable {
Review Comment:
Why this is needed?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] jerqi commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
jerqi commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r919605420
##########
common/src/main/java/org/apache/uniffle/common/config/RssConf.java:
##########
@@ -532,9 +532,9 @@ public String getValue(ConfigOption<?> configOption) {
// --------------------------------------------------------------------------------------------
@Override
- public RssConf clone() {
- RssConf config = new RssConf();
- config.addAll(this);
+ public RssConf clone() throws CloneNotSupportedException {
+ RssConf config = (RssConf) super.clone();
Review Comment:
```
RssConf config = (RssConf) super.clone();
```
The code seems a little strange.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] kaijchen commented on pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
kaijchen commented on PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#issuecomment-1182980587
Thanks @jerqi and @frankliee for the review.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] kaijchen commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
kaijchen commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r916484606
##########
common/src/main/java/org/apache/uniffle/common/config/RssConf.java:
##########
@@ -533,7 +533,12 @@ public String getValue(ConfigOption<?> configOption) {
@Override
public RssConf clone() {
- RssConf config = new RssConf();
+ RssConf config;
+ try {
+ config = (RssConf) super.clone();
Review Comment:
This is not enough for copy `settings` field.
```java
private final ConcurrentHashMap<String, Object> settings;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] frankliee commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
frankliee commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r919825302
##########
server/src/main/java/org/apache/uniffle/server/LocalStorageChecker.java:
##########
@@ -156,8 +156,7 @@ boolean checkStorageReadAndWrite() {
if (!writeFile.createNewFile()) {
return false;
}
- byte[] data = new byte[1024];
- new Random().nextBytes(data);
+ byte[] data = RandomUtils.nextBytes(1024);
Review Comment:
static matching is not smart for this...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] frankliee commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
frankliee commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r919833524
##########
server/src/main/java/org/apache/uniffle/server/LocalStorageChecker.java:
##########
@@ -156,8 +156,7 @@ boolean checkStorageReadAndWrite() {
if (!writeFile.createNewFile()) {
return false;
}
- byte[] data = new byte[1024];
- new Random().nextBytes(data);
+ byte[] data = RandomUtils.nextBytes(1024);
Review Comment:
soga
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] frankliee commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
frankliee commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r919845218
##########
pom.xml:
##########
@@ -820,6 +820,7 @@
</dependency>
</dependencies>
<configuration>
+ <threshold>high</threshold>
Review Comment:
I think high is OK, LGTM.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] frankliee merged pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
frankliee merged PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] codecov-commenter commented on pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#issuecomment-1178586350
# [Codecov](https://codecov.io/gh/apache/incubator-uniffle/pull/38?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#38](https://codecov.io/gh/apache/incubator-uniffle/pull/38?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (8f0e85c) into [master](https://codecov.io/gh/apache/incubator-uniffle/commit/37beb1f0bd35bfeb733af94efbbce755f7b09dfc?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (37beb1f) will **decrease** coverage by `0.90%`.
> The diff coverage is `77.55%`.
```diff
@@ Coverage Diff @@
## master #38 +/- ##
============================================
- Coverage 56.83% 55.93% -0.91%
+ Complexity 1204 1131 -73
============================================
Files 152 143 -9
Lines 8401 8034 -367
Branches 813 784 -29
============================================
- Hits 4775 4494 -281
+ Misses 3368 3290 -78
+ Partials 258 250 -8
```
| [Impacted Files](https://codecov.io/gh/apache/incubator-uniffle/pull/38?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../java/org/apache/uniffle/common/BufferSegment.java](https://codecov.io/gh/apache/incubator-uniffle/pull/38/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS91bmlmZmxlL2NvbW1vbi9CdWZmZXJTZWdtZW50LmphdmE=) | `96.15% <0.00%> (-3.85%)` | :arrow_down: |
| [...apache/uniffle/common/ShufflePartitionedBlock.java](https://codecov.io/gh/apache/incubator-uniffle/pull/38/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS91bmlmZmxlL2NvbW1vbi9TaHVmZmxlUGFydGl0aW9uZWRCbG9jay5qYXZh) | `35.29% <0.00%> (-1.07%)` | :arrow_down: |
| [.../apache/uniffle/common/ShufflePartitionedData.java](https://codecov.io/gh/apache/incubator-uniffle/pull/38/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS91bmlmZmxlL2NvbW1vbi9TaHVmZmxlUGFydGl0aW9uZWREYXRhLmphdmE=) | `0.00% <0.00%> (ø)` | |
| [...org/apache/uniffle/common/config/ConfigOption.java](https://codecov.io/gh/apache/incubator-uniffle/pull/38/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS91bmlmZmxlL2NvbW1vbi9jb25maWcvQ29uZmlnT3B0aW9uLmphdmE=) | `60.86% <0.00%> (-2.77%)` | :arrow_down: |
| [...java/org/apache/uniffle/common/config/RssConf.java](https://codecov.io/gh/apache/incubator-uniffle/pull/38/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS91bmlmZmxlL2NvbW1vbi9jb25maWcvUnNzQ29uZi5qYXZh) | `28.37% <0.00%> (-0.59%)` | :arrow_down: |
| [...niffle/storage/common/FileBasedShuffleSegment.java](https://codecov.io/gh/apache/incubator-uniffle/pull/38/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmFnZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvdW5pZmZsZS9zdG9yYWdlL2NvbW1vbi9GaWxlQmFzZWRTaHVmZmxlU2VnbWVudC5qYXZh) | `51.51% <ø> (-1.43%)` | :arrow_down: |
| [.../org/apache/uniffle/common/config/ConfigUtils.java](https://codecov.io/gh/apache/incubator-uniffle/pull/38/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS91bmlmZmxlL2NvbW1vbi9jb25maWcvQ29uZmlnVXRpbHMuamF2YQ==) | `22.36% <60.00%> (ø)` | |
| [.../java/org/apache/hadoop/mapreduce/RssMRConfig.java](https://codecov.io/gh/apache/incubator-uniffle/pull/38/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2xpZW50LW1yL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9oYWRvb3AvbWFwcmVkdWNlL1Jzc01SQ29uZmlnLmphdmE=) | `85.71% <100.00%> (-5.20%)` | :arrow_down: |
| [.../org/apache/uniffle/common/config/RssBaseConf.java](https://codecov.io/gh/apache/incubator-uniffle/pull/38/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS91bmlmZmxlL2NvbW1vbi9jb25maWcvUnNzQmFzZUNvbmYuamF2YQ==) | `91.80% <100.00%> (ø)` | |
| [...rg/apache/uniffle/coordinator/CoordinatorConf.java](https://codecov.io/gh/apache/incubator-uniffle/pull/38/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29vcmRpbmF0b3Ivc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3VuaWZmbGUvY29vcmRpbmF0b3IvQ29vcmRpbmF0b3JDb25mLmphdmE=) | `96.15% <100.00%> (ø)` | |
| ... and [16 more](https://codecov.io/gh/apache/incubator-uniffle/pull/38/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-uniffle/pull/38?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-uniffle/pull/38?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [37beb1f...8f0e85c](https://codecov.io/gh/apache/incubator-uniffle/pull/38?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] kaijchen commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
kaijchen commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r916628756
##########
storage/src/main/java/org/apache/uniffle/storage/util/ShuffleStorageUtils.java:
##########
@@ -199,7 +200,7 @@ public static int[] getPartitionRange(int partitionId, int partitionNumPerRange,
public static int getStorageIndex(int max, String appId, int shuffleId, int startPartition) {
String hash = appId + "_" + shuffleId + "_" + startPartition;
- int index = MurmurHash.getInstance().hash(hash.getBytes()) % max;
+ int index = MurmurHash.getInstance().hash(hash.getBytes(StandardCharsets.UTF_8)) % max;
Review Comment:
Encoding a string with only `ASCII` text in `UTF-8` is same as in `ASCII`.
So it's not necessary to change it.
```java
@Test
public void testEncoding() {
assertArrayEquals("123_456_789".getBytes(StandardCharsets.UTF_8),
"123_456_789".getBytes(StandardCharsets.US_ASCII));
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] kaijchen commented on pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
kaijchen commented on PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#issuecomment-1182902358
All the changes in this PR is necessary to fix a problem reported by the checks.
Please refer to individual commit names to see why it is needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] kaijchen commented on pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
kaijchen commented on PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#issuecomment-1182925116
> It is possible to make this checker with optional rules to avoid break CI? If some changes are not what we really wanted.
Yes, it is possible to add suppressions (by annotation) and exclusions (by config).
> This checker is powered by AI, and will not be always right.
It's not powered by AI, it's just static code analysis.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] frankliee commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
frankliee commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r919812080
##########
pom.xml:
##########
@@ -820,6 +820,7 @@
</dependency>
</dependencies>
<configuration>
+ <threshold>high</threshold>
Review Comment:
What about other threshold?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] kaijchen commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
kaijchen commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r919818774
##########
pom.xml:
##########
@@ -820,6 +820,7 @@
</dependency>
</dependencies>
<configuration>
+ <threshold>high</threshold>
Review Comment:
If there is a need, we can change it step by step, instead of trying to fix all of them in one huge PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] kaijchen commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
kaijchen commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r919830477
##########
server/src/main/java/org/apache/uniffle/server/LocalStorageChecker.java:
##########
@@ -156,8 +156,7 @@ boolean checkStorageReadAndWrite() {
if (!writeFile.createNewFile()) {
return false;
}
- byte[] data = new byte[1024];
- new Random().nextBytes(data);
+ byte[] data = RandomUtils.nextBytes(1024);
Review Comment:
> This code creates a java.util.Random object, uses it to generate one random number, and then discards the Random object. This produces mediocre quality random numbers and is inefficient.
Replacing it by `RandomUtils` is a choice made by me. It's also OK to store the Random object in a field, and reuse it every time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] kaijchen commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
kaijchen commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r919612578
##########
common/src/main/java/org/apache/uniffle/common/config/RssConf.java:
##########
@@ -532,9 +532,9 @@ public String getValue(ConfigOption<?> configOption) {
// --------------------------------------------------------------------------------------------
@Override
- public RssConf clone() {
- RssConf config = new RssConf();
- config.addAll(this);
+ public RssConf clone() throws CloneNotSupportedException {
+ RssConf config = (RssConf) super.clone();
Review Comment:
In fact, this is the Cloneable idiom. If a subclass extends this class and doesn't override `clone()`, it will still be correct.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] kaijchen commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
kaijchen commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r916610487
##########
storage/src/main/java/org/apache/uniffle/storage/util/ShuffleStorageUtils.java:
##########
@@ -199,7 +200,7 @@ public static int[] getPartitionRange(int partitionId, int partitionNumPerRange,
public static int getStorageIndex(int max, String appId, int shuffleId, int startPartition) {
String hash = appId + "_" + shuffleId + "_" + startPartition;
- int index = MurmurHash.getInstance().hash(hash.getBytes()) % max;
+ int index = MurmurHash.getInstance().hash(hash.getBytes(StandardCharsets.UTF_8)) % max;
Review Comment:
The method `getBytes()` encodes a String into a byte array using the platform's default charset if no argument is passed. This will cause the application behavior to vary between platforms.
The default charset is determined during virtual-machine startup and typically depends upon the locale and charset of the underlying operating system.
If you think `UTF-8` is a overkill here, we can change it to `US_ASCII`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] kaijchen commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
kaijchen commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r916484606
##########
common/src/main/java/org/apache/uniffle/common/config/RssConf.java:
##########
@@ -533,7 +533,12 @@ public String getValue(ConfigOption<?> configOption) {
@Override
public RssConf clone() {
- RssConf config = new RssConf();
+ RssConf config;
+ try {
+ config = (RssConf) super.clone();
Review Comment:
This is not enough for copy settings.
```java
private final ConcurrentHashMap<String, Object> settings;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] jerqi commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
jerqi commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r916613955
##########
storage/src/main/java/org/apache/uniffle/storage/util/ShuffleStorageUtils.java:
##########
@@ -199,7 +200,7 @@ public static int[] getPartitionRange(int partitionId, int partitionNumPerRange,
public static int getStorageIndex(int max, String appId, int shuffleId, int startPartition) {
String hash = appId + "_" + shuffleId + "_" + startPartition;
- int index = MurmurHash.getInstance().hash(hash.getBytes()) % max;
+ int index = MurmurHash.getInstance().hash(hash.getBytes(StandardCharsets.UTF_8)) % max;
Review Comment:
`US_ASCII` will be better. It's strange to use `UTF-8` here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] frankliee commented on pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
frankliee commented on PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#issuecomment-1182710422
It is better to move '3. Fix bugs reported by spotbugs' in another PRs to make this PR more independent.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] kaijchen commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
kaijchen commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r919612578
##########
common/src/main/java/org/apache/uniffle/common/config/RssConf.java:
##########
@@ -532,9 +532,9 @@ public String getValue(ConfigOption<?> configOption) {
// --------------------------------------------------------------------------------------------
@Override
- public RssConf clone() {
- RssConf config = new RssConf();
- config.addAll(this);
+ public RssConf clone() throws CloneNotSupportedException {
+ RssConf config = (RssConf) super.clone();
Review Comment:
In fact, this is the Cloneable idiom. If a subclass extends this class and doesn't override `clone()`, it will still be correct.
`Object.clone()` is implemented in native code, it will always return a object in exact same class.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] frankliee commented on pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
frankliee commented on PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#issuecomment-1182894241
> > It is better to decouple '3. Fix bugs reported by spotbugs' in another PRs to make this PR more independent.
>
> If we only include 1 and 2, the CI will fail. If we only include 3, how do you know these bugs will be reported by spotbugs (and there is nothing more)?
It is possible to make this checker won't break CI? If some changes are not what we really wanted.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] jerqi commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
jerqi commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r916632854
##########
storage/src/main/java/org/apache/uniffle/storage/util/ShuffleStorageUtils.java:
##########
@@ -199,7 +200,7 @@ public static int[] getPartitionRange(int partitionId, int partitionNumPerRange,
public static int getStorageIndex(int max, String appId, int shuffleId, int startPartition) {
String hash = appId + "_" + shuffleId + "_" + startPartition;
- int index = MurmurHash.getInstance().hash(hash.getBytes()) % max;
+ int index = MurmurHash.getInstance().hash(hash.getBytes(StandardCharsets.UTF_8)) % max;
Review Comment:
OK
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] jerqi commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
jerqi commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r916602185
##########
storage/src/main/java/org/apache/uniffle/storage/util/ShuffleStorageUtils.java:
##########
@@ -199,7 +200,7 @@ public static int[] getPartitionRange(int partitionId, int partitionNumPerRange,
public static int getStorageIndex(int max, String appId, int shuffleId, int startPartition) {
String hash = appId + "_" + shuffleId + "_" + startPartition;
- int index = MurmurHash.getInstance().hash(hash.getBytes()) % max;
+ int index = MurmurHash.getInstance().hash(hash.getBytes(StandardCharsets.UTF_8)) % max;
Review Comment:
Why do we need change this? This string only contain ASCII code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] kaijchen commented on pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
kaijchen commented on PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#issuecomment-1182717202
> It is better to decouple '3. Fix bugs reported by spotbugs' in another PRs to make this PR more independent.
If we only include 1 and 2, the CI will fail.
If we only include 3, how do you know these bugs will be reported by spotbugs (and there is nothing more)?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] kaijchen commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
kaijchen commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r919814381
##########
pom.xml:
##########
@@ -820,6 +820,7 @@
</dependency>
</dependencies>
<configuration>
+ <threshold>high</threshold>
Review Comment:
It will report too many errors, and some of them you might not want to fix.
For example, the default threshold is `medium`, see "Summary of failures" in
https://github.com/apache/incubator-uniffle/runs/7299882996?check_suite_focus=true
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org
[GitHub] [incubator-uniffle] kaijchen commented on a diff in pull request #38: Enable spotbugs and fix high priority bugs
Posted by GitBox <gi...@apache.org>.
kaijchen commented on code in PR #38:
URL: https://github.com/apache/incubator-uniffle/pull/38#discussion_r919774712
##########
common/src/main/java/org/apache/uniffle/common/config/RssConf.java:
##########
@@ -27,12 +27,12 @@
import org.apache.uniffle.common.util.UnitConverter;
-public class RssConf {
+public class RssConf implements Cloneable {
Review Comment:
Because RssConf overrides `clone()`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org