private void purgeMapData(final TaskContext taskContext,
                              final RefStreamDefinition refStreamDefinition,
                              final BatchingWriteTxn batchingWriteTxn,
                              final UID mapUid,
                              final PurgeCounter purgeCounter) {

        LOGGER.debug("purgeMapData(writeTxn, {})", mapUid);

        LOGGER.debug("Deleting key/value entries and de-referencing/deleting their values");
        // loop over all keyValue entries for this mapUid and dereference/delete the associated
        // valueStore entry
        updatePurgeTaskContextInfoSupplier(
                taskContext, refStreamDefinition, "Purging key/value entries", purgeCounter);
        keyValueStoreDb.deleteMapEntries(
                batchingWriteTxn,
                mapUid,
                (writeTxn, keyValueStoreKeyBuffer, valueStoreKeyBuffer) -> {
                    purgeCounter.incrementEntriesPurged();
                    //dereference this value, deleting it if required
                    deReferenceOrDeleteValue(
                            writeTxn,
                            valueStoreKeyBuffer,
                            purgeCounter);
                });
        LOGGER.debug(() -> LogUtil.message("Deleted {} value entries, de-referenced {} value entries",
                purgeCounter.transientValuesPurged, purgeCounter.transientValuesDeReferenced));

        LOGGER.debug("Deleting range/value entries and de-referencing/deleting their values");
        // loop over all rangeValue entries for this mapUid and dereference/delete the associated
        // valueStore entry
        updatePurgeTaskContextInfoSupplier(taskContext,
                refStreamDefinition, "Purging range/value entries", purgeCounter);
        rangeStoreDb.deleteMapEntries(
                batchingWriteTxn,
                mapUid,
                (writeTxn, rangeValueStoreKeyBuffer, valueStoreKeyBuffer) -> {
                    // This lambda is called before entry deletion, but close enough for logging purposes
                    purgeCounter.incrementEntriesPurged();
                    // dereference or delete this value as required
                    deReferenceOrDeleteValue(
                            writeTxn,
                            valueStoreKeyBuffer,
                            purgeCounter);
                });
        LOGGER.debug(() -> LogUtil.message("Deleted {} value entries, de-referenced {} value entries",
                purgeCounter.transientValuesPurged, purgeCounter.transientValuesDeReferenced));

        // Now all the entries are gone, delete the map def for them
        mapDefinitionUIDStore.deletePair(batchingWriteTxn.getTxn(), mapUid);
        purgeCounter.incrementMapsPurged();
    }
Synchronized to prevent to ensure concurrent purge jobs don't clash

@param now Allows the setting of the current time for testing purposes
stroom-pipeline/src/main/java/stroom/pipeline/refdata/store/offheapstore/RefDataOffHeapStore.java