Search in sources :

Example 1 with KeyColumnValueStore

use of org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStore 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 KeyColumnValueStore

use of org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStore in project janusgraph by JanusGraph.

the class HBaseStoreManagerConfigTest method testShortCfNames.

@Test
public void testShortCfNames() throws Exception {
    Logger log = Logger.getLogger(HBaseStoreManager.class);
    Level savedLevel = log.getLevel();
    log.setLevel(Level.WARN);
    StringWriter writer = new StringWriter();
    Appender appender = new WriterAppender(new PatternLayout("%p: %m%n"), writer);
    log.addAppender(appender);
    // Open the HBaseStoreManager and store with default SHORT_CF_NAMES true.
    WriteConfiguration config = HBaseStorageSetup.getHBaseGraphConfiguration();
    HBaseStoreManager manager = new HBaseStoreManager(new BasicConfiguration(GraphDatabaseConfiguration.ROOT_NS, config, BasicConfiguration.Restriction.NONE));
    KeyColumnValueStore store = manager.openDatabase(GraphDatabaseConfiguration.SYSTEM_PROPERTIES_STORE_NAME);
    store.close();
    manager.close();
    // Open the HBaseStoreManager and store with SHORT_CF_NAMES false.
    config.set(ConfigElement.getPath(HBaseStoreManager.SHORT_CF_NAMES), false);
    manager = new HBaseStoreManager(new BasicConfiguration(GraphDatabaseConfiguration.ROOT_NS, config, BasicConfiguration.Restriction.NONE));
    writer.getBuffer().setLength(0);
    store = manager.openDatabase(GraphDatabaseConfiguration.SYSTEM_PROPERTIES_STORE_NAME);
    // Verify we get WARN.
    assertTrue(writer.toString(), writer.toString().startsWith("WARN: Configuration"));
    log.removeAppender(appender);
    log.setLevel(savedLevel);
    store.close();
    manager.close();
}
Also used : Appender(org.apache.log4j.Appender) WriterAppender(org.apache.log4j.WriterAppender) StringWriter(java.io.StringWriter) KeyColumnValueStore(org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStore) PatternLayout(org.apache.log4j.PatternLayout) Level(org.apache.log4j.Level) WriterAppender(org.apache.log4j.WriterAppender) WriteConfiguration(org.janusgraph.diskstorage.configuration.WriteConfiguration) Logger(org.apache.log4j.Logger) BasicConfiguration(org.janusgraph.diskstorage.configuration.BasicConfiguration) Test(org.junit.Test)

Example 3 with KeyColumnValueStore

use of org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStore in project janusgraph by JanusGraph.

the class TTLKCVSManager method openDatabase.

@Override
public KeyColumnValueStore openDatabase(String name, StoreMetaData.Container metaData) throws BackendException {
    KeyColumnValueStore store = manager.openDatabase(name);
    final int storeTTL = metaData.contains(StoreMetaData.TTL) ? metaData.get(StoreMetaData.TTL) : -1;
    Preconditions.checkArgument(storeTTL > 0, "TTL must be positive: %s", storeTTL);
    ttlEnabledStores.put(name, storeTTL);
    return new TTLKCVS(store, storeTTL);
}
Also used : KeyColumnValueStore(org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStore)

Aggregations

KeyColumnValueStore (org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStore)3 Test (org.junit.Test)2 StringWriter (java.io.StringWriter)1 Appender (org.apache.log4j.Appender)1 Level (org.apache.log4j.Level)1 Logger (org.apache.log4j.Logger)1 PatternLayout (org.apache.log4j.PatternLayout)1 WriterAppender (org.apache.log4j.WriterAppender)1 CassandraThriftStoreManager (org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftStoreManager)1 BasicConfiguration (org.janusgraph.diskstorage.configuration.BasicConfiguration)1 WriteConfiguration (org.janusgraph.diskstorage.configuration.WriteConfiguration)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 JanusGraphHadoopConfiguration (org.janusgraph.hadoop.config.JanusGraphHadoopConfiguration)1 CassandraHadoopScanRunner (org.janusgraph.hadoop.scan.CassandraHadoopScanRunner)1