You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2020/11/18 06:09:59 UTC

[GitHub] [ignite] zstan commented on a change in pull request #8439: IGNITE-13572 Don't skip filtering for caches with zero backups.

zstan commented on a change in pull request #8439:
URL: https://github.com/apache/ignite/pull/8439#discussion_r525835972



##########
File path: modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/SqlPartitionEvictionTest.java
##########
@@ -0,0 +1,196 @@
+/*
+ * 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.index;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteDataStreamer;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.query.SqlFieldsQuery;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
+import org.apache.ignite.internal.processors.query.GridQueryProcessor;
+import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
+import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+/** */
+@RunWith(Parameterized.class)
+public class SqlPartitionEvictionTest extends GridCommonAbstractTest {
+    /** */
+    private static final String POI_CACHE_NAME = "POI_CACHE";
+
+    /** */
+    private static final String POI_SCHEMA_NAME = "DOMAIN";
+
+    /** */
+    private static final String POI_TABLE_NAME = "POI";
+
+    /** */
+    private static final String POI_CLASS_NAME = "PointOfInterest";
+
+    /** */
+    private static final String ID_FIELD_NAME = "id";
+
+    /** */
+    private static final String NAME_FIELD_NAME = "name";
+
+    /** */
+    private static final String LATITUDE_FIELD_NAME = "latitude";
+
+    /** */
+    private static final String LONGITUDE_FIELD_NAME = "longitude";
+
+    /** */
+    private static final int NUM_ENTITIES = 1_000;
+
+    /** Test parameters. */
+    @Parameterized.Parameters(name = "backups_count={0}")
+    public static Iterable<Object[]> params() {
+        return Arrays.asList(
+                new Object[] { 0 },
+                new Object[] { 1 },
+                new Object[] { 2 }
+            );
+    }
+
+    /** */
+    @Parameterized.Parameter
+    public int backupsCount;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+        cfg.setCacheConfiguration(new CacheConfiguration<>(POI_CACHE_NAME)
+            .setAtomicityMode(CacheAtomicityMode.ATOMIC)
+            .setSqlSchema("DOMAIN")
+            .setQueryEntities(Collections.singletonList(queryEntity()))
+            .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
+            .setCacheMode(CacheMode.PARTITIONED)
+            .setBackups(backupsCount)
+        );
+
+        cfg.setActiveOnStart(true);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        stopAllGrids(true);
+
+        super.afterTest();
+    }
+
+    @Test
+    public void testSqlConsistencyOnEviction() throws Exception {
+        ignitionStart(0);
+        IgniteEx ig = ignitionStart(1);
+
+        loadData(ig, 0, NUM_ENTITIES);
+
+        ignitionStart(2);
+
+        awaitPartitionMapExchange();
+
+        for (Ignite g: G.allGrids())
+            assertEquals(NUM_ENTITIES, query(g, "SELECT * FROM " + POI_TABLE_NAME).size());
+

Review comment:
       redundant line




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