accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject git commit: ACCUMULO-1689 Don't use deprecated methods in gc mac test
Date Tue, 10 Sep 2013 20:08:40 GMT
Updated Branches:
  refs/heads/master 7d2ae551f -> ccf988546


ACCUMULO-1689 Don't use deprecated methods in gc mac test


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

Branch: refs/heads/master
Commit: ccf988546159de0bfb504a33e3f32ee4bdb920d2
Parents: 7d2ae55
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Tue Sep 10 16:07:58 2013 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Tue Sep 10 16:07:58 2013 -0400

----------------------------------------------------------------------
 .../minicluster/MiniAccumuloClusterGCTest.java  | 48 +++++++++++---------
 1 file changed, 26 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/ccf98854/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 a432f50..2fb248b 100644
--- a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
+++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
@@ -18,12 +18,16 @@ package org.apache.accumulo.minicluster;
 
 import java.io.File;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.ZooKeeperInstance;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.filefilter.SuffixFileFilter;
 import org.apache.commons.io.filefilter.TrueFileFilter;
@@ -41,73 +45,73 @@ import com.google.common.collect.ImmutableMap;
  * 
  */
 public class MiniAccumuloClusterGCTest {
-  
+
   private static TemporaryFolder tmpDir = new TemporaryFolder();
   private static MiniAccumuloConfig macConfig;
   private static MiniAccumuloCluster accumulo;
   private static final String passwd = "password";
-  
+
   @BeforeClass
   public static void setupMiniCluster() throws Exception {
     tmpDir.create();
     Logger.getLogger("org.apache.zookeeper").setLevel(Level.ERROR);
-    
+
     macConfig = new MiniAccumuloConfig(tmpDir.getRoot(), passwd);
     macConfig.setNumTservers(1);
-    
+
     // Turn on the garbage collector
     macConfig.runGC(true);
-    
+
     // And tweak the settings to make it run often
     Map<String,String> config = ImmutableMap.of(Property.GC_CYCLE_DELAY.getKey(), "1s",
Property.GC_CYCLE_START.getKey(), "0s");
     macConfig.setSiteConfig(config);
-    
+
     accumulo = new MiniAccumuloCluster(macConfig);
     accumulo.start();
   }
-  
+
   @AfterClass
   public static void tearDownMiniCluster() throws Exception {
     accumulo.stop();
     tmpDir.delete();
   }
-  
+
   @Test(timeout = 20000)
   public void test() throws Exception {
     ZooKeeperInstance inst = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
-    Connector c = inst.getConnector("root", passwd);
-    
+    Connector c = inst.getConnector("root", new PasswordToken(passwd));
+
     final String table = "foobar";
     c.tableOperations().create(table);
-    
+
     BatchWriter bw = null;
-    
+
     // Add some data
     try {
-      bw = c.createBatchWriter(table, 1000l, 100l, 1);
+      bw = c.createBatchWriter(table, new BatchWriterConfig().setMaxMemory(1000l).setMaxLatency(100,
TimeUnit.MILLISECONDS).setMaxWriteThreads(1));
       Mutation m = new Mutation("a");
       for (int i = 0; i < 50; i++) {
         m.put("colf", Integer.toString(i), "");
       }
-      
+
       bw.addMutation(m);
     } finally {
       if (null != bw) {
         bw.close();
       }
     }
-    
+
     final boolean flush = true, wait = true;
-    
+
     // Compact the tables to get some rfiles which we can gc
     c.tableOperations().compact(table, null, null, flush, wait);
-    c.tableOperations().compact("!METADATA", null, null, flush, wait);
-    
+    c.tableOperations().compact(MetadataTable.NAME, null, null, flush, wait);
+
     File accumuloDir = new File(tmpDir.getRoot().getAbsolutePath(), "accumulo");
     File tables = new File(accumuloDir.getAbsolutePath(), "tables");
-    
+
     int fileCountAfterCompaction = FileUtils.listFiles(tables, new SuffixFileFilter(".rf"),
TrueFileFilter.TRUE).size();
-    
+
     // Sleep for 4s to let the GC do its thing
     for (int i = 1; i < 5; i++) {
       Thread.sleep(1000);
@@ -117,8 +121,8 @@ public class MiniAccumuloClusterGCTest {
         return;
       }
     }
-    
+
     Assert.fail("Expected to find less files after compaction and pause for GC");
   }
-  
+
 }


Mime
View raw message