Package org.apache.accumulo.core.client.admin

Examples of org.apache.accumulo.core.client.admin.TableOperations


  @Override
  public long balance(SortedMap<TServerInstance,TabletServerStatus> current, Set<KeyExtent> migrations, List<TabletMigration> migrationsOut) {
    long minBalanceTime = 5 * 1000;
    // Iterate over the tables and balance each of them
    TableOperations t = getTableOperations();
    if (t == null)
      return minBalanceTime;
    for (String s : t.tableIdMap().values()) {
      ArrayList<TabletMigration> newMigrations = new ArrayList<TabletMigration>();
      long tableBalanceTime = getBalancerForTable(s).balance(current, migrations, newMigrations);
      if (tableBalanceTime < minBalanceTime)
        minBalanceTime = tableBalanceTime;
      migrationsOut.addAll(newMigrations);
View Full Code Here


  }
 
  @Test
  public void test() throws Exception {
    Connector c = instance.getConnector("user", new PasswordToken("pass"));
    TableOperations tops = c.tableOperations();
    tops.create("t1");
    tops.create("t2");
    tops.create("t3");
    String t1Id = tops.tableIdMap().get("t1"), t2Id = tops.tableIdMap().get("t2"), t3Id = tops.tableIdMap().get("t3");
    state = new TreeMap<TServerInstance,TabletServerStatus>();
    TServerInstance svr = mkts("10.0.0.1", "0x01020304");
    state.put(svr, status(t1Id, 10, t2Id, 10, t3Id, 10));
   
    Set<KeyExtent> migrations = Collections.emptySet();
View Full Code Here

    boolean mutationsRejected = false;

    try {
      final String table1 = "testTableDelete_table1", table2 = "testTableDelete_table2";

      TableOperations tops = connector.tableOperations();
      tops.create(table1);
      tops.create(table2);

      BatchWriter bw1 = mtbw.getBatchWriter(table1), bw2 = mtbw.getBatchWriter(table2);

      Mutation m1 = new Mutation("foo");
      m1.put("col1", "", "val1");
      m1.put("col2", "", "val2");

      bw1.addMutation(m1);
      bw2.addMutation(m1);

      tops.delete(table1);
      tops.delete(table2);

      Mutation m2 = new Mutation("bar");
      m2.put("col1", "", "val1");
      m2.put("col2", "", "val2");
View Full Code Here

    boolean mutationsRejected = false;

    try {
      final String table1 = "testOfflineTable_table1", table2 = "testOfflineTable_table2";

      TableOperations tops = connector.tableOperations();
      tops.create(table1);
      tops.create(table2);

      BatchWriter bw1 = mtbw.getBatchWriter(table1), bw2 = mtbw.getBatchWriter(table2);

      Mutation m1 = new Mutation("foo");
      m1.put("col1", "", "val1");
      m1.put("col2", "", "val2");

      bw1.addMutation(m1);
      bw2.addMutation(m1);

      tops.offline(table1, true);
      tops.offline(table2, true);

      Mutation m2 = new Mutation("bar");
      m2.put("col1", "", "val1");
      m2.put("col2", "", "val2");
View Full Code Here

    boolean mutationsRejected = false;

    try {
      final String table1 = "testOfflineTableWithCache_table1", table2 = "testOfflineTableWithCache_table2";

      TableOperations tops = connector.tableOperations();
      tops.create(table1);
      tops.create(table2);

      BatchWriter bw1 = mtbw.getBatchWriter(table1), bw2 = mtbw.getBatchWriter(table2);

      Mutation m1 = new Mutation("foo");
      m1.put("col1", "", "val1");
      m1.put("col2", "", "val2");

      bw1.addMutation(m1);
      bw2.addMutation(m1);

      tops.offline(table1);

      try {
        bw1 = mtbw.getBatchWriter(table1);
      } catch (TableOfflineException e) {
        // pass
        mutationsRejected = true;
      }

      tops.offline(table2);

      try {
        bw2 = mtbw.getBatchWriter(table2);
      } catch (TableOfflineException e) {
        // pass
View Full Code Here

    boolean mutationsRejected = false;

    try {
      final String table1 = "testOfflineTableWithoutCache_table1", table2 = "testOfflineTableWithoutCache_table2";

      TableOperations tops = connector.tableOperations();
      tops.create(table1);
      tops.create(table2);

      BatchWriter bw1 = mtbw.getBatchWriter(table1), bw2 = mtbw.getBatchWriter(table2);

      Mutation m1 = new Mutation("foo");
      m1.put("col1", "", "val1");
      m1.put("col2", "", "val2");

      bw1.addMutation(m1);
      bw2.addMutation(m1);

      // Mutations might or might not flush before tables goes offline
      tops.offline(table1);
      tops.offline(table2);

      try {
        bw1 = mtbw.getBatchWriter(table1);
        Assert.fail(table1 + " should be offline");
      } catch (TableOfflineException e) {
View Full Code Here

public class MetaSplitIT extends SimpleMacIT {

  @Test(expected = AccumuloException.class, timeout = 30000)
  public void testRootTableSplit() throws Exception {
    TableOperations opts = getConnector().tableOperations();
    SortedSet<Text> splits = new TreeSet<Text>();
    splits.add(new Text("5"));
    opts.addSplits(RootTable.NAME, splits);
  }
View Full Code Here

    opts.addSplits(RootTable.NAME, splits);
  }

  @Test
  public void testRootTableMerge() throws Exception {
    TableOperations opts = getConnector().tableOperations();
    opts.merge(RootTable.NAME, null, null);
  }
View Full Code Here

    opts.addSplits(MetadataTable.NAME, splits);
  }

  @Test(timeout = 180000)
  public void testMetadataTableSplit() throws Exception {
    TableOperations opts = getConnector().tableOperations();
    for (int i = 1; i <= 10; i++) {
      opts.create("" + i);
    }
    opts.merge(MetadataTable.NAME, new Text("01"), new Text("02"));
    checkMetadataSplits(1, opts);
    addSplits(opts, "4 5 6 7 8".split(" "));
    checkMetadataSplits(6, opts);
    opts.merge(MetadataTable.NAME, new Text("6"), new Text("9"));
    checkMetadataSplits(4, opts);
    addSplits(opts, "44 55 66 77 88".split(" "));
    checkMetadataSplits(9, opts);
    opts.merge(MetadataTable.NAME, new Text("5"), new Text("7"));
    checkMetadataSplits(6, opts);
    opts.merge(MetadataTable.NAME, null, null);
    checkMetadataSplits(0, opts);
  }
View Full Code Here

  public void testTableRenameDataValidation() throws Exception {

    try {
      final String table1 = "testTableRenameDataValidation_table1", table2 = "testTableRenameDataValidation_table2";

      TableOperations tops = connector.tableOperations();
      tops.create(table1);

      BatchWriter bw1 = mtbw.getBatchWriter(table1);

      Mutation m1 = new Mutation("foo");
      m1.put("col1", "", "val1");

      bw1.addMutation(m1);

      tops.rename(table1, table2);
      tops.create(table1);

      BatchWriter bw2 = mtbw.getBatchWriter(table1);

      Mutation m2 = new Mutation("bar");
      m2.put("col1", "", "val1");
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.client.admin.TableOperations

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.