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


Java SnapshotTestingUtils.createTable方法代码示例

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


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

示例1: getSnapshot

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
private SnapshotProtos.SnapshotDescription getSnapshot() throws Exception {
  if (snapshot == null) {
    final TableName snapshotTableName = TableName.valueOf("testCloneSnapshot");
    long tid = System.currentTimeMillis();
    final byte[] snapshotName = Bytes.toBytes("snapshot-" + tid);

    Admin admin = UTIL.getAdmin();
    // create Table
    SnapshotTestingUtils.createTable(UTIL, snapshotTableName, getNumReplicas(), CF);
    // Load data
    SnapshotTestingUtils.loadData(UTIL, snapshotTableName, 500, CF);
    admin.disableTable(snapshotTableName);
    // take a snapshot
    admin.snapshot(snapshotName, snapshotTableName);
    admin.enableTable(snapshotTableName);

    List<SnapshotDescription> snapshotList = admin.listSnapshots();
    snapshot = ProtobufUtil.createHBaseProtosSnapshotDesc(snapshotList.get(0));
  }
  return snapshot;
}
 
开发者ID:apache,项目名称:hbase,代码行数:22,代码来源:TestCloneSnapshotProcedure.java

示例2: setup

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Initialize the tests with a table filled with some data
 * and two snapshots (snapshotName0, snapshotName1) of different states.
 * The tableName, snapshotNames and the number of rows in the snapshot are initialized.
 */
@Before
public void setup() throws Exception {
  this.admin = TEST_UTIL.getHBaseAdmin();

  long tid = System.currentTimeMillis();
  tableName =
      TableName.valueOf("testtb-" + tid);
  emptySnapshot = Bytes.toBytes("emptySnaptb-" + tid);
  snapshotName0 = Bytes.toBytes("snaptb0-" + tid);
  snapshotName1 = Bytes.toBytes("snaptb1-" + tid);
  snapshotName2 = Bytes.toBytes("snaptb2-" + tid);

  // create Table and disable it
  SnapshotTestingUtils.createTable(TEST_UTIL, tableName, getNumReplicas(), FAMILY);
  admin.disableTable(tableName);

  // take an empty snapshot
  admin.snapshot(emptySnapshot, tableName);

  // enable table and insert data
  admin.enableTable(tableName);
  SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 500, FAMILY);
  try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
    snapshot0Rows = TEST_UTIL.countRows(table);
  }
  admin.disableTable(tableName);

  // take a snapshot
  admin.snapshot(snapshotName0, tableName);

  // enable table and insert more data
  admin.enableTable(tableName);
  SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 500, FAMILY);
  try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
    snapshot1Rows = TEST_UTIL.countRows(table);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:43,代码来源:TestRestoreSnapshotFromClient.java

示例3: setup

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Initialize the tests with a table filled with some data
 * and two snapshots (snapshotName0, snapshotName1) of different states.
 * The tableName, snapshotNames and the number of rows in the snapshot are initialized.
 */
@Before
public void setup() throws Exception {
  this.admin = TEST_UTIL.getHBaseAdmin();

  long tid = System.currentTimeMillis();
  tableName =
      TableName.valueOf("testtb-" + tid);
  emptySnapshot = Bytes.toBytes("emptySnaptb-" + tid);
  snapshotName0 = Bytes.toBytes("snaptb0-" + tid);
  snapshotName1 = Bytes.toBytes("snaptb1-" + tid);
  snapshotName2 = Bytes.toBytes("snaptb2-" + tid);

  // create Table and disable it
  SnapshotTestingUtils.createTable(TEST_UTIL, tableName, FAMILY);
  admin.disableTable(tableName);

  // take an empty snapshot
  admin.snapshot(emptySnapshot, tableName);

  HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName);
  // enable table and insert data
  admin.enableTable(tableName);
  SnapshotTestingUtils.loadData(TEST_UTIL, table, 500, FAMILY);
  snapshot0Rows = TEST_UTIL.countRows(table);
  admin.disableTable(tableName);

  // take a snapshot
  admin.snapshot(snapshotName0, tableName);

  // enable table and insert more data
  admin.enableTable(tableName);
  SnapshotTestingUtils.loadData(TEST_UTIL, table, 500, FAMILY);
  snapshot1Rows = TEST_UTIL.countRows(table);
  table.close();
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:41,代码来源:TestRestoreSnapshotFromClient.java

