use of org.janusgraph.diskstorage.configuration.ModifiableConfiguration in project janusgraph by JanusGraph.
the class ThriftSolrTest method getConfiguration.
@Override
public WriteConfiguration getConfiguration() {
ModifiableConfiguration config = CassandraStorageSetup.getCassandraThriftConfiguration(ThriftSolrTest.class.getName());
// Add index
config.set(SolrIndex.ZOOKEEPER_URL, SolrRunner.getZookeeperUrls(), INDEX);
config.set(SolrIndex.WAIT_SEARCHER, true, INDEX);
config.set(INDEX_BACKEND, "solr", INDEX);
config.set(GraphDatabaseConfiguration.INDEX_MAX_RESULT_SET_SIZE, 3, INDEX);
// TODO: set SOLR specific config options
return config.getConfiguration();
}
use of org.janusgraph.diskstorage.configuration.ModifiableConfiguration in project janusgraph by JanusGraph.
the class ExpectedValueCheckingTest method setupMocks.
@Before
public void setupMocks() throws BackendException {
// Initialize mock controller
ctrl = EasyMock.createStrictControl();
ctrl.checkOrder(true);
// Setup some config mocks and objects
backingManager = ctrl.createMock(KeyColumnValueStoreManager.class);
LockerProvider lockerProvider = ctrl.createMock(LockerProvider.class);
ModifiableConfiguration globalConfig = GraphDatabaseConfiguration.buildGraphConfiguration();
ModifiableConfiguration localConfig = GraphDatabaseConfiguration.buildGraphConfiguration();
ModifiableConfiguration defaultConfig = GraphDatabaseConfiguration.buildGraphConfiguration();
// Set some properties on the configs, just so that global/local/default can be easily distinguished
globalConfig.set(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID, "global");
localConfig.set(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID, "local");
defaultConfig.set(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID, "default");
BaseTransactionConfig defaultTxConfig = new StandardBaseTransactionConfig.Builder().customOptions(defaultConfig).timestampProvider(TimestampProviders.MICRO).build();
StoreFeatures backingFeatures = new StandardStoreFeatures.Builder().keyConsistent(globalConfig, localConfig).build();
// Setup behavior specification starts below this line
// 1. Construct manager
// The EVCSManager ctor retrieves the backing store's features and stores it in an instance field
expect(backingManager.getFeatures()).andReturn(backingFeatures).once();
// 2. Begin transaction
// EVCTx begins two transactions on the backingManager: one with globalConfig and one with localConfig
// The capture is used in the @After method to check the config
txConfigCapture = EasyMock.newCapture(CaptureType.ALL);
inconsistentTx = ctrl.createMock(StoreTransaction.class);
consistentTx = ctrl.createMock(StoreTransaction.class);
expect(backingManager.beginTransaction(capture(txConfigCapture))).andReturn(inconsistentTx);
expect(backingManager.beginTransaction(capture(txConfigCapture))).andReturn(consistentTx);
// 3. Open a database
backingLocker = ctrl.createMock(Locker.class);
backingStore = ctrl.createMock(KeyColumnValueStore.class);
expect(backingManager.openDatabase(STORE_NAME)).andReturn(backingStore);
expect(backingStore.getName()).andReturn(STORE_NAME);
expect(lockerProvider.getLocker(LOCKER_NAME)).andReturn(backingLocker);
// Carry out setup behavior against mocks
ctrl.replay();
// 1. Construct manager
expectManager = new ExpectedValueCheckingStoreManager(backingManager, LOCK_SUFFIX, lockerProvider, Duration.ofSeconds(1L));
// 2. Begin transaction
expectTx = expectManager.beginTransaction(defaultTxConfig);
// 3. Open a database
expectStore = expectManager.openDatabase(STORE_NAME);
// Verify behavior and reset the mocks for test methods to use
ctrl.verify();
ctrl.reset();
}
use of org.janusgraph.diskstorage.configuration.ModifiableConfiguration in project janusgraph by JanusGraph.
the class IDAuthorityTest method open.
public void open() throws BackendException {
manager = new KeyColumnValueStoreManager[CONCURRENCY];
idAuthorities = new IDAuthority[CONCURRENCY];
for (int i = 0; i < CONCURRENCY; i++) {
ModifiableConfiguration sc = StorageSetup.getConfig(baseStoreConfiguration.copy());
// sc.set(GraphDatabaseConfiguration.INSTANCE_RID_SHORT,(short)i);
sc.set(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID_SUFFIX, (short) i);
if (!sc.has(UNIQUE_INSTANCE_ID)) {
String uniqueGraphId = getOrGenerateUniqueInstanceId(sc);
log.debug("Setting unique instance id: {}", uniqueGraphId);
sc.set(UNIQUE_INSTANCE_ID, uniqueGraphId);
}
sc.set(GraphDatabaseConfiguration.CLUSTER_MAX_PARTITIONS, MAX_NUM_PARTITIONS);
manager[i] = openStorageManager();
StoreFeatures storeFeatures = manager[i].getFeatures();
KeyColumnValueStore idStore = manager[i].openDatabase("ids");
if (storeFeatures.isKeyConsistent())
idAuthorities[i] = new ConsistentKeyIDAuthority(idStore, manager[i], sc);
else
throw new IllegalArgumentException("Cannot open id store");
}
}
use of org.janusgraph.diskstorage.configuration.ModifiableConfiguration in project janusgraph by JanusGraph.
the class LockKeyColumnValueStoreTest method open.
public void open() throws BackendException {
manager = new KeyColumnValueStoreManager[CONCURRENCY];
tx = new StoreTransaction[CONCURRENCY][NUM_TX];
store = new KeyColumnValueStore[CONCURRENCY];
for (int i = 0; i < CONCURRENCY; i++) {
final ModifiableConfiguration sc = GraphDatabaseConfiguration.buildGraphConfiguration();
sc.set(GraphDatabaseConfiguration.LOCK_LOCAL_MEDIATOR_GROUP, concreteClassName + i);
sc.set(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID, "inst" + i);
sc.set(GraphDatabaseConfiguration.LOCK_RETRY, 10);
sc.set(GraphDatabaseConfiguration.LOCK_EXPIRE, Duration.ofMillis(EXPIRE_MS));
manager[i] = openStorageManager(i, sc);
StoreFeatures storeFeatures = manager[i].getFeatures();
store[i] = manager[i].openDatabase(DB_NAME);
for (int j = 0; j < NUM_TX; j++) {
tx[i][j] = manager[i].beginTransaction(getTxConfig());
log.debug("Began transaction of class {}", tx[i][j].getClass().getCanonicalName());
}
if (!storeFeatures.hasLocking()) {
Preconditions.checkArgument(storeFeatures.isKeyConsistent(), "Store needs to support some form of locking");
KeyColumnValueStore lockerStore = manager[i].openDatabase(DB_NAME + "_lock_");
ConsistentKeyLocker c = new ConsistentKeyLocker.Builder(lockerStore, manager[i]).fromConfig(sc).mediatorName(concreteClassName + i).build();
store[i] = new ExpectedValueCheckingStore(store[i], c);
for (int j = 0; j < NUM_TX; j++) tx[i][j] = new ExpectedValueCheckingTransaction(tx[i][j], manager[i].beginTransaction(getConsistentTxConfig(manager[i])), GraphDatabaseConfiguration.STORAGE_READ_WAITTIME.getDefaultValue());
}
}
}
use of org.janusgraph.diskstorage.configuration.ModifiableConfiguration in project janusgraph by JanusGraph.
the class KCVSLogTest method openLogManager.
@Override
public LogManager openLogManager(String senderId, boolean requiresOrderPreserving) throws BackendException {
storeManager = openStorageManager();
ModifiableConfiguration config = GraphDatabaseConfiguration.buildGraphConfiguration();
config.set(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID, senderId);
config.set(GraphDatabaseConfiguration.LOG_READ_INTERVAL, Duration.ofMillis(500L), LOG_NAME);
// To ensure that the write order is preserved in reading, we need to ensure that all writes go to the same partition
// otherwise readers will independently read from the partitions out-of-order by design to avoid having to synchronize
config.set(KCVSLogManager.LOG_FIXED_PARTITION, requiresOrderPreserving, LOG_NAME);
return new KCVSLogManager(storeManager, config.restrictTo(LOG_NAME));
}
Aggregations