accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject git commit: ACCUMULO-1689 Ensure that the GC process isn't returned to the client.
Date Mon, 16 Sep 2013 00:21:11 GMT
Updated Branches:
  refs/heads/master 132a272eb -> f95fca397


ACCUMULO-1689 Ensure that the GC process isn't returned to the client.

Handled easily through a null check on the gcProcess as the config object is not
preserved inside of the minicluster. Added a test to make sure that we always
get a non-null Process (wrapped inside of each ProcessReference).


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

Branch: refs/heads/master
Commit: f95fca397d7ef2aecc84ea5911599d334372b3c6
Parents: 132a272
Author: Josh Elser <elserj@apache.org>
Authored: Sun Sep 15 20:19:35 2013 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Sun Sep 15 20:19:35 2013 -0400

----------------------------------------------------------------------
 .../minicluster/MiniAccumuloCluster.java         |  4 +++-
 .../minicluster/MiniAccumuloClusterGCTest.java   | 18 +++++++++++++++++-
 .../minicluster/MiniAccumuloClusterTest.java     | 19 +++++++++++++++++++
 3 files changed, 39 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/f95fca39/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
index 2e061dd..e41818b 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
@@ -398,7 +398,9 @@ public class MiniAccumuloCluster {
     result.put(ServerType.MASTER, references(masterProcess));
     result.put(ServerType.TABLET_SERVER, references(tabletServerProcesses.toArray(new Process[0])));
     result.put(ServerType.ZOOKEEPER, references(zooKeeperProcess));
-    result.put(ServerType.GARBAGE_COLLECTOR, references(gcProcess));
+    if (null != gcProcess) {
+      result.put(ServerType.GARBAGE_COLLECTOR, references(gcProcess));
+    }
     return result;
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f95fca39/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
----------------------------------------------------------------------
diff --git a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
index 6674136..f4a8ca9 100644
--- a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
+++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
@@ -17,6 +17,7 @@
 package org.apache.accumulo.minicluster;
 
 import java.io.File;
+import java.util.Collection;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
@@ -77,7 +78,7 @@ public class MiniAccumuloClusterGCTest {
   }
 
   @Test(timeout = 20000)
-  public void test() throws Exception {
+  public void testFilesAreGarbageCollected() throws Exception {
     ZooKeeperInstance inst = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
     Connector c = inst.getConnector("root", new PasswordToken(passwd));
     
@@ -125,4 +126,19 @@ public class MiniAccumuloClusterGCTest {
     Assert.fail("Expected to find less files after compaction and pause for GC");
   }
 
+  @Test(timeout = 10000)
+  public void testAccurateProcessListReturned() throws Exception {
+    Map<ServerType,Collection<ProcessReference>> procs = accumulo.getProcesses();
+    
+    for (ServerType t : new ServerType[] {ServerType.MASTER, ServerType.TABLET_SERVER, ServerType.ZOOKEEPER,
ServerType.GARBAGE_COLLECTOR}) {
+      Assert.assertTrue(procs.containsKey(t));
+      Collection<ProcessReference> procRefs = procs.get(t);
+      Assert.assertTrue(1 <= procRefs.size());
+      
+      for (ProcessReference procRef : procRefs) {
+        Assert.assertNotNull(procRef);
+      }
+    }
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f95fca39/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
----------------------------------------------------------------------
diff --git a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
index a4c37e9..3e749ab 100644
--- a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
+++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
@@ -21,6 +21,8 @@ import static org.junit.Assert.assertEquals;
 import java.io.File;
 import java.util.Collections;
 import java.util.Map.Entry;
+import java.util.Collection;
+import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 
@@ -203,6 +205,23 @@ public class MiniAccumuloClusterTest {
       Assert.assertTrue(debugPort.getSecond() > 0);
     }
   }
+  
+  @Test(timeout = 10000)
+  public void testAccurateProcessListReturned() throws Exception {
+    Map<ServerType,Collection<ProcessReference>> procs = accumulo.getProcesses();
+    
+    Assert.assertFalse(procs.containsKey(ServerType.GARBAGE_COLLECTOR));
+    
+    for (ServerType t : new ServerType[] {ServerType.MASTER, ServerType.TABLET_SERVER, ServerType.ZOOKEEPER})
{
+      Assert.assertTrue(procs.containsKey(t));
+      Collection<ProcessReference> procRefs = procs.get(t);
+      Assert.assertTrue(1 <= procRefs.size());
+      
+      for (ProcessReference procRef : procRefs) {
+        Assert.assertNotNull(procRef);
+      }
+    }
+  }
 
   @AfterClass
   public static void tearDownMiniCluster() throws Exception {


Mime
View raw message