You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2016/03/08 01:25:08 UTC

[01/11] incubator-geode git commit: Fix for GEODE-106 Invalidate operation fails with IndexMaintenanceException with underlying java.lang.ArrayIndexOutOfBoundsException.

Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-982 6a6c85ce3 -> 875f8ace0


Fix for GEODE-106 Invalidate operation fails with IndexMaintenanceException with underlying java.lang.ArrayIndexOutOfBoundsException.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/39969409
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/39969409
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/39969409

Branch: refs/heads/feature/GEODE-982
Commit: 3996940954e6099fb927c1703a2c085760c4899a
Parents: c18f515
Author: Anil <ag...@pivotal.io>
Authored: Wed Feb 24 17:13:04 2016 -0800
Committer: Anil <ag...@pivotal.io>
Committed: Tue Mar 1 16:13:13 2016 -0800

----------------------------------------------------------------------
 .../query/internal/index/IndexElemArray.java    | 34 +++++-----
 .../internal/index/IndexElemArrayJUnitTest.java | 66 +++++++++++++++++---
 2 files changed, 74 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39969409/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/IndexElemArray.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/IndexElemArray.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/IndexElemArray.java
index de694a4..7fdce2d 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/IndexElemArray.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/IndexElemArray.java
@@ -199,18 +199,20 @@ public class IndexElemArray implements Iterable, Collection {
    * @return <tt>true</tt> if this list contained the specified element
    */
   public boolean remove(Object o) {
-    if (o == null) {
-      for (int index = 0; index < size; index++)
-        if (elementData[index] == null) {
-          fastRemove(index);
-          return true;
-        }
-    } else {
-      for (int index = 0; index < size; index++)
-        if (o.equals(elementData[index])) {
-          fastRemove(index);
-          return true;
-        }
+    synchronized (lock) {
+      if (o == null) {
+        for (int index = 0; index < size; index++)
+          if (elementData[index] == null) {
+            fastRemove(index);
+            return true;
+          }
+      } else {
+        for (int index = 0; index < size; index++)
+          if (o.equals(elementData[index])) {
+            fastRemove(index);
+            return true;
+          }
+      }
     }
     return false;
   }
@@ -224,13 +226,11 @@ public class IndexElemArray implements Iterable, Collection {
     Object[] newArray = new Object[len - 1];
     System.arraycopy(elementData, 0, newArray, 0, index);
     int numMoved = len - index - 1;
-    if (numMoved > 0)
+    if (numMoved > 0) {
       System.arraycopy(elementData, index + 1, newArray, index, numMoved);
-
-    synchronized (lock) {
-      elementData = newArray;
-      --size;
     }
+    elementData = newArray;
+    --size;
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/39969409/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/IndexElemArrayJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/IndexElemArrayJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/IndexElemArrayJUnitTest.java
index 8c51264..91dbf7b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/IndexElemArrayJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/internal/index/IndexElemArrayJUnitTest.java
@@ -19,36 +19,37 @@ package com.gemstone.gemfire.cache.query.internal.index;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Iterator;
+import java.util.Random;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.stream.IntStream;
 
 import org.junit.After;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
+import com.gemstone.gemfire.cache.query.MultithreadedTester;
 import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 @Category(UnitTest.class)
 public class IndexElemArrayJUnitTest {
   
-  private IndexElemArray list;
+  private IndexElemArray list = new IndexElemArray(7);
 
   @After
   public void tearDown() {
-    System.clearProperty("index_elemarray_size");
+    //System.clearProperty("index_elemarray_size");
   }
   
   @Test
   public void testFunctionality() throws Exception {
-    // test disabled due to frequent failures that indicate that the product
-    // is malfunctioning.  See internal ticket #52285
-    if (true) {
-      return;
-    }
-    System.setProperty("index_elemarray_size", "7");
-    list = new IndexElemArray();
+    list.clear();
     boundaryCondition();
     add();
     clearAndAdd();
@@ -62,6 +63,52 @@ public class IndexElemArrayJUnitTest {
     clearAndAdd();
   }
 
+  @Test
+  /**
+   * This tests concurrent modification of IndexElemArray and to make 
+   * sure elementData and size are updated atomically. Ticket# GEODE-106.   
+   */
+  public void testFunctionalityUsingMultiThread() throws Exception {
+    list.clear();
+    Collection<Callable> callables = new ConcurrentLinkedQueue<>();    
+    IntStream.range(0, 1000).parallel().forEach(i -> {
+      callables.add(() -> {
+        if (i%3 == 0) {
+          return add(Integer.valueOf(new Random().nextInt(4)));
+        } else if (i%3 == 1) {
+          return remove(Integer.valueOf(new Random().nextInt(4)));
+        } else {
+          return iterateList();
+        }
+      });
+    });
+
+    Collection<Object> results = MultithreadedTester.runMultithreaded(callables);
+    results.forEach(result -> {
+      // There should not be any Exception here. 
+      // E.g. ArrayIndexOutOfBoundsException when multiple threads are acting.
+      assertTrue(result.getClass().getName() + " was not an expected result", result instanceof Integer);
+    });
+  }
+  
+  private Integer add(Integer i) {
+    list.add(i);
+    return i;
+  }
+  
+  private Integer remove(Integer i) {
+    list.remove(i);
+    return i;
+  }
+  
+  private Integer iterateList() {    
+    Iterator iter = list.iterator();
+    if (iter.hasNext()){ 
+      iter.next(); 
+    }
+    return Integer.valueOf(list.size());
+  }
+  
   private void add() {
     Object objBefore = list.getElementData();
     insert(7);
@@ -134,4 +181,5 @@ public class IndexElemArrayJUnitTest {
       // ok
     }
   }
+  
 }


[04/11] incubator-geode git commit: GEODE-1042

Posted by ds...@apache.org.
GEODE-1042

shadowPR's entries will not have version tag. So enforce checking if versionTag
is null.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/e7e1fc66
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/e7e1fc66
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/e7e1fc66

Branch: refs/heads/feature/GEODE-982
Commit: e7e1fc6660fc54ae449abed82fd0edbe06531050
Parents: 0ca2f2e
Author: zhouxh <gz...@pivotal.io>
Authored: Wed Mar 2 17:02:49 2016 -0800
Committer: zhouxh <gz...@pivotal.io>
Committed: Wed Mar 2 17:02:49 2016 -0800

----------------------------------------------------------------------
 .../gemfire/internal/cache/partitioned/FetchEntriesMessage.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e7e1fc66/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/FetchEntriesMessage.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/FetchEntriesMessage.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/FetchEntriesMessage.java
index 0342164..fda15c4 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/FetchEntriesMessage.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/partitioned/FetchEntriesMessage.java
@@ -559,7 +559,7 @@ public final class FetchEntriesMessage extends PartitionMessage
               VersionTag versionTag = DataSerializer.readObject(in);
               
               //Fix for 47260 - canonicalize the mebmer ids to avoid an OOME
-              VersionSource id = versionTag.getMemberID();
+              VersionSource id = versionTag==null?null:versionTag.getMemberID();
               if (id != null) {
                 if(canonicalMembers.containsKey(id)) {
                   versionTag.setMemberID(canonicalMembers.get(id));


[09/11] incubator-geode git commit: fixed typos

Posted by ds...@apache.org.
fixed typos


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/e1d83af8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/e1d83af8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/e1d83af8

Branch: refs/heads/feature/GEODE-982
Commit: e1d83af85561e25d0f3ed0a5a92d2d4ed238fcc5
Parents: 05a70cd
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Mon Mar 7 15:50:44 2016 -0800
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Mon Mar 7 15:50:44 2016 -0800

----------------------------------------------------------------------
 .../java/com/gemstone/gemfire/internal/cache/DiskEntry.java     | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e1d83af8/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskEntry.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskEntry.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskEntry.java
index cf71a44..26e49c9 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskEntry.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/DiskEntry.java
@@ -753,11 +753,10 @@ public interface DiskEntry extends RegionEntry {
 
     /**
      * Returns true if the given object is off-heap
-     * and it is worth wrapping a reference to to it
+     * and it is worth wrapping a reference to it
      * instead of copying its data to the heap.
      * Currently all StoredObject's with a refCount are
-     * wrapped but it make make sense to also only wrap
-     * them if they are over a certain size.
+     * wrapped.
      */
     public static boolean wrapOffHeapReference(Object o) {
       if (o instanceof StoredObject) {


[05/11] incubator-geode git commit: GEODE-1040: Add a DUnit for JTA rollback

Posted by ds...@apache.org.
GEODE-1040: Add a DUnit for JTA rollback


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/7e354942
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/7e354942
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/7e354942

Branch: refs/heads/feature/GEODE-982
Commit: 7e354942b5b861b1aa4edb620bb05d0307c67713
Parents: e7e1fc6
Author: Sai Boorlagadda <sb...@pivotal.io>
Authored: Wed Mar 2 12:54:15 2016 -0800
Committer: Sai Boorlagadda <sb...@pivotal.io>
Committed: Thu Mar 3 10:14:03 2016 -0800

----------------------------------------------------------------------
 .../cache/ClientServerTransactionDUnitTest.java | 58 +++++++++++++-------
 1 file changed, 39 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/7e354942/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java
index add43a0..28e6419 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java
@@ -388,22 +388,26 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
   }
 
   public void testBasicCommitOnEmpty() {
-    doBasicCommit(false, false);
+    doBasicTransaction(false, false, true);
   }
   
   public void testBasicCommitOnEmptyUsingJTA() {
-    doBasicCommit(false, true);
+    doBasicTransaction(false, true, true);
   }
 
   public void testBasicCommit() {
-    doBasicCommit(true, false);
+    doBasicTransaction(true, false, true);
   }
   
   public void testBasicCommitUsingJTA() {
-    doBasicCommit(true, true);
+    doBasicTransaction(true, true, true);
   }
   
-  private void doBasicCommit(final boolean prePopulateData, final boolean useJTA) {
+  public void testBasicRollbackUsingJTA() {
+    doBasicTransaction(true, true, false);
+  }
+  
+  private void doBasicTransaction(final boolean prePopulateData, final boolean useJTA, final boolean isCommit) {
     Host host = Host.getHost(0);
     VM server = host.getVM(0);
     VM client = host.getVM(1);
@@ -473,18 +477,28 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
             "pr sized should be " + MAX_ENTRIES + " but it is:" + pr.size(),
             MAX_ENTRIES, pr.size());
         com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("committing transaction");
-        if (useJTA) {
-          utx.commit();
+        if (isCommit) {
+          if (useJTA) {
+            utx.commit();
+          } else {
+            getCache().getCacheTransactionManager().commit();
+          }
         } else {
-          getCache().getCacheTransactionManager().commit();
+          if (useJTA) {
+            utx.rollback();
+          } else {
+            getCache().getCacheTransactionManager().rollback();
+          }
         }
-        com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("done committing transaction");
+        com.gemstone.gemfire.test.dunit.LogWriterUtils. getLogWriter().info("done " + (isCommit ? "committing" : "rollingback") + "transaction");
+        int expectedRegionSize = isCommit ? MAX_ENTRIES : 5;
+
         assertEquals(
-            "r sized should be " + MAX_ENTRIES + " but it is:" + r.size(),
-            MAX_ENTRIES, r.size());
+            "r sized should be " + expectedRegionSize + " but it is:" + r.size(),
+            expectedRegionSize, r.size());
         assertEquals(
-            "pr sized should be " + MAX_ENTRIES + " but it is:" + pr.size(),
-            MAX_ENTRIES, pr.size());
+            "pr sized should be " + expectedRegionSize + " but it is:" + pr.size(),
+            expectedRegionSize, pr.size());
 
         return null;
       }
@@ -494,12 +508,13 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
       public Object call() throws Exception {
         Region<Integer, String> r = getGemfireCache().getRegion(D_REFERENCE);
         Region<CustId, Customer> pr = getGemfireCache().getRegion(CUSTOMER);
+        int expectedRegionSize = isCommit ? MAX_ENTRIES : 5;
         assertEquals(
-            "r sized should be " + MAX_ENTRIES + " but it is:" + r.size(),
-            MAX_ENTRIES, r.size());
+            "r sized should be " + expectedRegionSize + " but it is:" + r.size(),
+            expectedRegionSize, r.size());
         assertEquals(
-            "pr sized should be " + MAX_ENTRIES + " but it is:" + pr.size(),
-            MAX_ENTRIES, pr.size());
+            "pr sized should be " + expectedRegionSize + " but it is:" + pr.size(),
+            expectedRegionSize, pr.size());
         return null;
       }
     });
@@ -512,8 +527,13 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
         for (int i = 0; i < MAX_ENTRIES; i++) {
           CustId custId = new CustId(i);
           Customer cust = new Customer("name"+suffix+i, "address"+suffix+i);
-          assertEquals(cust, r.get(custId));
-          assertEquals(cust, pr.get(custId));
+          if (isCommit) {
+            assertEquals(cust, r.get(custId));
+            assertEquals(cust, pr.get(custId));
+          } else {
+            assertNotSame(cust, r.get(custId));
+            assertNotSame(cust, pr.get(custId));
+          }
         }
         return null;
       }


[10/11] incubator-geode git commit: Merge remote-tracking branch 'origin/develop' into feature branch GEODE 982

Posted by ds...@apache.org.
Merge remote-tracking branch 'origin/develop' into feature branch GEODE 982


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/79ed00e9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/79ed00e9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/79ed00e9

Branch: refs/heads/feature/GEODE-982
Commit: 79ed00e9ef61e5c6b2613b7f2398eb6722cd0239
Parents: e1d83af 23950e8
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Mon Mar 7 16:14:22 2016 -0800
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Mon Mar 7 16:14:22 2016 -0800

----------------------------------------------------------------------
 .../query/internal/index/IndexElemArray.java    | 34 ++++----
 .../query/internal/index/IndexManager.java      | 10 +--
 .../cache/CachedDeserializableFactory.java      |  4 +-
 .../cache/partitioned/FetchEntriesMessage.java  |  2 +-
 .../internal/index/IndexElemArrayJUnitTest.java | 66 ++++++++++++---
 .../DistributedMulticastRegionDUnitTest.java    |  5 +-
 .../cache/ClientServerTransactionDUnitTest.java | 58 ++++++++-----
 .../internal/distributed/LuceneFunction.java    |  3 +-
 .../pulse/internal/data/JMXDataUpdater.java     | 85 ++------------------
 .../service/ClusterSelectedRegionService.java   |  8 +-
 .../ClusterSelectedRegionsMemberService.java    |  8 +-
 11 files changed, 140 insertions(+), 143 deletions(-)
----------------------------------------------------------------------



[11/11] incubator-geode git commit: renamed ChunkValueWrapper to OffHeapValueWrapper

Posted by ds...@apache.org.
renamed ChunkValueWrapper to OffHeapValueWrapper


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/875f8ace
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/875f8ace
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/875f8ace

Branch: refs/heads/feature/GEODE-982
Commit: 875f8ace0c0cc7f72b1a586959d0bfe08e500319
Parents: 79ed00e
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Mon Mar 7 16:23:46 2016 -0800
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Mon Mar 7 16:23:46 2016 -0800

----------------------------------------------------------------------
 .../cache/ChunkValueWrapperJUnitTest.java       | 188 -------------------
 .../cache/OffHeapValueWrapperJUnitTest.java     | 188 +++++++++++++++++++
 2 files changed, 188 insertions(+), 188 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/875f8ace/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ChunkValueWrapperJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ChunkValueWrapperJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ChunkValueWrapperJUnitTest.java
deleted file mode 100644
index 19b1ac1..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ChunkValueWrapperJUnitTest.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire.internal.cache;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import com.gemstone.gemfire.internal.cache.DiskEntry.Helper.OffHeapValueWrapper;
-import com.gemstone.gemfire.internal.cache.DiskEntry.Helper.Flushable;
-import com.gemstone.gemfire.internal.offheap.NullOffHeapMemoryStats;
-import com.gemstone.gemfire.internal.offheap.NullOutOfOffHeapMemoryListener;
-import com.gemstone.gemfire.internal.offheap.SimpleMemoryAllocatorImpl;
-import com.gemstone.gemfire.internal.offheap.SlabImpl;
-import com.gemstone.gemfire.internal.offheap.StoredObject;
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
-
-@Category(UnitTest.class)
-public class ChunkValueWrapperJUnitTest {
-
-  private static OffHeapValueWrapper createChunkValueWrapper(byte[] bytes, boolean isSerialized) {
-    StoredObject c = SimpleMemoryAllocatorImpl.getAllocator().allocateAndInitialize(bytes, isSerialized, false);
-    return new OffHeapValueWrapper(c);
-  }
-
-  @Before
-  public void setUp() throws Exception {
-    SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{new SlabImpl(1024*1024)});
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    SimpleMemoryAllocatorImpl.freeOffHeapMemory();
-  }
-
-  @Test
-  public void testIsSerialized() {
-    assertEquals(true, createChunkValueWrapper(new byte[16], true).isSerialized());
-    assertEquals(false, createChunkValueWrapper(new byte[16], false).isSerialized());
-  }
-  
-  @Test
-  public void testGetUserBits() {
-    assertEquals((byte)1, createChunkValueWrapper(new byte[16], true).getUserBits());
-    assertEquals((byte)0, createChunkValueWrapper(new byte[16], false).getUserBits());
-  }
-  
-  @Test
-  public void testGetLength() {
-    assertEquals(32, createChunkValueWrapper(new byte[32], true).getLength());
-    assertEquals(17, createChunkValueWrapper(new byte[17], false).getLength());
-  }
-  
-  @Test
-  public void testGetBytesAsString() {
-    assertEquals("byte[0, 0, 0, 0, 0, 0, 0, 0]", createChunkValueWrapper(new byte[8], false).getBytesAsString());
-  }
-  
-  @Test
-  public void testSendTo() throws IOException {
-    final ByteBuffer bb = ByteBuffer.allocateDirect(18);
-    bb.limit(8);
-    OffHeapValueWrapper vw = createChunkValueWrapper(new byte[]{1,2,3,4,5,6,7,8}, false);
-    vw.sendTo(bb, new Flushable() {
-      @Override
-      public void flush() throws IOException {
-        fail("should not have been called");
-      }
-
-      @Override
-      public void flush(ByteBuffer bb, ByteBuffer chunkbb) throws IOException {
-        fail("should not have been called");
-      }
-    });
-    assertEquals(8, bb.position());
-    bb.flip();
-    assertEquals(1, bb.get());
-    assertEquals(2, bb.get());
-    assertEquals(3, bb.get());
-    assertEquals(4, bb.get());
-    assertEquals(5, bb.get());
-    assertEquals(6, bb.get());
-    assertEquals(7, bb.get());
-    assertEquals(8, bb.get());
-    
-    bb.clear();
-    bb.limit(8);
-    vw = createChunkValueWrapper(new byte[]{1,2,3,4,5,6,7,8,9}, false);
-    final int[] flushCalls = new int[1];
-    vw.sendTo(bb, new Flushable() {
-      @Override
-      public void flush() throws IOException {
-        if (flushCalls[0] != 0) {
-          fail("expected flush to only be called once");
-        }
-        flushCalls[0]++;
-        assertEquals(8, bb.position());
-        for (int i=0; i < 8; i++) {
-          assertEquals(i+1, bb.get(i));
-        }
-        bb.clear();
-        bb.limit(8);
-      }
-
-      @Override
-      public void flush(ByteBuffer bb, ByteBuffer chunkbb) throws IOException {
-        fail("should not have been called");
-      }
-    });
-    assertEquals(1, bb.position());
-    bb.flip();
-    assertEquals(9, bb.get());
-    
-    bb.clear();
-    bb.limit(8);
-    flushCalls[0] = 0;
-    vw = createChunkValueWrapper(new byte[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}, false);
-    vw.sendTo(bb, new Flushable() {
-      @Override
-      public void flush() throws IOException {
-        if (flushCalls[0] > 1) {
-          fail("expected flush to only be called twice");
-        }
-        assertEquals(8, bb.position());
-        for (int i=0; i < 8; i++) {
-          assertEquals((flushCalls[0]*8)+i+1, bb.get(i));
-        }
-        flushCalls[0]++;
-        bb.clear();
-        bb.limit(8);
-      }
-
-      @Override
-      public void flush(ByteBuffer bb, ByteBuffer chunkbb) throws IOException {
-        fail("should not have been called");
-      }
-    });
-    assertEquals(1, bb.position());
-    bb.flip();
-    assertEquals(17, bb.get());
-    
-    // now test with a chunk that will not fit in bb.
-    bb.clear();
-    flushCalls[0] = 0;
-    bb.put((byte) 0);
-    vw = createChunkValueWrapper(new byte[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}, false);
-    vw.sendTo(bb, new Flushable() {
-      @Override
-      public void flush() throws IOException {
-        fail("should not have been called");
-      }
-
-      @Override
-      public void flush(ByteBuffer bb, ByteBuffer chunkbb) throws IOException {
-        flushCalls[0]++;
-        assertEquals(1, bb.position());
-        bb.flip();
-        assertEquals(0, bb.get());
-        assertEquals(19, chunkbb.remaining());
-        for (int i=1; i <= 19; i++) {
-          assertEquals(i, chunkbb.get());
-        }
-      }
-    });
-    assertEquals(1, flushCalls[0]);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/875f8ace/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapValueWrapperJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapValueWrapperJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapValueWrapperJUnitTest.java
new file mode 100644
index 0000000..0829009
--- /dev/null
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapValueWrapperJUnitTest.java
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.internal.cache;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.internal.cache.DiskEntry.Helper.OffHeapValueWrapper;
+import com.gemstone.gemfire.internal.cache.DiskEntry.Helper.Flushable;
+import com.gemstone.gemfire.internal.offheap.NullOffHeapMemoryStats;
+import com.gemstone.gemfire.internal.offheap.NullOutOfOffHeapMemoryListener;
+import com.gemstone.gemfire.internal.offheap.SimpleMemoryAllocatorImpl;
+import com.gemstone.gemfire.internal.offheap.SlabImpl;
+import com.gemstone.gemfire.internal.offheap.StoredObject;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class OffHeapValueWrapperJUnitTest {
+
+  private static OffHeapValueWrapper createChunkValueWrapper(byte[] bytes, boolean isSerialized) {
+    StoredObject c = SimpleMemoryAllocatorImpl.getAllocator().allocateAndInitialize(bytes, isSerialized, false);
+    return new OffHeapValueWrapper(c);
+  }
+
+  @Before
+  public void setUp() throws Exception {
+    SimpleMemoryAllocatorImpl.createForUnitTest(new NullOutOfOffHeapMemoryListener(), new NullOffHeapMemoryStats(), new SlabImpl[]{new SlabImpl(1024*1024)});
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    SimpleMemoryAllocatorImpl.freeOffHeapMemory();
+  }
+
+  @Test
+  public void testIsSerialized() {
+    assertEquals(true, createChunkValueWrapper(new byte[16], true).isSerialized());
+    assertEquals(false, createChunkValueWrapper(new byte[16], false).isSerialized());
+  }
+  
+  @Test
+  public void testGetUserBits() {
+    assertEquals((byte)1, createChunkValueWrapper(new byte[16], true).getUserBits());
+    assertEquals((byte)0, createChunkValueWrapper(new byte[16], false).getUserBits());
+  }
+  
+  @Test
+  public void testGetLength() {
+    assertEquals(32, createChunkValueWrapper(new byte[32], true).getLength());
+    assertEquals(17, createChunkValueWrapper(new byte[17], false).getLength());
+  }
+  
+  @Test
+  public void testGetBytesAsString() {
+    assertEquals("byte[0, 0, 0, 0, 0, 0, 0, 0]", createChunkValueWrapper(new byte[8], false).getBytesAsString());
+  }
+  
+  @Test
+  public void testSendTo() throws IOException {
+    final ByteBuffer bb = ByteBuffer.allocateDirect(18);
+    bb.limit(8);
+    OffHeapValueWrapper vw = createChunkValueWrapper(new byte[]{1,2,3,4,5,6,7,8}, false);
+    vw.sendTo(bb, new Flushable() {
+      @Override
+      public void flush() throws IOException {
+        fail("should not have been called");
+      }
+
+      @Override
+      public void flush(ByteBuffer bb, ByteBuffer chunkbb) throws IOException {
+        fail("should not have been called");
+      }
+    });
+    assertEquals(8, bb.position());
+    bb.flip();
+    assertEquals(1, bb.get());
+    assertEquals(2, bb.get());
+    assertEquals(3, bb.get());
+    assertEquals(4, bb.get());
+    assertEquals(5, bb.get());
+    assertEquals(6, bb.get());
+    assertEquals(7, bb.get());
+    assertEquals(8, bb.get());
+    
+    bb.clear();
+    bb.limit(8);
+    vw = createChunkValueWrapper(new byte[]{1,2,3,4,5,6,7,8,9}, false);
+    final int[] flushCalls = new int[1];
+    vw.sendTo(bb, new Flushable() {
+      @Override
+      public void flush() throws IOException {
+        if (flushCalls[0] != 0) {
+          fail("expected flush to only be called once");
+        }
+        flushCalls[0]++;
+        assertEquals(8, bb.position());
+        for (int i=0; i < 8; i++) {
+          assertEquals(i+1, bb.get(i));
+        }
+        bb.clear();
+        bb.limit(8);
+      }
+
+      @Override
+      public void flush(ByteBuffer bb, ByteBuffer chunkbb) throws IOException {
+        fail("should not have been called");
+      }
+    });
+    assertEquals(1, bb.position());
+    bb.flip();
+    assertEquals(9, bb.get());
+    
+    bb.clear();
+    bb.limit(8);
+    flushCalls[0] = 0;
+    vw = createChunkValueWrapper(new byte[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17}, false);
+    vw.sendTo(bb, new Flushable() {
+      @Override
+      public void flush() throws IOException {
+        if (flushCalls[0] > 1) {
+          fail("expected flush to only be called twice");
+        }
+        assertEquals(8, bb.position());
+        for (int i=0; i < 8; i++) {
+          assertEquals((flushCalls[0]*8)+i+1, bb.get(i));
+        }
+        flushCalls[0]++;
+        bb.clear();
+        bb.limit(8);
+      }
+
+      @Override
+      public void flush(ByteBuffer bb, ByteBuffer chunkbb) throws IOException {
+        fail("should not have been called");
+      }
+    });
+    assertEquals(1, bb.position());
+    bb.flip();
+    assertEquals(17, bb.get());
+    
+    // now test with a chunk that will not fit in bb.
+    bb.clear();
+    flushCalls[0] = 0;
+    bb.put((byte) 0);
+    vw = createChunkValueWrapper(new byte[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19}, false);
+    vw.sendTo(bb, new Flushable() {
+      @Override
+      public void flush() throws IOException {
+        fail("should not have been called");
+      }
+
+      @Override
+      public void flush(ByteBuffer bb, ByteBuffer chunkbb) throws IOException {
+        flushCalls[0]++;
+        assertEquals(1, bb.position());
+        bb.flip();
+        assertEquals(0, bb.get());
+        assertEquals(19, chunkbb.remaining());
+        for (int i=1; i <= 19; i++) {
+          assertEquals(i, chunkbb.get());
+        }
+      }
+    });
+    assertEquals(1, flushCalls[0]);
+  }
+}


[08/11] incubator-geode git commit: fixed EntryEventImpl toData

Posted by ds...@apache.org.
fixed EntryEventImpl toData


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/05a70cdb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/05a70cdb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/05a70cdb

Branch: refs/heads/feature/GEODE-982
Commit: 05a70cdbfcd11916f434cc1cc04a6ec5f2913166
Parents: 6a6c85c
Author: Darrel Schneider <ds...@pivotal.io>
Authored: Mon Mar 7 10:16:40 2016 -0800
Committer: Darrel Schneider <ds...@pivotal.io>
Committed: Mon Mar 7 10:16:40 2016 -0800

----------------------------------------------------------------------
 .../gemstone/gemfire/codeAnalysis/sanctionedDataSerializables.txt  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/05a70cdb/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedDataSerializables.txt
----------------------------------------------------------------------
diff --git a/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedDataSerializables.txt
index dd48df4..bb9f350 100644
--- a/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedDataSerializables.txt
+++ b/geode-core/src/test/resources/com/gemstone/gemfire/codeAnalysis/sanctionedDataSerializables.txt
@@ -1030,7 +1030,7 @@ toData,17,2ab400022bb800042ab400032bb80004b1
 
 com/gemstone/gemfire/internal/cache/EntryEventImpl,2
 fromData,214,2a2bb8001dc0001eb5001f2bb8001d4d2bb8001d4e2abb0020592c2d01b70021b500222a2bb900230100b80024b500252a2bb900260100b500082ab400222bb8001db600272a2bb8001dc00028b500092bb9002901009900112a2bb8001dc0002ab50007a700322bb9002901009900212a2bb8002bb5002c2a2ab4002cb500052a2ab4002cb8002db50004a7000b2a2bb8001db500042bb9002901009900192a2bb8002bb5002e2a2ab4002eb8002db50006a7000b2a2bb8001db500062a2bb8002fb500302a2bb80031b5000a2a2bb80032b50016b1
-toData,326,2ab4001f2bb801612ab600902bb801612ab40022b6018a2bb801612b2ab40025b4018bb9018c02002b2ab4000811c03f7eb9018d02002ab6004d2bb801612ab400092bb801612ab40007c6000704a70004033d2b1cb9018e02001c99000e2ab400072bb80161a7006f2ab600434e2dc10086360415049900152dc1008499000e2dc00084b900bb010036042b1504b9018e0200150499003b2ab4002cc6000e2ab4002c2bb8018fa7002e2ab40005c6000e2ab400052bb8018fa7001c2dc000863a051905b900c701002bb80190a700082d2bb801612ab700454d2cc100863e1d9900142cc1008499000d2cc00084b900bb01003e2b1db9018e02001d9900292ab4002ec6000e2ab4002e2bb8018fa7001c2cc000863a041904b900c701002bb80190a700082c2bb801612ab40030c001912bb801922ab6005a2bb801612ab400162bb80193b1
+toData,312,2ab400202bb801632ab6008f2bb801632ab40023b6018c2bb801632b2ab40026b4018db9018e02002b2ab4000911c03f7eb9018f02002ab6004e2bb801632ab4000a2bb801632ab40008c6000704a70004033d2b1cb9019002001c99000e2ab400082bb80163a700682ab600444e2dc100853604150499000e2dc00085b900bb010036042b1504b901900200150499003b2ab4002dc6000e2ab4002d2bb80191a7002e2ab40006c6000e2ab400062bb80191a7001c2dc000853a051905b900c901002bb80192a700082d2bb801632ab700464d2cc100853e1d99000d2cc00085b900bb01003e2b1db9019002001d9900292ab4002fc6000e2ab4002f2bb80191a7001c2cc000853a041904b900c901002bb80192a700082c2bb801632ab40031c001932bb801942ab6005b2bb801632ab400172bb80195b1
 
 com/gemstone/gemfire/internal/cache/EntrySnapshot,2
 fromData,50,2a03b500052bb9004101003d1c9900112abb000759b70042b50004a7000e2abb000359b70043b500042ab400042bb60044b1


[06/11] incubator-geode git commit: GEODE-966 HashIndex with Overflow region detection/conversion needs to occur sooner

Posted by ds...@apache.org.
GEODE-966 HashIndex with Overflow region detection/conversion needs to occur sooner

Conversion of HashIndex to CompactRangeIndex due to overflow is determined before the create
task is created.  This prevents the index map from getting into a weird state.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/49141421
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/49141421
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/49141421

Branch: refs/heads/feature/GEODE-982
Commit: 4914142105e2ec478679efdc1737ab9972b30d1e
Parents: 7e35494
Author: Jason Huynh <hu...@gmail.com>
Authored: Thu Feb 25 16:23:08 2016 -0800
Committer: Jason Huynh <hu...@gmail.com>
Committed: Thu Mar 3 15:15:15 2016 -0800

----------------------------------------------------------------------
 .../gemfire/cache/query/internal/index/IndexManager.java  | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49141421/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/IndexManager.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/IndexManager.java b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/IndexManager.java
index 7a0b1a9..d21b50d 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/IndexManager.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/cache/query/internal/index/IndexManager.java
@@ -302,6 +302,11 @@ public class IndexManager  {
 
       IndexCreationHelper helper = null;
       boolean isCompactOrHash = false;
+      //Hash index not supported for overflow but we "thought" we were so let's maintain backwards compatibility
+      //and create a regular compact range index instead
+      if (indexType == IndexType.HASH && isOverFlowRegion()) {
+        indexType = IndexType.FUNCTIONAL;
+      }
       if (indexType != IndexType.PRIMARY_KEY) {
         helper = new FunctionalIndexCreationHelper(origFromClause,
             origIndexedExpression, projectionAttributes, imports, region.getCache(),
@@ -1615,11 +1620,6 @@ public class IndexManager  {
       if (this.prIndex != null) {
         stats = this.prIndex.getStatistics();
       }
-      //Hash index not supported for overflow but we "thought" we were so let's maintain backwards compatibility
-      //and create a regular compact range index instead
-      if (indexType == IndexType.HASH && isOverFlowRegion()) {
-        indexType = IndexType.FUNCTIONAL;
-      }
       if (indexType == IndexType.PRIMARY_KEY) {
         index = new PrimaryKeyIndex(indexName, region, fromClause,indexedExpression,
              projectionAttributes, origFromClause,


[03/11] incubator-geode git commit: GEODE-991: Marking LuceneFunction as in InternalEntity

Posted by ds...@apache.org.
GEODE-991: Marking LuceneFunction as in InternalEntity

This prevents LuceneFunction from showing up in the list functions
command in gfsh.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/0ca2f2ea
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/0ca2f2ea
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/0ca2f2ea

Branch: refs/heads/feature/GEODE-982
Commit: 0ca2f2ea16d09b67b3b7b3c723b0f02e35b577b3
Parents: e1a0830
Author: Dan Smith <up...@apache.org>
Authored: Wed Mar 2 14:12:52 2016 -0800
Committer: Dan Smith <up...@apache.org>
Committed: Wed Mar 2 14:21:08 2016 -0800

----------------------------------------------------------------------
 .../gemfire/cache/lucene/internal/distributed/LuceneFunction.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0ca2f2ea/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunction.java b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunction.java
index c3b79c5..199b698 100644
--- a/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunction.java
+++ b/geode-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/internal/distributed/LuceneFunction.java
@@ -39,6 +39,7 @@ import com.gemstone.gemfire.cache.lucene.internal.repository.IndexRepository;
 import com.gemstone.gemfire.cache.lucene.internal.repository.IndexResultCollector;
 import com.gemstone.gemfire.cache.lucene.internal.repository.RepositoryManager;
 import com.gemstone.gemfire.cache.query.QueryException;
+import com.gemstone.gemfire.internal.InternalEntity;
 import com.gemstone.gemfire.internal.cache.BucketNotFoundException;
 import com.gemstone.gemfire.internal.logging.LogService;
 
@@ -47,7 +48,7 @@ import com.gemstone.gemfire.internal.logging.LogService;
  * and arguments like region and buckets. It invokes search on the local index and provides a result collector. The
  * locally collected results are sent to the search coordinator.
  */
-public class LuceneFunction extends FunctionAdapter {
+public class LuceneFunction extends FunctionAdapter implements InternalEntity {
   private static final long serialVersionUID = 1L;
   public static final String ID = LuceneFunction.class.getName();
 


[02/11] incubator-geode git commit: GEODE-1029 fixed test issue, where system is not working properly.

Posted by ds...@apache.org.
GEODE-1029 fixed test issue, where system is not working properly.


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/e1a0830e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/e1a0830e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/e1a0830e

Branch: refs/heads/feature/GEODE-982
Commit: e1a0830e2eda15cf7a8ec2281b521619333c8e53
Parents: 3996940
Author: Hitesh Khamesra <hk...@pivotal.io>
Authored: Tue Mar 1 14:26:48 2016 -0800
Committer: Hitesh Khamesra <hk...@pivotal.io>
Committed: Wed Mar 2 09:36:34 2016 -0800

----------------------------------------------------------------------
 .../gemfire/internal/cache/CachedDeserializableFactory.java     | 4 ++--
 .../gemfire/cache30/DistributedMulticastRegionDUnitTest.java    | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e1a0830e/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/CachedDeserializableFactory.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/CachedDeserializableFactory.java b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/CachedDeserializableFactory.java
index 9120e37..e1bf984 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/CachedDeserializableFactory.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/internal/cache/CachedDeserializableFactory.java
@@ -35,8 +35,8 @@ import com.gemstone.gemfire.pdx.PdxInstance;
  *
  */
 public class CachedDeserializableFactory {
-  private static final boolean PREFER_DESERIALIZED = ! Boolean.getBoolean("gemfire.PREFER_SERIALIZED");
-  private static final boolean STORE_ALL_VALUE_FORMS = Boolean.getBoolean("gemfire.STORE_ALL_VALUE_FORMS");
+  public static boolean PREFER_DESERIALIZED = ! Boolean.getBoolean("gemfire.PREFER_SERIALIZED");
+  public static boolean STORE_ALL_VALUE_FORMS = Boolean.getBoolean("gemfire.STORE_ALL_VALUE_FORMS");
 
   /**
    * Currently GFE always wants a CachedDeserializable wrapper.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e1a0830e/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java
index 72b7941..9a0a6dd 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/DistributedMulticastRegionDUnitTest.java
@@ -34,6 +34,7 @@ import com.gemstone.gemfire.distributed.internal.InternalLocator;
 import com.gemstone.gemfire.distributed.internal.ReplyException;
 import com.gemstone.gemfire.distributed.internal.SharedConfiguration;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.cache.CachedDeserializableFactory;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.internal.cache.OffHeapTestUtil;
 import com.gemstone.gemfire.pdx.PdxReader;
@@ -159,7 +160,7 @@ public class DistributedMulticastRegionDUnitTest extends CacheTestCase {
       
       SerializableRunnable setSysProp = new CacheSerializableRunnable("Create Region") {
         public void run2() throws CacheException {
-          System.setProperty("gemfire.STORE_ALL_VALUE_FORMS", "true");
+          CachedDeserializableFactory.STORE_ALL_VALUE_FORMS = true;
         }
       };
       
@@ -225,7 +226,7 @@ public class DistributedMulticastRegionDUnitTest extends CacheTestCase {
     }finally {
       SerializableRunnable unsetSysProp = new CacheSerializableRunnable("Create Region") {
         public void run2() throws CacheException {
-          System.setProperty("gemfire.STORE_ALL_VALUE_FORMS", "false");          
+          CachedDeserializableFactory.STORE_ALL_VALUE_FORMS = false;
         }
       };
       vm0.invoke(unsetSysProp);


[07/11] incubator-geode git commit: GEODE-1021: show members of the region that has hyphen in it's name

Posted by ds...@apache.org.
GEODE-1021: show members of the region that has hyphen in it's name


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/23950e80
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/23950e80
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/23950e80

Branch: refs/heads/feature/GEODE-982
Commit: 23950e80f8771eb134cb128ad9cff4d78f270d12
Parents: 4914142
Author: Jinmei Liao <ji...@pivotal.io>
Authored: Thu Mar 3 13:38:27 2016 -0800
Committer: Jinmei Liao <ji...@pivotal.io>
Committed: Fri Mar 4 07:51:50 2016 -0800

----------------------------------------------------------------------
 .../pulse/internal/data/JMXDataUpdater.java     | 85 ++------------------
 .../service/ClusterSelectedRegionService.java   |  8 +-
 .../ClusterSelectedRegionsMemberService.java    |  8 +-
 3 files changed, 14 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/23950e80/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java
index 71dfa61..bb433f5 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/data/JMXDataUpdater.java
@@ -1246,10 +1246,10 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
   /**
    * Add member specific region information on the region
    *
-   * @param regionFullPath
+   * @param regionObjectName: used to construct the jmx objectname. For region name that has special characters in, it will have double quotes around it.
    * @param region
    */
-  private void updateRegionOnMembers(String regionFullPath, Cluster.Region region) throws IOException {
+  private void updateRegionOnMembers(String regionObjectName, String regionFullPath, Cluster.Region region) throws IOException {
 
     try{
         List<String> memberNamesTemp = region.getMemberName();
@@ -1272,7 +1272,7 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
               regionOnMemberListNew.add(anRom);
 
               LOGGER.fine("updateRegionOnMembers : Processing existing Member name = " + anRom.getMemberName());
-              String objectNameROM = PulseConstants.OBJECT_NAME_REGION_ON_MEMBER_REGION + regionFullPath + PulseConstants.OBJECT_NAME_REGION_ON_MEMBER_MEMBER + anRom.getMemberName();
+              String objectNameROM = PulseConstants.OBJECT_NAME_REGION_ON_MEMBER_REGION + regionObjectName + PulseConstants.OBJECT_NAME_REGION_ON_MEMBER_MEMBER + anRom.getMemberName();
               ObjectName regionOnMemberMBean = new ObjectName(objectNameROM);
               LOGGER.fine("updateRegionOnMembers : Object name = " + regionOnMemberMBean.getCanonicalName());
 
@@ -1339,7 +1339,7 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
         LOGGER.fine("updateRegionOnMembers : Remaining new members in this region = " + memberNames.size());
         //loop over the remaining regions members and add new members for this region
         for(String memberName : memberNames) {
-          String objectNameROM = PulseConstants.OBJECT_NAME_REGION_ON_MEMBER_REGION + regionFullPath + PulseConstants.OBJECT_NAME_REGION_ON_MEMBER_MEMBER + memberName;
+          String objectNameROM = PulseConstants.OBJECT_NAME_REGION_ON_MEMBER_REGION + regionObjectName + PulseConstants.OBJECT_NAME_REGION_ON_MEMBER_MEMBER + memberName;
           ObjectName regionOnMemberMBean = new ObjectName(objectNameROM);
           Cluster.RegionOnMember regionOnMember = new Cluster.RegionOnMember();
           regionOnMember.setMemberName(memberName);
@@ -1419,6 +1419,7 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
           PulseConstants.REGION_MBEAN_ATTRIBUTES);
 
       // retrieve the full path of the region
+      String regionObjectName = mbeanName.getKeyProperty("name");
       String regionFullPath = null;
       for (int i = 0; i < attributeList.size(); i++) {
         Attribute attribute = (Attribute) attributeList.get(i);
@@ -1512,82 +1513,8 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
         }
       }
 
-      /* GemfireXD related code
-      try{// Added for Rolling upgrade
-    	  CompositeData compositeData = (CompositeData) (this.mbs.invoke(mbeanName,
-    	          PulseConstants.MBEAN_OPERATION_LISTREGIONATTRIBUTES, null, null));
-
-    	      if (compositeData != null) {
-    	        if (compositeData
-    	            .containsKey(PulseConstants.COMPOSITE_DATA_KEY_COMPRESSIONCODEC)) {
-    	          String regCompCodec = (String) compositeData
-    	              .get(PulseConstants.COMPOSITE_DATA_KEY_COMPRESSIONCODEC);
-    	          if (null != regCompCodec) {
-    	            region.setCompressionCodec(regCompCodec);
-    	          }
-    	        }
-    	        if (compositeData
-    	            .containsKey(PulseConstants.COMPOSITE_DATA_KEY_ENABLEOFFHEAPMEMORY)) {
-    	          region.setEnableOffHeapMemory((Boolean) compositeData
-    	              .get(PulseConstants.COMPOSITE_DATA_KEY_ENABLEOFFHEAPMEMORY));
-    	        }
-    	        if (compositeData
-    	            .containsKey(PulseConstants.COMPOSITE_DATA_KEY_HDFSWRITEONLY)) {
-    	          region.setHdfsWriteOnly((Boolean) compositeData
-    	              .get(PulseConstants.COMPOSITE_DATA_KEY_HDFSWRITEONLY));
-    	        }
-    	      }
-      } catch (MBeanException anfe) {
-          LOGGER.warning(anfe);
-          region.setHdfsWriteOnly(false);
-          region.setEnableOffHeapMemory(false);
-          region.setCompressionCodec("NA");
-      }catch (javax.management.RuntimeMBeanException invalidOe) {
-    	    region.setHdfsWriteOnly(false);
-            region.setEnableOffHeapMemory(false);
-            region.setCompressionCodec("NA");
-           // LOGGER.info("Some of the Pulse elements are not available currently. There might be a GemFire upgrade going on.");
-      }
-      */
-
-      // TODO : Uncomment below code when sql fire mbean attributes are
-      // available
-      /*
-       * // IF SQLFIRE if
-       * (PulseConstants.PRODUCT_NAME_SQLFIRE.equalsIgnoreCase(PulseController
-       * .getPulseProductSupport())) {
-       *
-       * try { String tableName = this.getTableNameFromRegionName(region
-       * .getFullPath());
-       *
-       * ObjectName tableObjName = new ObjectName(
-       * PulseConstants.OBJECT_NAME_TABLE_AGGREGATE_PATTERN + tableName);
-       *
-       * AttributeList tableAttributeList = this.mbs.getAttributes(
-       * tableObjName, PulseConstants.SF_TABLE_MBEAN_ATTRIBUTES);
-       *
-       * for (int i = 0; i < tableAttributeList.size(); i++) {
-       *
-       * Attribute attribute = (Attribute) tableAttributeList.get(i);
-       *
-       * if (attribute.getName().equals(
-       * PulseConstants.MBEAN_ATTRIBUTE_ENTRYSIZE)) {
-       * System.out.println("[SQLfire] setting entry size");
-       * region.setEntrySize(getLongAttribute(attribute.getValue(),
-       * attribute.getName())); } else if (attribute.getName().equals(
-       * PulseConstants.MBEAN_ATTRIBUTE_NUMBEROFROWS)) {
-       * System.out.println("[SQLfire] setting num of rows");
-       * region.setSystemRegionEntryCount(getLongAttribute(
-       * attribute.getValue(), attribute.getName())); } } } catch
-       * (MalformedObjectNameException e) { LOGGER.warning(e); } catch
-       * (NullPointerException e) { LOGGER.warning(e); } }
-       */
-
-      // Add to map even if region is present. If region is already there it
-      // will be a no-op.
-
       //add for each member
-      updateRegionOnMembers(regionFullPath, region);
+      updateRegionOnMembers(regionObjectName, regionFullPath, region);
 
       cluster.addClusterRegion(regionFullPath, region);
       cluster.getDeletedRegions().remove(region.getFullPath());

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/23950e80/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterSelectedRegionService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterSelectedRegionService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterSelectedRegionService.java
index 4309c40..1e2f5b1 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterSelectedRegionService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterSelectedRegionService.java
@@ -209,13 +209,13 @@ public class ClusterSelectedRegionService implements PulseService {
       }
 
       regionJSON.put("memoryReadsTrend",
-          mapper.valueToTree(reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_GETS_PER_SEC_TREND)));
+          mapper.<JsonNode>valueToTree(reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_GETS_PER_SEC_TREND)));
       regionJSON.put("memoryWritesTrend",
-          mapper.valueToTree(reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_PUTS_PER_SEC_TREND)));
+          mapper.<JsonNode>valueToTree(reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_PUTS_PER_SEC_TREND)));
       regionJSON.put("diskReadsTrend",
-          mapper.valueToTree(reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_DISK_READS_PER_SEC_TREND)));
+          mapper.<JsonNode>valueToTree(reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_DISK_READS_PER_SEC_TREND)));
       regionJSON.put("diskWritesTrend",
-          mapper.valueToTree(reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_DISK_WRITES_PER_SEC_TREND)));
+          mapper.<JsonNode>valueToTree(reg.getRegionStatisticTrend(Cluster.Region.REGION_STAT_DISK_WRITES_PER_SEC_TREND)));
 
       regionJSON.put("emptyNodes", reg.getEmptyNode());
       Long entrySize = reg.getEntrySize();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/23950e80/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterSelectedRegionsMemberService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterSelectedRegionsMemberService.java b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterSelectedRegionsMemberService.java
index 00807d9..f99e6d6 100644
--- a/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterSelectedRegionsMemberService.java
+++ b/geode-pulse/src/main/java/com/vmware/gemfire/tools/pulse/internal/service/ClusterSelectedRegionsMemberService.java
@@ -115,19 +115,19 @@ public class ClusterSelectedRegionsMemberService implements PulseService {
         LOGGER.finest("calling getSelectedRegionsMembersJson :: rom.getLocalMaxMemory() = " + rom.getLocalMaxMemory());
 
         memberJSON.put("memoryReadsTrend",
-            mapper.valueToTree(rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_GETS_PER_SEC_TREND)));
+            mapper.<JsonNode>valueToTree(rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_GETS_PER_SEC_TREND)));
         LOGGER.finest("memoryReadsTrend = " + rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_GETS_PER_SEC_TREND).length);
 
         memberJSON.put("memoryWritesTrend",
-            mapper.valueToTree(rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_PUTS_PER_SEC_TREND)));
+            mapper.<JsonNode>valueToTree(rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_PUTS_PER_SEC_TREND)));
         LOGGER.finest("memoryWritesTrend = " + rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_PUTS_PER_SEC_TREND).length);
 
         memberJSON.put("diskReadsTrend",
-            mapper.valueToTree(rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_DISK_READS_PER_SEC_TREND)));
+            mapper.<JsonNode>valueToTree(rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_DISK_READS_PER_SEC_TREND)));
         LOGGER.finest("diskReadsTrend = " + rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_DISK_READS_PER_SEC_TREND).length);
 
         memberJSON.put("diskWritesTrend",
-            mapper.valueToTree(rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_DISK_WRITES_PER_SEC_TREND)));
+            mapper.<JsonNode>valueToTree(rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_DISK_WRITES_PER_SEC_TREND)));
         LOGGER.finest("diskWritesTrend = " + rom.getRegionOnMemberStatisticTrend(RegionOnMember.REGION_ON_MEMBER_STAT_DISK_WRITES_PER_SEC_TREND).length);
 
         regionMemberJSON.put(rom.getMemberName(), memberJSON);