JAkutenshi commented on code in PR #5465: URL: https://github.com/apache/ignite-3/pull/5465#discussion_r2010229598
########## modules/partition-replicator/src/integrationTest/java/org/apache/ignite/internal/partition/replicator/ItZoneInMemoryTest.java: ########## @@ -0,0 +1,197 @@ +/* + * 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.partition.replicator; + +import static org.apache.ignite.internal.testframework.IgniteTestUtils.getFieldValue; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentMap; +import org.apache.ignite.internal.TestDefaultProfilesNames; +import org.apache.ignite.internal.catalog.descriptors.CatalogStorageProfileDescriptor; +import org.apache.ignite.internal.catalog.descriptors.CatalogZoneDescriptor; +import org.apache.ignite.internal.lang.NodeStoppingException; +import org.apache.ignite.internal.partition.replicator.fixtures.Node; +import org.apache.ignite.internal.raft.Peer; +import org.apache.ignite.internal.raft.RaftNodeId; +import org.apache.ignite.internal.raft.server.RaftServer; +import org.apache.ignite.internal.raft.server.impl.JraftServerImpl; +import org.apache.ignite.internal.raft.storage.impl.VolatileLogStorage; +import org.apache.ignite.internal.replicator.ZonePartitionId; +import org.apache.ignite.internal.storage.engine.StorageEngine; +import org.apache.ignite.internal.storage.pagememory.VolatilePageMemoryTableStorage; +import org.apache.ignite.internal.table.TableTestUtils; +import org.apache.ignite.internal.table.distributed.storage.InternalTableImpl; +import org.apache.ignite.raft.jraft.RaftGroupService; +import org.apache.ignite.raft.jraft.core.NodeImpl; +import org.apache.ignite.raft.jraft.storage.LogStorage; +import org.apache.ignite.table.KeyValueView; +import org.junit.jupiter.api.Test; + +/** + * Set of tests that are checking how in-memory scenarios are working under zone colocation. + */ +public class ItZoneInMemoryTest extends ItAbstractColocationTest { + @Test + void testMixedStorageProfilesZone() throws Exception { + startCluster(1); + + Node node = getNode(0); + + String zoneName = "mixed_zone"; + + int zoneId = createZoneWithStorageProfiles( + node, + zoneName, + 1, + 1, + TestDefaultProfilesNames.DEFAULT_TEST_PROFILE_NAME, + TestDefaultProfilesNames.DEFAULT_AIMEM_PROFILE_NAME + ); + + checkZoneConsistOfMixedStorageProfiles(node, zoneId); + + assertFalse(isRaftLogStorageVolatile(node, zoneId)); + + checkWriteReadInVolatileTableStorageIsSuccessful(node, zoneName); + } + + @Test + void testVolatileStorageProfileZone() throws Exception { + startCluster(1); + + Node node = getNode(0); + + String zoneName = "mixed_zone"; + int zoneId = createZoneWithStorageProfiles( + node, + zoneName, + 1, + 1, + TestDefaultProfilesNames.DEFAULT_AIMEM_PROFILE_NAME + ); + + checkZoneConsistOfVolatileOnlyStorageProfile(node, zoneId); + + assertTrue(isRaftLogStorageVolatile(node, zoneId)); + + checkWriteReadInVolatileTableStorageIsSuccessful(node, zoneName); + } + + private static void checkWriteReadInVolatileTableStorageIsSuccessful(Node node, String zoneName) throws NodeStoppingException { + String tableName = "volatile_table"; + + createTable(node, zoneName, tableName, TestDefaultProfilesNames.DEFAULT_AIMEM_PROFILE_NAME); + int tableId = TableTestUtils.getTableId(node.catalogManager, tableName, node.hybridClock.nowLong()); + + checkTableStorageIsVolatile(node, tableId); + + KeyValueView<Long, Integer> kvView = node.tableManager.table(tableId).keyValueView(Long.class, Integer.class); Review Comment: Isn't it a public api? Oo I'm to sure what I should use there instead of -- 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. To unsubscribe, e-mail: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org