You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/06/07 00:33:56 UTC

[GitHub] [geode] dschneider-pivotal opened a new pull request #5220: added equals and hashCode to RedisData classes

dschneider-pivotal opened a new pull request #5220:
URL: https://github.com/apache/geode/pull/5220


   Thank you for submitting a contribution to Apache Geode.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically `develop`)?
   
   - [ ] Is your initial contribution a single, squashed commit?
   
   - [ ] Does `gradlew build` run cleanly?
   
   - [ ] Have you written or updated unit tests to verify your changes?
   
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   
   ### Note:
   Please ensure that once the PR is submitted, check Concourse for build issues and
   submit an update to your PR as soon as possible. If you need help, please send an
   email to dev@geode.apache.org.
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] dschneider-pivotal commented on a change in pull request #5220: GEODE-8233: added equals and hashCode to RedisData classes

Posted by GitBox <gi...@apache.org>.
dschneider-pivotal commented on a change in pull request #5220:
URL: https://github.com/apache/geode/pull/5220#discussion_r437037866



##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/data/AbstractRedisData.java
##########
@@ -183,4 +184,20 @@ protected void storeChanges(Region<ByteArrayWrapper, RedisData> region, ByteArra
 
   protected abstract boolean removeFromRegion();
 
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (!(o instanceof AbstractRedisData)) {
+      return false;
+    }
+    AbstractRedisData that = (AbstractRedisData) o;
+    return getExpirationTimestamp() == that.getExpirationTimestamp();
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(getExpirationTimestamp());

Review comment:
       It is but that is not all that is used. That is all we have on AbstractRedisData. Look at its subclasses and you will see they call super.hashCode (this method) and then mix in their own fields to the hash.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] dschneider-pivotal commented on pull request #5220: added equals and hashCode to RedisData classes

Posted by GitBox <gi...@apache.org>.
dschneider-pivotal commented on pull request #5220:
URL: https://github.com/apache/geode/pull/5220#issuecomment-640742845


   The PersistentColocatedPartitionedRegionDistributedTest > testFullTreeOfColocatedChildPRsWithMissingRegions failure is not related to this pull request


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] dschneider-pivotal merged pull request #5220: GEODE-8233: added equals and hashCode to RedisData classes

Posted by GitBox <gi...@apache.org>.
dschneider-pivotal merged pull request #5220:
URL: https://github.com/apache/geode/pull/5220


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] lgtm-com[bot] commented on pull request #5220: added equals and hashCode to RedisData classes

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #5220:
URL: https://github.com/apache/geode/pull/5220#issuecomment-640141159


   This pull request **introduces 1 alert** when merging 27482df8e32af494a5d8b4b2e40dea20068e08d3 into 917f4c921c9c9fb3b19687ee67fe0dfe4f885056 - [view on LGTM.com](https://lgtm.com/projects/g/apache/geode/rev/pr-702674c07962aa2de76615ed79d355d1705ec3cc)
   
   **new alerts:**
   
   * 1 for Equals method does not inspect argument 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [geode] jhutchison commented on a change in pull request #5220: GEODE-8233: added equals and hashCode to RedisData classes

Posted by GitBox <gi...@apache.org>.
jhutchison commented on a change in pull request #5220:
URL: https://github.com/apache/geode/pull/5220#discussion_r436953412



##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/data/AbstractRedisData.java
##########
@@ -183,4 +184,20 @@ protected void storeChanges(Region<ByteArrayWrapper, RedisData> region, ByteArra
 
   protected abstract boolean removeFromRegion();
 
+  @Override
+  public boolean equals(Object o) {
+    if (this == o) {
+      return true;
+    }
+    if (!(o instanceof AbstractRedisData)) {
+      return false;
+    }
+    AbstractRedisData that = (AbstractRedisData) o;
+    return getExpirationTimestamp() == that.getExpirationTimestamp();
+  }
+
+  @Override
+  public int hashCode() {
+    return Objects.hash(getExpirationTimestamp());

Review comment:
       is an object's expiration time sufficiently unique to act as a hash?  I assume you've thought through this, but just curious...seems like in a concurrent world, 2 objects of different redistypes could be added concurrently and set to expire at the same time.  Or does our StripedExecutor somehow guard against 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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org