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


Java SnapshotTestingUtils.confirmSnapshotValid方法代码示例

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


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

示例1: testFlushTableSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Test simple flush snapshotting a table that is online
 * @throws Exception
 */
@Test (timeout=300000)
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);
  SnapshotTestingUtils.loadData(UTIL, table, DEFAULT_NUM_ROWS, TEST_FAM);

  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);
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:39,代码来源:TestFlushSnapshotFromClient.java

示例2: testFlushTableSnapshotWithProcedure

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Test simple flush snapshotting a table that is online
 * @throws Exception
 */
@Test (timeout=300000)
public void testFlushTableSnapshotWithProcedure() 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);
  SnapshotTestingUtils.loadData(UTIL, table, DEFAULT_NUM_ROWS, TEST_FAM);

  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);
  Map<String, String> props = new HashMap<String, String>();
  props.put("table", STRING_TABLE_NAME);
  admin.execProcedure(SnapshotManager.ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTION,
      snapshotString, props);


  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);
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:44,代码来源:TestFlushSnapshotFromClient.java

示例3: testOfflineTableSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Test snapshotting a table that is offline
 * @throws Exception
 */
@Test (timeout=300000)
public void testOfflineTableSnapshot() throws Exception {
  Admin 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, false);

  LOG.debug("FS state before disable:");
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
    FSUtils.getRootDir(UTIL.getConfiguration()), LOG);
  // XXX if this is flakey, might want to consider using the async version and looping as
  // disableTable can succeed and still timeout.
  admin.disableTable(TABLE_NAME);

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

  // take a snapshot of the disabled table
  final String SNAPSHOT_NAME = "offlineTableSnapshot";
  byte[] snapshot = Bytes.toBytes(SNAPSHOT_NAME);

  SnapshotDescription desc = SnapshotDescription.newBuilder()
    .setType(SnapshotDescription.Type.DISABLED)
    .setTable(STRING_TABLE_NAME)
    .setName(SNAPSHOT_NAME)
    .setVersion(SnapshotManifestV1.DESCRIPTOR_VERSION)
    .build();
  admin.snapshot(desc);
  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);

  admin.deleteSnapshot(snapshot);
  snapshots = admin.listSnapshots();
  SnapshotTestingUtils.assertNoSnapshots(admin);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:57,代码来源:TestSnapshotFromClient.java

示例4: testOfflineTableSnapshotWithEmptyRegions

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
@Test (timeout=300000)
public void testOfflineTableSnapshotWithEmptyRegions() throws Exception {
  // test with an empty table with one region

  Admin admin = UTIL.getHBaseAdmin();
  // make sure we don't fail on listing snapshots
  SnapshotTestingUtils.assertNoSnapshots(admin);

  LOG.debug("FS state before disable:");
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
    FSUtils.getRootDir(UTIL.getConfiguration()), LOG);
  admin.disableTable(TABLE_NAME);

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

  // take a snapshot of the disabled table
  byte[] snapshot = Bytes.toBytes("testOfflineTableSnapshotWithEmptyRegions");
  admin.snapshot(snapshot, TABLE_NAME);
  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);

  List<byte[]> emptyCfs = Lists.newArrayList(TEST_FAM); // no file in the region
  List<byte[]> nonEmptyCfs = Lists.newArrayList();
  SnapshotTestingUtils.confirmSnapshotValid(snapshots.get(0), TABLE_NAME, nonEmptyCfs, emptyCfs,
    rootDir, admin, fs);

  admin.deleteSnapshot(snapshot);
  snapshots = admin.listSnapshots();
  SnapshotTestingUtils.assertNoSnapshots(admin);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:43,代码来源:TestSnapshotFromClient.java

示例5: testOfflineTableSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Test snapshotting a table that is offline
 * @throws Exception
 */
@Test
public void testOfflineTableSnapshot() 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 disable:");
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
    FSUtils.getRootDir(UTIL.getConfiguration()), LOG);
  // XXX if this is flakey, might want to consider using the async version and looping as
  // disableTable can succeed and still timeout.
  admin.disableTable(TABLE_NAME);

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

  // take a snapshot of the disabled table
  byte[] snapshot = Bytes.toBytes("offlineTableSnapshot");
  admin.snapshot(snapshot, TABLE_NAME);
  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,代码行数:58,代码来源:TestSnapshotFromClient.java

示例6: testOfflineTableSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Test snapshotting a table that is offline
 * @throws Exception
 */
