Tabnine Logo
SnapshotTestingUtils.loadData
Code IndexAdd Tabnine to your IDE (free)

How to use
loadData
method
in
org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils

Best Java code snippets using org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils.loadData (Showing top 20 results out of 315)

origin: apache/hbase

@Override
public void loadData(final Table table, byte[]... families) throws Exception {
 SnapshotTestingUtils.loadData(UTIL, table.getName(), 1000, families);
}
origin: apache/hbase

public static void loadData(final HBaseTestingUtility util, final TableName tableName, int rows,
  byte[]... families) throws IOException, InterruptedException {
 BufferedMutator mutator = util.getConnection().getBufferedMutator(tableName);
 loadData(util, mutator, rows, families);
}
origin: apache/hbase

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;
}
origin: apache/hbase

SnapshotTestingUtils.loadData(UTIL, tableName, 500, FAMILY);
Table table = UTIL.getConnection().getTable(tableName);
snapshot0Rows = countRows(table);
SnapshotTestingUtils.loadData(UTIL, tableName, 500, FAMILY);
snapshot1Rows = countRows(table);
LOG.info("=== before snapshot with 1000 rows");
origin: apache/hbase

/**
 * Create a table and take a snapshot of the table used by the export test.
 */
@Before
public void setUp() throws Exception {
 this.admin = TEST_UTIL.getAdmin();
 tableName = TableName.valueOf("testtb-" + testName.getMethodName());
 snapshotName = Bytes.toBytes("snaptb0-" + testName.getMethodName());
 emptySnapshotName = Bytes.toBytes("emptySnaptb0-" + testName.getMethodName());
 // create Table
 createTable();
 // Take an empty snapshot
 admin.snapshot(emptySnapshotName, tableName);
 // Add some rows
 SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 50, FAMILY);
 tableNumFiles = admin.getTableRegions(tableName).size();
 // take a snapshot
 admin.snapshot(snapshotName, tableName);
}
origin: apache/hbase

SnapshotTestingUtils.loadData(UTIL, snapshotTableName, rowCountCF1, CF1);
SnapshotTestingUtils.loadData(UTIL, snapshotTableName, rowCountCF2, CF2);
SnapshotTestingUtils.verifyRowCount(UTIL, snapshotTableName, rowCountCF1 + rowCountCF2);
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));
origin: apache/hbase

/**
 * Test simple flush snapshotting a table that is online
 * @throws Exception
 */
@Test
public void testFlushTableSnapshotWithProcedure() throws Exception {
 // make sure we don't fail on listing snapshots
 SnapshotTestingUtils.assertNoSnapshots(admin);
 // put some stuff in the table
 SnapshotTestingUtils.loadData(UTIL, TABLE_NAME, DEFAULT_NUM_ROWS, TEST_FAM);
 LOG.debug("FS state before snapshot:");
 UTIL.getHBaseCluster().getMaster().getMasterFileSystem().logFileSystemState(LOG);
 // take a snapshot of the enabled table
 String snapshotString = "offlineTableSnapshot";
 byte[] snapshot = Bytes.toBytes(snapshotString);
 Map<String, String> props = new HashMap<>();
 props.put("table", TABLE_NAME.getNameAsString());
 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
 LOG.debug("FS state after snapshot:");
 UTIL.getHBaseCluster().getMaster().getMasterFileSystem().logFileSystemState(LOG);
 SnapshotTestingUtils.confirmSnapshotValid(UTIL,
  ProtobufUtil.createHBaseProtosSnapshotDesc(snapshots.get(0)), TABLE_NAME, TEST_FAM);
}
origin: apache/hbase

SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 500, FAMILY);
try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
 snapshot0Rows = countRows(table);
SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 500, FAMILY);
try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
 snapshot1Rows = countRows(table);
