sk0x50 commented on code in PR #5133: URL: https://github.com/apache/ignite-3/pull/5133#discussion_r1935504110
########## modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/AbstractCollocationBenchmark.java: ########## @@ -0,0 +1,141 @@ +/* + * 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.benchmark; + +import static org.apache.ignite.catalog.definitions.ColumnDefinition.column; +import static org.apache.ignite.internal.catalog.CatalogService.DEFAULT_STORAGE_PROFILE; +import static org.apache.ignite.internal.testframework.TestIgnitionManager.PRODUCTION_CLUSTER_CONFIG_STRING; + +import java.util.ArrayList; +import java.util.List; +import org.apache.ignite.catalog.ColumnType; +import org.apache.ignite.catalog.definitions.TableDefinition; +import org.apache.ignite.catalog.definitions.ZoneDefinition; +import org.apache.ignite.internal.replicator.TablePartitionId; +import org.apache.ignite.internal.replicator.ZonePartitionId; +import org.apache.ignite.internal.tx.message.WriteIntentSwitchReplicaRequest; +import org.apache.ignite.table.KeyValueView; +import org.apache.ignite.table.Table; +import org.apache.ignite.table.Tuple; + +/** + * Base class that allows to measure basic KeyValue operations for tables that share the same distribution zone. + * TODO: https://issues.apache.org/jira/browse/IGNITE-22522 remove this benchmark. + */ +public class AbstractCollocationBenchmark extends AbstractMultiNodeBenchmark { + /** Name of shared zone. */ + private static final String SHARED_ZONE_NAME = "shared_zone"; + + /** System property that allows to enable/disable collocation feature. */ + private static final String FEATURE_FLAG_NAME = "IGNITE_ZONE_BASED_REPLICATION"; + + /** {@code true} enables collocation feature. */ + private static final Boolean ENABLE_COLLOCATION_FEATURE = true; + + protected final List<KeyValueView<Tuple, Tuple>> tableViews = new ArrayList<>(); + + @Override + protected int nodes() { + return 1; + } + + @Override + protected int replicaCount() { + return 1; + } + + @Override + protected String clusterConfiguration() { + if (tinySchemaSyncWaits()) { + return super.clusterConfiguration(); + } else { + // Return a magic string that explicitly requests production defaults. + return PRODUCTION_CLUSTER_CONFIG_STRING; + } + } + + @Override + protected void createDistributionZoneOnStartup() { + ZoneDefinition zone = ZoneDefinition.builder(SHARED_ZONE_NAME) + .partitions(partitionCount()) + .replicas(replicaCount()) + .storageProfiles(DEFAULT_STORAGE_PROFILE) + .build(); + + publicIgnite.catalog().createZone(zone); + } + + @Override + protected void createTableOnStartup() { + for (int i = 1; i <= tableCount(); ++i) { Review Comment: Ok, agree. I will rename the method. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
