| | |
| | | { |
| | | private final TreeName treeName = new TreeName("dc=test", "test"); |
| | | private PDBStorage storage; |
| | | |
| | | |
| | | @BeforeClass |
| | | public static void startServer() throws Exception |
| | | { |
| | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void testExchangeWithSmallValuesAreReleasedToPool() throws Exception |
| | | { |
| | | final Exchange initial = storage.getNewExchange(treeName, true); |
| | | storage.releaseExchange(initial); |
| | | |
| | | |
| | | storage.write(new WriteOperation() |
| | | { |
| | | @Override |
| | |
| | | txn.put(treeName, valueOfUtf8("small"), valueOfBytes(new byte[512 * KB])); |
| | | } |
| | | }); |
| | | |
| | | |
| | | assertThat(storage.getNewExchange(treeName, true)).isSameAs(initial); |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void testExchangeWithLargeValuesAreNotReleasedToPool() throws Exception |
| | | { |
| | |
| | | txn.put(treeName, valueOfUtf8("small"), valueOfBytes(new byte[16 * MB])); |
| | | } |
| | | }); |
| | | |
| | | |
| | | assertThat(storage.getNewExchange(treeName, true)).isNotSameAs(initial); |
| | | } |
| | | |