Search in sources :

Example 1 with SnapshotMock

use of org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils.SnapshotMock in project hbase by apache.

the class TestExportSnapshotNoCluster method testSnapshotWithRefsExportFileSystemState.

/**
   * Mock a snapshot with files in the archive dir,
   * two regions, and one reference file.
   */
@Test
public void testSnapshotWithRefsExportFileSystemState() throws Exception {
    SnapshotMock snapshotMock = new SnapshotMock(TEST_UTIL.getConfiguration(), fs, testDir);
    SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV2("tableWithRefsV1", "tableWithRefsV1");
    testSnapshotWithRefsExportFileSystemState(builder);
    snapshotMock = new SnapshotMock(TEST_UTIL.getConfiguration(), fs, testDir);
    builder = snapshotMock.createSnapshotV2("tableWithRefsV2", "tableWithRefsV2");
    testSnapshotWithRefsExportFileSystemState(builder);
}
Also used : SnapshotMock(org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils.SnapshotMock) Test(org.junit.Test)

Example 2 with SnapshotMock

use of org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils.SnapshotMock in project hbase by apache.

the class TestExportSnapshotV2NoCluster method testSnapshotWithRefsExportFileSystemState.

@Test
public void testSnapshotWithRefsExportFileSystemState() throws Exception {
    final SnapshotMock snapshotMock = new SnapshotMock(testUtil.getConfiguration(), testDir.getFileSystem(testUtil.getConfiguration()), testDir);
    final SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV2("tableWithRefsV2", "tableWithRefsV2");
    TestExportSnapshotV1NoCluster.testSnapshotWithRefsExportFileSystemState(this.fs, builder, this.testUtil, this.testDir);
}
Also used : SnapshotMock(org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils.SnapshotMock) Test(org.junit.Test)

Example 3 with SnapshotMock

use of org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils.SnapshotMock in project hbase by apache.

the class TestRestoreSnapshotHelper method restoreAndVerify.

private void restoreAndVerify(final String snapshotName, final String tableName) throws IOException {
    // Test Rolling-Upgrade like Snapshot.
    // half machines writing using v1 and the others using v2 format.
    SnapshotMock snapshotMock = createSnapshotMock();
    SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV2("snapshot", tableName);
    builder.addRegionV1();
    builder.addRegionV2();
    builder.addRegionV2();
    builder.addRegionV1();
    Path snapshotDir = builder.commit();
    TableDescriptor htd = builder.getTableDescriptor();
    SnapshotDescription desc = builder.getSnapshotDescription();
    // Test clone a snapshot
    TableDescriptor htdClone = snapshotMock.createHtd("testtb-clone");
    testRestore(snapshotDir, desc, htdClone);
    verifyRestore(rootDir, htd, htdClone);
    // Test clone a clone ("link to link")
    SnapshotDescription cloneDesc = SnapshotDescription.newBuilder().setName("cloneSnapshot").setTable("testtb-clone").build();
    Path cloneDir = CommonFSUtils.getTableDir(rootDir, htdClone.getTableName());
    TableDescriptor htdClone2 = snapshotMock.createHtd("testtb-clone2");
    testRestore(cloneDir, cloneDesc, htdClone2);
    verifyRestore(rootDir, htd, htdClone2);
}
Also used : Path(org.apache.hadoop.fs.Path) SnapshotDescription(org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription) SnapshotMock(org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils.SnapshotMock) TableDescriptor(org.apache.hadoop.hbase.client.TableDescriptor)

Example 4 with SnapshotMock

use of org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils.SnapshotMock in project hbase by apache.

the class TestExportSnapshotV1NoCluster method testSnapshotWithRefsExportFileSystemState.

/**
 * V1 snapshot test
 */
@Test
public void testSnapshotWithRefsExportFileSystemState() throws Exception {
    final SnapshotMock snapshotMock = new SnapshotMock(testUtil.getConfiguration(), this.fs, testDir);
    final SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV1("tableWithRefsV1", "tableWithRefsV1");
    testSnapshotWithRefsExportFileSystemState(this.fs, builder, testUtil, testDir);
}
Also used : SnapshotMock(org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils.SnapshotMock) Test(org.junit.Test)

Example 5 with SnapshotMock

use of org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils.SnapshotMock in project hbase by apache.

the class TestSnapshotFileCache method createAndTestSnapshotV2.

private void createAndTestSnapshotV2(final SnapshotFileCache cache, final String name, final boolean tmp, final boolean removeOnExit, boolean setFolderTime) throws IOException {
    SnapshotMock snapshotMock = new SnapshotMock(conf, fs, rootDir);
    SnapshotMock.SnapshotBuilder builder = snapshotMock.createSnapshotV2(name, name);
    createAndTestSnapshot(cache, builder, tmp, removeOnExit, setFolderTime);
}
Also used : SnapshotMock(org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils.SnapshotMock)

Aggregations

SnapshotMock (org.apache.hadoop.hbase.snapshot.SnapshotTestingUtils.SnapshotMock)6 Test (org.junit.Test)3 Path (org.apache.hadoop.fs.Path)1 TableDescriptor (org.apache.hadoop.hbase.client.TableDescriptor)1 SnapshotDescription (org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription)1