本文整理汇总了Java中org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription方法的典型用法代码示例。如果您正苦于以下问题:Java HBaseProtos.SnapshotDescription方法的具体用法?Java HBaseProtos.SnapshotDescription怎么用?Java HBaseProtos.SnapshotDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hbase.protobuf.generated.HBaseProtos
的用法示例。
在下文中一共展示了HBaseProtos.SnapshotDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertSnapshotRequestIsValid
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
/**
* Check to make sure that the description of the snapshot requested is valid
* @param snapshot description of the snapshot
* @throws IllegalArgumentException if the name of the snapshot or the name of the table to
* snapshot are not valid names.
*/
public static void assertSnapshotRequestIsValid(HBaseProtos.SnapshotDescription snapshot)
throws IllegalArgumentException {
// make sure the snapshot name is valid
TableName.isLegalTableQualifierName(Bytes.toBytes(snapshot.getName()), true);
if(snapshot.hasTable()) {
// make sure the table name is valid, this will implicitly check validity
TableName tableName = TableName.valueOf(snapshot.getTable());
if (tableName.isSystemTable()) {
throw new IllegalArgumentException("System table snapshots are not allowed");
}
}
}
示例2: testNamespace
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
@Test
public void testNamespace() throws Exception {
List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
String[] argsParam;
SnapshotArgs args;
Snapshot app;
String fullTableName = null;
try {
// create table with namespace
fullTableName = TEST_NAMESPACE + ":" + TestBase.tableName;
createTable(fullTableName);
// table with namespace
argsParam = new String[]{"localhost", fullTableName};
args = new SnapshotArgs(argsParam);
app = new Snapshot(admin, args);
// create snapshot
app.run();
snapshotDescriptions = admin.listSnapshots(app.getPrefix(fullTableName) + ".*");
assertEquals(1, snapshotDescriptions.size());
} finally {
dropTable(fullTableName);
}
}
示例3: testAfterSuccess
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
@Test
public void testAfterSuccess() throws Exception {
List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
// all tables, keep unlimited
String[] argsParam = {"localhost", ".*", "--test",
"--" + Args.OPTION_AFTER_SUCCESS + "=" + AlertSenderTest.ALERT_SCRIPT};
SnapshotArgs args = new SnapshotArgs(argsParam);
Snapshot app = new Snapshot(admin, args);
int sendCountBefore = AlertSender.getSendCount();
// create snapshot
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(1, snapshotDescriptions.size());
Assert.assertEquals(sendCountBefore + 1, AlertSender.getSendCount());
}
示例4: testExclude
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
@Test
public void testExclude() throws Exception {
List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
String[] argsParam;
SnapshotArgs args;
Snapshot app;
// create table
String tableName2 = createAdditionalTable(tableName + "2");
// with table list
argsParam = new String[]{"localhost", ".*", "--exclude=" + tableName, "--test"};
args = new SnapshotArgs(argsParam);
app = new Snapshot(admin, args);
// create snapshot
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(1, snapshotDescriptions.size());
assertEquals(tableName2, snapshotDescriptions.get(0).getTable());
}
示例5: testExcludeRegexList
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
@Test
public void testExcludeRegexList() throws Exception {
List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
String[] argsParam;
SnapshotArgs args;
Snapshot app;
// create table
String tableName2 = createAdditionalTable(tableName + "2");
createAdditionalTable(tableName + "21");
// with table list
argsParam = new String[]{"localhost", ".*", "--exclude=" + tableName2 + ".*", "--test"};
args = new SnapshotArgs(argsParam);
app = new Snapshot(admin, args);
// create snapshot
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(1, snapshotDescriptions.size());
assertEquals(tableName, snapshotDescriptions.get(0).getTable());
}
示例6: toString
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
/**
* Returns a single line (no \n) representation of snapshot metadata. Use this instead of
* {@link org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription#toString()}. We don't replace SnapshotDescrpition's toString
* because it is auto-generated by protoc.
* @param ssd
* @return Single line string with a summary of the snapshot parameters
*/
public static String toString(HBaseProtos.SnapshotDescription ssd) {
if (ssd == null) {
return null;
}
return "{ ss=" + ssd.getName() +
" table=" + (ssd.hasTable()?TableName.valueOf(ssd.getTable()):"") +
" type=" + ssd.getType() + " }";
}
示例7: testAllTables
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
@Test
public void testAllTables() throws Exception {
List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
// create tables
createAdditionalTable(tableName + "2");
createAdditionalTable(tableName + "3");
// all tables, keep unlimited
String[] argsParam = {"localhost", ".*", "--test"};
SnapshotArgs args = new SnapshotArgs(argsParam);
Snapshot app = new Snapshot(admin, args);
// create snapshot 1
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(3, snapshotDescriptions.size());
// create snapshot 2
Thread.sleep(1000);
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(6, snapshotDescriptions.size());
// create snapshot 3
Thread.sleep(1000);
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(9, snapshotDescriptions.size());
// create snapshot 3
Thread.sleep(1000);
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(12, snapshotDescriptions.size());
}
示例8: testList
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
@Test
public void testList() throws Exception {
List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
String[] argsParam;
SnapshotArgs args;
Snapshot app;
// create table
String tableName2 = createAdditionalTable(tableName + "2");
// with table list
argsParam = new String[]{"localhost", tableName + "," + tableName2};
args = new SnapshotArgs(argsParam);
app = new Snapshot(admin, args);
// create snapshot
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(2, snapshotDescriptions.size());
// with table list contains blank
argsParam = new String[]{"localhost", tableName + " , " + tableName2};
args = new SnapshotArgs(argsParam);
app = new Snapshot(admin, args);
// create snapshot
Thread.sleep(1000);
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(4, snapshotDescriptions.size());
}
示例9: testSkipFlush
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
@Test
public void testSkipFlush() throws Exception {
List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
String[] argsParam;
SnapshotArgs args;
Snapshot app;
// skip flush
argsParam = new String[]{"localhost", ".*", "--skip-flush=true", "--test"};
args = new SnapshotArgs(argsParam);
app = new Snapshot(admin, args);
// create snapshot
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(1, snapshotDescriptions.size());
assertEquals(HBaseProtos.SnapshotDescription.Type.SKIPFLUSH, snapshotDescriptions.get(0).getType());
// do not skip flush
argsParam = new String[]{"localhost", ".*", "--test"};
args = new SnapshotArgs(argsParam);
app = new Snapshot(admin, args);
// create snapshot
Thread.sleep(1000);
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(2, snapshotDescriptions.size());
assertEquals(HBaseProtos.SnapshotDescription.Type.FLUSH, snapshotDescriptions.get(1).getType());
}
示例10: testRegexList
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
@Test
public void testRegexList() throws Exception {
// create tables
String tableName2 = createAdditionalTable(tableName + "2");
String tableName3 = createAdditionalTable(tableName + "3");
List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
// all tables, keep unlimited
String[] argsParam = {"localhost", tableName + ".*," + tableName2 + ".*," + tableName3 + ".*"};
SnapshotArgs args = new SnapshotArgs(argsParam);
Snapshot app = new Snapshot(admin, args);
// create snapshot 1
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(3, snapshotDescriptions.size());
// create snapshot 2
Thread.sleep(1000);
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(6, snapshotDescriptions.size());
// create snapshot 3
Thread.sleep(1000);
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(9, snapshotDescriptions.size());
// create snapshot 3
Thread.sleep(1000);
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(12, snapshotDescriptions.size());
}
示例11: testDetailList
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
@Test
public void testDetailList() throws Exception {
List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
String[] argsParam;
SnapshotArgs args;
Snapshot app;
// create table
String tableName2 = createAdditionalTable(tableName + "2");
// with table list
argsParam = new String[]{"localhost", tableName + "/1/true," + tableName2 + "/2/false"};
args = new SnapshotArgs(argsParam);
app = new Snapshot(admin, args);
// create snapshot 1
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(2, snapshotDescriptions.size());
assertEquals(tableName2, snapshotDescriptions.get(0).getTable());
assertEquals(HBaseProtos.SnapshotDescription.Type.FLUSH, snapshotDescriptions.get(0).getType());
assertEquals(tableName, snapshotDescriptions.get(1).getTable());
assertEquals(HBaseProtos.SnapshotDescription.Type.SKIPFLUSH, snapshotDescriptions.get(1).getType());
// create snapshot 2
Thread.sleep(1000);
app.run();
snapshotDescriptions = listSnapshots(tableName + ".*");
assertEquals(3, snapshotDescriptions.size());
assertEquals(tableName2, snapshotDescriptions.get(0).getTable());
assertEquals(HBaseProtos.SnapshotDescription.Type.FLUSH, snapshotDescriptions.get(0).getType());
assertEquals(tableName2, snapshotDescriptions.get(1).getTable());
assertEquals(HBaseProtos.SnapshotDescription.Type.FLUSH, snapshotDescriptions.get(1).getType());
assertEquals(tableName, snapshotDescriptions.get(2).getTable());
assertEquals(HBaseProtos.SnapshotDescription.Type.SKIPFLUSH, snapshotDescriptions.get(2).getType());
}
示例12: takeSnapshotAsync
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
@Override
public MasterProtos.SnapshotResponse takeSnapshotAsync(HBaseProtos.SnapshotDescription snapshot) throws IOException {
throw new UnsupportedOperationException("takeSnapshotAsync");
}
示例13: isSnapshotFinished
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
@Override
public boolean isSnapshotFinished(HBaseProtos.SnapshotDescription snapshot) throws IOException {
throw new UnsupportedOperationException("isSnapshotFinished");
}
示例14: listSnapshots
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
@Override
public List<HBaseProtos.SnapshotDescription> listSnapshots() throws IOException {
throw new UnsupportedOperationException("listSnapshots");
}
示例15: listSnapshots
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; //导入方法依赖的package包/类
@Override
public List<HBaseProtos.SnapshotDescription> listSnapshots(String string) throws IOException {
return wrappedHbaseAdmin.listSnapshots(string);
}