Esempio n. 1
0
  @Test
  public void compact_double_recid_reuse() {
    e = openEngine();
    if (e instanceof StoreAppend) return; // TODO reenable once StoreAppend has compaction
    long recid1 = e.put("aa", Serializer.STRING);
    long recid2 = e.put("bb", Serializer.STRING);
    e.compact();
    e.delete(recid1, Serializer.STRING);
    e.compact();
    e.delete(recid2, Serializer.STRING);
    e.compact();

    TT.sortAndEquals(new long[] {recid1, recid2}, new long[] {e.preallocate(), e.preallocate()});

    e.close();
  }
Esempio n. 2
0
 @Test
 public void preallocate_cas() {
   e = openEngine();
   long recid = e.preallocate();
   assertFalse(e.compareAndSwap(recid, 1L, 2L, Serializer.ILLEGAL_ACCESS));
   assertTrue(e.compareAndSwap(recid, null, 2L, Serializer.LONG));
   assertEquals((Long) 2L, e.get(recid, Serializer.LONG));
 }
Esempio n. 3
0
 @Test
 public void preallocate_get_update_delete_update_get() {
   e = openEngine();
   long recid = e.preallocate();
   assertNull(e.get(recid, Serializer.ILLEGAL_ACCESS));
   e.update(recid, 1L, Serializer.LONG);
   assertEquals((Long) 1L, e.get(recid, Serializer.LONG));
   e.delete(recid, Serializer.LONG);
   assertNull(e.get(recid, Serializer.ILLEGAL_ACCESS));
   e.update(recid, 1L, Serializer.LONG);
   assertEquals((Long) 1L, e.get(recid, Serializer.LONG));
   e.close();
 }