Igniters,

I've noticed an issue with NoopSwapSpaceSpi and dynamically started cashes.

We have the following logic on node start:

            if (cfg.getSwapSpaceSpi() == null) {
                boolean needSwap = false;

                if (cfg.getCacheConfiguration() != null &&
!Boolean.TRUE.equals(cfg.isClientMode())) {
                    for (CacheConfiguration c :
cfg.getCacheConfiguration()) {
                        if (c.isSwapEnabled()) {
                            needSwap = true;

                            break;
                        }
                    }
                }

                cfg.setSwapSpaceSpi(needSwap ? new FileSwapSpaceSpi() : new
NoopSwapSpaceSpi());
            }

According to the code above, if IgniteConfiguration doesn't contain cache
configurations or all configured caches configured without swap, then node
will be started with NoopSwapSpaceSpi.
As a result in this case, when we start dynamic cache with enabled swap
then actually swap doesn't work.

There is simple workaround - user have to explicitly set FileSwapSpaceSpi
to configuration. But now, there is no any warning or exception.

What we can do:

   1. Throw an exception on dynamic cache start (with swap enabled)
   if NoopSwapSpaceSpi is configured.
   2. Actually, I don't see why we need NoopSwapSpaceSpi at all. I think we
   should configure FileSwapSpaceSpi always if user doesn't provide any
   SwapSpaceSpi explicitly.

Thoughts?

Thanks,
-- Artem --

Reply via email to