-
Notifications
You must be signed in to change notification settings - Fork 395
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
[#2164][#2166] improvement: enable MutablePublicArray and ReferenceEquality error-prone #2511
Conversation
… ReferenceEquality error-prone
@yuqi1129 @qqqttt123 Could you please help review this? Thanks. |
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.
It's okay with me.
@@ -649,4 +649,11 @@ void testDeadLockChecker() throws InterruptedException, ExecutionException { | |||
service.take().get(); | |||
} | |||
} | |||
|
|||
@Test | |||
public void testMockRootTreeLock() { |
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.
Why do we need to add this test case?
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.
@qqqttt123 I can remove it. I add it to validate https://github.com/datastrato/gravitino/pull/2511/files#diff-2144813a8300501a572d32e9f24651ab50594709644c031e983ac05a38bdc519R233.
if we replace ==
with .equals()
, this unit test will failed. Do you think we need this?
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.
OK, I got it.
Thanks @coolderli @yuqi1129 |
What changes were proposed in this pull request?
MutablePublicArray
aims to avoidpublic static final List<T>
, because it can be modified outside. See more details at https://errorprone.info/bugpattern/MutablePublicArray.There are two ways to fix this problem:
Since
MutablePublicArray
has been fixed at #2171, we enable the check in this MR.ReferenceEquality
aims to use reference equality instead of value equality for reference objects.There are some ways to fix this problem:
.equals()
instead of==
Objects.equals()
if there is anull
See more details at https://errorprone.info/bugpattern/ReferenceEquality.
In this MR, we suppress this check at
com.datastrato.gravitino.catalog.lakehouse.iceberg.converter.ToIcebergType#struct
andcom.datastrato.gravitino.lock.LockManager#createTreeLock
. In there places, we'd better use reference to compare the root node.Why are the changes needed?
Fix: [Improvement] JdbcConnectorUtils.java contains mutable array #2164
Fix: [Improvement] LockManager.java comparison using reference equality instead of value equality #2166
Does this PR introduce any user-facing change?
How was this patch tested?
./gradlew build