Our current node startup logic includes a simple heuristic like this:
final IgniteCache cache = ignite.getOrCreateCache(configuration);
if (cache.localSize(CachePeekMode.ALL) == 0) {
LOGGER.info("Empty cache or No-one else around in the ignite cloud,
loading cache {} from database", configuration.getName() );
cache.loadCache((k, v) -> true, Integer.MAX_VALUE);
}
The problem with this logic is that that cache is started after
getOrCreateCache, and other cluster members coming up while the first
node is starting can get partial replication. How can I make loadCache
happen during getOrCreateCache to ensure atomic startup/loading of the
cache ?
Kristian