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

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

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

origin: apache/hbase

/**
 * Take a snapshot of the specified table and verify that the given family is
 * not empty. Note that this will leave the table disabled
 * in the case of an offline snapshot.
 */
public static void createSnapshotAndValidate(Admin admin,
  TableName tableName, String familyName, String snapshotNameString,
  Path rootDir, FileSystem fs, boolean onlineSnapshot)
  throws Exception {
 ArrayList<byte[]> nonEmptyFamilyNames = new ArrayList<>(1);
 nonEmptyFamilyNames.add(Bytes.toBytes(familyName));
 createSnapshotAndValidate(admin, tableName, nonEmptyFamilyNames, /* emptyFamilyNames= */ null,
              snapshotNameString, rootDir, fs, onlineSnapshot);
}
origin: apache/hbase

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

SnapshotTestingUtils.createSnapshotAndValidate(admin, tableName,
 Arrays.asList(FAMILIES), null, snapshotName, rootDir, fs, true);
origin: apache/hbase

@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);
 }
}
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.createSnapshotAndValidate(admin, originalTableName, null,
 familiesList, snapshotNameAsString, rootDir, fs, /* onlineSnapshot= */ false);
origin: apache/hbase

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

final byte[] snapshotName = Bytes.toBytes(snapshotNameAsString);
SnapshotTestingUtils.createSnapshotAndValidate(admin, originalTableName,
 familiesWithDataList, emptyFamiliesList, snapshotNameAsString, rootDir, fs,
 /* onlineSnapshot= */ false);
origin: apache/hbase

FileSystem fs = rootDir.getFileSystem(conf1);
String sourceSnapshotName = "sourceSnapshot-" + System.currentTimeMillis();
SnapshotTestingUtils.createSnapshotAndValidate(utility1.getAdmin(), tableName,
 new String(famName), sourceSnapshotName, rootDir, fs, true);
FileSystem peerFs = peerRootDir.getFileSystem(conf2);
String peerSnapshotName = "peerSnapshot-" + System.currentTimeMillis();
SnapshotTestingUtils.createSnapshotAndValidate(utility2.getAdmin(), tableName,
 new String(famName), peerSnapshotName, peerRootDir, peerFs, true);
SnapshotTestingUtils.createSnapshotAndValidate(utility1.getAdmin(), tableName,
 new String(famName), sourceSnapshotName, rootDir, fs, true);
SnapshotTestingUtils.createSnapshotAndValidate(utility2.getAdmin(), tableName,
 new String(famName), peerSnapshotName, peerRootDir, peerFs, true);
origin: apache/hbase

FileSystem fs = rootDir.getFileSystem(UTIL.getConfiguration());
SnapshotTestingUtils.createSnapshotAndValidate(admin, tableName, Arrays.asList(FAMILIES),
 null, snapshotName, rootDir, fs, true);
origin: apache/hbase

FileSystem fs = rootDir.getFileSystem(UTIL.getConfiguration());
SnapshotTestingUtils.createSnapshotAndValidate(admin, tableName,
 Arrays.asList(FAMILIES), null, snapshotName, rootDir, fs, true);
origin: org.apache.hbase/hbase-server

/**
 * Take a snapshot of the specified table and verify that the given family is
 * not empty. Note that this will leave the table disabled
 * in the case of an offline snapshot.
 */
public static void createSnapshotAndValidate(Admin admin,
  TableName tableName, String familyName, String snapshotNameString,
  Path rootDir, FileSystem fs, boolean onlineSnapshot)
  throws Exception {
 ArrayList<byte[]> nonEmptyFamilyNames = new ArrayList<>(1);
 nonEmptyFamilyNames.add(Bytes.toBytes(familyName));
 createSnapshotAndValidate(admin, tableName, nonEmptyFamilyNames, /* emptyFamilyNames= */ null,
              snapshotNameString, rootDir, fs, onlineSnapshot);
}
origin: org.apache.hbase/hbase-server

/**
 * 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);
}
origin: com.aliyun.hbase/alihbase-mapreduce

SnapshotTestingUtils.createSnapshotAndValidate(admin, tableName,
 Arrays.asList(FAMILIES), null, snapshotName, rootDir, fs, true);
origin: org.apache.hbase/hbase-mapreduce

SnapshotTestingUtils.createSnapshotAndValidate(admin, tableName,
 Arrays.asList(FAMILIES), null, snapshotName, rootDir, fs, true);
origin: org.apache.hbase/hbase-mapreduce

@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);
 }
}
origin: com.aliyun.hbase/alihbase-mapreduce

@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);
 }
}
origin: org.apache.hbase/hbase-server

/**
 * 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: org.apache.hbase/hbase-server

SnapshotTestingUtils.createSnapshotAndValidate(admin, originalTableName, null,
 familiesList, snapshotNameAsString, rootDir, fs, /* onlineSnapshot= */ false);
origin: org.apache.hbase/hbase-server

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();
}
org.apache.hadoop.hbase.snapshotSnapshotTestingUtilscreateSnapshotAndValidate

Javadoc

Take a snapshot of the specified table and verify that the given family is not empty. Note that this will leave the table disabled in the case of an offline snapshot.

Popular methods of SnapshotTestingUtils

  • deleteAllSnapshots
  • deleteArchiveDirectory
  • loadData
  • 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

  • Finding current android device location
  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • findViewById (Activity)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JButton (javax.swing)
  • JLabel (javax.swing)
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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