@Test
    void testDupSupport_noDupData() {
        BasicLmdbDb<String, String> db = new BasicLmdbDb<>(
                lmdbEnv,
                new ByteBufferPoolFactory().getByteBufferPool(),
                new StringSerde(),
                new StringSerde(),
                "dupDb",
                DbiFlags.MDB_CREATE,
                DbiFlags.MDB_DUPSORT);

        lmdbEnv.doWithWriteTxn(writeTxn -> {
            // Two entries with the same key
            byteBufferPool.doWithBufferPair(10, 10, (keyBuffer, valBuffer) -> {
                keyBuffer.clear();
                db.serializeKey(keyBuffer, "key1");
                valBuffer.clear();
                db.serializeValue(valBuffer, "val1");
                boolean didPut = db.getLmdbDbi().put(writeTxn, keyBuffer, valBuffer, PutFlags.MDB_NODUPDATA);
                Assertions.assertThat(didPut)
                        .isTrue();

                keyBuffer.clear();
                db.serializeKey(keyBuffer, "key2");
                valBuffer.clear();
                db.serializeValue(valBuffer, "val2a");
                didPut = db.getLmdbDbi().put(writeTxn, keyBuffer, valBuffer, PutFlags.MDB_NODUPDATA);
                Assertions.assertThat(didPut)
                        .isTrue();

                keyBuffer.clear();
                db.serializeKey(keyBuffer, "key2");
                valBuffer.clear();
                db.serializeValue(valBuffer, "val2a");
                didPut = db.getLmdbDbi().put(writeTxn, keyBuffer, valBuffer, PutFlags.MDB_NODUPDATA);
                Assertions.assertThat(didPut)
                        .isFalse();
            });
        });

        db.logDatabaseContents();

        final List<Entry<String, String>> entries = lmdbEnv.getWithReadTxn(readTxn ->
                db.streamEntries(readTxn, KeyRange.all(), stream -> stream
                        .collect(Collectors.toList())));

        LOGGER.info("Entries:\n{}", AsciiTable.builder(entries)
                .withColumn(Column.of("key", Entry::getKey))
                .withColumn(Column.of("value", Entry::getValue))
                .build());

        assertThat(entries)
                .satisfiesExactly(
                        entry1 -> assertThat(entry1)
                                .isEqualTo(Map.entry("key1", "val1")),
                        entry2 -> assertThat(entry2)
                                .isEqualTo(Map.entry("key2", "val2a")));
    }
This test is an example of how to abuse LMDB. If run it will crash the JVM
as a direct bytebuffer returned from a get() was mutated outside the transaction.
stroom-lmdb/src/test/java/stroom/lmdb/TestBasicLmdbDb.java