public static void optimizeTable()

in modules/accumulo/src/main/java/org/apache/fluo/recipes/accumulo/ops/TableOperations.java [63:98]


  public static void optimizeTable(FluoConfiguration fluoConfig, TableOptimizations tableOptim)
      throws Exception {

    try (AccumuloClient client = getClient(fluoConfig)) {

      TreeSet<Text> splits = new TreeSet<>();

      for (Bytes split : tableOptim.getSplits()) {
        splits.add(new Text(split.toArray()));
      }

      String table = fluoConfig.getAccumuloTable();
      client.tableOperations().addSplits(table, splits);

      if (tableOptim.getTabletGroupingRegex() != null
          && !tableOptim.getTabletGroupingRegex().isEmpty()) {
        // was going to call :
        // conn.instanceOperations().testClassLoad(RGB_CLASS, TABLET_BALANCER_CLASS)
        // but that failed. See ACCUMULO-4068

        try {
          // setting this prop first intentionally because it should fail in 1.6
          client.tableOperations().setProperty(table, RGB_PATTERN_PROP,
              tableOptim.getTabletGroupingRegex());
          client.tableOperations().setProperty(table, RGB_DEFAULT_PROP, "none");
          client.tableOperations().setProperty(table, TABLE_BALANCER_PROP, RGB_CLASS);
        } catch (AccumuloException e) {
          logger
              .warn("Unable to setup regex balancer (this is expected to fail in Accumulo 1.6.X) : "
                  + e.getMessage());
          logger.debug(
              "Unable to setup regex balancer (this is expected to fail in Accumulo 1.6.X)", e);
        }
      }
    }
  }