ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] dspavlov commented on a change in pull request #6781: IGNITE-9562 Destroyed cache that resurrected on an old offline node b…
Date Tue, 20 Aug 2019 11:17:10 GMT
dspavlov commented on a change in pull request #6781: IGNITE-9562 Destroyed cache that resurrected
on an old offline node b…
URL: https://github.com/apache/ignite/pull/6781#discussion_r315633803
 
 

 ##########
 File path: modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgniteCacheGroupsWithRestartsTest.java
 ##########
 @@ -0,0 +1,259 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.persistence.db;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.function.BiFunction;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.QueryIndexType;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.ConnectorConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.commandline.CommandHandler;
+import org.apache.ignite.internal.util.typedef.X;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorTaskArgument;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR;
+
+/**
+ * Testing corner cases in cache group functionality: -stopping cache in shared group and
immediate node leaving;
+ * -starting cache in shared group with the same name as destroyed one; -etc.
+ */
+@SuppressWarnings({"unchecked", "ThrowableNotThrown"})
+public class IgniteCacheGroupsWithRestartsTest extends GridCommonAbstractTest {
+    /** Group name. */
+    public static final String GROUP = "group";
+
+    /**
+     *
+     */
+    private volatile boolean startExtraStaticCache;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
+        IgniteConfiguration configuration = super.getConfiguration(gridName);
+
+        configuration.setConsistentId(gridName);
+
+        configuration.setConnectorConfiguration(new ConnectorConfiguration());
+
+        DataStorageConfiguration cfg = new DataStorageConfiguration();
+
+        cfg.setDefaultDataRegionConfiguration(new DataRegionConfiguration()
+            .setPersistenceEnabled(true)
+            .setMaxSize(256 * 1024 * 1024));
+
+        configuration.setDataStorageConfiguration(cfg);
+
+        if (startExtraStaticCache)
+            configuration.setCacheConfiguration(getCacheConfiguration(3));
+
+        return configuration;
+    }
+
+    /**
+     * @param i Cache index number.
+     * @return Cache configuration with the given number in name.
+     */
+    private CacheConfiguration<Object, Object> getCacheConfiguration(int i) {
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        LinkedHashMap<String, String> fields = new LinkedHashMap<>();
+
+        fields.put("updateDate", "java.lang.Date");
+        fields.put("amount", "java.lang.Long");
+        fields.put("name", "java.lang.String");
+
+        Set<QueryIndex> indices = Collections.singleton(new QueryIndex("name", QueryIndexType.SORTED));
+
+        ccfg.setName(getCacheName(i))
+            .setGroupName("group")
+            .setQueryEntities(Collections.singletonList(
+                new QueryEntity(Long.class, Account.class)
+                    .setFields(fields)
+                    .setIndexes(indices)
+            ))
+            .setAffinity(new RendezvousAffinityFunction(false, 64));
+
+        return ccfg;
+    }
+
+    /**
+     * @param i Index.
+     * @return Generated cache name for index.
+     */
+    private String getCacheName(int i) {
+        return "cache-" + i;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        afterTest();
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+
+        cleanPersistenceDir();
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    @Ignore("https://issues.apache.org/jira/browse/IGNITE-8717")
+    @Test
+    public void testNodeRestartRightAfterCacheStop() throws Exception {
 
 Review comment:
   this test failed loccally because Ignore is not yet supported in the base branch
   
   I've added fail("https://issues.apache.org/jira/browse/IGNITE-8717");

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message