Hello, Igniters!

If an error occurred during of creation dynamic cache, the
CacheAffinitySharedManager#processCacheStartRequests method will try to
rollback cache start routine.
```
try {
        if (startCache) {
                cctx.cache().prepareCacheStart(req.startCacheConfiguration(),
                        cacheDesc,
                        nearCfg,
                        evts.topologyVersion(),
                        req.disabledAfterStart());
                //some code 
        }
}
catch (IgniteCheckedException e) {
        U.error(log, "Failed to initialize cache. Will try to rollback cache 
start
routine. " +
                "[cacheName=" + req.cacheName() + ']', e);

        cctx.cache().closeCaches(Collections.singleton(req.cacheName()), false);

        cctx.cache().completeCacheStartFuture(req, false, e);
}
```
Assume, that GridDhtPartitionsExchangeFuture will finish without any error
because of the exception is just logged.
Is this way right? What should return the Ignite#createCache method in this
case?

I can't check what could return in that case because it just doesn't work
this way now.
In the further, we're getting the critical error that stops ExchangeWorker
in a test environment 
or stops node in a production environment.

Reproducer:
```
package org.apache.ignite.internal.processors.cache;

import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.internal.IgniteEx;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;

public class CreateCacheFreezeTest extends GridCommonAbstractTest {
    public void test() throws Exception {
        IgniteEx ignite = startGrid(0);

        U.registerMBean(ignite.context().config().getMBeanServer(),
ignite.name(), "FIRST_CACHE",
           
"org.apache.ignite.internal.processors.cache.CacheLocalMetricsMXBeanImpl",
            new DummyMBeanImpl(), DummyMBean.class);

        GridTestUtils.assertThrowsWithCause(() -> {
            ignite.createCache(new CacheConfiguration<>("FIRST_CACHE"));

            return 0;
        }, IgniteCheckedException.class);
        //The creation of SECOND_CACHE will hang because of ExchangeWorker
is stopped
        assertNotNull(ignite.createCache(new
CacheConfiguration<>("SECOND_CACHE")));
    }

    public interface DummyMBean {
        void noop();
    }
    static class DummyMBeanImpl implements DummyMBean {
        @Override public void noop() {
        }
    }
}
```



--
Sent from: http://apache-ignite-developers.2346864.n4.nabble.com/

Reply via email to