當前位置: 首頁>>代碼示例>>Java>>正文


Java Admin.listSnapshots方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.client.Admin.listSnapshots方法的典型用法代碼示例。如果您正苦於以下問題:Java Admin.listSnapshots方法的具體用法?Java Admin.listSnapshots怎麽用?Java Admin.listSnapshots使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.client.Admin的用法示例。


在下文中一共展示了Admin.listSnapshots方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: assertExistsMatchingSnapshot

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的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(
    Admin 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:fengchen8086,項目名稱:ditb,代碼行數:22,代碼來源:SnapshotTestingUtils.java

示例2: assertOneSnapshotThatMatches

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的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(
    Admin 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:fengchen8086,項目名稱:ditb,代碼行數:17,代碼來源:SnapshotTestingUtils.java

示例3: deleteAllSnapshots

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
public static void deleteAllSnapshots(final Admin admin)
    throws IOException {
  // Delete all the snapshots
  for (SnapshotDescription snapshot: admin.listSnapshots()) {
    admin.deleteSnapshot(snapshot.getName());
  }
  SnapshotTestingUtils.assertNoSnapshots(admin);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:9,代碼來源:SnapshotTestingUtils.java

示例4: testSkipFlushTableSnapshot

import org.apache.hadoop.hbase.client.Admin; //導入方法依賴的package包/類
/**
 * Test snapshotting a table that is online without flushing
 * @throws Exception
 */
@Test(timeout=30000)
public void testSkipFlushTableSnapshot() throws Exception {
  Admin admin = UTIL.getHBaseAdmin();
  // make sure we don't fail on listing snapshots
  SnapshotTestingUtils.assertNoSnapshots(admin);

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

  LOG.debug("FS state before snapshot:");
  UTIL.getHBaseCluster().getMaster().getMasterFileSystem().logFileSystemState(LOG);

  // take a snapshot of the enabled table
  String snapshotString = "skipFlushTableSnapshot";
  byte[] snapshot = Bytes.toBytes(snapshotString);
  admin.snapshot(snapshotString, TABLE_NAME, SnapshotDescription.Type.SKIPFLUSH);
  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
  LOG.debug("FS state after snapshot:");
  UTIL.getHBaseCluster().getMaster().getMasterFileSystem().logFileSystemState(LOG);

  SnapshotTestingUtils.confirmSnapshotValid(UTIL, snapshots.get(0), TABLE_NAME, TEST_FAM);

  admin.deleteSnapshot(snapshot);
  snapshots = admin.listSnapshots();
  SnapshotTestingUtils.assertNoSnapshots(admin);
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:39,代碼來源:TestFlushSnapshotFromClient.java


注:本文中的org.apache.hadoop.hbase.client.Admin.listSnapshots方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。