-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
HBASE-27203 Clean up error-prone findings in hbase-client #4626
Conversation
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
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.
Just skimmed a small piece of code.
For the returns only warning, let me think whether we could implement spotless rule to convert it automatically, so we do not need to mix this stytle change with other more critical fixes.
@@ -28,7 +29,7 @@ public final class CacheEvictionStats { | |||
|
|||
private final long evictedBlocks; | |||
private final long maxCacheSize; | |||
private final Map<byte[], Throwable> exceptions; | |||
private final IdentityHashMap<byte[], Throwable> exceptions; |
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.
I think this will be a bit dangerous if we will return this map to upper layer...
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 warning here is the one that suggests maps and identity keys should not be mixed... that if the keys use object identity, the map type should be IdentityHashMap. It seems minor, but correct.
storeFileSizeMB += r.getStoreFileSize().get(Size.Unit.MEGABYTE); | ||
memStoreSizeMB += r.getMemStoreSize().get(Size.Unit.MEGABYTE); | ||
storefileIndexSizeKB += r.getStoreFileUncompressedDataIndexSize().get(Size.Unit.KILOBYTE); | ||
uncompressedStoreFileSizeMB = (long) (uncompressedStoreFileSizeMB |
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.
Just use += and cast the right operator to long is enough?
@Apache9 Agreed, let's apply the new spotless rule for the automated fix, and then come back to this PR. |
No description provided.