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-6696: EntryEvenImpl.offHeapLock created only if off-heap in use #3581

Merged
merged 1 commit into from
May 30, 2019

Conversation

mivanac
Copy link
Contributor

@mivanac mivanac commented May 11, 2019

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?

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 [email protected].

@mivanac mivanac force-pushed the feature/GEODE-6696 branch from ae77bb5 to 9d45d63 Compare May 13, 2019 18:16
InternalDistributedSystem ds =
(InternalDistributedSystem) region.getCache().getDistributedSystem();
if (ds.getOffHeapStore() != null) {
this.offHeapLock = new Object();
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like we could end up initializing the offHeapLock more than one place, which seems like an issue to me. Shouldn't this only be initialized in the constructor (if needed) and then used everywhere else? Or, alternately, a check could be added here for if offHeapLock is already non-null. My concern is that we would be creating a new lock each time fromData is called (and it is called all over the place), and then for each call get a different lock object so that we wouldn't actually be locking, because each call would be the only one holding that particular lock.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am unclear how this is working given that offHeapLock is final. Is it actually only being set once?

Copy link
Contributor

Choose a reason for hiding this comment

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

You are right about it being final. EntryEventImpl has multiple constructors and this is just one of them. I don't see fromData initializing offHeapLock. For an EntryEventImpl that we deserialize it will use the no-arg constructor which sets offHeapLock to null.

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right. The way it was showing the diff in Github made it look like that line was in fromData instead of in a constructor

@mivanac mivanac force-pushed the feature/GEODE-6696 branch from 9d45d63 to 189bb86 Compare May 13, 2019 19:20
@mivanac
Copy link
Contributor Author

mivanac commented May 16, 2019

Since changes are approved, could you merge this changes.

@nonbinaryprogrammer nonbinaryprogrammer merged commit 327feec into apache:develop May 30, 2019
@mivanac mivanac deleted the feature/GEODE-6696 branch May 31, 2019 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants