本文整理了Java中org.apache.hadoop.hbase.regionserver.Region.getTableDesc
方法的一些代码示例,展示了Region.getTableDesc
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Region.getTableDesc
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.regionserver.Region
类名称:Region
方法名:getTableDesc
暂无
代码示例来源:origin: harbby/presto-connectors
/**
* Gets the online tables in this RS.
* This method looks at the in-memory onlineRegions.
* @return all the online tables in this RS
*/
@Override
public Set<TableName> getOnlineTables() {
Set<TableName> tables = new HashSet<TableName>();
synchronized (this.onlineRegions) {
for (Region region: this.onlineRegions.values()) {
tables.add(region.getTableDesc().getTableName());
}
}
return tables;
}
代码示例来源:origin: harbby/presto-connectors
/**
* Returns {@code true} if the given region is part of the {@code _acl_}
* metadata table.
*/
static boolean isAclRegion(Region region) {
return ACL_TABLE_NAME.equals(region.getTableDesc().getTableName());
}
代码示例来源:origin: harbby/presto-connectors
@Override
public void preMerge(ObserverContext<RegionServerCoprocessorEnvironment> ctx, Region regionA,
Region regionB) throws IOException {
requirePermission("mergeRegions", regionA.getTableDesc().getTableName(), null, null,
Action.ADMIN);
}
代码示例来源:origin: org.apache.omid/omid-hbase-shims-hbase1.x
public static boolean OmidCompactionEnabled(ObserverContext<RegionCoprocessorEnvironment> env,
Store store,
String cfFlagValue) {
HTableDescriptor desc = env.getEnvironment().getRegion().getTableDesc();
HColumnDescriptor famDesc
= desc.getFamily(Bytes.toBytes(store.getColumnFamilyName()));
return Boolean.valueOf(famDesc.getValue(cfFlagValue));
}
代码示例来源:origin: harbby/presto-connectors
@Override
public void start(CoprocessorEnvironment environment) {
// make sure we are on a region server
if (!(environment instanceof RegionCoprocessorEnvironment)) {
throw new IllegalArgumentException(
"Constraints only act on regions - started in an environment that was not a region");
}
RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) environment;
HTableDescriptor desc = env.getRegion().getTableDesc();
// load all the constraints from the HTD
try {
this.constraints = Constraints.getConstraints(desc, classloader);
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
if (LOG.isInfoEnabled()) {
LOG.info("Finished loading " + constraints.size()
+ " user Constraints on table: " + desc.getTableName());
}
}
代码示例来源:origin: harbby/presto-connectors
/**
* Authorization security check for
* SecureBulkLoadProtocol.cleanupBulkLoad()
* @param ctx the context
* @param request the request
* @throws IOException
*/
@Override
public void preCleanupBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx,
CleanupBulkLoadRequest request) throws IOException {
requireAccess("preCleanupBulkLoad",
ctx.getEnvironment().getRegion().getTableDesc().getTableName(), Action.CREATE);
}
代码示例来源:origin: harbby/presto-connectors
/**
* Authorization check for
* SecureBulkLoadProtocol.prepareBulkLoad()
* @param ctx the context
* @param request the request
* @throws IOException
*/
@Override
public void prePrepareBulkLoad(ObserverContext<RegionCoprocessorEnvironment> ctx,
PrepareBulkLoadRequest request) throws IOException {
requireAccess("prePareBulkLoad",
ctx.getEnvironment().getRegion().getTableDesc().getTableName(), Action.CREATE);
}
代码示例来源:origin: co.cask.tephra/tephra-hbase-compat-1.1
@Override
public void start(CoprocessorEnvironment e) throws IOException {
if (e instanceof RegionCoprocessorEnvironment) {
RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
Supplier<TransactionStateCache> cacheSupplier = getTransactionStateCacheSupplier(env);
this.cache = cacheSupplier.get();
HTableDescriptor tableDesc = env.getRegion().getTableDesc();
for (HColumnDescriptor columnDesc : tableDesc.getFamilies()) {
String columnTTL = columnDesc.getValue(TxConstants.PROPERTY_TTL);
long ttl = 0;
if (columnTTL != null) {
try {
ttl = Long.parseLong(columnTTL);
LOG.info("Family " + columnDesc.getNameAsString() + " has TTL of " + columnTTL);
} catch (NumberFormatException nfe) {
LOG.warn("Invalid TTL value configured for column family " + columnDesc.getNameAsString() +
", value = " + columnTTL);
}
}
ttlByFamily.put(columnDesc.getName(), ttl);
}
this.allowEmptyValues = env.getConfiguration().getBoolean(TxConstants.ALLOW_EMPTY_VALUES_KEY,
TxConstants.ALLOW_EMPTY_VALUES_DEFAULT);
this.readNonTxnData = Boolean.valueOf(tableDesc.getValue(TxConstants.READ_NON_TX_DATA));
if (readNonTxnData) {
LOG.info("Reading pre-existing data enabled for table " + tableDesc.getNameAsString());
}
}
}
代码示例来源:origin: harbby/presto-connectors
public static Filter createVisibilityLabelFilter(Region region, Authorizations authorizations)
throws IOException {
Map<ByteRange, Integer> cfVsMaxVersions = new HashMap<ByteRange, Integer>();
for (HColumnDescriptor hcd : region.getTableDesc().getFamilies()) {
cfVsMaxVersions.put(new SimpleMutableByteRange(hcd.getName()), hcd.getMaxVersions());
}
VisibilityLabelService vls = VisibilityLabelServiceManager.getInstance()
.getVisibilityLabelService();
Filter visibilityLabelFilter = new VisibilityLabelFilter(
vls.getVisibilityExpEvaluator(authorizations), cfVsMaxVersions);
return visibilityLabelFilter;
}
代码示例来源:origin: caskdata/tephra
@Override
public void start(CoprocessorEnvironment e) throws IOException {
if (e instanceof RegionCoprocessorEnvironment) {
RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
Supplier<TransactionStateCache> cacheSupplier = getTransactionStateCacheSupplier(env);
this.cache = cacheSupplier.get();
HTableDescriptor tableDesc = env.getRegion().getTableDesc();
for (HColumnDescriptor columnDesc : tableDesc.getFamilies()) {
String columnTTL = columnDesc.getValue(TxConstants.PROPERTY_TTL);
long ttl = 0;
if (columnTTL != null) {
try {
ttl = Long.parseLong(columnTTL);
LOG.info("Family " + columnDesc.getNameAsString() + " has TTL of " + columnTTL);
} catch (NumberFormatException nfe) {
LOG.warn("Invalid TTL value configured for column family " + columnDesc.getNameAsString() +
", value = " + columnTTL);
}
}
ttlByFamily.put(columnDesc.getName(), ttl);
}
this.allowEmptyValues = env.getConfiguration().getBoolean(TxConstants.ALLOW_EMPTY_VALUES_KEY,
TxConstants.ALLOW_EMPTY_VALUES_DEFAULT);
this.readNonTxnData = Boolean.valueOf(tableDesc.getValue(TxConstants.READ_NON_TX_DATA));
if (readNonTxnData) {
LOG.info("Reading pre-existing data enabled for table " + tableDesc.getNameAsString());
}
}
}
代码示例来源:origin: caskdata/cdap
@Override
public void start(CoprocessorEnvironment e) throws IOException {
if (e instanceof RegionCoprocessorEnvironment) {
RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
HTableDescriptor tableDesc = env.getRegion().getTableDesc();
this.tablePrefix = tableDesc.getValue(Constants.Dataset.TABLE_PREFIX);
this.cConfCacheSupplier = new CConfigurationCacheSupplier(env, tablePrefix,
TxConstants.Manager.CFG_TX_MAX_LIFETIME,
TxConstants.Manager.DEFAULT_TX_MAX_LIFETIME);
this.cConfCache = cConfCacheSupplier.get();
}
// Need to create the cConf cache before calling start on the parent, since it is required for
// initializing some properties in the parent class.
super.start(e);
}
代码示例来源:origin: cdapio/cdap
@Override
public void start(CoprocessorEnvironment e) throws IOException {
if (e instanceof RegionCoprocessorEnvironment) {
RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
HTableDescriptor tableDesc = env.getRegion().getTableDesc();
this.tablePrefix = tableDesc.getValue(Constants.Dataset.TABLE_PREFIX);
this.cConfCacheSupplier = new CConfigurationCacheSupplier(env, tablePrefix,
TxConstants.Manager.CFG_TX_MAX_LIFETIME,
TxConstants.Manager.DEFAULT_TX_MAX_LIFETIME);
this.cConfCache = cConfCacheSupplier.get();
}
// Need to create the cConf cache before calling start on the parent, since it is required for
// initializing some properties in the parent class.
super.start(e);
}
代码示例来源:origin: harbby/presto-connectors
/**
* Verifies user has CREATE privileges on
* the Column Families involved in the bulkLoadHFile
* request. Specific Column Write privileges are presently
* ignored.
*/
@Override
public void preBulkLoadHFile(ObserverContext<RegionCoprocessorEnvironment> ctx,
List<Pair<byte[], String>> familyPaths) throws IOException {
for(Pair<byte[],String> el : familyPaths) {
requirePermission("preBulkLoadHFile",
ctx.getEnvironment().getRegion().getTableDesc().getTableName(),
el.getFirst(),
null,
Action.CREATE);
}
}
代码示例来源:origin: caskdata/cdap
@Override
public void start(CoprocessorEnvironment e) throws IOException {
if (e instanceof RegionCoprocessorEnvironment) {
RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
this.region = ((RegionCoprocessorEnvironment) e).getRegion();
HTableDescriptor tableDesc = region.getTableDesc();
this.state = new IncrementHandlerState(env, tableDesc);
for (HColumnDescriptor columnDesc : tableDesc.getFamilies()) {
state.initFamily(columnDesc.getName(), convertFamilyValues(columnDesc.getValues()));
}
}
}
代码示例来源:origin: cdapio/cdap
@Override
public void start(CoprocessorEnvironment e) throws IOException {
if (e instanceof RegionCoprocessorEnvironment) {
RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
this.region = ((RegionCoprocessorEnvironment) e).getRegion();
HTableDescriptor tableDesc = region.getTableDesc();
this.state = new IncrementHandlerState(env, tableDesc);
for (HColumnDescriptor columnDesc : tableDesc.getFamilies()) {
state.initFamily(columnDesc.getName(), convertFamilyValues(columnDesc.getValues()));
}
}
}
代码示例来源:origin: cdapio/cdap
@Override
public void start(CoprocessorEnvironment e) throws IOException {
if (e instanceof RegionCoprocessorEnvironment) {
RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
HTableDescriptor tableDesc = env.getRegion().getTableDesc();
String metadataTableNamespace = tableDesc.getValue(Constants.MessagingSystem.HBASE_METADATA_TABLE_NAMESPACE);
String tablePrefix = tableDesc.getValue(Constants.Dataset.TABLE_PREFIX);
prefixLength = Integer.valueOf(tableDesc.getValue(
Constants.MessagingSystem.HBASE_MESSAGING_TABLE_PREFIX_NUM_BYTES));
CConfigurationReader cConfReader = new CoprocessorCConfigurationReader(env, tablePrefix);
topicMetadataCacheSupplier = new TopicMetadataCacheSupplier(
env, cConfReader, tablePrefix, metadataTableNamespace, new HBase12CDH570ScanBuilder());
topicMetadataCache = topicMetadataCacheSupplier.get();
}
}
代码示例来源:origin: caskdata/cdap
@Override
public void start(CoprocessorEnvironment e) throws IOException {
if (e instanceof RegionCoprocessorEnvironment) {
RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
HTableDescriptor tableDesc = env.getRegion().getTableDesc();
String metadataTableNamespace = tableDesc.getValue(Constants.MessagingSystem.HBASE_METADATA_TABLE_NAMESPACE);
String tablePrefix = tableDesc.getValue(Constants.Dataset.TABLE_PREFIX);
prefixLength = Integer.valueOf(tableDesc.getValue(
Constants.MessagingSystem.HBASE_MESSAGING_TABLE_PREFIX_NUM_BYTES));
CConfigurationReader cConfReader = new CoprocessorCConfigurationReader(env, tablePrefix);
topicMetadataCacheSupplier = new TopicMetadataCacheSupplier(
env, cConfReader, tablePrefix, metadataTableNamespace, new HBase11ScanBuilder());
topicMetadataCache = topicMetadataCacheSupplier.get();
}
}
代码示例来源:origin: harbby/presto-connectors
@Override
@QosPriority(priority=HConstants.ADMIN_QOS)
public GetStoreFileResponse getStoreFile(final RpcController controller,
final GetStoreFileRequest request) throws ServiceException {
try {
checkOpen();
Region region = getRegion(request.getRegion());
requestCount.increment();
Set<byte[]> columnFamilies;
if (request.getFamilyCount() == 0) {
columnFamilies = region.getTableDesc().getFamiliesKeys();
} else {
columnFamilies = new TreeSet<byte[]>(Bytes.BYTES_RAWCOMPARATOR);
for (ByteString cf: request.getFamilyList()) {
columnFamilies.add(cf.toByteArray());
}
}
int nCF = columnFamilies.size();
List<String> fileList = region.getStoreFileList(
columnFamilies.toArray(new byte[nCF][]));
GetStoreFileResponse.Builder builder = GetStoreFileResponse.newBuilder();
builder.addAllStoreFile(fileList);
return builder.build();
} catch (IOException ie) {
throw new ServiceException(ie);
}
}
代码示例来源:origin: cdapio/cdap
@Override
public void start(CoprocessorEnvironment e) throws IOException {
if (e instanceof RegionCoprocessorEnvironment) {
RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
HTableDescriptor tableDesc = env.getRegion().getTableDesc();
String metadataTableNamespace = tableDesc.getValue(Constants.MessagingSystem.HBASE_METADATA_TABLE_NAMESPACE);
prefixLength = Integer.valueOf(tableDesc.getValue(
Constants.MessagingSystem.HBASE_MESSAGING_TABLE_PREFIX_NUM_BYTES));
String tablePrefix = tableDesc.getValue(Constants.Dataset.TABLE_PREFIX);
CConfigurationReader cConfReader = new CoprocessorCConfigurationReader(env, tablePrefix);
txStateCacheSupplier = new DefaultTransactionStateCacheSupplier(tablePrefix, env);
txStateCache = txStateCacheSupplier.get();
topicMetadataCacheSupplier = new TopicMetadataCacheSupplier(
env, cConfReader, tablePrefix, metadataTableNamespace, new HBase12CDH570ScanBuilder());
topicMetadataCache = topicMetadataCacheSupplier.get();
}
}
代码示例来源:origin: caskdata/cdap
@Override
public void start(CoprocessorEnvironment e) throws IOException {
if (e instanceof RegionCoprocessorEnvironment) {
RegionCoprocessorEnvironment env = (RegionCoprocessorEnvironment) e;
HTableDescriptor tableDesc = env.getRegion().getTableDesc();
String metadataTableNamespace = tableDesc.getValue(Constants.MessagingSystem.HBASE_METADATA_TABLE_NAMESPACE);
prefixLength = Integer.valueOf(tableDesc.getValue(
Constants.MessagingSystem.HBASE_MESSAGING_TABLE_PREFIX_NUM_BYTES));
String tablePrefix = tableDesc.getValue(Constants.Dataset.TABLE_PREFIX);
CConfigurationReader cConfReader = new CoprocessorCConfigurationReader(env, tablePrefix);
txStateCacheSupplier = new DefaultTransactionStateCacheSupplier(tablePrefix, env);
txStateCache = txStateCacheSupplier.get();
topicMetadataCacheSupplier = new TopicMetadataCacheSupplier(
env, cConfReader, tablePrefix, metadataTableNamespace, new HBase11ScanBuilder());
topicMetadataCache = topicMetadataCacheSupplier.get();
}
}
内容来源于网络,如有侵权,请联系作者删除!