public void deleteFromDisk() {
        securityContext.secure(AppPermission.MANAGE_INDEX_SHARDS_PERMISSION, () -> {
            if (deletingShards.compareAndSet(false, true)) {
                try {
                    final FindIndexShardCriteria criteria = FindIndexShardCriteria.matchAll();
                    criteria.getNodeNameSet().add(nodeInfo.getThisNodeName());
                    criteria.getIndexShardStatusSet().add(IndexShardStatus.DELETED);
                    final ResultPage<IndexShard> shards = indexShardDao.find(criteria);
                    if (NullSafe.test(shards, shards2 -> shards2.size() > 0)) {
                        deleteShardsFromDisk(indexShardWriterCache, shards);
                    } else {
                        LOGGER.debug("No matching shards to delete, criteria: {}", criteria);
                    }
                } catch (final RuntimeException e) {
                    LOGGER.error(e::getMessage, e);
                } finally {
                    deletingShards.set(false);
                }
            } else {
                LOGGER.debug("Another thread is deleting shards, we will just drop out quietly");
            }
        });
    }
Delete anything that has been marked to delete
stroom-index/stroom-index-impl/src/main/java/stroom/index/impl/IndexShardManager.java