org.apache.hadoop.hbase.TableName.getNamespaceAsString()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(141)

本文整理了Java中org.apache.hadoop.hbase.TableName.getNamespaceAsString()方法的一些代码示例,展示了TableName.getNamespaceAsString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableName.getNamespaceAsString()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.TableName
类名称:TableName
方法名:getNamespaceAsString

TableName.getNamespaceAsString介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

public Set<String> getNamespacesWithQuotas() {
 Set<String> namespaces = new HashSet<>();
 for (TableName tn : tablesWithNamespaceQuotas) {
  namespaces.add(tn.getNamespaceAsString());
 }
 return namespaces;
}

代码示例来源:origin: apache/hbase

private void addTable(TableName tableName, int regionCount) throws IOException {
 NamespaceTableAndRegionInfo info =
   nsStateCache.get(tableName.getNamespaceAsString());
 if(info != null) {
  info.addTable(tableName, regionCount);
 } else {
  throw new IOException("Bad state : Namespace quota information not found for namespace : "
    + tableName.getNamespaceAsString());
 }
}

代码示例来源:origin: apache/hbase

synchronized void addTable(TableName tableName, int regionCount) {
 if (!name.equalsIgnoreCase(tableName.getNamespaceAsString())) {
  throw new IllegalStateException("Table : " + tableName + " does not belong to namespace "
    + name);
 }
 if (!tableAndRegionInfo.containsKey(tableName)) {
  tableAndRegionInfo.put(tableName, new AtomicInteger(regionCount));
 } else {
  throw new IllegalStateException("Table already in the cache " + tableName);
 }
}

代码示例来源:origin: apache/hbase

synchronized void removeTable(TableName tableName) {
 NamespaceTableAndRegionInfo info =
   nsStateCache.get(tableName.getNamespaceAsString());
 if (info != null) {
  info.removeTable(tableName);
 }
}

代码示例来源:origin: apache/hbase

@Override
 public boolean apply(Entry<RegionInfo,Long> input) {
  return namespace.equals(input.getKey().getTable().getNamespaceAsString());
 }
});

代码示例来源:origin: apache/hbase

@VisibleForTesting
public static String qualifyMetricsName(TableName tableName, String metric) {
 StringBuilder sb = new StringBuilder();
 sb.append("Namespace_").append(tableName.getNamespaceAsString());
 sb.append("_table_").append(tableName.getQualifierAsString());
 sb.append("_metric_").append(metric);
 return sb.toString();
}

代码示例来源:origin: apache/hbase

private String getHFilePath(TableName table, BulkLoadDescriptor bld, String storeFile,
  byte[] family) {
 return new StringBuilder(100).append(table.getNamespaceAsString()).append(Path.SEPARATOR)
   .append(table.getQualifierAsString()).append(Path.SEPARATOR)
   .append(Bytes.toString(bld.getEncodedRegionName().toByteArray())).append(Path.SEPARATOR)
   .append(Bytes.toString(family)).append(Path.SEPARATOR).append(storeFile).toString();
}

代码示例来源:origin: apache/hbase

/**
 * Returns the Table directory under the WALRootDir for the specified table name
 * @param conf configuration used to get the WALRootDir
 * @param tableName Table to get the directory for
 * @return a path to the WAL table directory for the specified table
 * @throws IOException if there is an exception determining the WALRootDir
 */
public static Path getWALTableDir(final Configuration conf, final TableName tableName)
  throws IOException {
 return new Path(new Path(getWALRootDir(conf), tableName.getNamespaceAsString()),
   tableName.getQualifierAsString());
}

代码示例来源:origin: apache/hbase

protected Path getBulkOutputDirForTable(TableName table) {
 Path tablePath = getBulkOutputDir();
 tablePath = new Path(tablePath, table.getNamespaceAsString());
 tablePath = new Path(tablePath, table.getQualifierAsString());
 return new Path(tablePath, "data");
}

代码示例来源:origin: apache/hbase

/**
 * Ideally, getNameAsString should contain namespace within it,
 * but if the namespace is default, it just returns the name. This method
 * takes care of this corner case.
 */
public String getNameWithNamespaceInclAsString() {
 if(getNamespaceAsString().equals(NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR)) {
  return NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR +
    TableName.NAMESPACE_DELIM + getNameAsString();
 }
 return getNameAsString();
}

代码示例来源:origin: apache/hbase

/**
 * Returns the {@link org.apache.hadoop.fs.Path} object representing the table directory under
 * path rootdir
 *
 * @param rootdir qualified path of HBase root directory
 * @param tableName name of table
 * @return {@link org.apache.hadoop.fs.Path} for table
 */
public static Path getTableDir(Path rootdir, final TableName tableName) {
 return new Path(getNamespaceDir(rootdir, tableName.getNamespaceAsString()),
   tableName.getQualifierAsString());
}

