Index: modules/core/src/test/java/org/apache/ignite/issues/Ignite123456Test.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/modules/core/src/test/java/org/apache/ignite/issues/Ignite123456Test.java b/modules/core/src/test/java/org/apache/ignite/issues/Ignite123456Test.java new file mode 100644 --- /dev/null (date 1648470765487) +++ b/modules/core/src/test/java/org/apache/ignite/issues/Ignite123456Test.java (date 1648470765487) @@ -0,0 +1,114 @@ +/* + * 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.issues; + +import org.apache.ignite.IgniteCache; +import org.apache.ignite.cache.QueryEntity; +import org.apache.ignite.cache.query.SqlFieldsQuery; +import org.apache.ignite.configuration.CacheConfiguration; +import org.apache.ignite.configuration.DataRegionConfiguration; +import org.apache.ignite.configuration.DataStorageConfiguration; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.junit.Test; + +import java.util.Arrays; + +/** + * When entering a node, with a difference in the description of QueryEntity, according to the composition of the fields. + * An incorrect patch is generated - the name of the added field comes to the meta in lower case. + * In the test, the age field of the Person class is used as an example, which should come in uppercase, + * but comes in lowercase. + * The first node starts without a description of the age field in QueryEntity, the second with a description. + */ +public class Ignite123456Test extends GridCommonAbstractTest { + /** + * Start cluster nodes. + */ + public static final int NODES_CNT = 2; + + /** + * Count of backup partitions. + */ + public static final int BACKUPS = 2; + + + @Override + protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { + QueryEntity queryEntity = new QueryEntity(String.class, Person.class) + .setTableName("PERSON") + .addQueryField("id", Integer.class.getName(), null) + .addQueryField("name", String.class.getName(), null); + + //if second node then add description age field + if (igniteInstanceName.equals("issues.Ignite123456Test1")) + queryEntity.addQueryField("age", Integer.class.getName(), null); + + IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName) + .setActiveOnStart(false) + .setConsistentId(igniteInstanceName) + .setDataStorageConfiguration(new DataStorageConfiguration() + .setDefaultDataRegionConfiguration(new DataRegionConfiguration())) + .setCacheConfiguration( + new CacheConfiguration(DEFAULT_CACHE_NAME) + .setBackups(BACKUPS) + .setQueryEntities(Arrays.asList(queryEntity))); + + return cfg; + } + + + /** + * {@inheritDoc} + */ + @Override + protected void afterTest() throws Exception { + stopAllGrids(); + } + + /** + * + */ + @Test + public void testIssue() throws Exception { + startGrids(NODES_CNT); + + grid(0).active(true); + + IgniteCache igniteCache = grid(0).cache(DEFAULT_CACHE_NAME); + + int querySizeUpper = igniteCache.query(new SqlFieldsQuery("select * from \"SYS\".TABLE_COLUMNS " + + "where COLUMN_NAME='AGE' and TABLE_NAME='PERSON'")) + .getAll().size(); + + int querySizeLower = igniteCache.query(new SqlFieldsQuery("select * from \"SYS\".TABLE_COLUMNS " + + "where COLUMN_NAME='age' and TABLE_NAME='PERSON'")) + .getAll().size(); + + assertEquals(1, querySizeUpper); + assertEquals(0, querySizeLower); + } + + class Person { + private long id; + + private String name; + + private int age; + } +}