当前位置: 首页>>代码示例>>Java>>正文


Java HBaseAdmin.listSnapshots方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.client.HBaseAdmin.listSnapshots方法的典型用法代码示例。如果您正苦于以下问题:Java HBaseAdmin.listSnapshots方法的具体用法?Java HBaseAdmin.listSnapshots怎么用?Java HBaseAdmin.listSnapshots使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.client.HBaseAdmin的用法示例。


在下文中一共展示了HBaseAdmin.listSnapshots方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: assertExistsMatchingSnapshot

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
/**
 * Make sure that there is only one snapshot returned from the master and its
 * name and table match the passed in parameters.
 */
public static List<SnapshotDescription> assertExistsMatchingSnapshot(
    HBaseAdmin admin, String snapshotName, String tableName)
    throws IOException {
  // list the snapshot
  List<SnapshotDescription> snapshots = admin.listSnapshots();

  List<SnapshotDescription> returnedSnapshots = new ArrayList<SnapshotDescription>();
  for (SnapshotDescription sd : snapshots) {
    if (snapshotName.equals(sd.getName()) &&
        tableName.equals(sd.getTable())) {
      returnedSnapshots.add(sd);
    }
  }

  Assert.assertTrue("No matching snapshots found.", returnedSnapshots.size()>0);
  return returnedSnapshots;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:22,代码来源:SnapshotTestingUtils.java

示例2: assertExistsMatchingSnapshot

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
/**
 * Make sure that there is only one snapshot returned from the master and its
 * name and table match the passed in parameters.
 */
public static List<SnapshotDescription> assertExistsMatchingSnapshot(
    HBaseAdmin admin, String snapshotName, TableName tableName)
    throws IOException {
  // list the snapshot
  List<SnapshotDescription> snapshots = admin.listSnapshots();

  List<SnapshotDescription> returnedSnapshots = new ArrayList<SnapshotDescription>();
  for (SnapshotDescription sd : snapshots) {
    if (snapshotName.equals(sd.getName()) &&
        tableName.equals(TableName.valueOf(sd.getTable()))) {
      returnedSnapshots.add(sd);
    }
  }

  Assert.assertTrue("No matching snapshots found.", returnedSnapshots.size()>0);
  return returnedSnapshots;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:22,代码来源:SnapshotTestingUtils.java

示例3: assertOneSnapshotThatMatches

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
/**
 * Make sure that there is only one snapshot returned from the master and its
 * name and table match the passed in parameters.
 */
public static List<SnapshotDescription> assertOneSnapshotThatMatches(
    HBaseAdmin admin, String snapshotName, String tableName)
    throws IOException {
  // list the snapshot
  List<SnapshotDescription> snapshots = admin.listSnapshots();

  assertEquals("Should only have 1 snapshot", 1, snapshots.size());
  assertEquals(snapshotName, snapshots.get(0).getName());
  assertEquals(tableName, snapshots.get(0).getTable());

  return snapshots;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:17,代码来源:SnapshotTestingUtils.java

示例4: deleteAllSnapshots

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
public static void deleteAllSnapshots(final HBaseAdmin admin)
    throws IOException {
  // Delete all the snapshots
  for (SnapshotDescription snapshot: admin.listSnapshots()) {
    admin.deleteSnapshot(snapshot.getName());
  }
  SnapshotTestingUtils.assertNoSnapshots(admin);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:9,代码来源:SnapshotTestingUtils.java

示例5: assertOneSnapshotThatMatches

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
/**
 * Make sure that there is only one snapshot returned from the master and its
 * name and table match the passed in parameters.
 */
public static List<SnapshotDescription> assertOneSnapshotThatMatches(
    HBaseAdmin admin, String snapshotName, TableName tableName)
    throws IOException {
  // list the snapshot
  List<SnapshotDescription> snapshots = admin.listSnapshots();

  assertEquals("Should only have 1 snapshot", 1, snapshots.size());
  assertEquals(snapshotName, snapshots.get(0).getName());
  assertEquals(tableName, TableName.valueOf(snapshots.get(0).getTable()));

  return snapshots;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:17,代码来源:SnapshotTestingUtils.java

示例6: testFlushTableSnapshot

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
/**
 * Test simple flush snapshotting a table that is online
 * @throws Exception
 */
@Test
public void testFlushTableSnapshot() throws Exception {
  HBaseAdmin admin = UTIL.getHBaseAdmin();
  // make sure we don't fail on listing snapshots
  SnapshotTestingUtils.assertNoSnapshots(admin);

  // put some stuff in the table
  HTable table = new HTable(UTIL.getConfiguration(), TABLE_NAME);
  UTIL.loadTable(table, TEST_FAM);

  // get the name of all the regionservers hosting the snapshotted table
  Set<String> snapshotServers = new HashSet<String>();
  List<RegionServerThread> servers = UTIL.getMiniHBaseCluster().getLiveRegionServerThreads();
  for (RegionServerThread server : servers) {
    if (server.getRegionServer().getOnlineRegions(TABLE_NAME).size() > 0) {
      snapshotServers.add(server.getRegionServer().getServerName().toString());
    }
  }

  LOG.debug("FS state before snapshot:");
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
    FSUtils.getRootDir(UTIL.getConfiguration()), LOG);

  // take a snapshot of the enabled table
  String snapshotString = "offlineTableSnapshot";
  byte[] snapshot = Bytes.toBytes(snapshotString);
  admin.snapshot(snapshotString, STRING_TABLE_NAME, SnapshotDescription.Type.FLUSH);
  LOG.debug("Snapshot completed.");

  // make sure we have the snapshot
  List<SnapshotDescription> snapshots = SnapshotTestingUtils.assertOneSnapshotThatMatches(admin,
    snapshot, TABLE_NAME);

  // make sure its a valid snapshot
  FileSystem fs = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getFileSystem();
  Path rootDir = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir();
  LOG.debug("FS state after snapshot:");
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
    FSUtils.getRootDir(UTIL.getConfiguration()), LOG);

  SnapshotTestingUtils.confirmSnapshotValid(snapshots.get(0), TABLE_NAME, TEST_FAM, rootDir,
    admin, fs, false, new Path(rootDir, HConstants.HREGION_LOGDIR_NAME), snapshotServers);

  admin.deleteSnapshot(snapshot);
  snapshots = admin.listSnapshots();
  SnapshotTestingUtils.assertNoSnapshots(admin);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:52,代码来源:TestFlushSnapshotFromClient.java

示例7: getSnapshotDescriptions

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
public static List<HBaseProtos.SnapshotDescription> getSnapshotDescriptions(HBaseAdmin admin, String targetSnapshotName) throws IOException {
    return admin.listSnapshots(targetSnapshotName);
}
 
开发者ID:kakao,项目名称:hbase-tools,代码行数:4,代码来源:SnapshotAdapter.java


注:本文中的org.apache.hadoop.hbase.client.HBaseAdmin.listSnapshots方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。