org.apache.hadoop.hbase.protobuf.generated.HBaseProtos Java Examples

The following examples show how to use org.apache.hadoop.hbase.protobuf.generated.HBaseProtos. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SnapshotTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example #2
Source File: HBaseMetadata.java    From presto-hbase-connector with Apache License 2.0 6 votes vote down vote up
/**
 * create snapshot
 *
 * @param snapshotName snapshot name
 * @param admin        admin
 * @param schemaName   schema name
 * @param tableName    table name
 * @throws IOException io exception
 */
public static void createSnapshot(String snapshotName,
                                  Admin admin,
                                  String schemaName,
                                  String tableName) throws IOException {
    long start = System.currentTimeMillis();
    String fullTableName;
    if (Constant.HBASE_NAMESPACE_DEFAULT.equals(schemaName)
            || "".equals(schemaName)) {
        fullTableName = tableName;
    } else {
        fullTableName = schemaName + ":" + tableName;
    }
    HBaseProtos.SnapshotDescription snapshot = HBaseProtos.SnapshotDescription.newBuilder()
            .setName(snapshotName)
            .setTable(fullTableName)
            .setType(HBaseProtos.SnapshotDescription.Type.FLUSH)
            // .setType(HBaseProtos.SnapshotDescription.Type.DISABLED)
            .build();
    admin.snapshot(snapshot);
    log.info("createSnapshot: create snapshot " + snapshotName
            + " used " + (System.currentTimeMillis() - start) + " mill seconds.");
}
 
Example #3
Source File: SnapshotOptionAfterScriptTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #4
Source File: SnapshotOptionTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #5
Source File: SnapshotOptionTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@Test
public void testClearWatchLeak() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // with option
    argsParam = new String[]{"localhost", ".*", "--test", "--clear-watch-leak"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
}
 
Example #6
Source File: SnapshotOptionTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #7
Source File: SnapshotTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@Test
public void testDuplicatedName() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    argsParam = new String[]{"localhost", ".*", "--test"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    String snapshotName = app.getPrefix(tableName) + "test";
    // create snapshot first
    app.snapshot(null, tableName, snapshotName);
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());

    // create snapshot again
    app.snapshot(null, tableName, snapshotName);
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
}
 
Example #8
Source File: SnapshotTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example #9
Source File: SnapshotOptionAfterScriptTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #10
Source File: SnapshotOptionTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #11
Source File: SnapshotOptionTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #12
Source File: SnapshotTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@Test
public void testDuplicatedName() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    argsParam = new String[]{"localhost", ".*", "--test"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    String snapshotName = app.getPrefix(tableName) + "test";
    // create snapshot first
    app.snapshot(null, tableName, snapshotName);
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());

    // create snapshot again
    app.snapshot(null, tableName, snapshotName);
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
}
 
Example #13
Source File: SnapshotTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@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);
    }
}
 
Example #14
Source File: SnapshotOptionAfterScriptTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #15
Source File: SnapshotOptionTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #16
Source File: SnapshotOptionTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@Test
public void testClearWatchLeak() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // with option
    argsParam = new String[]{"localhost", ".*", "--test", "--clear-watch-leak"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
}
 
Example #17
Source File: SnapshotOptionTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #18
Source File: SnapshotTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@Test
public void testDuplicatedName() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    argsParam = new String[]{"localhost", ".*", "--test"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    String snapshotName = app.getPrefix(tableName) + "test";
    // create snapshot first
    app.snapshot(null, tableName, snapshotName);
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());

    // create snapshot again
    app.snapshot(null, tableName, snapshotName);
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
}
 
Example #19
Source File: Utils.java    From presto-hbase-connector with Apache License 2.0 6 votes vote down vote up
/**
 * get region infos
 *
 * @param zookeeperQuorum     zookeeper quorum
 * @param zookeeperClientPort zookeeper client port
 * @param hBaseRootDir        HBase root dir
 * @param snapshotName        snapshot name
 * @return region info list
 * @throws IOException IOException
 */
