ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Вячеслав Коптилин <slava.kopti...@gmail.com>
Subject Re: Creation of dynamic cache
Date Tue, 07 Aug 2018 12:31:22 GMT
Hello Denis,

It seems we can just comment out the following catch block:
```
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);
//}
```
I think that this exception should be propery handled by
GridDhtPartitionsExchangeFuture#onCacheChangeRequest(boolean crd) method.
(please take a look at this JIRA ticket:
https://issues.apache.org/jira/browse/IGNITE-1094)

Best regards,
Slava.


пт, 3 авг. 2018 г. в 14:54, Denis Garus <garus.d.g@gmail.com>:

> 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/
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message