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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations