Search in sources :

Example 16 with VerifyParams

use of org.apache.accumulo.test.VerifyIngest.VerifyParams in project accumulo by apache.

the class BulkIT method runTest.

static void runTest(AccumuloClient c, ClientInfo info, FileSystem fs, Path basePath, String tableName, String filePrefix, String dirSuffix, boolean useOld) throws Exception {
    c.tableOperations().create(tableName);
    Path base = new Path(basePath, "testBulkFail_" + dirSuffix);
    fs.delete(base, true);
    fs.mkdirs(base);
    fs.deleteOnExit(base);
    Path bulkFailures = new Path(base, "failures");
    fs.deleteOnExit(bulkFailures);
    Path files = new Path(base, "files");
    fs.deleteOnExit(files);
    fs.mkdirs(bulkFailures);
    fs.mkdirs(files);
    IngestParams params = new IngestParams(info.getProperties(), tableName, N);
    params.timestamp = 1;
    params.random = 56;
    params.cols = 1;
    String fileFormat = filePrefix + "rf%02d";
    for (int i = 0; i < COUNT; i++) {
        params.outputFile = new Path(files, String.format(fileFormat, i)).toString();
        params.startRow = N * i;
        TestIngest.ingest(c, fs, params);
    }
    params.outputFile = new Path(files, String.format(fileFormat, N)).toString();
    params.startRow = N;
    params.rows = 1;
    // create an rfile with one entry, there was a bug with this:
    TestIngest.ingest(c, fs, params);
    bulkLoad(c, tableName, bulkFailures, files, useOld);
    VerifyParams verifyParams = new VerifyParams(info.getProperties(), tableName, N);
    verifyParams.random = 56;
    for (int i = 0; i < COUNT; i++) {
        verifyParams.startRow = i * N;
        VerifyIngest.verifyIngest(c, verifyParams);
    }
    verifyParams.startRow = N;
    verifyParams.rows = 1;
    VerifyIngest.verifyIngest(c, verifyParams);
}
Also used : Path(org.apache.hadoop.fs.Path) VerifyParams(org.apache.accumulo.test.VerifyIngest.VerifyParams) IngestParams(org.apache.accumulo.test.TestIngest.IngestParams)

Example 17 with VerifyParams

use of org.apache.accumulo.test.VerifyIngest.VerifyParams in project accumulo by apache.

the class ManagerFailoverIT method test.

@Test
public void test() throws Exception {
    try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
        String[] names = getUniqueNames(2);
        c.tableOperations().create(names[0]);
        VerifyParams params = new VerifyParams(getClientProps(), names[0]);
        TestIngest.ingest(c, params);
        ClusterControl control = cluster.getClusterControl();
        control.stopAllServers(ServerType.MANAGER);
        // start up a new one
        control.startAllServers(ServerType.MANAGER);
        // talk to it
        c.tableOperations().rename(names[0], names[1]);
        params.tableName = names[1];
        VerifyIngest.verifyIngest(c, params);
    }
}
Also used : AccumuloClient(org.apache.accumulo.core.client.AccumuloClient) VerifyParams(org.apache.accumulo.test.VerifyIngest.VerifyParams) ClusterControl(org.apache.accumulo.cluster.ClusterControl) Test(org.junit.Test)

Example 18 with VerifyParams

use of org.apache.accumulo.test.VerifyIngest.VerifyParams in project accumulo by apache.

the class GarbageCollectorIT method gcTest.

@Test
public void gcTest() throws Exception {
    killMacGc();
    final String table = "test_ingest";
    try (AccumuloClient c = Accumulo.newClient().from(getClientProperties()).build()) {
        c.tableOperations().create(table);
        c.tableOperations().setProperty(table, Property.TABLE_SPLIT_THRESHOLD.getKey(), "5K");
        VerifyParams params = new VerifyParams(getClientProperties(), table, 10_000);
        params.cols = 1;
        TestIngest.ingest(c, cluster.getFileSystem(), params);
        c.tableOperations().compact(table, null, null, true, true);
        int before = countFiles();
        while (true) {
            sleepUninterruptibly(1, TimeUnit.SECONDS);
            int more = countFiles();
            if (more <= before)
                break;
            before = more;
        }
        // restart GC
        getCluster().start();
        sleepUninterruptibly(15, TimeUnit.SECONDS);
        int after = countFiles();
        VerifyIngest.verifyIngest(c, params);
        assertTrue(after < before);
    }
}
Also used : AccumuloClient(org.apache.accumulo.core.client.AccumuloClient) VerifyParams(org.apache.accumulo.test.VerifyIngest.VerifyParams) Test(org.junit.Test)

