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


Java HBaseAdmin.snapshot方法代码示例

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


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

示例1: createSnapshotAndValidate

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
/**
 * Take a snapshot of the specified table and verify the given families.
 * Note that this will leave the table disabled in the case of an offline snapshot.
 */
public static void createSnapshotAndValidate(HBaseAdmin admin,
    String tableName, List<byte[]> nonEmptyFamilyNames, List<byte[]> emptyFamilyNames,
    String snapshotNameString, Path rootDir, FileSystem fs, boolean onlineSnapshot)
      throws Exception {
  if (!onlineSnapshot) {
    try {
      admin.disableTable(tableName);
    } catch (TableNotEnabledException tne) {
      LOG.info("In attempting to disable " + tableName + " it turns out that the this table is " +
          "already disabled.");
    }
  }
  admin.snapshot(snapshotNameString, tableName);

  List<SnapshotDescription> snapshots = SnapshotTestingUtils.assertExistsMatchingSnapshot(admin,
    snapshotNameString, tableName);
  if (snapshots == null || snapshots.size() != 1) {
    Assert.fail("Incorrect number of snapshots for table " + tableName);
  }

  SnapshotTestingUtils.confirmSnapshotValid(snapshots.get(0), tableName, nonEmptyFamilyNames,
    emptyFamilyNames, rootDir, admin, fs, false,
    new Path(rootDir, HConstants.HREGION_LOGDIR_NAME), null);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:29,代码来源:SnapshotTestingUtils.java

示例2: snapshot

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
public static void snapshot(HBaseAdmin admin,
    final String snapshotName, final String tableName,
    SnapshotDescription.Type type, int numTries) throws IOException {
  int tries = 0;
  CorruptedSnapshotException lastEx = null;
  while (tries++ < numTries) {
    try {
      admin.snapshot(snapshotName, tableName, type);
      return;
    } catch (CorruptedSnapshotException cse) {
      LOG.warn("Got CorruptedSnapshotException", cse);
      lastEx = cse;
    }
  }
  throw lastEx;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:17,代码来源:SnapshotTestingUtils.java

示例3: createSnapshotAndValidate

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
/**
 * Take a snapshot of the specified table and verify the given families.
 * Note that this will leave the table disabled in the case of an offline snapshot.
 */
public static void createSnapshotAndValidate(HBaseAdmin admin,
    TableName tableName, List<byte[]> nonEmptyFamilyNames, List<byte[]> emptyFamilyNames,
    String snapshotNameString, Path rootDir, FileSystem fs, boolean onlineSnapshot)
      throws Exception {
  if (!onlineSnapshot) {
    try {
      admin.disableTable(tableName);
    } catch (TableNotEnabledException tne) {
      LOG.info("In attempting to disable " + tableName + " it turns out that the this table is " +
          "already disabled.");
    }
  }
  admin.snapshot(snapshotNameString, tableName);

  List<SnapshotDescription> snapshots = SnapshotTestingUtils.assertExistsMatchingSnapshot(admin,
    snapshotNameString, tableName);
  if (snapshots == null || snapshots.size() != 1) {
    Assert.fail("Incorrect number of snapshots for table " + tableName);
  }

  SnapshotTestingUtils.confirmSnapshotValid(snapshots.get(0), tableName, nonEmptyFamilyNames,
    emptyFamilyNames, rootDir, admin, fs, false,
    new Path(rootDir, HConstants.HREGION_LOGDIR_NAME), null);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:29,代码来源:SnapshotTestingUtils.java

示例4: perform

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
@Override
public void perform() throws Exception {
  HBaseTestingUtility util = context.getHBaseIntegrationTestingUtility();
  String snapshotName = tableName + "-it-" + System.currentTimeMillis();
  HBaseAdmin admin = util.getHBaseAdmin();

  LOG.info("Performing action: Snapshot table " + tableName);
  admin.snapshot(snapshotName, tableName);
  if (sleepTime > 0) {
    Thread.sleep(sleepTime);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:13,代码来源:SnapshotTableAction.java

示例5: testSnapshotOperations

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
@Test
public void testSnapshotOperations() throws Exception {
  MiniHBaseCluster cluster = UTIL.getHBaseCluster();
  HMaster master = cluster.getMaster();
  MasterCoprocessorHost host = master.getCoprocessorHost();
  CPMasterObserver cp = (CPMasterObserver)host.findCoprocessor(
      CPMasterObserver.class.getName());
  cp.resetStates();

  // create a table
  HTableDescriptor htd = new HTableDescriptor(TEST_TABLE);
  htd.addFamily(new HColumnDescriptor(TEST_FAMILY));
  HBaseAdmin admin = UTIL.getHBaseAdmin();

  // delete table if exists
  if (admin.tableExists(TEST_TABLE)) {
    UTIL.deleteTable(TEST_TABLE);
  }

  admin.createTable(htd);
  admin.disableTable(TEST_TABLE);
  assertTrue(admin.isTableDisabled(TEST_TABLE));

  try {
    // Test snapshot operation
    assertFalse("Coprocessor should not have been called yet",
      cp.wasSnapshotCalled());
    admin.snapshot(TEST_SNAPSHOT, TEST_TABLE);
    assertTrue("Coprocessor should have been called on snapshot",
      cp.wasSnapshotCalled());

    // Test clone operation
    admin.cloneSnapshot(TEST_SNAPSHOT, TEST_CLONE);
    assertTrue("Coprocessor should have been called on snapshot clone",
      cp.wasCloneSnapshotCalled());
    assertFalse("Coprocessor restore should not have been called on snapshot clone",
      cp.wasRestoreSnapshotCalled());
    admin.disableTable(TEST_CLONE);
    assertTrue(admin.isTableDisabled(TEST_TABLE));
    admin.deleteTable(TEST_CLONE);

    // Test restore operation
    cp.resetStates();
    admin.restoreSnapshot(TEST_SNAPSHOT);
    assertTrue("Coprocessor should have been called on snapshot restore",
      cp.wasRestoreSnapshotCalled());
    assertFalse("Coprocessor clone should not have been called on snapshot restore",
      cp.wasCloneSnapshotCalled());

    admin.deleteSnapshot(TEST_SNAPSHOT);
    assertTrue("Coprocessor should have been called on snapshot delete",
      cp.wasDeleteSnapshotCalled());
  } finally {
    admin.deleteTable(TEST_TABLE);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:57,代码来源:TestMasterObserver.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: testFlushCreateListDestroy

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
/**
 * Basic end-to-end test of simple-flush-based snapshots
 */
@Test
public void testFlushCreateListDestroy() throws Exception {
  LOG.debug("------- Starting Snapshot test -------------");
  HBaseAdmin admin = UTIL.getHBaseAdmin();
  // make sure we don't fail on listing snapshots
  SnapshotTestingUtils.assertNoSnapshots(admin);
  // load the table so we have some data
  UTIL.loadTable(new HTable(UTIL.getConfiguration(), TABLE_NAME), TEST_FAM);
  // and wait until everything stabilizes
  waitForTableToBeOnline(TABLE_NAME);

  String snapshotName = "flushSnapshotCreateListDestroy";
  // test creating the snapshot
  admin.snapshot(snapshotName, STRING_TABLE_NAME, SnapshotDescription.Type.FLUSH);
  logFSTree(new Path(UTIL.getConfiguration().get(HConstants.HBASE_DIR)));

  // make sure we only have 1 matching snapshot
  List<SnapshotDescription> snapshots = SnapshotTestingUtils.assertOneSnapshotThatMatches(admin,
    snapshotName, STRING_TABLE_NAME);

  // check the directory structure
  FileSystem fs = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getFileSystem();
  Path rootDir = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir();
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshots.get(0), rootDir);
  assertTrue(fs.exists(snapshotDir));
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(), snapshotDir, LOG);
  Path snapshotinfo = new Path(snapshotDir, SnapshotDescriptionUtils.SNAPSHOTINFO_FILE);
  assertTrue(fs.exists(snapshotinfo));

  // check the table info
  HTableDescriptor desc = FSTableDescriptors.getTableDescriptor(fs, rootDir, TABLE_NAME);
  HTableDescriptor snapshotDesc = FSTableDescriptors.getTableDescriptor(fs,
    SnapshotDescriptionUtils.getSnapshotsDir(rootDir), Bytes.toBytes(snapshotName));
  assertEquals(desc, snapshotDesc);

  // check the region snapshot for all the regions
  List<HRegionInfo> regions = admin.getTableRegions(TABLE_NAME);
  for (HRegionInfo info : regions) {
    String regionName = info.getEncodedName();
    Path regionDir = new Path(snapshotDir, regionName);
    HRegionInfo snapshotRegionInfo = HRegion.loadDotRegionInfoFileContent(fs, regionDir);
    assertEquals(info, snapshotRegionInfo);
    // check to make sure we have the family
    Path familyDir = new Path(regionDir, Bytes.toString(TEST_FAM));
    assertTrue(fs.exists(familyDir));
    // make sure we have some file references
    assertTrue(fs.listStatus(familyDir).length > 0);
  }

  // test that we can delete the snapshot
  admin.deleteSnapshot(snapshotName);
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(),
    FSUtils.getRootDir(UTIL.getConfiguration()), LOG);

  // make sure we don't have any snapshots
  SnapshotTestingUtils.assertNoSnapshots(admin);
  LOG.debug("------- Flush-Snapshot Create List Destroy-------------");
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:62,代码来源:TestFlushSnapshotFromClient.java

示例8: testSnapshotOperations

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
@Test
public void testSnapshotOperations() throws Exception {
  MiniHBaseCluster cluster = UTIL.getHBaseCluster();
  HMaster master = cluster.getMaster();
  MasterCoprocessorHost host = master.getCoprocessorHost();
  CPMasterObserver cp = (CPMasterObserver)host.findCoprocessor(
      CPMasterObserver.class.getName());
  cp.resetStates();

  // create a table
  HTableDescriptor htd = new HTableDescriptor(TEST_TABLE);
  htd.addFamily(new HColumnDescriptor(TEST_FAMILY));
  HBaseAdmin admin = UTIL.getHBaseAdmin();

  tableCreationLatch = new CountDownLatch(1);
  admin.createTable(htd);
  tableCreationLatch.await();
  tableCreationLatch = new CountDownLatch(1);

  admin.disableTable(TEST_TABLE);
  assertTrue(admin.isTableDisabled(TEST_TABLE));

  try {
    // Test snapshot operation
    assertFalse("Coprocessor should not have been called yet",
      cp.wasSnapshotCalled());
    admin.snapshot(TEST_SNAPSHOT, TEST_TABLE);
    assertTrue("Coprocessor should have been called on snapshot",
      cp.wasSnapshotCalled());

    // Test clone operation
    admin.cloneSnapshot(TEST_SNAPSHOT, TEST_CLONE);
    assertTrue("Coprocessor should have been called on snapshot clone",
      cp.wasCloneSnapshotCalled());
    assertFalse("Coprocessor restore should not have been called on snapshot clone",
      cp.wasRestoreSnapshotCalled());
    admin.disableTable(TEST_CLONE);
    assertTrue(admin.isTableDisabled(TEST_TABLE));
    admin.deleteTable(TEST_CLONE);

    // Test restore operation
    cp.resetStates();
    admin.restoreSnapshot(TEST_SNAPSHOT);
    assertTrue("Coprocessor should have been called on snapshot restore",
      cp.wasRestoreSnapshotCalled());
    assertFalse("Coprocessor clone should not have been called on snapshot restore",
      cp.wasCloneSnapshotCalled());

    admin.deleteSnapshot(TEST_SNAPSHOT);
    assertTrue("Coprocessor should have been called on snapshot delete",
      cp.wasDeleteSnapshotCalled());
  } finally {
    admin.deleteTable(TEST_TABLE);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:56,代码来源:TestMasterObserver.java

示例9: testFlushTableSnapshot

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的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

示例10: testSnapshotStateAfterMerge

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
@Test (timeout=300000)
public void testSnapshotStateAfterMerge() throws Exception {
  int numRows = DEFAULT_NUM_ROWS;
  HBaseAdmin admin = UTIL.getHBaseAdmin();
  // make sure we don't fail on listing snapshots
  SnapshotTestingUtils.assertNoSnapshots(admin);
  // load the table so we have some data
  SnapshotTestingUtils.loadData(UTIL, TABLE_NAME, numRows, TEST_FAM);

  // Take a snapshot
  String snapshotBeforeMergeName = "snapshotBeforeMerge";
  admin.snapshot(snapshotBeforeMergeName, STRING_TABLE_NAME, SnapshotDescription.Type.FLUSH);

  // Clone the table
  String cloneBeforeMergeName = "cloneBeforeMerge";
  admin.cloneSnapshot(snapshotBeforeMergeName, cloneBeforeMergeName);
  SnapshotTestingUtils.waitForTableToBeOnline(UTIL, TableName.valueOf(cloneBeforeMergeName));

  // Merge two regions
  List<HRegionInfo> regions = admin.getTableRegions(TABLE_NAME);
  Collections.sort(regions, new Comparator<HRegionInfo>() {
    public int compare(HRegionInfo r1, HRegionInfo r2) {
      return Bytes.compareTo(r1.getStartKey(), r2.getStartKey());
    }
  });

  int numRegions = admin.getTableRegions(TABLE_NAME).size();
  int numRegionsAfterMerge = numRegions - 2;
  admin.mergeRegions(regions.get(1).getEncodedNameAsBytes(),
      regions.get(2).getEncodedNameAsBytes(), true);
  admin.mergeRegions(regions.get(5).getEncodedNameAsBytes(),
      regions.get(6).getEncodedNameAsBytes(), true);

  // Verify that there's one region less
  waitRegionsAfterMerge(numRegionsAfterMerge);
  assertEquals(numRegionsAfterMerge, admin.getTableRegions(TABLE_NAME).size());

  // Clone the table
  String cloneAfterMergeName = "cloneAfterMerge";
  admin.cloneSnapshot(snapshotBeforeMergeName, cloneAfterMergeName);
  SnapshotTestingUtils.waitForTableToBeOnline(UTIL, TableName.valueOf(cloneAfterMergeName));

  SnapshotTestingUtils.verifyRowCount(UTIL, TABLE_NAME, numRows);
  SnapshotTestingUtils.verifyRowCount(UTIL, TableName.valueOf(cloneBeforeMergeName), numRows);
  SnapshotTestingUtils.verifyRowCount(UTIL, TableName.valueOf(cloneAfterMergeName), numRows);

  // test that we can delete the snapshot
  UTIL.deleteTable(cloneAfterMergeName);
  UTIL.deleteTable(cloneBeforeMergeName);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:51,代码来源:TestFlushSnapshotFromClient.java

示例11: testFlushCreateListDestroy

import org.apache.hadoop.hbase.client.HBaseAdmin; //导入方法依赖的package包/类
/**
 * Basic end-to-end test of simple-flush-based snapshots
 */
@Test (timeout=300000)
public void testFlushCreateListDestroy() throws Exception {
  LOG.debug("------- Starting Snapshot test -------------");
  HBaseAdmin admin = UTIL.getHBaseAdmin();
  // make sure we don't fail on listing snapshots
  SnapshotTestingUtils.assertNoSnapshots(admin);
  // load the table so we have some data
  SnapshotTestingUtils.loadData(UTIL, TABLE_NAME, DEFAULT_NUM_ROWS, TEST_FAM);

  String snapshotName = "flushSnapshotCreateListDestroy";
  // test creating the snapshot
  admin.snapshot(snapshotName, STRING_TABLE_NAME, SnapshotDescription.Type.FLUSH);
  logFSTree(FSUtils.getRootDir(UTIL.getConfiguration()));

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

  // check the directory structure
  FileSystem fs = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getFileSystem();
  Path rootDir = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir();
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshots.get(0), rootDir);
  assertTrue(fs.exists(snapshotDir));
  FSUtils.logFileSystemState(UTIL.getTestFileSystem(), snapshotDir, LOG);
  Path snapshotinfo = new Path(snapshotDir, SnapshotDescriptionUtils.SNAPSHOTINFO_FILE);
  assertTrue(fs.exists(snapshotinfo));

  // check the table info
  HTableDescriptor desc = FSTableDescriptors.getTableDescriptorFromFs(fs,
      rootDir, TABLE_NAME);
  HTableDescriptor snapshotDesc = FSTableDescriptors.getTableDescriptorFromFs(fs,
      new Path(SnapshotDescriptionUtils.getSnapshotsDir(rootDir), snapshotName));
  assertEquals(desc, snapshotDesc);

  // check the region snapshot for all the regions
  List<HRegionInfo> regions = admin.getTableRegions(TABLE_NAME);
  assertTrue(regions.size() > 1);
  for (HRegionInfo info : regions) {
    String regionName = info.getEncodedName();
    Path regionDir = new Path(snapshotDir, regionName);
    HRegionInfo snapshotRegionInfo = HRegionFileSystem.loadRegionInfoFileContent(fs, regionDir);
    assertEquals(info, snapshotRegionInfo);
    // check to make sure we have the family
    Path familyDir = new Path(regionDir, Bytes.toString(TEST_FAM));
    assertTrue("Missing region " + Bytes.toString(snapshotRegionInfo.getStartKey()),
               fs.exists(familyDir));

    // make sure we have some file references
    assertTrue(fs.listStatus(familyDir).length > 0);
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:55,代码来源:TestFlushSnapshotFromClient.java


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