use of org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStoreManager 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);
}
use of org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStoreManager in project janusgraph by JanusGraph.
the class JanusGraphIterativeBenchmark method testDataSequential.
@RepeatedTest(10)
public void testDataSequential() throws Exception {
loadData(200000, 2);
close();
KeyColumnValueStoreManager manager = openStorageManager();
KeyColumnValueStore store = manager.openDatabase(Backend.EDGESTORE_NAME);
SliceQuery query = new SliceQuery(BufferUtil.zeroBuffer(8), BufferUtil.oneBuffer(8));
query.setLimit(2);
Stopwatch watch = Stopwatch.createStarted();
StoreTransaction txh = manager.beginTransaction(StandardBaseTransactionConfig.of(TimestampProviders.MILLI));
KeyIterator iterator = store.getKeys(query, txh);
int numV = 0;
while (iterator.hasNext()) {
iterator.next();
RecordIterator<Entry> entries = iterator.getEntries();
assertEquals(2, Iterators.size(entries));
numV++;
}
iterator.close();
txh.commit();
System.out.println("Time taken: " + watch.elapsed(TimeUnit.MILLISECONDS));
System.out.println("Num Vertices: " + numV);
store.close();
manager.close();
}
use of org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStoreManager in project janusgraph by JanusGraph.
the class KCVSConfigTest method getConfig.
@Override
public WriteConfiguration getConfig() {
final KeyColumnValueStoreManager manager = new InMemoryStoreManager(Configuration.EMPTY);
ModifiableConfiguration config = GraphDatabaseConfiguration.buildGraphConfiguration();
config.set(GraphDatabaseConfiguration.TIMESTAMP_PROVIDER, TimestampProviders.MICRO);
try {
return new KCVSConfiguration(new BackendOperation.TransactionalProvider() {
@Override
public StoreTransaction openTx() throws BackendException {
return manager.beginTransaction(StandardBaseTransactionConfig.of(TimestampProviders.MICRO, manager.getFeatures().getKeyConsistentTxConfig()));
}
@Override
public void close() throws BackendException {
manager.close();
}
}, config, manager.openDatabase("janusgraph"), "general");
} catch (BackendException e) {
throw new RuntimeException(e);
}
}
use of org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStoreManager in project janusgraph by JanusGraph.
the class MetricInstrumentedStoreManagerTest method testGetHadoopManagerReturnsBaseHadoopManager.
@Test
public void testGetHadoopManagerReturnsBaseHadoopManager() throws BackendException {
Object result = new Object();
KeyColumnValueStoreManager mock = mock(KeyColumnValueStoreManager.class);
when(mock.getHadoopManager()).thenReturn(result);
MetricInstrumentedStoreManager metricInstrumentedStoreManager = new MetricInstrumentedStoreManager(mock, "", true, "");
Object hadoopManager = metricInstrumentedStoreManager.getHadoopManager();
verify(mock).getHadoopManager();
assertEquals(result, hadoopManager);
}
use of org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStoreManager in project janusgraph by JanusGraph.
the class Backend method getStorageManager.
public static KeyColumnValueStoreManager getStorageManager(Configuration storageConfig) {
StoreManager manager = getImplementationClass(storageConfig, storageConfig.get(STORAGE_BACKEND), StandardStoreManager.getAllManagerClasses());
if (manager instanceof OrderedKeyValueStoreManager) {
Map<String, Integer> keyLength = new HashMap<>(3);
keyLength.put(EDGESTORE_NAME, 8);
keyLength.put(EDGESTORE_NAME + LOCK_STORE_SUFFIX, 8);
keyLength.put(storageConfig.get(IDS_STORE_NAME), 8);
keyLength = Collections.unmodifiableMap(keyLength);
manager = new OrderedKeyValueStoreManagerAdapter((OrderedKeyValueStoreManager) manager, keyLength);
}
Preconditions.checkArgument(manager instanceof KeyColumnValueStoreManager, "Invalid storage manager: %s", manager.getClass());
return (KeyColumnValueStoreManager) manager;
}
Aggregations