Search in sources :

Example 1 with CassandraHadoopScanRunner

use of org.janusgraph.hadoop.scan.CassandraHadoopScanRunner in project janusgraph by JanusGraph.

the class CassandraScanJobIT method testSimpleScan.

@Test
public void testSimpleScan() throws InterruptedException, ExecutionException, IOException, BackendException {
    int keys = 1000;
    int cols = 40;
    String[][] values = KeyValueStoreUtil.generateData(keys, cols);
    // Make it only half the number of columns for every 2nd key
    for (int i = 0; i < values.length; i++) {
        if (i % 2 == 0)
            values[i] = Arrays.copyOf(values[i], cols / 2);
    }
    log.debug("Loading values: " + keys + "x" + cols);
    KeyColumnValueStoreManager mgr = new CassandraThriftStoreManager(GraphDatabaseConfiguration.buildGraphConfiguration());
    KeyColumnValueStore store = mgr.openDatabase("edgestore");
    StoreTransaction tx = mgr.beginTransaction(StandardBaseTransactionConfig.of(TimestampProviders.MICRO));
    KeyColumnValueStoreUtil.loadValues(store, tx, values);
    // noop on Cassandra, but harmless
    tx.commit();
    SimpleScanJobRunner runner = (ScanJob job, Configuration jobConf, String rootNSName) -> {
        try {
            return new CassandraHadoopScanRunner(job).scanJobConf(jobConf).scanJobConfRoot(rootNSName).partitionerOverride("org.apache.cassandra.dht.Murmur3Partitioner").run();
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    };
    SimpleScanJob.runBasicTests(keys, cols, runner);
}
Also used : KeyColumnValueStore(org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStore) JanusGraphHadoopConfiguration(org.janusgraph.hadoop.config.JanusGraphHadoopConfiguration) GraphDatabaseConfiguration(org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration) CassandraThriftStoreManager(org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftStoreManager) StoreTransaction(org.janusgraph.diskstorage.keycolumnvalue.StoreTransaction) KeyColumnValueStoreManager(org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStoreManager) CassandraHadoopScanRunner(org.janusgraph.hadoop.scan.CassandraHadoopScanRunner) ScanJob(org.janusgraph.diskstorage.keycolumnvalue.scan.ScanJob) Test(org.junit.Test) JanusGraphBaseTest(org.janusgraph.graphdb.JanusGraphBaseTest)

Example 2 with CassandraHadoopScanRunner

use of org.janusgraph.hadoop.scan.CassandraHadoopScanRunner in project janusgraph by JanusGraph.

the class MapReduceIndexJobs method cassandraRepair.

public static ScanMetrics cassandraRepair(Properties janusgraphProperties, String indexName, String relationType, String partitionerName, Configuration hadoopBaseConf) throws InterruptedException, IOException, ClassNotFoundException {
    IndexRepairJob job = new IndexRepairJob();
    CassandraHadoopScanRunner cr = new CassandraHadoopScanRunner(job);
    ModifiableConfiguration mc = getIndexJobConf(indexName, relationType);
    copyPropertiesToInputAndOutputConf(hadoopBaseConf, janusgraphProperties);
    cr.partitionerOverride(partitionerName);
    cr.scanJobConf(mc);
    cr.scanJobConfRoot(GraphDatabaseConfiguration.class.getName() + "#JOB_NS");
    cr.baseHadoopConf(hadoopBaseConf);
    return cr.run();
}
Also used : IndexRepairJob(org.janusgraph.graphdb.olap.job.IndexRepairJob) CassandraHadoopScanRunner(org.janusgraph.hadoop.scan.CassandraHadoopScanRunner) ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration)

Example 3 with CassandraHadoopScanRunner

use of org.janusgraph.hadoop.scan.CassandraHadoopScanRunner in project janusgraph by JanusGraph.

the class MapReduceIndexJobs method cassandraRemove.

public static ScanMetrics cassandraRemove(Properties janusgraphProperties, String indexName, String relationType, String partitionerName, Configuration hadoopBaseConf) throws InterruptedException, IOException, ClassNotFoundException {
    IndexRemoveJob job = new IndexRemoveJob();
    CassandraHadoopScanRunner cr = new CassandraHadoopScanRunner(job);
    ModifiableConfiguration mc = getIndexJobConf(indexName, relationType);
    copyPropertiesToInputAndOutputConf(hadoopBaseConf, janusgraphProperties);
    cr.partitionerOverride(partitionerName);
    cr.scanJobConf(mc);
    cr.scanJobConfRoot(GraphDatabaseConfiguration.class.getName() + "#JOB_NS");
    cr.baseHadoopConf(hadoopBaseConf);
    return cr.run();
}
Also used : CassandraHadoopScanRunner(org.janusgraph.hadoop.scan.CassandraHadoopScanRunner) ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration) IndexRemoveJob(org.janusgraph.graphdb.olap.job.IndexRemoveJob)

Aggregations

CassandraHadoopScanRunner (org.janusgraph.hadoop.scan.CassandraHadoopScanRunner)3 ModifiableConfiguration (org.janusgraph.diskstorage.configuration.ModifiableConfiguration)2 CassandraThriftStoreManager (org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftStoreManager)1 KeyColumnValueStore (org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStore)1 KeyColumnValueStoreManager (org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStoreManager)1 StoreTransaction (org.janusgraph.diskstorage.keycolumnvalue.StoreTransaction)1 ScanJob (org.janusgraph.diskstorage.keycolumnvalue.scan.ScanJob)1 JanusGraphBaseTest (org.janusgraph.graphdb.JanusGraphBaseTest)1 GraphDatabaseConfiguration (org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration)1 IndexRemoveJob (org.janusgraph.graphdb.olap.job.IndexRemoveJob)1 IndexRepairJob (org.janusgraph.graphdb.olap.job.IndexRepairJob)1 JanusGraphHadoopConfiguration (org.janusgraph.hadoop.config.JanusGraphHadoopConfiguration)1 Test (org.junit.Test)1