public static List<HRegionInfo> getRegionInfos(String zookeeperQuorum, String zookeeperClientPort,
                                               String hBaseRootDir, String snapshotName) throws IOException {
    try {
        Configuration conf = Utils.getHadoopConf(zookeeperQuorum, zookeeperClientPort);
        Path root = new Path(hBaseRootDir);
        FileSystem fs = FileSystem.get(conf);
        Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, root);
        HBaseProtos.SnapshotDescription snapshotDesc = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir);
        SnapshotManifest manifest = SnapshotManifest.open(conf, fs, snapshotDir, snapshotDesc);
        return Utils.getRegionInfosFromManifest(manifest);
    } catch (IOException ex) {
        logger.error("get region info error: " + ex.getMessage(), ex);
        throw ex;
    }
}
 
Example #20
Source File: SnapshotOptionTest.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@Test
public void testClearWatchLeak() throws Exception {
    List<HBaseProtos.SnapshotDescription> snapshotDescriptions;
    String[] argsParam;
    SnapshotArgs args;
    Snapshot app;

    // with option
    argsParam = new String[]{"localhost", ".*", "--test", "--clear-watch-leak"};
    args = new SnapshotArgs(argsParam);
    app = new Snapshot(admin, args);

    // create snapshot
    app.run();
    snapshotDescriptions = listSnapshots(tableName + ".*");
    assertEquals(1, snapshotDescriptions.size());
}
 
Example #21
Source File: SnapshotTableArgTest.java    From hbase-tools with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example #22
Source File: SnapshotTableArgTest.java    From hbase-tools with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example #23
Source File: SnapshotTest.java    From hbase-tools with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example #24
Source File: TestBase.java    From hbase-tools with Apache License 2.0 5 votes vote down vote up
protected void deleteSnapshots(String tableName) throws Exception {
    for (HBaseProtos.SnapshotDescription snapshotDescription : admin.listSnapshots(".*" + tableName + ".*")) {
        if (snapshotDescription.getTable().equals(tableName) || snapshotDescription.getTable().equals(TEST_NAMESPACE + ":" + tableName)) {
            admin.deleteSnapshots(snapshotDescription.getName());
        }
    }
}
 
Example #25
Source File: SnapshotAdapter.java    From hbase-tools with Apache License 2.0 5 votes vote down vote up
public static HBaseProtos.SnapshotDescription.Type getType(OptionSet optionSet) {
    if (optionSet.has(Args.OPTION_SKIP_FLUSH)) {
        return HBaseProtos.SnapshotDescription.Type.SKIPFLUSH;
    } else {
        return HBaseProtos.SnapshotDescription.Type.FLUSH;
    }
}
 
Example #26
Source File: SnapshotAdapter.java    From hbase-tools with Apache License 2.0 5 votes vote down vote up
public static HBaseProtos.SnapshotDescription.Type getType(String tableName, Map<String, Boolean> tableFlushMap) {
    if (tableFlushMap.get(tableName)) {
        return HBaseProtos.SnapshotDescription.Type.SKIPFLUSH;
    } else {
        return HBaseProtos.SnapshotDescription.Type.FLUSH;
    }
}
 
Example #27
Source File: SnapshotArgs.java    From hbase-tools with Apache License 2.0 5 votes vote down vote up
public HBaseProtos.SnapshotDescription.Type flushType(String tableName) {
    if (tableFlushMap.get(tableName) == null) {
        return SnapshotAdapter.getType(optionSet);
    } else {
        return SnapshotAdapter.getType(tableName, tableFlushMap);
    }
}
 
Example #28
Source File: SnapshotAdapter.java    From hbase-tools with Apache License 2.0 5 votes vote down vote up
public static HBaseProtos.SnapshotDescription.Type getType(String tableName, Map<String, Boolean> tableFlushMap) {
    if (tableFlushMap.get(tableName)) {
        return HBaseProtos.SnapshotDescription.Type.SKIPFLUSH;
    } else {
        return HBaseProtos.SnapshotDescription.Type.FLUSH;
    }
}
 
Example #29
Source File: SnapshotTest.java    From hbase-tools with Apache License 2.0 5 votes vote down vote up
@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());
}
 
Example #30
Source File: SnapshotAdapter.java    From hbase-tools with Apache License 2.0 5 votes vote down vote up
public static HBaseProtos.SnapshotDescription.Type getType(String tableName, Map<String, Boolean> tableFlushMap) {
    if (tableFlushMap.get(tableName)) {
        return HBaseProtos.SnapshotDescription.Type.SKIPFLUSH;
    } else {
        return HBaseProtos.SnapshotDescription.Type.FLUSH;
    }
}