Skip to content
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

GEODE-10161: Remove unnecessary synchronization from RedisList #7579

Conversation

jdeppe-pivotal
Copy link
Contributor

  • Now, with the addition of versioning and synchronization at the
    higher-level methods, all the synchronization can be removed from the
    small, helper methods we have.
  • We still need to ensure that there is synchronization between toData
    and within methods that are mutating the list.
  • Inline various helper methods in RedisList as they are not adding any
    value.
  • Use AvailablePortHelper to set up the port that the crashing VM will
    use. Without this there is interference from other tests when running
    multiple tests concurrently (in the stressTest job).
  • Ran at least 1000 iterations of all list-related DUnit tests without
    any failures.

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?

- Now, with the addition of versioning and synchronization at the
  higher-level methods, all the synchronization can be removed from the
  small, helper methods we have.
- We still need to ensure that there is synchronization between toData
  and within methods that are mutating the list.
- Inline various helper methods in RedisList as they are not adding any
  value.
- Use AvailablePortHelper to set up the port that the crashing VM will
  use. Without this there is interference from other tests when running
  multiple tests concurrently (in the stressTest job).
- Ran at least 1000 iterations of all list-related DUnit tests without
  any failures.
@jdeppe-pivotal jdeppe-pivotal added the redis Issues related to the geode-for-redis module label Apr 11, 2022
Copy link
Contributor

@DonalEvans DonalEvans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not directly related to this PR, but looking at AbstractRedisData.fromDelta(), we seem to be inconsistent about whether we synchronize before calling deserializeFrom() on the various Delta types. I don't know if it's a big deal, but seems like either all of them should be synchronizing or none of them should be, otherwise it's just arbitrary.

@@ -265,7 +267,7 @@ public void lset(Region<RedisKey, RedisData> region, RedisKey key, int index, by
throw new RedisException(ERROR_INDEX_OUT_OF_RANGE);
}

elementReplace(adjustedIndex, value);
elementList.set(adjustedIndex, value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call is not inside a synchronized block but modifies the backing list. Is there a possibility of issues here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're not updating the version here this should be OK. Synchronization is implemented to allow atomic updates to both the version and the underlying structure. Additionally synchronization also prevents the possibility of ConcurrentModificationExceptions which this set call won't trigger since it's merely changing an existing value and not changing the structure (size) of the list.

@jdeppe-pivotal
Copy link
Contributor Author

@DonalEvans I created https://issues.apache.org/jira/browse/GEODE-10244 for the AbstractRedisData issue you mentioned.

@jdeppe-pivotal jdeppe-pivotal merged commit 39e3a89 into apache:develop Apr 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
redis Issues related to the geode-for-redis module
Projects
None yet
2 participants