Artem, I like the option with proper exception in case if a dynamic cache is started with swap enabled while there was no swap configured in Ignite.
Starting FileSwapSpaceSpi all the time is not a good option as user will face the same problem when trying to change to a different SPI. D. On Wed, Feb 10, 2016 at 4:39 AM, Artem Shutak <[email protected]> wrote: > 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 -- >
