Search in sources :

Example 6 with IngestParams

use of org.apache.accumulo.test.TestIngest.IngestParams 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)

Aggregations

IngestParams (org.apache.accumulo.test.TestIngest.IngestParams)6 AccumuloClient (org.apache.accumulo.core.client.AccumuloClient)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)2 NewTableConfiguration (org.apache.accumulo.core.client.admin.NewTableConfiguration)2 VerifyParams (org.apache.accumulo.test.VerifyIngest.VerifyParams)2 HashMap (java.util.HashMap)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 BatchWriterConfig (org.apache.accumulo.core.client.BatchWriterConfig)1 Range (org.apache.accumulo.core.data.Range)1 Path (org.apache.hadoop.fs.Path)1 Text (org.apache.hadoop.io.Text)1