示例4: createTableAndSnapshots

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
protected void createTableAndSnapshots() throws Exception {
  // create Table and disable it
  SnapshotTestingUtils.createTable(TEST_UTIL, tableName, getNumReplicas(), FAMILY);
  admin.disableTable(tableName);

  // take an empty snapshot
  admin.snapshot(emptySnapshot, tableName);

  // enable table and insert data
  admin.enableTable(tableName);
  SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 500, FAMILY);
  try (Table table = TEST_UTIL.getConnection().getTable(tableName)){
    snapshot0Rows = TEST_UTIL.countRows(table);
  }
  admin.disableTable(tableName);

  // take a snapshot
  admin.snapshot(snapshotName0, tableName);

  // enable table and insert more data
  admin.enableTable(tableName);
  SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 500, FAMILY);
  try (Table table = TEST_UTIL.getConnection().getTable(tableName)){
    snapshot1Rows = TEST_UTIL.countRows(table);
  }
  admin.disableTable(tableName);

  // take a snapshot of the updated table
  admin.snapshot(snapshotName1, tableName);

  // re-enable table
  admin.enableTable(tableName);
}
 
开发者ID:apache,项目名称:hbase,代码行数:34,代码来源:TestCloneSnapshotFromClient.java

示例5: setup

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Initialize the tests with a table filled with some data
 * and two snapshots (snapshotName0, snapshotName1) of different states.
 * The tableName, snapshotNames and the number of rows in the snapshot are initialized.
 */
@Before
public void setup() throws Exception {
  this.admin = TEST_UTIL.getHBaseAdmin();

  long tid = System.currentTimeMillis();
  tableName = TableName.valueOf("testtb-" + tid);
  emptySnapshot = Bytes.toBytes("emptySnaptb-" + tid);
  snapshotName0 = Bytes.toBytes("snaptb0-" + tid);
  snapshotName1 = Bytes.toBytes("snaptb1-" + tid);
  snapshotName2 = Bytes.toBytes("snaptb2-" + tid);

  // create Table and disable it
  SnapshotTestingUtils.createTable(TEST_UTIL, tableName, getNumReplicas(), FAMILY);
  admin.disableTable(tableName);

  // take an empty snapshot
  admin.snapshot(emptySnapshot, tableName);

  // enable table and insert data
  admin.enableTable(tableName);
  SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 500, FAMILY);
  try (Table table = TEST_UTIL.getConnection().getTable(tableName)){
    snapshot0Rows = TEST_UTIL.countRows(table);
  }
  admin.disableTable(tableName);

  // take a snapshot
  admin.snapshot(snapshotName0, tableName);

  // enable table and insert more data
  admin.enableTable(tableName);
  SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 500, FAMILY);
  try (Table table = TEST_UTIL.getConnection().getTable(tableName)){
    snapshot1Rows = TEST_UTIL.countRows(table);
  }
  admin.disableTable(tableName);

  // take a snapshot of the updated table
  admin.snapshot(snapshotName1, tableName);

  // re-enable table
  admin.enableTable(tableName);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:49,代码来源:TestCloneSnapshotFromClient.java

示例6: setup

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Initialize the tests with a table filled with some data
 * and two snapshots (snapshotName0, snapshotName1) of different states.
 * The tableName, snapshotNames and the number of rows in the snapshot are initialized.
 */
@Before
public void setup() throws Exception {
  this.admin = TEST_UTIL.getHBaseAdmin();

  long tid = System.currentTimeMillis();
  tableName = Bytes.toBytes("testtb-" + tid);
  emptySnapshot = Bytes.toBytes("emptySnaptb-" + tid);
  snapshotName0 = Bytes.toBytes("snaptb0-" + tid);
  snapshotName1 = Bytes.toBytes("snaptb1-" + tid);
  snapshotName2 = Bytes.toBytes("snaptb2-" + tid);

  // create Table and disable it
  SnapshotTestingUtils.createTable(TEST_UTIL, tableName, FAMILY);
  admin.disableTable(tableName);

  // take an empty snapshot
  admin.snapshot(emptySnapshot, tableName);

  HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName);
  // enable table and insert data
  admin.enableTable(tableName);
  SnapshotTestingUtils.loadData(TEST_UTIL, table, 500, FAMILY);
  snapshot0Rows = TEST_UTIL.countRows(table);
  admin.disableTable(tableName);

  // take a snapshot
  admin.snapshot(snapshotName0, tableName);

  // enable table and insert more data
  admin.enableTable(tableName);
  SnapshotTestingUtils.loadData(TEST_UTIL, table, 500, FAMILY);
  snapshot1Rows = TEST_UTIL.countRows(table);
  admin.disableTable(tableName);

  // take a snapshot of the updated table
  admin.snapshot(snapshotName1, tableName);

  // re-enable table
  admin.enableTable(tableName);
  table.close();
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:47,代码来源:TestRestoreSnapshotFromClient.java