Example 19 with VerifyParams

use of org.apache.accumulo.test.VerifyIngest.VerifyParams in project accumulo by apache.

the class BulkSplitOptimizationIT method testBulkSplitOptimization.

@Test
public void testBulkSplitOptimization() throws Exception {
    try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
        final String tableName = getUniqueNames(1)[0];
        c.tableOperations().create(tableName);
        c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "1000");
        c.tableOperations().setProperty(tableName, Property.TABLE_FILE_MAX.getKey(), "1000");
        c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "1G");
        FileSystem fs = cluster.getFileSystem();
        Path testDir = new Path(cluster.getTemporaryPath(), "testmf");
        fs.deleteOnExit(testDir);
        FunctionalTestUtils.createRFiles(c, fs, testDir.toString(), ROWS, SPLITS, 8);
        FileStatus[] stats = fs.listStatus(testDir);
        System.out.println("Number of generated files: " + stats.length);
        c.tableOperations().importDirectory(testDir.toString()).to(tableName).load();
        FunctionalTestUtils.checkSplits(c, tableName, 0, 0);
        FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 100, 100);
        // initiate splits
        c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "100K");
        sleepUninterruptibly(2, TimeUnit.SECONDS);
        // wait until over split threshold -- should be 78 splits
        while (c.tableOperations().listSplits(tableName).size() < 75) {
            sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
        }
        FunctionalTestUtils.checkSplits(c, tableName, 50, 100);
        VerifyParams params = new VerifyParams(getClientProps(), tableName, ROWS);
        params.timestamp = 1;
        params.dataSize = 50;
        params.random = 56;
        params.startRow = 0;
        params.cols = 1;
        VerifyIngest.verifyIngest(c, params);
        // ensure each tablet does not have all map files, should be ~2.5 files per tablet
        FunctionalTestUtils.checkRFiles(c, tableName, 50, 100, 1, 4);
    }
}
Also used : AccumuloClient(org.apache.accumulo.core.client.AccumuloClient) Path(org.apache.hadoop.fs.Path) FileStatus(org.apache.hadoop.fs.FileStatus) FileSystem(org.apache.hadoop.fs.FileSystem) VerifyParams(org.apache.accumulo.test.VerifyIngest.VerifyParams) Test(org.junit.Test)

Example 20 with VerifyParams

use of org.apache.accumulo.test.VerifyIngest.VerifyParams in project accumulo by apache.

the class DeleteIT method deleteTest.

public static void deleteTest(AccumuloClient c, AccumuloCluster cluster, String tableName) throws Exception {
    VerifyParams params = new VerifyParams(getClientProps(), tableName, 1000);
    params.cols = 1;
    params.random = 56;
    TestIngest.ingest(c, params);
    assertEquals(0, cluster.getClusterControl().exec(TestRandomDeletes.class, new String[] { "-c", cluster.getClientPropsPath(), "--table", tableName }));
    TestIngest.ingest(c, params);
    VerifyIngest.verifyIngest(c, params);
}
Also used : TestRandomDeletes(org.apache.accumulo.test.TestRandomDeletes) VerifyParams(org.apache.accumulo.test.VerifyIngest.VerifyParams)

Aggregations

VerifyParams (org.apache.accumulo.test.VerifyIngest.VerifyParams)20 Test (org.junit.Test)16 AccumuloClient (org.apache.accumulo.core.client.AccumuloClient)15 ClusterControl (org.apache.accumulo.cluster.ClusterControl)5 Path (org.apache.hadoop.fs.Path)4 IOException (java.io.IOException)3 FileSystem (org.apache.hadoop.fs.FileSystem)3 AccumuloException (org.apache.accumulo.core.client.AccumuloException)2 AccumuloSecurityException (org.apache.accumulo.core.client.AccumuloSecurityException)2 Scanner (org.apache.accumulo.core.client.Scanner)2 NewTableConfiguration (org.apache.accumulo.core.client.admin.NewTableConfiguration)2 ClientInfo (org.apache.accumulo.core.clientImpl.ClientInfo)2 TableId (org.apache.accumulo.core.data.TableId)2 KeyExtent (org.apache.accumulo.core.dataImpl.KeyExtent)2 ZooCache (org.apache.accumulo.fate.zookeeper.ZooCache)2 ZooReader (org.apache.accumulo.fate.zookeeper.ZooReader)2 IngestParams (org.apache.accumulo.test.TestIngest.IngestParams)2 FileNotFoundException (java.io.FileNotFoundException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1