代码示例来源:origin: apache/hbase

public MetricsTableSourceImpl(String tblName,
  MetricsTableAggregateSourceImpl aggregate, MetricsTableWrapperAggregate tblWrapperAgg) {
 LOG.debug("Creating new MetricsTableSourceImpl for table '{}'", tblName);
 this.tableName = TableName.valueOf(tblName);
 this.agg = aggregate;
 this.tableWrapperAgg = tblWrapperAgg;
 this.registry = agg.getMetricsRegistry();
 this.tableNamePrefix = "Namespace_" + this.tableName.getNamespaceAsString() +
   "_table_" + this.tableName.getQualifierAsString() + "_metric_";
 this.hashCode = this.tableName.hashCode();
}

代码示例来源:origin: apache/hbase

public synchronized void removeRegionFromTable(RegionInfo hri) throws IOException {
  String namespace = hri.getTable().getNamespaceAsString();
  NamespaceTableAndRegionInfo nsInfo = nsStateCache.get(namespace);
  if (nsInfo != null) {
   nsInfo.decrementRegionCountForTable(hri.getTable(), 1);
  } else {
   throw new IOException("Namespace state found null for namespace : " + namespace);
  }
 }
}

代码示例来源:origin: apache/hbase

/**
 * Returns a view of all tables that reside in a namespace with a namespace
 * quota, grouped by the namespace itself.
 */
public Multimap<String,TableName> getTablesByNamespace() {
 Multimap<String,TableName> tablesByNS = HashMultimap.create();
 for (TableName tn : tablesWithNamespaceQuotas) {
  tablesByNS.put(tn.getNamespaceAsString(), tn);
 }
 return tablesByNS;
}

代码示例来源:origin: apache/hbase

@Override
public String getNamespace() {
 TableDescriptor tableDesc = this.region.getTableDescriptor();
 if (tableDesc == null) {
  return UNKNOWN;
 }
 return tableDesc.getTableName().getNamespaceAsString();
}

代码示例来源:origin: apache/hbase

/*********************************** Observer implementations ***********************************/
@Override
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> c,
  TableDescriptor desc, RegionInfo[] regions) throws IOException {
 Set<byte[]> families = desc.getColumnFamilyNames();
 Map<byte[], Set<byte[]>> familyMap = new TreeMap<>(Bytes.BYTES_COMPARATOR);
 for (byte[] family: families) {
  familyMap.put(family, null);
 }
 requireNamespacePermission(c, "createTable",
   desc.getTableName().getNamespaceAsString(), desc.getTableName(), familyMap, Action.CREATE);
}

代码示例来源:origin: apache/hbase

private TableQueue getTableQueue(TableName tableName) {
 TableQueue node = AvlTree.get(tableMap, tableName, TABLE_QUEUE_KEY_COMPARATOR);
 if (node != null) return node;
 node = new TableQueue(tableName, MasterProcedureUtil.getTablePriority(tableName),
   locking.getTableLock(tableName), locking.getNamespaceLock(tableName.getNamespaceAsString()));
 tableMap = AvlTree.insert(tableMap, node);
 return node;
}

代码示例来源:origin: apache/hbase

@Override
 public boolean evaluate() throws Exception {
  SpaceQuotaSnapshot snapshot = (SpaceQuotaSnapshot) conn.getAdmin()
   .getCurrentSpaceQuotaSnapshot(tn.getNamespaceAsString());
  LOG.debug("Namespace snapshot after initial ingest: " + snapshot);
  if (snapshot == null) {
   return false;
  }
  nsUsage.set(snapshot.getUsage());
  return snapshot.getLimit() == nsLimit && snapshot.getUsage() > 0;
 }
});

代码示例来源:origin: apache/hbase

@Override
 public boolean evaluate() throws Exception {
  SpaceQuotaSnapshot snapshot = (SpaceQuotaSnapshot) conn.getAdmin()
   .getCurrentSpaceQuotaSnapshot(tn.getNamespaceAsString());
  LOG.debug("Namespace snapshot after second ingest: " + snapshot);
  if (snapshot == null) {
   return false;
  }
  return snapshot.getUsage() > nsUsage.get() && !snapshot.getQuotaStatus().isInViolation();
 }
});

代码示例来源:origin: apache/hbase

private TableName validateNames(TableName expected, Names names) {
 assertEquals(expected.getNameAsString(), names.nn);
 assertArrayEquals(expected.getName(), names.nnb);
 assertEquals(expected.getQualifierAsString(), names.tn);
 assertArrayEquals(expected.getQualifier(), names.tnb);
 assertEquals(expected.getNamespaceAsString(), names.ns);
 assertArrayEquals(expected.getNamespace(), names.nsb);
 return expected;
}

相关文章