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);
}
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();
}
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);
}
Aggregations