Search in sources :

Example 51 with ModifiableConfiguration

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();
}
Also used : ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration)

Example 52 with ModifiableConfiguration

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();
}
Also used : StandardStoreFeatures(org.janusgraph.diskstorage.keycolumnvalue.StandardStoreFeatures) StoreFeatures(org.janusgraph.diskstorage.keycolumnvalue.StoreFeatures) Locker(org.janusgraph.diskstorage.locking.Locker) ExpectedValueCheckingStoreManager(org.janusgraph.diskstorage.locking.consistentkey.ExpectedValueCheckingStoreManager) KeyColumnValueStore(org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStore) StandardBaseTransactionConfig(org.janusgraph.diskstorage.util.StandardBaseTransactionConfig) StoreTransaction(org.janusgraph.diskstorage.keycolumnvalue.StoreTransaction) KeyColumnValueStoreManager(org.janusgraph.diskstorage.keycolumnvalue.KeyColumnValueStoreManager) ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration) StandardBaseTransactionConfig(org.janusgraph.diskstorage.util.StandardBaseTransactionConfig) LockerProvider(org.janusgraph.diskstorage.locking.LockerProvider) Before(org.junit.Before)

Example 53 with ModifiableConfiguration

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");
    }
}
Also used : ConsistentKeyIDAuthority(org.janusgraph.diskstorage.idmanagement.ConsistentKeyIDAuthority) ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration)

Example 54 with ModifiableConfiguration

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());
        }
    }
}
Also used : ExpectedValueCheckingStore(org.janusgraph.diskstorage.locking.consistentkey.ExpectedValueCheckingStore) ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration) ConsistentKeyLocker(org.janusgraph.diskstorage.locking.consistentkey.ConsistentKeyLocker) ExpectedValueCheckingTransaction(org.janusgraph.diskstorage.locking.consistentkey.ExpectedValueCheckingTransaction)

Example 55 with ModifiableConfiguration

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));
}
Also used : KCVSLogManager(org.janusgraph.diskstorage.log.kcvs.KCVSLogManager) ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration)

Aggregations

ModifiableConfiguration (org.janusgraph.diskstorage.configuration.ModifiableConfiguration)62 Test (org.junit.Test)16 BaseConfiguration (org.apache.commons.configuration.BaseConfiguration)10 CommonsConfiguration (org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration)10 KeyColumnValueStoreTest (org.janusgraph.diskstorage.KeyColumnValueStoreTest)6 BasicConfiguration (org.janusgraph.diskstorage.configuration.BasicConfiguration)5 Configuration (org.janusgraph.diskstorage.configuration.Configuration)5 GraphDatabaseConfiguration (org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration)5 HashMap (java.util.HashMap)3 Map (java.util.Map)3 StandardBaseTransactionConfig (org.janusgraph.diskstorage.util.StandardBaseTransactionConfig)3 WriteConfiguration (org.janusgraph.diskstorage.configuration.WriteConfiguration)2 InMemoryStoreManager (org.janusgraph.diskstorage.keycolumnvalue.inmemory.InMemoryStoreManager)2 IndexRemoveJob (org.janusgraph.graphdb.olap.job.IndexRemoveJob)2 IndexRepairJob (org.janusgraph.graphdb.olap.job.IndexRepairJob)2 CassandraHadoopScanRunner (org.janusgraph.hadoop.scan.CassandraHadoopScanRunner)2 HBaseHadoopScanRunner (org.janusgraph.hadoop.scan.HBaseHadoopScanRunner)2 Before (org.junit.Before)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 IOException (java.io.IOException)1