示例7: setup

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Initialize the tests with a table filled with some data
 * and two snapshots (snapshotName0, snapshotName1) of different states.
 * The tableName, snapshotNames and the number of rows in the snapshot are initialized.
 */
@Before
public void setup() throws Exception {
  this.admin = TEST_UTIL.getHBaseAdmin();

  long tid = System.currentTimeMillis();
  tableName = Bytes.toBytes("testtb-" + tid);
  emptySnapshot = Bytes.toBytes("emptySnaptb-" + tid);
  snapshotName0 = Bytes.toBytes("snaptb0-" + tid);
  snapshotName1 = Bytes.toBytes("snaptb1-" + tid);
  snapshotName2 = Bytes.toBytes("snaptb2-" + tid);

  // create Table and disable it
  SnapshotTestingUtils.createTable(TEST_UTIL, tableName, FAMILY);
  admin.disableTable(tableName);

  // take an empty snapshot
  admin.snapshot(emptySnapshot, tableName);

  HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName);
  try {
    // enable table and insert data
    admin.enableTable(tableName);
    SnapshotTestingUtils.loadData(TEST_UTIL, table, 500, FAMILY);
    snapshot0Rows = TEST_UTIL.countRows(table);
    admin.disableTable(tableName);

    // take a snapshot
    admin.snapshot(snapshotName0, tableName);

    // enable table and insert more data
    admin.enableTable(tableName);
    SnapshotTestingUtils.loadData(TEST_UTIL, table, 500, FAMILY);
    snapshot1Rows = TEST_UTIL.countRows(table);
    admin.disableTable(tableName);

    // take a snapshot of the updated table
    admin.snapshot(snapshotName1, tableName);

    // re-enable table
    admin.enableTable(tableName);
  } finally {
    table.close();
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:50,代码来源:TestCloneSnapshotFromClient.java

示例8: setup

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Initialize the tests with a table filled with some data
 * and two snapshots (snapshotName0, snapshotName1) of different states.
 * The tableName, snapshotNames and the number of rows in the snapshot are initialized.
 */
@Before
public void setup() throws Exception {
  this.admin = TEST_UTIL.getHBaseAdmin();

  long tid = System.currentTimeMillis();
  tableName = TableName.valueOf("testtb-" + tid);
  emptySnapshot = Bytes.toBytes("emptySnaptb-" + tid);
  snapshotName0 = Bytes.toBytes("snaptb0-" + tid);
  snapshotName1 = Bytes.toBytes("snaptb1-" + tid);
  snapshotName2 = Bytes.toBytes("snaptb2-" + tid);

  // create Table and disable it
  SnapshotTestingUtils.createTable(TEST_UTIL, tableName, FAMILY);
  admin.disableTable(tableName);

  // take an empty snapshot
  admin.snapshot(emptySnapshot, tableName);

  HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName);
  try {
    // enable table and insert data
    admin.enableTable(tableName);
    SnapshotTestingUtils.loadData(TEST_UTIL, table, 500, FAMILY);
    snapshot0Rows = TEST_UTIL.countRows(table);
    admin.disableTable(tableName);

    // take a snapshot
    admin.snapshot(snapshotName0, tableName);

    // enable table and insert more data
    admin.enableTable(tableName);
    SnapshotTestingUtils.loadData(TEST_UTIL, table, 500, FAMILY);
    snapshot1Rows = TEST_UTIL.countRows(table);
    admin.disableTable(tableName);

    // take a snapshot of the updated table
    admin.snapshot(snapshotName1, tableName);

    // re-enable table
    admin.enableTable(tableName);
  } finally {
    table.close();
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:50,代码来源:TestCloneSnapshotFromClient.java

示例9: setup

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
  SnapshotTestingUtils.createTable(UTIL, TABLE_NAME, TEST_FAM);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:5,代码来源:TestFlushSnapshotFromClient.java

示例10: createTable

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
protected void createTable() throws Exception {
  SnapshotTestingUtils.createTable(TEST_UTIL, tableName, getNumReplicas(), FAMILY);
}
 
开发者ID:apache,项目名称:hbase,代码行数:4,代码来源:TestRestoreSnapshotFromClient.java

示例11: setupSnapshotAndUpdateTable

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
private void setupSnapshotAndUpdateTable() throws Exception {
  long tid = System.currentTimeMillis();
  final byte[] snapshotName = Bytes.toBytes("snapshot-" + tid);
  Admin admin = UTIL.getAdmin();
  // create Table
  SnapshotTestingUtils.createTable(UTIL, snapshotTableName, getNumReplicas(), CF1, CF2);
  // Load data
  SnapshotTestingUtils.loadData(UTIL, snapshotTableName, rowCountCF1, CF1);
  SnapshotTestingUtils.loadData(UTIL, snapshotTableName, rowCountCF2, CF2);
  SnapshotTestingUtils.verifyRowCount(UTIL, snapshotTableName, rowCountCF1 + rowCountCF2);

  snapshotHTD = admin.getTableDescriptor(snapshotTableName);

  admin.disableTable(snapshotTableName);
  // take a snapshot
  admin.snapshot(snapshotName, snapshotTableName);

  List<SnapshotDescription> snapshotList = admin.listSnapshots();
  snapshot = ProtobufUtil.createHBaseProtosSnapshotDesc(snapshotList.get(0));

  // modify the table
  HColumnDescriptor columnFamilyDescriptor3 = new HColumnDescriptor(CF3);
  HColumnDescriptor columnFamilyDescriptor4 = new HColumnDescriptor(CF4);
  admin.addColumnFamily(snapshotTableName, columnFamilyDescriptor3);
  admin.addColumnFamily(snapshotTableName, columnFamilyDescriptor4);
  admin.deleteColumnFamily(snapshotTableName, CF2);
  // enable table and insert data
  admin.enableTable(snapshotTableName);
  SnapshotTestingUtils.loadData(UTIL, snapshotTableName, rowCountCF3, CF3);
  SnapshotTestingUtils.loadData(UTIL, snapshotTableName, rowCountCF4, CF4);
  SnapshotTestingUtils.loadData(UTIL, snapshotTableName, rowCountCF1addition, CF1);
  HTableDescriptor currentHTD = admin.getTableDescriptor(snapshotTableName);
  assertTrue(currentHTD.hasFamily(CF1));
  assertFalse(currentHTD.hasFamily(CF2));
  assertTrue(currentHTD.hasFamily(CF3));
  assertTrue(currentHTD.hasFamily(CF4));
  assertNotEquals(currentHTD.getFamiliesKeys().size(), snapshotHTD.getFamiliesKeys().size());
  SnapshotTestingUtils.verifyRowCount(
    UTIL, snapshotTableName, rowCountCF1 + rowCountCF3 + rowCountCF4 + rowCountCF1addition);
  admin.disableTable(snapshotTableName);
}
 
开发者ID:apache,项目名称:hbase,代码行数:42,代码来源:TestRestoreSnapshotProcedure.java

示例12: setup

import org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils; //导入方法依赖的package包/类
/**
 * Initialize the tests with a table filled with some data
 * and two snapshots (snapshotName0, snapshotName1) of different states.
 * The tableName, snapshotNames and the number of rows in the snapshot are initialized.
 */
@Before
public void setup() throws Exception {
  this.admin = TEST_UTIL.getHBaseAdmin();

  long tid = System.currentTimeMillis();
  tableName =
      TableName.valueOf("testtb-" + tid);
  emptySnapshot = Bytes.toBytes("emptySnaptb-" + tid);
  snapshotName0 = Bytes.toBytes("snaptb0-" + tid);
  snapshotName1 = Bytes.toBytes("snaptb1-" + tid);
  snapshotName2 = Bytes.toBytes("snaptb2-" + tid);

  // create Table and disable it
  SnapshotTestingUtils.createTable(TEST_UTIL, tableName, FAMILY);
  admin.disableTable(tableName);

  // take an empty snapshot
  admin.snapshot(emptySnapshot, tableName);

  HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName);
  // enable table and insert data
  admin.enableTable(tableName);
  SnapshotTestingUtils.loadData(TEST_UTIL, table, 500, FAMILY);
  snapshot0Rows = TEST_UTIL.countRows(table);
  admin.disableTable(tableName);

  // take a snapshot
  admin.snapshot(snapshotName0, tableName);

  // enable table and insert more data
  admin.enableTable(tableName);
  SnapshotTestingUtils.loadData(TEST_UTIL, table, 500, FAMILY);
  snapshot1Rows = TEST_UTIL.countRows(table);
  admin.disableTable(tableName);

  // take a snapshot of the updated table
  admin.snapshot(snapshotName1, tableName);

  // re-enable table
  admin.enableTable(tableName);
  table.close();
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:48,代码来源:TestRestoreSnapshotFromClient.java


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