origin: apache/hbase

 @Test
 @Override
 public void testCloneLinksAfterDelete() throws IOException, InterruptedException {
  // delay the flush to make sure
  delayFlush = true;
  SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 20, FAMILY);
  long tid = System.currentTimeMillis();
  byte[] snapshotName3 = Bytes.toBytes("snaptb3-" + tid);
  TableName clonedTableName3 =
   TableName.valueOf(name.getMethodName() + System.currentTimeMillis());
  admin.snapshot(snapshotName3, tableName);
  delayFlush = false;
  int snapshot3Rows = -1;
  try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
   snapshot3Rows = TEST_UTIL.countRows(table);
  }
  admin.cloneSnapshot(snapshotName3, clonedTableName3);
  admin.deleteSnapshot(snapshotName3);
  super.testCloneLinksAfterDelete();
  verifyRowCount(TEST_UTIL, clonedTableName3, snapshot3Rows);
  admin.disableTable(clonedTableName3);
  admin.deleteTable(clonedTableName3);
 }
}
origin: apache/hbase

 @Test
 public void testRestoreSnapshotAfterSplittingRegions() throws IOException, InterruptedException {
  List<RegionInfo> regionInfos = admin.getRegions(tableName);
  RegionReplicaUtil.removeNonDefaultRegions(regionInfos);

  // Split the first region
  splitRegion(regionInfos.get(0));

  // Take a snapshot
  admin.snapshot(snapshotName1, tableName);

  // Load more data
  SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 500, FAMILY);

  // Split the second region
  splitRegion(regionInfos.get(1));

  // Restore the snapshot
  admin.disableTable(tableName);
  admin.restoreSnapshot(snapshotName1);
  admin.enableTable(tableName);

  verifyRowCount(TEST_UTIL, tableName, snapshot1Rows);
 }
}
origin: apache/hbase

/**
 * Test simple flush snapshotting a table that is online
 * @throws Exception
 */
@Test
public void testFlushTableSnapshot() throws Exception {
 // make sure we don't fail on listing snapshots
 SnapshotTestingUtils.assertNoSnapshots(admin);
 // put some stuff in the table
 SnapshotTestingUtils.loadData(UTIL, TABLE_NAME, DEFAULT_NUM_ROWS, TEST_FAM);
 LOG.debug("FS state before snapshot:");
 UTIL.getHBaseCluster().getMaster().getMasterFileSystem().logFileSystemState(LOG);
 // take a snapshot of the enabled table
 String snapshotString = "offlineTableSnapshot";
 byte[] snapshot = Bytes.toBytes(snapshotString);
 admin.snapshot(snapshotString, TABLE_NAME, SnapshotType.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
 LOG.debug("FS state after snapshot:");
 UTIL.getHBaseCluster().getMaster().getMasterFileSystem().logFileSystemState(LOG);
 SnapshotTestingUtils.confirmSnapshotValid(UTIL,
  ProtobufUtil.createHBaseProtosSnapshotDesc(snapshots.get(0)), TABLE_NAME, TEST_FAM);
}
origin: apache/hbase

/**
 * Basic end-to-end test of simple-flush-based snapshots
 */
@Test
public void testFlushCreateListDestroy() throws Exception {
 LOG.debug("------- Starting Snapshot test -------------");
 // 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, TABLE_NAME, Bytes.toString(TEST_FAM),
  snapshotName, rootDir, fs, true);
}
origin: apache/hbase

SnapshotTestingUtils.loadData(UTIL, TABLE_NAME, numRows, TEST_FAM);
origin: apache/hbase

SnapshotTestingUtils.loadData(UTIL, TABLE_NAME, numRows, TEST_FAM);
origin: apache/hbase

HBaseTestingUtility.modifyTableSync(TEST_UTIL.getAdmin(), table1Desc);
SnapshotTestingUtils.loadData(TEST_UTIL, table1, 50, fam2Name);
HTable t1 = (HTable) conn.getTable(table1);
int rows0 = MobSnapshotTestingUtils.countMobRows(t1, fam2Name);
origin: apache/hbase

