accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From keith-turner <...@git.apache.org>
Subject [GitHub] accumulo pull request: ACCUMULO-3089: Create volume chooser from t...
Date Wed, 24 Sep 2014 17:45:52 GMT
Github user keith-turner commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/16#discussion_r17987487
  
    --- Diff: test/src/test/java/org/apache/accumulo/test/VolumeChooserIT.java ---
    @@ -0,0 +1,670 @@
    +/*
    + * 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.test;
    +
    +import static org.junit.Assert.*;
    +
    +import java.io.File;
    +import java.util.HashMap;
    +import java.util.Map;
    +import java.util.SortedSet;
    +import java.util.TreeSet;
    +import java.util.Map.Entry;
    +
    +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.Scanner;
    +import org.apache.accumulo.core.client.admin.TimeType;
    +import org.apache.accumulo.core.conf.Property;
    +import org.apache.accumulo.core.data.Key;
    +import org.apache.accumulo.core.data.Mutation;
    +import org.apache.accumulo.core.data.Range;
    +import org.apache.accumulo.core.data.Value;
    +import org.apache.accumulo.core.metadata.MetadataTable;
    +import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
    +import org.apache.accumulo.core.security.Authorizations;
    +import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
    +import org.apache.accumulo.test.functional.ConfigurableMacIT;
    +import org.apache.hadoop.conf.Configuration;
    +import org.apache.hadoop.fs.Path;
    +import org.apache.hadoop.fs.RawLocalFileSystem;
    +import org.apache.hadoop.io.Text;
    +import org.junit.Test;
    +
    +/**
    + * 
    + */
    +public class VolumeChooserIT extends ConfigurableMacIT {
    +
    +  private static final Text EMPTY = new Text();
    +  private static final Value EMPTY_VALUE = new Value(new byte[] {});
    +  private File volDirBase;
    +  private Path v1, v2, v3, v4;
    +
    +  @Override
    +  public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
    +    // Get 2 tablet servers
    +    cfg.setNumTservers(2);
    +
    +    // Set the general volume chooser to the GeneralVolumeChooser so that different choosers
can be specified
    +    Map<String,String> siteConfig = new HashMap<String,String>();
    +    siteConfig.put(Property.GENERAL_VOLUME_CHOOSER.getKey(), org.apache.accumulo.server.fs.GeneralVolumeChooser.class.getName());
    +    cfg.setSiteConfig(siteConfig);
    +
    +    // Set up 4 different volume paths
    +    File baseDir = cfg.getDir();
    +    volDirBase = new File(baseDir, "volumes");
    +    File v1f = new File(volDirBase, "v1");
    +    File v2f = new File(volDirBase, "v2");
    +    File v3f = new File(volDirBase, "v3");
    +    File v4f = new File(volDirBase, "v4");
    +    v1f.mkdir();
    +    v2f.mkdir();
    +    v4f.mkdir();
    +    v1 = new Path("file://" + v1f.getAbsolutePath());
    +    v2 = new Path("file://" + v2f.getAbsolutePath());
    +    v3 = new Path("file://" + v3f.getAbsolutePath());
    +    v4 = new Path("file://" + v4f.getAbsolutePath());
    +
    +    // Only add volumes 1, 2, and 4 to the list of instance volumes to have one volume
that isn't in the options list when they are choosing
    +    cfg.setProperty(Property.INSTANCE_VOLUMES, v1.toString() + "," + v2.toString() +
"," + v4.toString());
    +
    +    // use raw local file system so walogs sync and flush will work
    +    hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
    +
    +    super.configure(cfg, hadoopCoreSite);
    +
    +  }
    +
    +  // Test that uses two tables with 10 split points each. They each use the StaticVolumeChooser
to choose volumes.
    +  @Test(timeout = 60 * 1000)
    +  public void twoTablesStaticVolumeChooser() throws Exception {
    +    log.info("Starting StaticVolumeChooser");
    +
    +    // Create and populate initial properties map for creating table 1
    +    Map<String,String> properties = new HashMap<String,String>();
    +    String propertyName = "table.custom.chooser";
    +    String volume = "org.apache.accumulo.server.fs.StaticVolumeChooser";
    --- End diff --
    
    Could do the following, not sure if method names to get name is correct
    
    ```java
      String volume = StaticVolumeChooser.class.getName()
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message