Index: modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/InlineIndexTest.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/InlineIndexTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/InlineIndexTest.java new file mode 100644 --- /dev/null (date 1653294304099) +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/InlineIndexTest.java (date 1653294304099) @@ -0,0 +1,110 @@ +/* + * 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 org.apache.ignite.Ignite; +import org.apache.ignite.IgniteCache; +import org.apache.ignite.cache.query.SqlFieldsQuery; +import org.apache.ignite.configuration.DataRegionConfiguration; +import org.apache.ignite.configuration.DataStorageConfiguration; +import org.apache.ignite.configuration.IgniteConfiguration; + +import org.apache.ignite.testframework.junits.WithSystemProperty; +import org.junit.Test; + +import static org.apache.ignite.IgniteSystemProperties.IGNITE_MAX_INDEX_PAYLOAD_SIZE; + +/** + * + */ +public class InlineIndexTest extends AbstractIndexingCommonTest { + + private final int inlinesSet[] = {10, 100}; + private final String TYPES[] = {"NUMBER", "VARCHAR", "BIGINT"}; + private final int ENTRY_COUNT = 1000; + + @Override + protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception { + IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName); + cfg.setCacheConfiguration(defaultCacheConfiguration()); + + DataRegionConfiguration drCfg = new DataRegionConfiguration(); + drCfg.setPersistenceEnabled(true); + + DataStorageConfiguration dsCfg = new DataStorageConfiguration(); + dsCfg.setDefaultDataRegionConfiguration(drCfg); + + cfg.setDataStorageConfiguration(dsCfg); + // for debug cfg.setFailureDetectionTimeout(100000); + + return cfg; + } + + @Override + protected void beforeTest() throws Exception { + super.beforeTest(); + + cleanPersistenceDir(); + } + + @Override + protected void afterTest() throws Exception { + super.afterTest(); + + //cleanPersistenceDir(); + } + + // after stop use - "du -sh IGNITE_HOME/db/node*/*INLINE*/* | grep index.bin" + @WithSystemProperty(key = IGNITE_MAX_INDEX_PAYLOAD_SIZE, value = "100") + @Test + public void testCase() throws Exception { + try { + Ignite ignite = startGrid(0); + ignite.active(true); + + IgniteCache igniteCache = ignite.cache(DEFAULT_CACHE_NAME); + + + for (int z = 0; z < TYPES.length; z++) { + for (int i = 0; i < inlinesSet.length; i++) { + final String suffix = TYPES[z] + "_INLINE" + inlinesSet[i]; + final String tableName = "TABLE_" + suffix; + final String indexName = "INDEX_" + suffix; + + final SqlFieldsQuery sqlCreateTable = new SqlFieldsQuery("create table " + tableName + " (ID NUMBER,TEST_COLUMN " + TYPES[z] + ", PRIMARY KEY (ID)) WITH \"CACHE_GROUP=" + suffix + "\""); + final SqlFieldsQuery sqlCreateIndex = new SqlFieldsQuery("create index " + indexName + " on " + tableName + " (TEST_COLUMN) INLINE_SIZE " + inlinesSet[i]); + final SqlFieldsQuery sqlInsert = new SqlFieldsQuery("insert into " + tableName + " values ( ? , ?)"); + + igniteCache.query(sqlCreateTable).getAll(); + igniteCache.query(sqlCreateIndex).getAll(); + for (int y = 0; y < ENTRY_COUNT; y++) { + igniteCache.query(sqlInsert.setArgs(y, y)).getAll(); + } + } + } + // for debug Thread.sleep(5000); + ignite.active(false); + // for debug Thread.sleep(5000); + + } finally { + stopAllGrids(); + } + } + + +}