Search in sources :

Example 1 with KCVSLogManager

use of com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLogManager in project titan by thinkaurelius.

the class Backend method getLogManager.

private static LogManager getLogManager(Configuration config, String logName, KeyColumnValueStoreManager sm) {
    Configuration logConfig = config.restrictTo(logName);
    String backend = logConfig.get(LOG_BACKEND);
    if (backend.equalsIgnoreCase(LOG_BACKEND.getDefaultValue())) {
        return new KCVSLogManager(sm, logConfig);
    } else {
        Preconditions.checkArgument(config != null);
        LogManager lm = getImplementationClass(logConfig, logConfig.get(LOG_BACKEND), REGISTERED_LOG_MANAGERS);
        Preconditions.checkNotNull(lm);
        return lm;
    }
}
Also used : KCVSLogManager(com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLogManager) TransactionConfiguration(com.thinkaurelius.titan.graphdb.transaction.TransactionConfiguration) GraphDatabaseConfiguration(com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration) KCVSConfiguration(com.thinkaurelius.titan.diskstorage.configuration.backend.KCVSConfiguration) LogManager(com.thinkaurelius.titan.diskstorage.log.LogManager) KCVSLogManager(com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLogManager)

Example 2 with KCVSLogManager

use of com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLogManager in project titan by thinkaurelius.

the class TitanGraphBaseTest method openLog.

private Log openLog(String logManagerName, String logName) {
    try {
        ModifiableConfiguration configuration = new ModifiableConfiguration(GraphDatabaseConfiguration.ROOT_NS, config.copy(), BasicConfiguration.Restriction.NONE);
        configuration.set(GraphDatabaseConfiguration.UNIQUE_INSTANCE_ID, "reader");
        configuration.set(GraphDatabaseConfiguration.LOG_READ_INTERVAL, Duration.ofMillis(500L), logManagerName);
        if (logStoreManager == null) {
            logStoreManager = Backend.getStorageManager(configuration);
        }
        StoreFeatures f = logStoreManager.getFeatures();
        boolean part = f.isDistributed() && f.isKeyOrdered();
        if (part) {
            for (String logname : new String[] { USER_LOG, TRANSACTION_LOG, MANAGEMENT_LOG }) configuration.set(KCVSLogManager.LOG_MAX_PARTITIONS, 8, logname);
        }
        assert logStoreManager != null;
        if (!logManagers.containsKey(logManagerName)) {
            //Open log manager - only supports KCVSLog
            Configuration logConfig = configuration.restrictTo(logManagerName);
            Preconditions.checkArgument(logConfig.get(LOG_BACKEND).equals(LOG_BACKEND.getDefaultValue()));
            logManagers.put(logManagerName, new KCVSLogManager(logStoreManager, logConfig));
        }
        assert logManagers.containsKey(logManagerName);
        return logManagers.get(logManagerName).openLog(logName);
    } catch (BackendException e) {
        throw new TitanException("Could not open log: " + logName, e);
    }
}
Also used : StoreFeatures(com.thinkaurelius.titan.diskstorage.keycolumnvalue.StoreFeatures) KCVSLogManager(com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLogManager) GraphDatabaseConfiguration(com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration) BackendException(com.thinkaurelius.titan.diskstorage.BackendException)

Example 3 with KCVSLogManager

use of com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLogManager in project titan by thinkaurelius.

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(com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLogManager) ModifiableConfiguration(com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration)

Aggregations

KCVSLogManager (com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLogManager)3 GraphDatabaseConfiguration (com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration)2 BackendException (com.thinkaurelius.titan.diskstorage.BackendException)1 ModifiableConfiguration (com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration)1 KCVSConfiguration (com.thinkaurelius.titan.diskstorage.configuration.backend.KCVSConfiguration)1 StoreFeatures (com.thinkaurelius.titan.diskstorage.keycolumnvalue.StoreFeatures)1 LogManager (com.thinkaurelius.titan.diskstorage.log.LogManager)1 TransactionConfiguration (com.thinkaurelius.titan.graphdb.transaction.TransactionConfiguration)1