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


Java SnapshotTestingUtils.createSnapshotAndValidate方法代码示例

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


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

示例1: testDescribeMatchesAfterClone

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Verify that the describe for a cloned table matches the describe from the original.
 */
@Test (timeout=300000)
public void testDescribeMatchesAfterClone() throws Exception {
  // Clone the original table
  final String clonedTableNameAsString = "clone" + originalTableName;
  final TableName clonedTableName = TableName.valueOf(clonedTableNameAsString);
  final String snapshotNameAsString = "snapshot" + originalTableName
      + System.currentTimeMillis();
  final byte[] snapshotName = Bytes.toBytes(snapshotNameAsString);

  // restore the snapshot into a cloned table and examine the output
  List<byte[]> familiesList = new ArrayList<byte[]>();
  Collections.addAll(familiesList, families);

  // Create a snapshot in which all families are empty
  SnapshotTestingUtils.createSnapshotAndValidate(admin, originalTableName, null,
    familiesList, snapshotNameAsString, rootDir, fs, /* onlineSnapshot= */ false);

  admin.cloneSnapshot(snapshotName, clonedTableName);
  Table clonedTable = new HTable(UTIL.getConfiguration(), clonedTableName);
  HTableDescriptor cloneHtd = admin.getTableDescriptor(clonedTableName);
  assertEquals(
    originalTableDescription.replace(originalTableName.getNameAsString(),clonedTableNameAsString),
    cloneHtd.toStringCustomizedValues());

  // Verify the custom fields
  assertEquals(originalTableDescriptor.getValues().size(),
                      cloneHtd.getValues().size());
  assertEquals(originalTableDescriptor.getConfiguration().size(),
                      cloneHtd.getConfiguration().size());
  assertEquals(cloneHtd.getValue(TEST_CUSTOM_VALUE), TEST_CUSTOM_VALUE);
  assertEquals(cloneHtd.getConfigurationValue(TEST_CONF_CUSTOM_VALUE), TEST_CONF_CUSTOM_VALUE);
  assertEquals(originalTableDescriptor.getValues(), cloneHtd.getValues());
  assertEquals(originalTableDescriptor.getConfiguration(), cloneHtd.getConfiguration());

  admin.enableTable(originalTableName);
  clonedTable.close();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:41,代码来源:TestSnapshotMetadata.java

示例2: testFlushCreateListDestroy

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的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";
  FileSystem fs = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getFileSystem();
  Path rootDir = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir();
  SnapshotTestingUtils.createSnapshotAndValidate(admin,
    TableName.valueOf(STRING_TABLE_NAME), Bytes.toString(TEST_FAM),
    snapshotName, rootDir, fs, true);
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:20,代码来源:TestFlushSnapshotFromClient.java

示例3: createTableAndSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
public static void createTableAndSnapshot(HBaseTestingUtility util, TableName tableName,
    String snapshotName, int numRegions)
    throws Exception {
  try {
    util.deleteTable(tableName);
  } catch(Exception ex) {
    // ignore
  }

  if (numRegions > 1) {
    util.createTable(tableName, FAMILIES, 1, bbb, yyy, numRegions);
  } else {
    util.createTable(tableName, FAMILIES);
  }
  Admin admin = util.getHBaseAdmin();

  // put some stuff in the table
  HTable table = new HTable(util.getConfiguration(), tableName);
  util.loadTable(table, FAMILIES);

  Path rootDir = FSUtils.getRootDir(util.getConfiguration());
  FileSystem fs = rootDir.getFileSystem(util.getConfiguration());

  SnapshotTestingUtils.createSnapshotAndValidate(admin, tableName,
      Arrays.asList(FAMILIES), null, snapshotName, rootDir, fs, true);

  // load different values
  byte[] value = Bytes.toBytes("after_snapshot_value");
  util.loadTable(table, FAMILIES, value);

  // cause flush to create new files in the region
  admin.flush(tableName);
  table.close();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:35,代码来源:TestTableSnapshotScanner.java

示例4: setUpSnapshots

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
@BeforeClass
public static void setUpSnapshots() throws Exception {

  TEST_UTIL.enableDebug(MultiTableSnapshotInputFormat.class);
  TEST_UTIL.enableDebug(MultiTableSnapshotInputFormatImpl.class);

  // take a snapshot of every table we have.
  for (String tableName : TABLES) {
    SnapshotTestingUtils
        .createSnapshotAndValidate(TEST_UTIL.getHBaseAdmin(), TableName.valueOf(tableName),
            ImmutableList.of(MultiTableInputFormatTestBase.INPUT_FAMILY), null,
            snapshotNameForTable(tableName), FSUtils.getRootDir(TEST_UTIL.getConfiguration()),
            TEST_UTIL.getTestFileSystem(), true);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:TestMultiTableSnapshotInputFormat.java

示例5: createTableAndSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
protected static void createTableAndSnapshot(HBaseTestingUtility util, TableName tableName,
  String snapshotName, byte[] startRow, byte[] endRow, int numRegions)
  throws Exception {
  try {
    util.deleteTable(tableName);
  } catch(Exception ex) {
    // ignore
  }

  if (numRegions > 1) {
    util.createTable(tableName, FAMILIES, 1, startRow, endRow, numRegions);
  } else {
    util.createTable(tableName, FAMILIES);
  }
  Admin admin = util.getHBaseAdmin();

  // put some stuff in the table
  HTable table = new HTable(util.getConfiguration(), tableName);
  util.loadTable(table, FAMILIES);

  Path rootDir = FSUtils.getRootDir(util.getConfiguration());
  FileSystem fs = rootDir.getFileSystem(util.getConfiguration());

  SnapshotTestingUtils.createSnapshotAndValidate(admin, tableName,
    Arrays.asList(FAMILIES), null, snapshotName, rootDir, fs, true);

  // load different values
  byte[] value = Bytes.toBytes("after_snapshot_value");
  util.loadTable(table, FAMILIES, value);

  // cause flush to create new files in the region
  admin.flush(tableName);
  table.close();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:35,代码来源:TableSnapshotInputFormatTestBase.java

示例6: testDescribeMatchesAfterClone

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Verify that the describe for a cloned table matches the describe from the original.
 */
@Test (timeout=300000)
public void testDescribeMatchesAfterClone() throws Exception {
  // Clone the original table
  final String clonedTableNameAsString = "clone" + originalTableName;
  final byte[] clonedTableName = Bytes.toBytes(clonedTableNameAsString);
  final String snapshotNameAsString = "snapshot" + originalTableName
      + System.currentTimeMillis();
  final byte[] snapshotName = Bytes.toBytes(snapshotNameAsString);

  // restore the snapshot into a cloned table and examine the output
  List<byte[]> familiesList = new ArrayList<byte[]>();
  for (byte[] family : families) {
    familiesList.add(family);
  }

  // Create a snapshot in which all families are empty
  SnapshotTestingUtils.createSnapshotAndValidate(admin, originalTableName, null,
    familiesList, snapshotNameAsString, rootDir, fs, /* onlineSnapshot= */ false);

  admin.cloneSnapshot(snapshotName, clonedTableName);
  HTable clonedTable = new HTable(UTIL.getConfiguration(), clonedTableName);
  HTableDescriptor cloneHtd = admin.getTableDescriptor(clonedTableName);
  assertEquals(
    originalTableDescription.replace(originalTableName.getNameAsString(),clonedTableNameAsString),
    cloneHtd.toStringCustomizedValues());

  // Verify the custom fields
  assertEquals(originalTableDescriptor.getValues().size(),
                      cloneHtd.getValues().size());
  assertEquals(originalTableDescriptor.getConfiguration().size(),
                      cloneHtd.getConfiguration().size());
  assertEquals(cloneHtd.getValue(TEST_CUSTOM_VALUE), TEST_CUSTOM_VALUE);
  assertEquals(cloneHtd.getConfigurationValue(TEST_CONF_CUSTOM_VALUE), TEST_CONF_CUSTOM_VALUE);
  assertEquals(originalTableDescriptor.getValues(), cloneHtd.getValues());
  assertEquals(originalTableDescriptor.getConfiguration(), cloneHtd.getConfiguration());

  admin.enableTable(originalTableName);
  clonedTable.close();
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:43,代码来源:TestSnapshotMetadata.java

示例7: createTableAndSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
public static void createTableAndSnapshot(HBaseTestingUtility util, TableName tableName,
    String snapshotName, int numRegions)
    throws Exception {
  try {
    util.deleteTable(tableName);
  } catch(Exception ex) {
    // ignore
  }

  if (numRegions > 1) {
    util.createTable(tableName, FAMILIES, 1, bbb, yyy, numRegions);
  } else {
    util.createTable(tableName, FAMILIES);
  }
  HBaseAdmin admin = util.getHBaseAdmin();

  // put some stuff in the table
  HTable table = new HTable(util.getConfiguration(), tableName);
  util.loadTable(table, FAMILIES);

  Path rootDir = new Path(util.getConfiguration().get(HConstants.HBASE_DIR));
  FileSystem fs = rootDir.getFileSystem(util.getConfiguration());

  SnapshotTestingUtils.createSnapshotAndValidate(admin, tableName,
      Arrays.asList(FAMILIES), null, snapshotName, rootDir, fs, true);

  // load different values
  byte[] value = Bytes.toBytes("after_snapshot_value");
  util.loadTable(table, FAMILIES, value);

  // cause flush to create new files in the region
  admin.flush(tableName.toString());
  table.close();
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:35,代码来源:TestTableSnapshotScanner.java

示例8: createTableAndSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
protected static void createTableAndSnapshot(HBaseTestingUtility util, TableName tableName,
  String snapshotName, byte[] startRow, byte[] endRow, int numRegions)
  throws Exception {
  try {
    util.deleteTable(tableName);
  } catch(Exception ex) {
    // ignore
  }

  if (numRegions > 1) {
    util.createTable(tableName, FAMILIES, 1, startRow, endRow, numRegions);
  } else {
    util.createTable(tableName, FAMILIES);
  }
  HBaseAdmin admin = util.getHBaseAdmin();

  // put some stuff in the table
  HTable table = new HTable(util.getConfiguration(), tableName);
  util.loadTable(table, FAMILIES);

  Path rootDir = FSUtils.getRootDir(util.getConfiguration());
  FileSystem fs = rootDir.getFileSystem(util.getConfiguration());

  SnapshotTestingUtils.createSnapshotAndValidate(admin, tableName,
    Arrays.asList(FAMILIES), null, snapshotName, rootDir, fs, true);

  // load different values
  byte[] value = Bytes.toBytes("after_snapshot_value");
  util.loadTable(table, FAMILIES, value);

  // cause flush to create new files in the region
  admin.flush(tableName.toString());
  table.close();
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:35,代码来源:TableSnapshotInputFormatTestBase.java

示例9: testDescribeMatchesAfterClone

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Verify that the describe for a cloned table matches the describe from the original.
 */
@Test (timeout=300000)
public void testDescribeMatchesAfterClone() throws Exception {
  // Clone the original table
  final String clonedTableNameAsString = "clone" + originalTableName;
  final TableName clonedTableName = TableName.valueOf(clonedTableNameAsString);
  final String snapshotNameAsString = "snapshot" + originalTableName
      + System.currentTimeMillis();
  final byte[] snapshotName = Bytes.toBytes(snapshotNameAsString);

  // restore the snapshot into a cloned table and examine the output
  List<byte[]> familiesList = new ArrayList<>();
  Collections.addAll(familiesList, families);

  // Create a snapshot in which all families are empty
  SnapshotTestingUtils.createSnapshotAndValidate(admin, originalTableName, null,
    familiesList, snapshotNameAsString, rootDir, fs, /* onlineSnapshot= */ false);

  admin.cloneSnapshot(snapshotName, clonedTableName);
  Table clonedTable = UTIL.getConnection().getTable(clonedTableName);
  HTableDescriptor cloneHtd = admin.getTableDescriptor(clonedTableName);
  assertEquals(
    originalTableDescription.replace(originalTableName.getNameAsString(),clonedTableNameAsString),
    cloneHtd.toStringCustomizedValues());

  // Verify the custom fields
  assertEquals(originalTableDescriptor.getValues().size(),
                      cloneHtd.getValues().size());
  assertEquals(originalTableDescriptor.getConfiguration().size(),
                      cloneHtd.getConfiguration().size());
  assertEquals(TEST_CUSTOM_VALUE, cloneHtd.getValue(TEST_CUSTOM_VALUE));
  assertEquals(TEST_CONF_CUSTOM_VALUE, cloneHtd.getConfigurationValue(TEST_CONF_CUSTOM_VALUE));
  assertEquals(originalTableDescriptor.getValues(), cloneHtd.getValues());
  assertEquals(originalTableDescriptor.getConfiguration(), cloneHtd.getConfiguration());

  admin.enableTable(originalTableName);
  clonedTable.close();
}
 
开发者ID:apache,项目名称:hbase,代码行数:41,代码来源:TestSnapshotMetadata.java

示例10: createTableAndSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
public static void createTableAndSnapshot(HBaseTestingUtility util, TableName tableName,
    String snapshotName, int numRegions)
    throws Exception {
  try {
    util.deleteTable(tableName);
  } catch(Exception ex) {
    // ignore
  }

  if (numRegions > 1) {
    util.createTable(tableName, FAMILIES, 1, bbb, yyy, numRegions);
  } else {
    util.createTable(tableName, FAMILIES);
  }
  Admin admin = util.getAdmin();

  // put some stuff in the table
  Table table = util.getConnection().getTable(tableName);
  util.loadTable(table, FAMILIES);

  Path rootDir = FSUtils.getRootDir(util.getConfiguration());
  FileSystem fs = rootDir.getFileSystem(util.getConfiguration());

  SnapshotTestingUtils.createSnapshotAndValidate(admin, tableName,
      Arrays.asList(FAMILIES), null, snapshotName, rootDir, fs, true);

  // load different values
  byte[] value = Bytes.toBytes("after_snapshot_value");
  util.loadTable(table, FAMILIES, value);

  // cause flush to create new files in the region
  admin.flush(tableName);
  table.close();
}
 
开发者ID:apache,项目名称:hbase,代码行数:35,代码来源:TestTableSnapshotScanner.java

示例11: createAndCloneSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Takes the snapshot of originalTable and clones the snapshot to another tables.
 * If {@code online} is false, the original table is disabled during taking snapshot, so also
 * enables it again.
 * @param online - Whether the table is online or not during the snapshot
 */
private void createAndCloneSnapshot(boolean online) throws Exception {
  SnapshotTestingUtils.createSnapshotAndValidate(admin, originalTableName, TEST_FAM_STR,
    snapshotNameAsString, rootDir, fs, online);

  // If offline, enable the table disabled by snapshot testing util.
  if (!online) {
    admin.enableTable(originalTableName);
    UTIL.waitTableAvailable(originalTableName);
  }

  admin.cloneSnapshot(snapshotName, cloneTableName);
  UTIL.waitUntilAllRegionsAssigned(cloneTableName);
}
 
开发者ID:apache,项目名称:hbase,代码行数:20,代码来源:TestSnapshotCloneIndependence.java

示例12: setUpSnapshots

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
@BeforeClass
public static void setUpSnapshots() throws Exception {

  TEST_UTIL.enableDebug(MultiTableSnapshotInputFormat.class);
  TEST_UTIL.enableDebug(MultiTableSnapshotInputFormatImpl.class);

  // take a snapshot of every table we have.
  for (String tableName : TABLES) {
    SnapshotTestingUtils
        .createSnapshotAndValidate(TEST_UTIL.getAdmin(), TableName.valueOf(tableName),
            ImmutableList.of(INPUT_FAMILY), null,
            snapshotNameForTable(tableName), FSUtils.getRootDir(TEST_UTIL.getConfiguration()),
            TEST_UTIL.getTestFileSystem(), true);
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:16,代码来源:TestMultiTableSnapshotInputFormat.java

示例13: createTableAndSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
protected static void createTableAndSnapshot(HBaseTestingUtility util, TableName tableName,
  String snapshotName, byte[] startRow, byte[] endRow, int numRegions)
  throws Exception {
  try {
    LOG.debug("Ensuring table doesn't exist.");
    util.deleteTable(tableName);
  } catch(Exception ex) {
    // ignore
  }

  LOG.info("creating table '" + tableName + "'");
  if (numRegions > 1) {
    util.createTable(tableName, FAMILIES, 1, startRow, endRow, numRegions);
  } else {
    util.createTable(tableName, FAMILIES);
  }
  Admin admin = util.getAdmin();

  LOG.info("put some stuff in the table");
  Table table = util.getConnection().getTable(tableName);
  util.loadTable(table, FAMILIES);

  Path rootDir = FSUtils.getRootDir(util.getConfiguration());
  FileSystem fs = rootDir.getFileSystem(util.getConfiguration());

  LOG.info("snapshot");
  SnapshotTestingUtils.createSnapshotAndValidate(admin, tableName,
    Arrays.asList(FAMILIES), null, snapshotName, rootDir, fs, true);

  LOG.info("load different values");
  byte[] value = Bytes.toBytes("after_snapshot_value");
  util.loadTable(table, FAMILIES, value);

  LOG.info("cause flush to create new files in the region");
  admin.flush(tableName);
  table.close();
}
 
开发者ID:apache,项目名称:hbase,代码行数:38,代码来源:TableSnapshotInputFormatTestBase.java

示例14: createTableAndSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
public static void createTableAndSnapshot(HBaseTestingUtility util, TableName tableName,
    String snapshotName, int numRegions)
    throws Exception {
  try {
    util.deleteTable(tableName);
  } catch(Exception ex) {
    // ignore
  }

  if (numRegions > 1) {
    util.createTable(tableName, FAMILIES, 1, bbb, yyy, numRegions);
  } else {
    util.createTable(tableName, FAMILIES);
  }
  HBaseAdmin admin = util.getHBaseAdmin();

  // put some stuff in the table
  HTable table = new HTable(util.getConfiguration(), tableName);
  util.loadTable(table, FAMILIES);

  Path rootDir = FSUtils.getRootDir(util.getConfiguration());
  FileSystem fs = rootDir.getFileSystem(util.getConfiguration());

  SnapshotTestingUtils.createSnapshotAndValidate(admin, tableName,
      Arrays.asList(FAMILIES), null, snapshotName, rootDir, fs, true);

  // load different values
  byte[] value = Bytes.toBytes("after_snapshot_value");
  util.loadTable(table, FAMILIES, value);

  // cause flush to create new files in the region
  admin.flush(tableName.toString());
  table.close();
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:35,代码来源:TestTableSnapshotScanner.java

示例15: testDescribeMatchesAfterClone

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Verify that the describe for a cloned table matches the describe from the original.
 */
@Test (timeout=300000)
public void testDescribeMatchesAfterClone() throws Exception {
  // Clone the original table
  final String clonedTableNameAsString = "clone" + originalTableName;
  final byte[] clonedTableName = Bytes.toBytes(clonedTableNameAsString);
  final String snapshotNameAsString = "snapshot" + originalTableName
      + System.currentTimeMillis();
  final byte[] snapshotName = Bytes.toBytes(snapshotNameAsString);

  // restore the snapshot into a cloned table and examine the output
  List<byte[]> familiesList = new ArrayList<byte[]>();
  for (byte[] family : families) {

    familiesList.add(family);
  }

  // Create a snapshot in which all families are empty
  SnapshotTestingUtils.createSnapshotAndValidate(admin, originalTableName, null,
    familiesList, snapshotNameAsString, rootDir, fs, /* onlineSnapshot= */ false);

  admin.cloneSnapshot(snapshotName, clonedTableName);
  HTable clonedTable = new HTable(UTIL.getConfiguration(), clonedTableName);
  assertEquals(
    originalTableDescription.replace(originalTableName.getNameAsString(),clonedTableNameAsString),
    clonedTable.getTableDescriptor().toString());

  admin.enableTable(originalTableName);
  clonedTable.close();
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:33,代码来源:TestSnapshotMetadata.java


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