@Test (timeout=300000)
public void testOfflineTableSnapshot() 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, false);

  // 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 disable:");
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
    FSUtils.getRootDir(UTIL.getConfiguration()), LOG);
  // XXX if this is flakey, might want to consider using the async version and looping as
  // disableTable can succeed and still timeout.
  admin.disableTable(TABLE_NAME);

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

  // take a snapshot of the disabled table
  byte[] snapshot = Bytes.toBytes("offlineTableSnapshot");
  admin.snapshot(snapshot, TABLE_NAME);
  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:tenggyut,项目名称:HIndex,代码行数:58,代码来源:TestSnapshotFromClient.java

示例7: testOfflineTableSnapshotWithEmptyRegions

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
@Test (timeout=300000)
public void testOfflineTableSnapshotWithEmptyRegions() throws Exception {
  // test with an empty table with one region

  HBaseAdmin admin = UTIL.getHBaseAdmin();
  // make sure we don't fail on listing snapshots
  SnapshotTestingUtils.assertNoSnapshots(admin);

  // 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 disable:");
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
    FSUtils.getRootDir(UTIL.getConfiguration()), LOG);
  admin.disableTable(TABLE_NAME);

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

  // take a snapshot of the disabled table
  byte[] snapshot = Bytes.toBytes("testOfflineTableSnapshotWithEmptyRegions");
  admin.snapshot(snapshot, TABLE_NAME);
  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);

  List<byte[]> emptyCfs = Lists.newArrayList(TEST_FAM); // no file in the region
  List<byte[]> nonEmptyCfs = Lists.newArrayList();
  SnapshotTestingUtils.confirmSnapshotValid(snapshots.get(0), TABLE_NAME, nonEmptyCfs, emptyCfs, rootDir,
    admin, fs, false, new Path(rootDir, HConstants.HREGION_LOGDIR_NAME), snapshotServers);

  admin.deleteSnapshot(snapshot);
  snapshots = admin.listSnapshots();
  SnapshotTestingUtils.assertNoSnapshots(admin);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:52,代码来源:TestSnapshotFromClient.java

示例8: testFlushTableSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Test simple flush snapshotting a table that is online
 * @throws Exception
 */
@Test (timeout=300000)
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);
  SnapshotTestingUtils.loadData(UTIL, table, DEFAULT_NUM_ROWS, 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);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:48,代码来源:TestFlushSnapshotFromClient.java

示例9: testFlushTableSnapshotWithProcedure

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Test simple flush snapshotting a table that is online
 * @throws Exception
 */
@Test (timeout=300000)
public void testFlushTableSnapshotWithProcedure() 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);
  SnapshotTestingUtils.loadData(UTIL, table, DEFAULT_NUM_ROWS, 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);
  Map<String, String> props = new HashMap<String, String>();
  props.put("table", STRING_TABLE_NAME);
  admin.execProcedure(SnapshotManager.ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTION,
      snapshotString, props);


  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);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:53,代码来源:TestFlushSnapshotFromClient.java

示例10: testOfflineTableSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Test snapshotting a table that is offline
 * @throws Exception
 */
@Test (timeout=300000)
public void testOfflineTableSnapshot() throws Exception {
  Admin admin = UTIL.getAdmin();
  // make sure we don't fail on listing snapshots
  SnapshotTestingUtils.assertNoSnapshots(admin);

  // put some stuff in the table
  Table table = UTIL.getConnection().getTable(TABLE_NAME);
  UTIL.loadTable(table, TEST_FAM, false);

  LOG.debug("FS state before disable:");
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
    FSUtils.getRootDir(UTIL.getConfiguration()), LOG);
  // XXX if this is flakey, might want to consider using the async version and looping as
  // disableTable can succeed and still timeout.
  admin.disableTable(TABLE_NAME);

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

  // take a snapshot of the disabled table
  final String SNAPSHOT_NAME = "offlineTableSnapshot";
  byte[] snapshot = Bytes.toBytes(SNAPSHOT_NAME);

  admin.snapshot(new SnapshotDescription(SNAPSHOT_NAME, TABLE_NAME,
      SnapshotType.DISABLED, null, -1, SnapshotManifestV1.DESCRIPTOR_VERSION));
  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(
    ProtobufUtil.createHBaseProtosSnapshotDesc(snapshots.get(0)), TABLE_NAME, TEST_FAM,
    rootDir, admin, fs);

  admin.deleteSnapshot(snapshot);
  snapshots = admin.listSnapshots();
  SnapshotTestingUtils.assertNoSnapshots(admin);
}
 
开发者ID:apache,项目名称:hbase,代码行数:52,代码来源:TestSnapshotFromClient.java

