Search in sources :

Example 16 with EntryList

use of com.thinkaurelius.titan.diskstorage.EntryList in project titan by thinkaurelius.

the class LockCleanerRunnableTest method testPreservesLocksAtOrAfterCutoff.

/**
     * Locks with timestamps equal to or numerically greater than the cleaner
     * cutoff timestamp must be preserved. Test that the cleaner reads locks by
     * slicing the store and then does <b>not</b> attempt to write.
     */
@Test
public void testPreservesLocksAtOrAfterCutoff() throws BackendException {
    final Instant cutoff = Instant.ofEpochMilli(10L);
    Entry currentLock = StaticArrayEntry.of(codec.toLockCol(cutoff, defaultLockRid, TimestampProviders.MILLI), BufferUtil.getIntBuffer(0));
    Entry futureLock = StaticArrayEntry.of(codec.toLockCol(cutoff.plusMillis(1), defaultLockRid, TimestampProviders.MILLI), BufferUtil.getIntBuffer(0));
    EntryList locks = StaticArrayEntryList.of(currentLock, futureLock);
    // Don't increment cutoff: lockCol is exactly at the cutoff timestamp
    del = new StandardLockCleanerRunnable(store, kc, tx, codec, cutoff, TimestampProviders.MILLI);
    expect(store.getSlice(eq(ksq), eq(tx))).andReturn(locks);
    ctrl.replay();
    del.run();
}
Also used : StandardLockCleanerRunnable(com.thinkaurelius.titan.diskstorage.locking.consistentkey.StandardLockCleanerRunnable) Entry(com.thinkaurelius.titan.diskstorage.Entry) Instant(java.time.Instant) EntryList(com.thinkaurelius.titan.diskstorage.EntryList) Test(org.junit.Test)

Aggregations

EntryList (com.thinkaurelius.titan.diskstorage.EntryList)16 SliceQuery (com.thinkaurelius.titan.diskstorage.keycolumnvalue.SliceQuery)6 Entry (com.thinkaurelius.titan.diskstorage.Entry)5 StaticBuffer (com.thinkaurelius.titan.diskstorage.StaticBuffer)4 Map (java.util.Map)4 StandardLockCleanerRunnable (com.thinkaurelius.titan.diskstorage.locking.consistentkey.StandardLockCleanerRunnable)3 Test (org.junit.Test)3 LongArrayList (com.carrotsearch.hppc.LongArrayList)2 ImmutableList (com.google.common.collect.ImmutableList)2 TitanVertex (com.thinkaurelius.titan.core.TitanVertex)2 KeySliceQuery (com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeySliceQuery)2 StoreTransaction (com.thinkaurelius.titan.diskstorage.keycolumnvalue.StoreTransaction)2 CacheTransaction (com.thinkaurelius.titan.diskstorage.keycolumnvalue.cache.CacheTransaction)2 StandardTitanTx (com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx)2 CacheVertex (com.thinkaurelius.titan.graphdb.vertices.CacheVertex)2 PreloadedVertex (com.thinkaurelius.titan.graphdb.vertices.PreloadedVertex)2 Instant (java.time.Instant)2 ArrayList (java.util.ArrayList)2 Preconditions (com.google.common.base.Preconditions)1 Iterables (com.google.common.collect.Iterables)1