Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 87DB3200BAE for ; Fri, 28 Oct 2016 23:19:20 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 86824160AE4; Fri, 28 Oct 2016 21:19:20 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CB4E1160ACA for ; Fri, 28 Oct 2016 23:19:19 +0200 (CEST) Received: (qmail 37539 invoked by uid 500); 28 Oct 2016 21:19:19 -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 37530 invoked by uid 99); 28 Oct 2016 21:19:19 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Oct 2016 21:19:18 +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 90E7CC1867 for ; Fri, 28 Oct 2016 21:19:18 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id oJhgmrpyfKRF for ; Fri, 28 Oct 2016 21:19:16 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 376AA5F54E for ; Fri, 28 Oct 2016 21:19:15 +0000 (UTC) Received: (qmail 33281 invoked by uid 99); 28 Oct 2016 21:18:39 -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, 28 Oct 2016 21:18:39 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A40C8E5CE1; Fri, 28 Oct 2016 21:18:39 +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 Message-Id: <00a7ddf7e9dd4e04aa279b50e7872ea6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-geode git commit: GEODE-2043: change makeTombstone to handle exception Date: Fri, 28 Oct 2016 21:18:39 +0000 (UTC) archived-at: Fri, 28 Oct 2016 21:19:20 -0000 Repository: incubator-geode Updated Branches: refs/heads/develop 765a55a0e -> 2ef50b24d GEODE-2043: change makeTombstone to handle exception Now if makeTombstone has an exception but had already changed the region entry value to a TOMBSTONE, it will now change the value to REMOVE_PHASE2 instead of leaving it as a TOMBSTONE. Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/2ef50b24 Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/2ef50b24 Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/2ef50b24 Branch: refs/heads/develop Commit: 2ef50b24de1457ab91729f22a3c2ff4a8a07557b Parents: 765a55a Author: Darrel Schneider Authored: Thu Oct 27 16:05:08 2016 -0700 Committer: Darrel Schneider Committed: Fri Oct 28 14:12:59 2016 -0700 ---------------------------------------------------------------------- .../internal/cache/AbstractRegionEntry.java | 15 ++- .../internal/cache/AbstractRegionEntryTest.java | 112 +++++++++++++++++++ 2 files changed, 125 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/2ef50b24/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionEntry.java ---------------------------------------------------------------------- diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionEntry.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionEntry.java index 4e1f0aa..2138af9 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionEntry.java +++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegionEntry.java @@ -209,7 +209,7 @@ public abstract class AbstractRegionEntry implements RegionEntry, HashEntry rvv = mock(RegionVersionVector.class); + when(lr.getVersionVector()).thenReturn(rvv); + VersionTag vt = mock(VersionTag.class); + Object value = "value"; + AbstractRegionEntry re = new TestableRegionEntry(lr, value); + assertEquals(value, re.getValueField()); + Assertions.assertThatThrownBy(() -> re.makeTombstone(lr, vt)) + .isInstanceOf(RuntimeException.class) + .hasMessage("throw exception on setValue(TOMBSTONE)"); + assertEquals(Token.REMOVED_PHASE2, re.getValueField()); + } + + + public static class TestableRegionEntry extends AbstractRegionEntry { + + private Object value; + + protected TestableRegionEntry(RegionEntryContext context, Object value) { + super(context, value); + } + + @Override + protected Object getValueField() { + return this.value; + } + + @Override + protected void setValueField(Object v) { + this.value = v; + } + + @Override + public void setValue(RegionEntryContext context, @Unretained Object value) + throws RegionClearedException { + super.setValue(context, value); + if (value == Token.TOMBSTONE) { + throw new RuntimeException("throw exception on setValue(TOMBSTONE)"); + } + } + + @Override + public int getEntryHash() { + return 0; + } + + @Override + public HashEntry getNextEntry() { + return null; + } + + @Override + public void setNextEntry(HashEntry n) { + } + + @Override + public Object getKey() { + return null; + } + + @Override + protected long getlastModifiedField() { + return 0; + } + + @Override + protected boolean compareAndSetLastModifiedField(long expectedValue, long newValue) { + return false; + } + + @Override + protected void setEntryHash(int v) { + } + + } +}