Skip to content

Conversation

@dschneider-pivotal
Copy link
Contributor

@dschneider-pivotal dschneider-pivotal commented Oct 17, 2017

Idle expiration now sends a message to others checking
if they have been read more recently. If so the expiration
is rescheduled.
This is only done for distributed expiration actions.

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, you check travis-ci 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.

long latestLastAccessTime = getLatestLastAccessTimeOnOtherMembers();
if (latestLastAccessTime > getLastAccessedTime()) {
setLastAccessedTime(latestLastAccessTime);
return false;
Copy link

Choose a reason for hiding this comment

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

Is this always true? Can last accessed time from another member can be newer than ours, but still be expired? Do we need to test this new value against the expiration time point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See the new commit that addresses this issue.
If a later lastAccessTime is obtained from others, the caller of this method now rechecks if it is still expired or if it should be rescheduled. This will prevent an extra round of messages in the case in which two members have slightly different lastAccessTimes but are both expired.

Copy link

@nreich nreich left a comment

Choose a reason for hiding this comment

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

Looks good after latest change (other than spotless validation failure that I assume you will fix before merge).

}
}

public long getLatestLastAccessTime() {

Choose a reason for hiding this comment

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

synchronized?

VM[] vms = new VM[] {member1, member2, member3};
for (VM vm : vms) {
vm.invoke(() -> {
KEEP_READING.set(false);

Choose a reason for hiding this comment

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

This should also be in setUp(), right? Now the first test method sees the KEEP_READING value to be true and other subsequent tests (if added in future) sees it set to FALSE...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

KEEP_READING is now initialized to true in setUp

Copy link
Contributor

@kirklund kirklund left a comment

Choose a reason for hiding this comment

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

+1

long expTime = getExpirationTime();
if (expTime > 0L && getNow() >= expTime) {
return true;
if (expTime > 0L) {
Copy link
Member

Choose a reason for hiding this comment

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

What should happen if expiration is due to ttl?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then it is okay to just expire based on the local information.
Since last modified time is always changed by a write and since writes go to every copy of the data the ttl check only needs to happen locally.
The way this works in this fix is that the implementation of isIdleExpiredOnOthers
does this check:
if (getIdleAttributes().getTimeout() <= 0L) {
// idle expiration is not being used
return true;
}
So if you expiration configuration does not care about idle time then we just return true which means expiration is possible.
If we are using idle time then we fetch it from others and redo this calculation which may cause is to still expire due to ttl (note that you can have both idle and ttl configured on a region).

Copy link
Member

Choose a reason for hiding this comment

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

@dschneider-pivotal Thanks Darrel. I thought the same that we should be expiring if its TTL.
getExpirationTime() call in the previous line also checks if TTL or Idle and returns expiryTime based on the what is configured.
Probably its more readable if the check is part of this function rather than in isIdleExpiredOnOthers.

Idle expiration now sends a message to others checking
if they have been read more recently. If so and if given
the new last access time the entry is not expired then
the expiration is rescheduled.
This is only done for distributed expiration actions.
This change applies to both replicates and partitioned regions.

The system property "geode.restoreIdleExpirationBehavior" can
be set to true to restore the previous idle expiration behavior.
@dschneider-pivotal dschneider-pivotal merged commit 0259f77 into apache:develop Oct 23, 2017
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.

5 participants