[ 
https://issues.apache.org/jira/browse/IGNITE-8640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16698840#comment-16698840
 ] 

Vyacheslav Koptilin commented on IGNITE-8640:
---------------------------------------------

Hello [~garus.d.g],

In general, I have no objections related to the proposed fix, but it seems that 
we need to modify tests.
Please take into account the following note:
 - the definition of {{IgniteCache.getOrCreateCache()}} states that this method 
throws {{javax.cache.CacheException}}
so, it does not seem correct to me catching {{IgniteCheckedException}} instead 
of {{CacheException}}.
For example, {{SqlIllegalSchemaSelfTest.testBadCacheNameDynamic()}}

{code:java}
        try {
            node.getOrCreateCache(new 
CacheConfiguration().setName(QueryUtils.SCHEMA_SYS));
        }
        catch (Throwable e) {
            assertTrue(hasCause(e, IgniteCheckedException.class,
                "SQL schema name derived from cache name is reserved (please 
set explicit SQL " +
                    "schema name through CacheConfiguration.setSqlSchema() or 
choose another cache name) [" +
                    "cacheName=IGNITE, schemaName=null]"));

            return;
        }
{code}
So, I suggest a trivial change:
{code:java}
        try {
            node.getOrCreateCache(new 
CacheConfiguration().setName(QueryUtils.SCHEMA_SYS));
        }
        catch (CacheException e) {
            assertTrue(hasCause(e, IgniteCheckedException.class,
                "SQL schema name derived from cache name is reserved (please 
set explicit SQL " +
                    "schema name through CacheConfiguration.setSqlSchema() or 
choose another cache name) [" +
                    "cacheName=IGNITE, schemaName=null]"));

            return;
        }
        catch (Throwable e) {
             fail("Exception class is not as expected [expected=" + 
CacheException.class + ", actual=" + e.getClass() + ']', e);
        }

        fail("Exception has not been thrown.");
{code}

> If first createCache fail - Ignite is freezing on next createCache
> ------------------------------------------------------------------
>
>                 Key: IGNITE-8640
>                 URL: https://issues.apache.org/jira/browse/IGNITE-8640
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>    Affects Versions: 2.6
>            Reporter: Nikolay Izhikov
>            Assignee: Denis Garus
>            Priority: Critical
>             Fix For: 2.8
>
>
> If first {{createCache}} operation fails on some condition inside 
> {{GridCacheProcessor#validate}} then second {{createCache}} will freeze 
> forever.
> Reproducer:
> {code:java}
> package org.apache.ignite.internal.processors.cache;
> import org.apache.ignite.IgniteCache;
> import org.apache.ignite.IgniteCheckedException;
> import org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy;
> import org.apache.ignite.configuration.CacheConfiguration;
> import org.apache.ignite.internal.IgniteEx;
> import org.apache.ignite.testframework.GridTestUtils;
> import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
> public class CreateCacheFreezeTest extends GridCommonAbstractTest {
>     public void testCreateEncryptedNotPersistedCacheFail() throws Exception {
>         IgniteEx ignite = startGrid(0);
>         
>         GridTestUtils.assertThrowsWithCause(() -> {
>             CacheConfiguration<Long, String> cc = new 
> CacheConfiguration<>("failed");
>             cc.setEvictionPolicy(new FifoEvictionPolicy());
>             cc.setOnheapCacheEnabled(false);
>             ignite.createCache(cc);
>             return 0;
>         }, IgniteCheckedException.class);
>         IgniteCache<Long, String> cache = ignite.createCache(new 
> CacheConfiguration<>("default"));
>         assertNotNull(cache);
>     }
> }
> {code}
> Log message:
> {noformat}
> [2018-05-29 
> 16:38:11,958][ERROR][exchange-worker-#38%cache.CreateCacheFreezeTest0%][GridDhtPartitionsExchangeFuture]
>  Failed to reinitialize local partitions (preloading will be stopped): 
> GridDhtPartitionExchangeId [topVer=AffinityTopologyVersion [topVer=1, 
> minorTopVer=1], discoEvt=DiscoveryCustomEvent 
> [customMsg=DynamicCacheChangeBatch 
> [id=67cce1ca361-993dd9c2-f4fe-443b-af43-27e06424e1b0, 
> reqs=[DynamicCacheChangeRequest [cacheName=failed, hasCfg=true, 
> nodeId=a525b74c-aec5-4c62-855a-ff96ef300000, clientStartOnly=false, 
> stop=false, destroy=false, disabledAfterStartfalse]], 
> exchangeActions=ExchangeActions [startCaches=[failed], stopCaches=null, 
> startGrps=[failed], stopGrps=[], resetParts=null, stateChangeRequest=null], 
> startCaches=false], affTopVer=AffinityTopologyVersion [topVer=1, 
> minorTopVer=1], super=DiscoveryEvent [evtNode=TcpDiscoveryNode 
> [id=a525b74c-aec5-4c62-855a-ff96ef300000, addrs=[127.0.0.1], 
> sockAddrs=[/127.0.0.1:47500], discPort=47500, order=1, intOrder=1, 
> lastExchangeTime=1527601090538, loc=true, ver=2.5.0#19700101-sha1:00000000, 
> isClient=false], topVer=1, nodeId8=a525b74c, msg=null, 
> type=DISCOVERY_CUSTOM_EVT, tstamp=1527601091938]], nodeId=a525b74c, 
> evt=DISCOVERY_CUSTOM_EVT]
> java.lang.AssertionError: stopping=false, groupName=null, caches=[]
>       at 
> org.apache.ignite.internal.processors.cache.CacheGroupContext.singleCacheContext(CacheGroupContext.java:375)
>       at 
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition.<init>(GridDhtLocalPartition.java:197)
>       at 
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopologyImpl.getOrCreatePartition(GridDhtPartitionTopologyImpl.java:828)
>       at 
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopologyImpl.initPartitions(GridDhtPartitionTopologyImpl.java:369)
>       at 
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionTopologyImpl.beforeExchange(GridDhtPartitionTopologyImpl.java:544)
>       at 
> org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.distributedExchange(GridDhtPartitionsExchangeFuture.java:1190)
>       at 
> org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture.init(GridDhtPartitionsExchangeFuture.java:722)
>       at 
> org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body0(GridCachePartitionExchangeManager.java:2452)
>       at 
> org.apache.ignite.internal.processors.cache.GridCachePartitionExchangeManager$ExchangeWorker.body(GridCachePartitionExchangeManager.java:2332)
>       at 
> org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
>       at java.lang.Thread.run(Thread.java:748)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to