private UID createForwardReversePair(final Txn<ByteBuffer> writeTxn,
                                         final ByteBuffer mapDefinitionBuffer,
                                         final PooledByteBuffer newUidPooledBuffer) {

        // this is all done in a write txn so we can be sure of consistency
        // between the forward and reverse DBs

        LOGGER.trace(() ->
                LogUtil.message("Creating UID mappings for mapDefinition {}",
                        ByteBufferUtils.byteBufferInfo(mapDefinitionBuffer)));

        // get the next UID into our pooled buffer
        final ByteBuffer nextUidKeyBuffer = mapUidReverseDb.getNextUid(writeTxn, newUidPooledBuffer);

        LOGGER.trace(() -> "nextUidKeyBuffer " + ByteBufferUtils.byteBufferToHexAll(nextUidKeyBuffer));

        mapUidReverseDb.putReverseEntry(writeTxn, nextUidKeyBuffer, mapDefinitionBuffer);

        // We are not changing the buffers so can just reuse them

        LOGGER.trace(() -> "nextUidKeyBuffer " + ByteBufferUtils.byteBufferToHexAll(nextUidKeyBuffer));

        mapUidForwardDb.putForwardEntry(writeTxn, mapDefinitionBuffer, nextUidKeyBuffer);

        // this buffer is 'owned' by LMDB now but we are still in a txn so can pass it back

        LOGGER.trace(() -> "nextUidKeyBuffer " + ByteBufferUtils.byteBufferToHexAll(nextUidKeyBuffer));

        // ensure it is ready for reading again as we are returning it
        UID mapUid = UID.wrap(nextUidKeyBuffer);

        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("nextUidKeyBuffer {}", ByteBufferUtils.byteBufferInfo(nextUidKeyBuffer));
            LOGGER.trace("mapDefinitionBuffer {}", ByteBufferUtils.byteBufferInfo(mapDefinitionBuffer));
            LOGGER.trace("mapDefinitionKeyBuffer {}", ByteBufferUtils.byteBufferInfo(mapDefinitionBuffer));
            LOGGER.trace("nextUidValueBuffer {}", ByteBufferUtils.byteBufferInfo(nextUidKeyBuffer));
            LOGGER.trace("nextUidValueBuffer {}", ByteBufferUtils.byteBufferInfo(nextUidKeyBuffer));
            LOGGER.trace("Creating UID mapping for {}", mapUid);
        }
        return mapUid;
    }
Returns the UID corresponding to the passed mapDefinition if it exists in the two mapping DBs. If it doesn't
exist, a forward and reverse mapping will be created and the new UID returned. The returned UID wraps a
direct allocation {@link ByteBuffer} owned by LMDB, so it may ONLY be used whilst still inside the passed
{@link Txn}.
stroom-pipeline/src/main/java/stroom/pipeline/refdata/store/offheapstore/MapDefinitionUIDStore.java