Java Code Examples for org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment#getTable()

The following examples show how to use org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment#getTable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompactionState.java    From phoenix-tephra with Apache License 2.0 5 votes vote down vote up
public CompactionState(final RegionCoprocessorEnvironment env, final TableName stateTable, long pruneFlushInterval) {
  this.regionName = env.getRegionInfo().getRegionName();
  this.regionNameAsString = env.getRegionInfo().getRegionNameAsString();
  DataJanitorState dataJanitorState = new DataJanitorState(new DataJanitorState.TableSupplier() {
    @Override
    public Table get() throws IOException {
      return env.getTable(stateTable);
    }
  });
  this.pruneUpperBoundWriterSupplier = new PruneUpperBoundWriterSupplier(stateTable, dataJanitorState,
                                                                         pruneFlushInterval);
  this.pruneUpperBoundWriter = pruneUpperBoundWriterSupplier.get();
}
 
Example 2
Source File: CompactionState.java    From phoenix-tephra with Apache License 2.0 5 votes vote down vote up
public CompactionState(final RegionCoprocessorEnvironment env, final TableName stateTable, long pruneFlushInterval) {
  this.regionName = env.getRegion().getRegionName();
  this.regionNameAsString = env.getRegion().getRegionNameAsString();
  DataJanitorState dataJanitorState = new DataJanitorState(new DataJanitorState.TableSupplier() {
    @Override
    public HTableInterface get() throws IOException {
      return env.getTable(stateTable);
    }
  });
  this.pruneUpperBoundWriterSupplier = new PruneUpperBoundWriterSupplier(stateTable, dataJanitorState,
                                                                         pruneFlushInterval);
  this.pruneUpperBoundWriter = pruneUpperBoundWriterSupplier.get();
}
 
Example 3
Source File: CompactionState.java    From phoenix-tephra with Apache License 2.0 5 votes vote down vote up
public CompactionState(final RegionCoprocessorEnvironment env, final TableName stateTable, long pruneFlushInterval) {
  this.regionName = env.getRegionInfo().getRegionName();
  this.regionNameAsString = env.getRegionInfo().getRegionNameAsString();
  DataJanitorState dataJanitorState = new DataJanitorState(new DataJanitorState.TableSupplier() {
    @Override
    public Table get() throws IOException {
      return env.getTable(stateTable);
    }
  });
  this.pruneUpperBoundWriterSupplier = new PruneUpperBoundWriterSupplier(stateTable, dataJanitorState,
                                                                         pruneFlushInterval);
  this.pruneUpperBoundWriter = pruneUpperBoundWriterSupplier.get();
}
 
Example 4
Source File: CompactionState.java    From phoenix-tephra with Apache License 2.0 5 votes vote down vote up
public CompactionState(final RegionCoprocessorEnvironment env, final TableName stateTable, long pruneFlushInterval) {
  this.regionName = env.getRegionInfo().getRegionName();
  this.regionNameAsString = env.getRegionInfo().getRegionNameAsString();
  DataJanitorState dataJanitorState = new DataJanitorState(new DataJanitorState.TableSupplier() {
    @Override
    public Table get() throws IOException {
      return env.getTable(stateTable);
    }
  });
  this.pruneUpperBoundWriterSupplier = new PruneUpperBoundWriterSupplier(stateTable, dataJanitorState,
                                                                         pruneFlushInterval);
  this.pruneUpperBoundWriter = pruneUpperBoundWriterSupplier.get();
}
 
Example 5
Source File: CompactionState.java    From phoenix-tephra with Apache License 2.0 5 votes vote down vote up
public CompactionState(final RegionCoprocessorEnvironment env, final TableName stateTable, long pruneFlushInterval) {
  this.regionName = env.getRegionInfo().getRegionName();
  this.regionNameAsString = env.getRegionInfo().getRegionNameAsString();
  DataJanitorState dataJanitorState = new DataJanitorState(new DataJanitorState.TableSupplier() {
    @Override
    public Table get() throws IOException {
      return env.getTable(stateTable);
    }
  });
  this.pruneUpperBoundWriterSupplier = new PruneUpperBoundWriterSupplier(stateTable, dataJanitorState,
                                                                         pruneFlushInterval);
  this.pruneUpperBoundWriter = pruneUpperBoundWriterSupplier.get();
}
 
Example 6
Source File: CompactionState.java    From phoenix-tephra with Apache License 2.0 5 votes vote down vote up
public CompactionState(final RegionCoprocessorEnvironment env, final TableName stateTable, long pruneFlushInterval) {
  this.regionName = env.getRegionInfo().getRegionName();
  this.regionNameAsString = env.getRegionInfo().getRegionNameAsString();
  DataJanitorState dataJanitorState = new DataJanitorState(new DataJanitorState.TableSupplier() {
    @Override
    public Table get() throws IOException {
      return env.getTable(stateTable);
    }
  });
  this.pruneUpperBoundWriterSupplier = new PruneUpperBoundWriterSupplier(stateTable, dataJanitorState,
                                                                         pruneFlushInterval);
  this.pruneUpperBoundWriter = pruneUpperBoundWriterSupplier.get();
}
 
Example 7
Source File: CompactionState.java    From phoenix-tephra with Apache License 2.0 5 votes vote down vote up
public CompactionState(final RegionCoprocessorEnvironment env, final TableName stateTable, long pruneFlushInterval) {
  this.regionName = env.getRegion().getRegionName();
  this.regionNameAsString = env.getRegion().getRegionNameAsString();
  DataJanitorState dataJanitorState = new DataJanitorState(new DataJanitorState.TableSupplier() {
    @Override
    public HTableInterface get() throws IOException {
      return env.getTable(stateTable);
    }
  });
  this.pruneUpperBoundWriterSupplier = new PruneUpperBoundWriterSupplier(stateTable, dataJanitorState,
                                                                         pruneFlushInterval);
  this.pruneUpperBoundWriter = pruneUpperBoundWriterSupplier.get();
}
 
Example 8
Source File: StatisticsWriter.java    From phoenix with Apache License 2.0 5 votes vote down vote up
/**
 * @param tableName TODO
 * @param clientTimeStamp TODO
 * @return the {@link StatisticsWriter} for the given primary table.
 * @throws IOException
 *             if the table cannot be created due to an underlying HTable creation error
 */
public static StatisticsWriter newWriter(RegionCoprocessorEnvironment env, String tableName, long clientTimeStamp) throws IOException {
    if (clientTimeStamp == HConstants.LATEST_TIMESTAMP) {
        clientTimeStamp = TimeKeeper.SYSTEM.getCurrentTime();
    }
    HTableInterface statsWriterTable = env.getTable(TableName.valueOf(PhoenixDatabaseMetaData.SYSTEM_STATS_NAME_BYTES));
    HTableInterface statsReaderTable = ServerUtil.getHTableForCoprocessorScan(env, statsWriterTable);
    StatisticsWriter statsTable = new StatisticsWriter(statsReaderTable, statsWriterTable, tableName, clientTimeStamp);
    if (clientTimeStamp != StatisticsCollector.NO_TIMESTAMP) { // Otherwise we do this later as we don't know the ts yet
        statsTable.commitLastStatsUpdatedTime();
    }
    return statsTable;
}
 
Example 9
Source File: ServerUtil.java    From phoenix with Apache License 2.0 4 votes vote down vote up
public static HTableInterface getHTableForCoprocessorScan (RegionCoprocessorEnvironment env, byte[] tableName) throws IOException {
    if (coprocessorScanWorks(env)) {
        return env.getTable(TableName.valueOf(tableName));
    }
    return getTableFromSingletonPool(env, tableName);
}