SnapshotTestingUtils.loadData(UTIL, tableName, 500, TEST_FAM);
try (Table table = UTIL.getConnection().getTable(tableName)) {
 snapshot0Rows = UTIL.countRows(table);
SnapshotTestingUtils.loadData(UTIL, tableName, 500, TEST_FAM);
try (Table table = UTIL.getConnection().getTable(tableName)) {
 snapshot1Rows = UTIL.countRows(table);
origin: apache/hbase

private void createTableAndSnapshots() throws Exception {
 // create Table and disable it
 createTable();
 admin.disableTable(tableName);
 // take an empty snapshot
 admin.snapshot(emptySnapshot, tableName);
 // enable table and insert data
 admin.enableTable(tableName);
 SnapshotTestingUtils.loadData(TEST_UTIL, tableName, numRowsToLoad(), FAMILY);
 try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
  snapshot0Rows = 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, numRowsToLoad(), FAMILY);
 try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
  snapshot1Rows = countRows(table);
 }
 admin.disableTable(tableName);
 // take a snapshot of the updated table
 admin.snapshot(snapshotName1, tableName);
 // re-enable table
 admin.enableTable(tableName);
}
origin: apache/hbase

SnapshotTestingUtils.loadData(UTIL, tableName, 500, TEST_FAM);
try (Table table = UTIL.getConnection().getTable(tableName)) {
 snapshot0Rows = UTIL.countRows(table);
SnapshotTestingUtils.loadData(UTIL, tableName, 500, TEST_FAM);
try (Table table = UTIL.getConnection().getTable(tableName)) {
 snapshot1Rows = UTIL.countRows(table);
origin: apache/hbase

 @Test
 public void testRestoreSnapshotAfterTruncate() throws Exception {
  TableName tableName = TableName.valueOf(getValidMethodName());
  SnapshotTestingUtils.createTable(TEST_UTIL, tableName, getNumReplicas(), FAMILY);
  SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 500, FAMILY);
  int numOfRows = 0;

  try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
   numOfRows = countRows(table);
  }
  // take snapshot
  admin.snapshot("snap", tableName);
  admin.disableTable(tableName);
  admin.truncateTable(tableName, false);
  admin.disableTable(tableName);
  admin.restoreSnapshot("snap");

  admin.enableTable(tableName);
  verifyRowCount(TEST_UTIL, tableName, numOfRows);
  SnapshotTestingUtils.verifyReplicasCameOnline(tableName, admin, getNumReplicas());
 }
}
origin: apache/hbase

TableDescriptor htd = admin.getDescriptor(tableName);
assertEquals(2, htd.getColumnFamilyCount());
SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 500, TEST_FAMILY2);
long snapshot2Rows = snapshot1Rows + 500L;
assertEquals(snapshot2Rows, countRows(table));
org.apache.hadoop.hbase.snapshotSnapshotTestingUtilsloadData

Popular methods of SnapshotTestingUtils

  • deleteAllSnapshots
  • deleteArchiveDirectory
  • createSnapshotAndValidate
    Take a snapshot of the specified table and verify the given families. Note that this will leave the
  • createPreSplitTable
  • waitForTableToBeOnline
  • assertExistsMatchingSnapshot
    Make sure that there is only one snapshot returned from the master and its name and table match the
  • assertNoSnapshots
    Assert that we don't have any snapshots lists
  • assertOneSnapshotThatMatches
    Make sure that there is only one snapshot returned from the master and its name and table match the
  • cleanupSnapshot
  • confirmSnapshotValid
    Confirm that the snapshot contains references to all the files that should be in the snapshot.
  • corruptSnapshot
    Corrupt the specified snapshot by deleting some files.
  • createPut
  • corruptSnapshot,
  • createPut,
  • createTable,
  • expectSnapshotDoneException,
  • getSplitKeys,
  • listHFileNames,
  • snapshot,
  • verifyReplicasCameOnline,
  • verifyRowCount

Popular in Java

  • Running tasks concurrently on multiple threads
  • getResourceAsStream (ClassLoader)
  • setRequestProperty (URLConnection)
  • setContentView (Activity)
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Option (scala)
  • Top 17 Free Sublime Text Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now