Return-Path: X-Original-To: apmail-geode-commits-archive@minotaur.apache.org Delivered-To: apmail-geode-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 422EE18009 for ; Fri, 24 Jul 2015 00:16:27 +0000 (UTC) Received: (qmail 17924 invoked by uid 500); 24 Jul 2015 00:16:27 -0000 Delivered-To: apmail-geode-commits-archive@geode.apache.org Received: (qmail 17893 invoked by uid 500); 24 Jul 2015 00:16:27 -0000 Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@geode.incubator.apache.org Delivered-To: mailing list commits@geode.incubator.apache.org Received: (qmail 17884 invoked by uid 99); 24 Jul 2015 00:16:27 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jul 2015 00:16:27 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id B2FC4D72D5 for ; Fri, 24 Jul 2015 00:16:26 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.554 X-Spam-Level: X-Spam-Status: No, score=0.554 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-1.227, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 06Y3p1BKGO4n for ; Fri, 24 Jul 2015 00:16:22 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id 0889E25F5C for ; Fri, 24 Jul 2015 00:16:14 +0000 (UTC) Received: (qmail 17378 invoked by uid 99); 24 Jul 2015 00:16:13 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Jul 2015 00:16:13 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id F0A4AE684A; Fri, 24 Jul 2015 00:16:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dschneider@apache.org To: commits@geode.incubator.apache.org Date: Fri, 24 Jul 2015 00:16:21 -0000 Message-Id: <5ad6b1f718d840239053e160c1c2f38b@git.apache.org> In-Reply-To: <35ac9a19172d4cd5802c3b3a13f5b30a@git.apache.org> References: <35ac9a19172d4cd5802c3b3a13f5b30a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [10/13] incubator-geode git commit: fixed tests to work with PRs and invalidates to work with concurrency check regions fixed tests to work with PRs and invalidates to work with concurrency check regions Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/620aa08e Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/620aa08e Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/620aa08e Branch: refs/heads/feature/GEODE-148 Commit: 620aa08ece867aef947c4af5bc40480e36b00a63 Parents: 77daa48 Author: Darrel Schneider Authored: Tue Jul 21 11:03:12 2015 -0700 Committer: Darrel Schneider Committed: Thu Jul 23 17:14:07 2015 -0700 ---------------------------------------------------------------------- .../internal/cache/PartitionedRegion.java | 8 +++++ .../gemfire/cache30/MultiVMRegionTestCase.java | 33 ++++++++++++-------- .../gemfire/cache30/RegionTestCase.java | 10 ++++-- 3 files changed, 36 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/620aa08e/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegion.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegion.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegion.java index 003b691..b11d7f6 100644 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegion.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegion.java @@ -11450,5 +11450,13 @@ public class PartitionedRegion extends LocalRegion implements return this.getLocalMaxMemory() != 0; } + @Override + public EntryExpiryTask getEntryExpiryTask(Object key) { + BucketRegion br = this.getDataStore().getLocalBucketByKey(key); + if (br == null) { + throw new EntryNotFoundException("Bucket for key " + key + " does not exist."); + } + return br.getEntryExpiryTask(key); + } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/620aa08e/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java index 8f0c522..d0acc4d 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/MultiVMRegionTestCase.java @@ -73,6 +73,7 @@ import com.gemstone.gemfire.cache.TimeoutException; import com.gemstone.gemfire.cache.TransactionEvent; import com.gemstone.gemfire.cache.TransactionId; import com.gemstone.gemfire.cache.TransactionListener; +import com.gemstone.gemfire.cache.partition.PartitionRegionHelper; import com.gemstone.gemfire.cache.server.CacheServer; import com.gemstone.gemfire.cache.util.CacheListenerAdapter; import com.gemstone.gemfire.distributed.internal.DMStats; @@ -4086,7 +4087,7 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase { VM vm1 = host.getVM(1); - vm1.invoke(new CacheSerializableRunnable("Create Region " + name) { + vm0.invoke(new CacheSerializableRunnable("Create with Idle") { public void run2() throws CacheException { AttributesFactory factory = new AttributesFactory(getRegionAttributes()); factory.setStatisticsEnabled(true); @@ -4094,15 +4095,22 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase { new ExpirationAttributes(timeout, ExpirationAction.DESTROY); factory.setEntryIdleTimeout(expire); - if(getRegionAttributes().getPartitionAttributes() != null){ - createRegion(name, factory.create()); - } else { - createRegion(name); - } + LocalRegion region = + (LocalRegion) createRegion(name, factory.create()); + if (region.getDataPolicy().withPartitioning()) { + // Force all buckets to be created locally so the + // test will know that the create happens in this vm + // and the update (in vm1) is remote. + PartitionRegionHelper.assignBucketsToPartitions(region); + } + region.create(key, null); + EntryExpiryTask eet = region.getEntryExpiryTask(key); + region.create("createExpiryTime", eet.getExpirationTime()); + waitForExpiryClockToChange(region); } }); - vm0.invoke(new CacheSerializableRunnable("Create with Idle") { + vm1.invoke(new CacheSerializableRunnable("Create Region " + name) { public void run2() throws CacheException { AttributesFactory factory = new AttributesFactory(getRegionAttributes()); factory.setStatisticsEnabled(true); @@ -4110,12 +4118,11 @@ public abstract class MultiVMRegionTestCase extends RegionTestCase { new ExpirationAttributes(timeout, ExpirationAction.DESTROY); factory.setEntryIdleTimeout(expire); - LocalRegion region = - (LocalRegion) createRegion(name, factory.create()); - region.create(key, null); - EntryExpiryTask eet = region.getEntryExpiryTask(key); - region.create("createExpiryTime", eet.getExpirationTime()); - waitForExpiryClockToChange(region); + if(getRegionAttributes().getPartitionAttributes() != null){ + createRegion(name, factory.create()); + } else { + createRegion(name); + } } }); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/620aa08e/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java index 1c1b59c..8f20e12 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java @@ -3778,8 +3778,14 @@ public abstract class RegionTestCase extends CacheTestCase { region.invalidate(key); // touch assertSame(eet, region.getEntryExpiryTask(key)); long invalidateExpiryTime = eet.getExpirationTime(); - if (invalidateExpiryTime != putExpiryTime) { - fail("invalidate did reset the expiration time. putExpiryTime=" + putExpiryTime + " invalidateExpiryTime=" + invalidateExpiryTime); + if (region.getConcurrencyChecksEnabled()) { + if (putExpiryTime - getExpiryTime <= 0L) { + fail("invalidate did not reset the expiration time. putExpiryTime=" + putExpiryTime + " invalidateExpiryTime=" + invalidateExpiryTime); + } + } else { + if (invalidateExpiryTime != putExpiryTime) { + fail("invalidate did reset the expiration time. putExpiryTime=" + putExpiryTime + " invalidateExpiryTime=" + invalidateExpiryTime); + } } }