/** * This transaction configuration should disable transaction isolation as it * will only be used for reads that are rolled back. * the configurations, in decreasing order of precedence * scanTxConfig overrides graphConfiguration which overrides defaultValue */ @Override public Configuration getScanTxConfig() { return buildGraphConfig().set(TUPL_LOCK_MODE, LockMode.UNSAFE.name()); } @Override public boolean supportsInterruption() { return false; }
@Override public byte[] load(final Transaction txn, final byte[] tkey) throws IOException { final byte[] key = inverseTransformKey(tkey); if (key == null) { return null; } if (txn == null || !txn.lockMode().isRepeatable()) { return mTransformer.transformValue(mSource.load(txn, key), key, tkey); } txn.enter(); try { byte[] value = mSource.load(txn, key); if (value == null || (value = mTransformer.transformValue(value, key, tkey)) != null) { // Keep the lock if value doesn't exist or if allowed by transformer. txn.commit(); } return value; } finally { txn.exit(); } }
public TuplStoreTransaction beginTransaction(BaseTransactionConfig config) throws BackendException { final Configuration effectiveCfg = new MergedConfiguration( config.getCustomOptions() /*overrides, defined in individual titan transaction configs*/, getStorageConfig() /*defaults, in superclass AbstractStoreManager, passed into ctor*/); //configure the durability mode if(batchLoading && effectiveCfg.has(TUPL_DURABILITY_MODE)) { throw new PermanentBackendException(CANNOT_OVERRIDE_DURABILITY_MODE_WHEN_BATCH_LOADING); } final DurabilityMode effectiveDurabilityMode = batchLoading ? DurabilityMode.NO_REDO : DurabilityMode.valueOf(effectiveCfg.get(TUPL_DURABILITY_MODE)); //configure the lock mode if((!transactional || batchLoading) && effectiveCfg.has(TUPL_LOCK_MODE)) { throw new PermanentBackendException(CANT_OVERRIDE_LOCK_MODE_WITHOUT_TX_OR_WHEN_BATCH_LOADING); } final LockMode effectiveLockMode = (transactional && !batchLoading) ? LockMode.valueOf(effectiveCfg.get(TUPL_LOCK_MODE)) : LockMode.UNSAFE; final Transaction txn = database.newTransaction(effectiveDurabilityMode); txn.lockMode(effectiveLockMode); return new TuplStoreTransaction(config, txn, database); }
@Override public byte[] load(final Transaction txn, final byte[] tkey) throws IOException { final byte[] key = inverseTransformKey(tkey); if (key == null) { return null; } if (txn == null || !txn.lockMode().isRepeatable()) { return mTransformer.transformValue(mSource.load(txn, key), key, tkey); } txn.enter(); try { byte[] value = mSource.load(txn, key); if (value == null || (value = mTransformer.transformValue(value, key, tkey)) != null) { // Keep the lock if value doesn't exist or if allowed by transformer. txn.commit(); } return value; } finally { txn.exit(); } }
if (txn == null || !txn.lockMode().isRepeatable()) { return mTransformer.transformValue(mSource.load(txn, key), key, tkey) != null;
if (txn == null || !txn.lockMode().isRepeatable()) { return mTransformer.transformValue(mSource.load(txn, key), key, tkey);