示例11: testOfflineTableSnapshotWithEmptyRegions

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
@Test (timeout=300000)
public void testOfflineTableSnapshotWithEmptyRegions() throws Exception {
  // test with an empty table with one region

  Admin admin = UTIL.getAdmin();
  // make sure we don't fail on listing snapshots
  SnapshotTestingUtils.assertNoSnapshots(admin);

  LOG.debug("FS state before disable:");
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
    FSUtils.getRootDir(UTIL.getConfiguration()), LOG);
  admin.disableTable(TABLE_NAME);

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

  // take a snapshot of the disabled table
  byte[] snapshot = Bytes.toBytes("testOfflineTableSnapshotWithEmptyRegions");
  admin.snapshot(snapshot, TABLE_NAME);
  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);

  List<byte[]> emptyCfs = Lists.newArrayList(TEST_FAM); // no file in the region
  List<byte[]> nonEmptyCfs = Lists.newArrayList();
  SnapshotTestingUtils.confirmSnapshotValid(
    ProtobufUtil.createHBaseProtosSnapshotDesc(snapshots.get(0)), TABLE_NAME, nonEmptyCfs,
    emptyCfs, rootDir, admin, fs);

  admin.deleteSnapshot(snapshot);
  snapshots = admin.listSnapshots();
  SnapshotTestingUtils.assertNoSnapshots(admin);
}
 
开发者ID:apache,项目名称:hbase,代码行数:44,代码来源:TestSnapshotFromClient.java

示例12: testOfflineTableSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Test snapshotting a table that is offline
 * @throws Exception
 */
@Test (timeout=300000)
public void testOfflineTableSnapshot() 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, false);

  LOG.debug("FS state before disable:");
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
    FSUtils.getRootDir(UTIL.getConfiguration()), LOG);
  // XXX if this is flakey, might want to consider using the async version and looping as
  // disableTable can succeed and still timeout.
  admin.disableTable(TABLE_NAME);

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

  // take a snapshot of the disabled table
  final String SNAPSHOT_NAME = "offlineTableSnapshot";
  byte[] snapshot = Bytes.toBytes(SNAPSHOT_NAME);

  SnapshotDescription desc = SnapshotDescription.newBuilder()
    .setType(SnapshotDescription.Type.DISABLED)
    .setTable(STRING_TABLE_NAME)
    .setName(SNAPSHOT_NAME)
    .setVersion(SnapshotManifestV1.DESCRIPTOR_VERSION)
    .build();
  admin.snapshot(desc);
  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);

  admin.deleteSnapshot(snapshot);
  snapshots = admin.listSnapshots();
  SnapshotTestingUtils.assertNoSnapshots(admin);
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:57,代码来源:TestSnapshotFromClient.java

示例13: testOfflineTableSnapshotWithEmptyRegions

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
@Test (timeout=300000)
public void testOfflineTableSnapshotWithEmptyRegions() throws Exception {
  // test with an empty table with one region

  HBaseAdmin admin = UTIL.getHBaseAdmin();
  // make sure we don't fail on listing snapshots
  SnapshotTestingUtils.assertNoSnapshots(admin);

  LOG.debug("FS state before disable:");
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
    FSUtils.getRootDir(UTIL.getConfiguration()), LOG);
  admin.disableTable(TABLE_NAME);

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

  // take a snapshot of the disabled table
  byte[] snapshot = Bytes.toBytes("testOfflineTableSnapshotWithEmptyRegions");
  admin.snapshot(snapshot, TABLE_NAME);
  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);

  List<byte[]> emptyCfs = Lists.newArrayList(TEST_FAM); // no file in the region
  List<byte[]> nonEmptyCfs = Lists.newArrayList();
  SnapshotTestingUtils.confirmSnapshotValid(snapshots.get(0), TABLE_NAME, nonEmptyCfs, emptyCfs,
    rootDir, admin, fs);

  admin.deleteSnapshot(snapshot);
  snapshots = admin.listSnapshots();
  SnapshotTestingUtils.assertNoSnapshots(admin);
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:43,代码来源:TestSnapshotFromClient.java

示例14: testOfflineTableSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Test snapshotting a table that is offline
 * @throws Exception
 */
@Test (timeout=300000)
public void testOfflineTableSnapshot() 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 disable:");
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
    FSUtils.getRootDir(UTIL.getConfiguration()), LOG);
  // XXX if this is flakey, might want to consider using the async version and looping as
  // disableTable can succeed and still timeout.
  admin.disableTable(TABLE_NAME);

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

  // take a snapshot of the disabled table
  byte[] snapshot = Bytes.toBytes("offlineTableSnapshot");
  admin.snapshot(snapshot, TABLE_NAME);
  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:cloud-software-foundation,项目名称:c5,代码行数:58,代码来源:TestSnapshotFromClient.java


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