本文整理汇总了Java中org.apache.hadoop.hbase.util.FSVisitor.visitTableStoreFiles方法的典型用法代码示例。如果您正苦于以下问题:Java FSVisitor.visitTableStoreFiles方法的具体用法?Java FSVisitor.visitTableStoreFiles怎么用?Java FSVisitor.visitTableStoreFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.util.FSVisitor
的用法示例。
在下文中一共展示了FSVisitor.visitTableStoreFiles方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listHFileNames
import org.apache.hadoop.hbase.util.FSVisitor; //导入方法依赖的package包/类
/**
* List all the HFiles in the given table
*
* @param fs: FileSystem where the table lives
* @param tableDir directory of the table
* @return array of the current HFiles in the table (could be a zero-length array)
* @throws IOException on unexecpted error reading the FS
*/
public static ArrayList<String> listHFileNames(final FileSystem fs, final Path tableDir)
throws IOException {
final ArrayList<String> hfiles = new ArrayList<String>();
FSVisitor.visitTableStoreFiles(fs, tableDir, new FSVisitor.StoreFileVisitor() {
@Override
public void storeFile(final String region, final String family, final String hfileName)
throws IOException {
hfiles.add(hfileName);
}
});
Collections.sort(hfiles);
return hfiles;
}
示例2: setupTable
import org.apache.hadoop.hbase.util.FSVisitor; //导入方法依赖的package包/类
private void setupTable(final TableName tableName) throws IOException {
// load the table
Table table = UTIL.createTable(tableName, FAMILY_NAME);
try {
rowCount = 0;
byte[] value = new byte[1024];
byte[] q = Bytes.toBytes("q");
while (rowCount < NUM_ROWS) {
Put put = new Put(Bytes.toBytes(String.format("%010d", rowCount)));
put.setDurability(Durability.SKIP_WAL);
put.add(FAMILY_NAME, q, value);
table.put(put);
if ((rowCount++ % ROW_PER_FILE) == 0) {
// flush it
((HTable)table).flushCommits();
UTIL.getHBaseAdmin().flush(tableName);
}
}
} finally {
UTIL.getHBaseAdmin().flush(tableName);
table.close();
}
assertEquals(NUM_ROWS, rowCount);
// get the store file paths
storeFiles.clear();
tableDir = FSUtils.getTableDir(getRootDir(), tableName);
FSVisitor.visitTableStoreFiles(getFileSystem(), tableDir, new FSVisitor.StoreFileVisitor() {
@Override
public void storeFile(final String region, final String family, final String hfile)
throws IOException {
HFileLink link = HFileLink.build(UTIL.getConfiguration(), tableName, region, family, hfile);
storeFiles.add(link.getOriginPath());
}
});
assertTrue("Expected at least " + NUM_FILES + " store files", storeFiles.size() >= NUM_FILES);
LOG.info("Store files: " + storeFiles);
}
示例3: listHFiles
import org.apache.hadoop.hbase.util.FSVisitor; //导入方法依赖的package包/类
/**
* List all the HFiles in the given table
*
* @param fs: FileSystem where the table lives
* @param tableDir directory of the table
* @return array of the current HFiles in the table (could be a zero-length array)
* @throws IOException on unexecpted error reading the FS
*/
public static Path[] listHFiles(final FileSystem fs, final Path tableDir)
throws IOException {
final ArrayList<Path> hfiles = new ArrayList<Path>();
FSVisitor.visitTableStoreFiles(fs, tableDir, new FSVisitor.StoreFileVisitor() {
public void storeFile(final String region, final String family, final String hfileName)
throws IOException {
hfiles.add(new Path(tableDir, new Path(region, new Path(family, hfileName))));
}
});
return hfiles.toArray(new Path[hfiles.size()]);
}
示例4: listHFiles
import org.apache.hadoop.hbase.util.FSVisitor; //导入方法依赖的package包/类
/**
* List all the HFiles in the given table
*
* @param fs: FileSystem where the table lives
* @param tableDir directory of the table
* @return array of the current HFiles in the table (could be a zero-length array)
* @throws IOException on unexecpted error reading the FS
*/
public static Path[] listHFiles(final FileSystem fs, final Path tableDir)
throws IOException {
final ArrayList<Path> hfiles = new ArrayList<Path>();
FSVisitor.visitTableStoreFiles(fs, tableDir, new FSVisitor.StoreFileVisitor() {
@Override
public void storeFile(final String region, final String family, final String hfileName)
throws IOException {
hfiles.add(new Path(tableDir, new Path(region, new Path(family, hfileName))));
}
});
return hfiles.toArray(new Path[hfiles.size()]);
}
示例5: listHFileNames
import org.apache.hadoop.hbase.util.FSVisitor; //导入方法依赖的package包/类
/**
* List all the HFiles in the given table
*
* @param fs: FileSystem where the table lives
* @param tableDir directory of the table
* @return array of the current HFiles in the table (could be a zero-length array)
* @throws IOException on unexecpted error reading the FS
*/
public static ArrayList<String> listHFileNames(final FileSystem fs, final Path tableDir)
throws IOException {
final ArrayList<String> hfiles = new ArrayList<>();
FSVisitor.visitTableStoreFiles(fs, tableDir, new FSVisitor.StoreFileVisitor() {
@Override
public void storeFile(final String region, final String family, final String hfileName)
throws IOException {
hfiles.add(hfileName);
}
});
Collections.sort(hfiles);
return hfiles;
}
示例6: visitTableStoreFiles
import org.apache.hadoop.hbase.util.FSVisitor; //导入方法依赖的package包/类
/**
* Iterate over the snapshot store files
*
* @param fs {@link FileSystem}
* @param snapshotDir {@link Path} to the Snapshot directory
* @param visitor callback object to get the store files
* @throws IOException if an error occurred while scanning the directory
*/
public static void visitTableStoreFiles(final FileSystem fs, final Path snapshotDir,
final FSVisitor.StoreFileVisitor visitor) throws IOException {
FSVisitor.visitTableStoreFiles(fs, snapshotDir, visitor);
}