accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [3/5] git commit: ACCUMULO-1689 Merge remote-tracking branch 'origin/1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT
Date Tue, 10 Sep 2013 16:47:53 GMT
ACCUMULO-1689 Merge remote-tracking branch 'origin/1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT

Conflicts:
	pom.xml


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

Branch: refs/heads/master
Commit: 699b40f13aa29c787d4f2a001aa287cd0f0caeeb
Parents: 368fe1c da95fd6
Author: Josh Elser <elserj@apache.org>
Authored: Mon Sep 9 23:59:00 2013 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Mon Sep 9 23:59:00 2013 -0400

----------------------------------------------------------------------
 minicluster/pom.xml                             |   5 +
 .../minicluster/MiniAccumuloClusterGCTest.java  | 124 +++++++++++++++++++
 2 files changed, 129 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/699b40f1/minicluster/pom.xml
----------------------------------------------------------------------
diff --cc minicluster/pom.xml
index caa45a2,0000000..32848d8
mode 100644,000000..100644
--- a/minicluster/pom.xml
+++ b/minicluster/pom.xml
@@@ -1,85 -1,0 +1,90 @@@
 +<?xml version="1.0" encoding="UTF-8"?>
 +<!--
 +  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.
 +-->
 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 +  <modelVersion>4.0.0</modelVersion>
 +  <parent>
 +    <groupId>org.apache.accumulo</groupId>
 +    <artifactId>accumulo-project</artifactId>
 +    <version>1.5.1-SNAPSHOT</version>
 +  </parent>
 +  <artifactId>accumulo-minicluster</artifactId>
 +  <name>MiniCluster</name>
 +  <dependencies>
 +    <dependency>
 +      <groupId>com.beust</groupId>
 +      <artifactId>jcommander</artifactId>
 +    </dependency>
 +    <dependency>
 +      <groupId>org.apache.accumulo</groupId>
 +      <artifactId>accumulo-core</artifactId>
 +    </dependency>
 +    <dependency>
 +      <groupId>org.apache.accumulo</groupId>
 +      <artifactId>accumulo-server</artifactId>
 +    </dependency>
 +    <dependency>
 +      <groupId>org.apache.accumulo</groupId>
 +      <artifactId>accumulo-start</artifactId>
 +    </dependency>
 +    <dependency>
 +      <groupId>commons-configuration</groupId>
 +      <artifactId>commons-configuration</artifactId>
 +      <scope>provided</scope>
 +    </dependency>
 +    <dependency>
 +      <groupId>commons-io</groupId>
 +      <artifactId>commons-io</artifactId>
 +      <scope>provided</scope>
 +    </dependency>
 +    <dependency>
 +      <groupId>log4j</groupId>
 +      <artifactId>log4j</artifactId>
 +      <scope>provided</scope>
 +    </dependency>
 +    <dependency>
 +      <groupId>org.apache.hadoop</groupId>
 +      <artifactId>hadoop-client</artifactId>
 +      <scope>provided</scope>
 +    </dependency>
 +    <dependency>
 +      <groupId>org.apache.zookeeper</groupId>
 +      <artifactId>zookeeper</artifactId>
 +      <scope>provided</scope>
 +    </dependency>
 +    <dependency>
++      <groupId>com.google.guava</groupId>
++      <artifactId>guava</artifactId>
++      <scope>test</scope>
++    </dependency>
++    <dependency>
 +      <groupId>junit</groupId>
 +      <artifactId>junit</artifactId>
 +      <scope>test</scope>
 +    </dependency>
 +    <dependency>
 +      <groupId>org.slf4j</groupId>
 +      <artifactId>slf4j-api</artifactId>
 +      <scope>test</scope>
 +    </dependency>
 +    <dependency>
 +      <groupId>org.slf4j</groupId>
 +      <artifactId>slf4j-log4j12</artifactId>
 +      <scope>test</scope>
 +    </dependency>
 +  </dependencies>
 +</project>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/699b40f1/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
----------------------------------------------------------------------
diff --cc minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
index 0000000,0000000..a432f50
new file mode 100644
--- /dev/null
+++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterGCTest.java
@@@ -1,0 -1,0 +1,124 @@@
++/*
++ * 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 org.apache.accumulo.minicluster;
++
++import java.io.File;
++import java.util.Map;
++
++import org.apache.accumulo.core.client.BatchWriter;
++import org.apache.accumulo.core.client.Connector;
++import org.apache.accumulo.core.client.ZooKeeperInstance;
++import org.apache.accumulo.core.conf.Property;
++import org.apache.accumulo.core.data.Mutation;
++import org.apache.commons.io.FileUtils;
++import org.apache.commons.io.filefilter.SuffixFileFilter;
++import org.apache.commons.io.filefilter.TrueFileFilter;
++import org.apache.log4j.Level;
++import org.apache.log4j.Logger;
++import org.junit.AfterClass;
++import org.junit.Assert;
++import org.junit.BeforeClass;
++import org.junit.Test;
++import org.junit.rules.TemporaryFolder;
++
++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);
++    
++    final String table = "foobar";
++    c.tableOperations().create(table);
++    
++    BatchWriter bw = null;
++    
++    // Add some data
++    try {
++      bw = c.createBatchWriter(table, 1000l, 100l, 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);
++    
++    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);
++      int fileCountAfterGCWait = FileUtils.listFiles(tables, new SuffixFileFilter(".rf"),
TrueFileFilter.TRUE).size();
++
++      if (fileCountAfterGCWait < fileCountAfterCompaction) {
++        return;
++      }
++    }
++    
++    Assert.fail("Expected to find less files after compaction and pause for GC");
++  }
++  
++}


Mime
View raw message