@Test public void testPutAndDelete() throws IOException { tm = new BTreeEmpty(log, createTestSplittingPolicy(), true, 1).getMutableCopy(); for (int i = 0; i < 100; i++) { getTreeMutable().put(kv(i, "v" + i)); } long rootAddress = saveTree(); tm = new BTree(log, getTreeMutable().getBalancePolicy(), rootAddress, true, 1).getMutableCopy(); checkTree(getTreeMutable(), 100).run(); for (int i = 0; i < 100; i++) { getTreeMutable().put(kv(i, "v" + i)); } Assert.assertEquals(1L, (long) tm.getExpiredLoggables().getSize()); for (int i = 0; i < 100; i++) { final INode ln = kv(i, "v" + i); getTreeMutable().delete(ln.getKey(), ln.getValue()); } Assert.assertEquals(0, tm.getSize()); assertMatchesIterator(tm, Collections.emptyList()); rootAddress = saveTree(); reopen(); t = new BTree(log, rootAddress, true, 1); assertMatchesIterator(tm, Collections.emptyList()); }
@Override @NotNull public BTreeMutable getMutableCopy() { final BTreeMutable result = new BTreeMutable(this); result.addExpiredLoggable(rootLoggable); return result; }
BTree extends BTreeBase { @Override @NotNull public BTreeMutable getMutableCopy() { final BTreeMutable result = new BTreeMutable(this); result.addExpiredLoggable(rootLoggable); return result; } }
BTree extends BTreeBase { @Override @NotNull public BTreeMutable getMutableCopy() { final BTreeMutable result = new BTreeMutable(this); result.addExpiredLoggable(rootLoggable); return result; } BTree(@NotNull final Log log, final long rootAddress, final boolean allowsDuplicates, final int structureId);  BTree(@NotNull final Log log,
                 @NotNull final BTreeBalancePolicy policy,
                 final long rootAddress,
                 final boolean allowsDuplicates,
                 final int structureId); }
BTree extends BTreeBase { @Override @NotNull public BTreeMutable getMutableCopy() { final BTreeMutable result = new BTreeMutable(this); result.addExpiredLoggable(rootLoggable); return result; } BTree(@NotNull final Log log, final long rootAddress, final boolean allowsDuplicates, final int structureId);  BTree(@NotNull final Log log,
                 @NotNull final BTreeBalancePolicy policy,
                 final long rootAddress,
                 final boolean allowsDuplicates,
                 final int structureId); @Override long getRootAddress(); @Override @NotNull BTreeMutable getMutableCopy(); }
BTree extends BTreeBase { @Override @NotNull public BTreeMutable getMutableCopy() { final BTreeMutable result = new BTreeMutable(this); result.addExpiredLoggable(rootLoggable); return result; } BTree(@NotNull final Log log, final long rootAddress, final boolean allowsDuplicates, final int structureId);  BTree(@NotNull final Log log,
                 @NotNull final BTreeBalancePolicy policy,
                 final long rootAddress,
                 final boolean allowsDuplicates,
                 final int structureId); @Override long getRootAddress(); @Override @NotNull BTreeMutable getMutableCopy();  }