public static String getFileNameCompatibleString(TableName table) { return table.getNamespaceAsString() + "-" + table.getQualifierAsString(); }
/** * Given the backup root dir, backup id and the table name, return the backup image location, * which is also where the backup manifest file is. return value look like: * "hdfs://backup.hbase.org:9000/user/biadmin/backup/backup_1396650096738/default/t1_dn/", where * "hdfs://backup.hbase.org:9000/user/biadmin/backup" is a backup root directory * @param backupRootDir backup root directory * @param backupId backup id * @param tableName table name * @return backupPath String for the particular table */ public static String getTableBackupDir(String backupRootDir, String backupId, TableName tableName) { return backupRootDir + Path.SEPARATOR + backupId + Path.SEPARATOR + tableName.getNamespaceAsString() + Path.SEPARATOR + tableName.getQualifierAsString() + Path.SEPARATOR; }
@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(); }
/** * Given the backup root dir, backup id and the table name, return the backup image location, * which is also where the backup manifest file is. return value look like: * "hdfs://backup.hbase.org:9000/user/biadmin/backup1/backup_1396650096738/default/t1_dn/" * @param backupRootDir backup root directory * @param backupId backup id * @param tableName table name * @return backupPath String for the particular table */ public static String getTableBackupDir(String backupRootDir, String backupId, TableName tableName) { return backupRootDir + Path.SEPARATOR + backupId + Path.SEPARATOR + tableName.getNamespaceAsString() + Path.SEPARATOR + tableName.getQualifierAsString() + Path.SEPARATOR; }
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(); }
/** * 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()); }
public static TableName valueOf(String namespaceAsString, String qualifierAsString) { if (namespaceAsString == null || namespaceAsString.length() < 1) { namespaceAsString = NamespaceDescriptor.DEFAULT_NAMESPACE_NAME_STR; } for (TableName tn : tableCache) { if (qualifierAsString.equals(tn.getQualifierAsString()) && namespaceAsString.equals(tn.getNamespaceAsString())) { return tn; } } return createTableNameIfNecessary( ByteBuffer.wrap(Bytes.toBytes(namespaceAsString)), ByteBuffer.wrap(Bytes.toBytes(qualifierAsString))); }
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"); }
/** * 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()); }
/** * return value represent path for: * ".../user/biadmin/backup1/default/t1_dn/backup_1396650096738/archive/data/default/t1_dn" * @param tableName table name * @return path to table archive * @throws IOException exception */ Path getTableArchivePath(TableName tableName) throws IOException { Path baseDir = new Path(HBackupFileSystem.getTableBackupPath(tableName, backupRootPath, backupId), HConstants.HFILE_ARCHIVE_DIRECTORY); Path dataDir = new Path(baseDir, HConstants.BASE_NAMESPACE_DIR); Path archivePath = new Path(dataDir, tableName.getNamespaceAsString()); Path tableArchivePath = new Path(archivePath, tableName.getQualifierAsString()); if (!fs.exists(tableArchivePath) || !fs.getFileStatus(tableArchivePath).isDirectory()) { LOG.debug("Folder tableArchivePath: " + tableArchivePath.toString() + " does not exists"); tableArchivePath = null; // empty table has no archive } return tableArchivePath; }
@Override public String getTableName() { TableDescriptor tableDesc = this.region.getTableDescriptor(); if (tableDesc == null) { return UNKNOWN; } return tableDesc.getTableName().getQualifierAsString(); }
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(); }
public PartitionedMobCompactor(Configuration conf, FileSystem fs, TableName tableName, ColumnFamilyDescriptor column, ExecutorService pool) throws IOException { super(conf, fs, tableName, column, pool); mergeableSize = conf.getLong(MobConstants.MOB_COMPACTION_MERGEABLE_THRESHOLD, MobConstants.DEFAULT_MOB_COMPACTION_MERGEABLE_THRESHOLD); delFileMaxCount = conf.getInt(MobConstants.MOB_DELFILE_MAX_COUNT, MobConstants.DEFAULT_MOB_DELFILE_MAX_COUNT); // default is 100 compactionBatchSize = conf.getInt(MobConstants.MOB_COMPACTION_BATCH_SIZE, MobConstants.DEFAULT_MOB_COMPACTION_BATCH_SIZE); tempPath = new Path(MobUtils.getMobHome(conf), MobConstants.TEMP_DIR_NAME); bulkloadPath = new Path(tempPath, new Path(MobConstants.BULKLOAD_DIR_NAME, new Path( tableName.getNamespaceAsString(), tableName.getQualifierAsString()))); compactionKVMax = this.conf.getInt(HConstants.COMPACTION_KV_MAX, HConstants.COMPACTION_KV_MAX_DEFAULT); Configuration copyOfConf = new Configuration(conf); copyOfConf.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0f); compactionCacheConfig = new CacheConfig(copyOfConf); List<Tag> tags = new ArrayList<>(2); tags.add(MobConstants.MOB_REF_TAG); Tag tableNameTag = new ArrayBackedTag(TagType.MOB_TABLE_NAME_TAG_TYPE, tableName.getName()); tags.add(tableNameTag); this.refCellTags = TagUtil.fromList(tags); cryptoContext = EncryptionUtil.createEncryptionContext(copyOfConf, column); }
srcTable.getQualifierAsString()); for (Map.Entry<String,Map<String,List<Pair<String, Boolean>>>> regionEntry : tblEntry.getValue().entrySet()){ String tblName = srcTable.getQualifierAsString(); Path tgtFam = new Path(new Path(tgtTable, regionName), fam); if (!tgtFs.mkdirs(tgtFam)) {
HTableDescriptor[] tables = servlet.getAdmin().listTableDescriptorsByNamespace(namespace); for(int i = 0; i < tables.length; i++){ tableModel.add(new TableModel(tables[i].getTableName().getQualifierAsString()));
Configuration conf = getConf(); TableName tableName = TableName.valueOf(conf.get(TABLE_NAME_KEY, DEFAULT_TABLE_NAME)); String snapshotName = conf.get(SNAPSHOT_NAME_KEY, tableName.getQualifierAsString() + "_snapshot_" + System.currentTimeMillis()); int numRegions = conf.getInt(NUM_REGIONS_KEY, DEFAULT_NUM_REGIONS); Path tableDir; if (tableDirStr == null) { tableDir = util.getDataTestDirOnTestFS(tableName.getQualifierAsString()); } else { tableDir = new Path(tableDirStr);
tName.getNamespaceAsString(), tName.getQualifierAsString())));
tn1.getQualifierAsString() + "snapshot", tn1, SnapshotType.SKIPFLUSH)); admin.snapshot(new SnapshotDescription( tn2.getQualifierAsString() + "snapshot", tn2, SnapshotType.SKIPFLUSH)); admin.snapshot(new SnapshotDescription( tn3.getQualifierAsString() + "snapshot", tn3, SnapshotType.SKIPFLUSH)); assertEquals(tn1.getQualifierAsString() + "snapshot", mapping.get(tn1).iterator().next()); assertEquals(1, mapping.get(tn2).size()); assertEquals(tn2.getQualifierAsString() + "snapshot", mapping.get(tn2).iterator().next()); tn2.getQualifierAsString() + "snapshot1", tn2, SnapshotType.SKIPFLUSH)); admin.snapshot(new SnapshotDescription( tn3.getQualifierAsString() + "snapshot2", tn3, SnapshotType.SKIPFLUSH)); assertEquals(tn1.getQualifierAsString() + "snapshot", mapping.get(tn1).iterator().next()); assertEquals(2, mapping.get(tn2).size()); assertEquals( new HashSet<String>(Arrays.asList(tn2.getQualifierAsString() + "snapshot", tn2.getQualifierAsString() + "snapshot1")), mapping.get(tn2));
new Path(master.getMasterFileSystem().getRootDir(), new Path(HConstants.BASE_NAMESPACE_DIR, new Path(nsName, desc.getTableName().getQualifierAsString()))))); assertEquals(1, admin.listTables().length);
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; }