tkalkirill commented on a change in pull request #591: URL: https://github.com/apache/ignite-3/pull/591#discussion_r793523251
########## File path: modules/api/src/main/java/org/apache/ignite/configuration/schemas/store/PageMemoryDataRegionConfigurationSchema.java ########## @@ -0,0 +1,79 @@ +/* + * 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.configuration.schemas.store; + +import static org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionConfigurationSchema.PAGE_MEMORY_DATA_REGION_TYPE; + +import org.apache.ignite.configuration.annotation.ConfigValue; +import org.apache.ignite.configuration.annotation.PolymorphicConfigInstance; +import org.apache.ignite.configuration.annotation.Value; +import org.apache.ignite.configuration.validation.Immutable; +import org.apache.ignite.configuration.validation.OneOf; + +/** + * Data region configuration for Page Memory storage engine. + */ +@PolymorphicConfigInstance(PAGE_MEMORY_DATA_REGION_TYPE) +public class PageMemoryDataRegionConfigurationSchema extends DataRegionConfigurationSchema { + /** Type of the Page Memory data region. */ + public static final String PAGE_MEMORY_DATA_REGION_TYPE = "pagemem"; + + /** Default initial size. */ + public static final long DFLT_DATA_REGION_INITIAL_SIZE = 256 * 1024 * 1024; + + /** Default max size. */ + public static final long DFLT_DATA_REGION_MAX_SIZE = 256 * 1024 * 1024; + + @Immutable + @Value(hasDefault = true) + public int pageSize = 16 * 1024; + + @Value(hasDefault = true) + public boolean persistent = false; + + @Value(hasDefault = true) + public long initSize = DFLT_DATA_REGION_INITIAL_SIZE; + + @Value(hasDefault = true) + public long maxSize = DFLT_DATA_REGION_MAX_SIZE; + + @ConfigValue + public MemoryAllocatorConfigurationSchema memoryAllocator; + + @OneOf({"DISABLED", "RANDOM_LRU", "RANDOM_2_LRU"}) + @Value(hasDefault = true) + public String evictionPolicy = "DISABLED"; Review comment: Can use constants? ########## File path: modules/api/src/main/java/org/apache/ignite/configuration/schemas/store/PageMemoryDataRegionConfigurationSchema.java ########## @@ -0,0 +1,79 @@ +/* + * 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.configuration.schemas.store; + +import static org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionConfigurationSchema.PAGE_MEMORY_DATA_REGION_TYPE; + +import org.apache.ignite.configuration.annotation.ConfigValue; +import org.apache.ignite.configuration.annotation.PolymorphicConfigInstance; +import org.apache.ignite.configuration.annotation.Value; +import org.apache.ignite.configuration.validation.Immutable; +import org.apache.ignite.configuration.validation.OneOf; + +/** + * Data region configuration for Page Memory storage engine. + */ +@PolymorphicConfigInstance(PAGE_MEMORY_DATA_REGION_TYPE) +public class PageMemoryDataRegionConfigurationSchema extends DataRegionConfigurationSchema { + /** Type of the Page Memory data region. */ + public static final String PAGE_MEMORY_DATA_REGION_TYPE = "pagemem"; + + /** Default initial size. */ + public static final long DFLT_DATA_REGION_INITIAL_SIZE = 256 * 1024 * 1024; + + /** Default max size. */ + public static final long DFLT_DATA_REGION_MAX_SIZE = 256 * 1024 * 1024; + + @Immutable + @Value(hasDefault = true) + public int pageSize = 16 * 1024; + + @Value(hasDefault = true) + public boolean persistent = false; + + @Value(hasDefault = true) + public long initSize = DFLT_DATA_REGION_INITIAL_SIZE; + + @Value(hasDefault = true) + public long maxSize = DFLT_DATA_REGION_MAX_SIZE; + + @ConfigValue + public MemoryAllocatorConfigurationSchema memoryAllocator; + + @OneOf({"DISABLED", "RANDOM_LRU", "RANDOM_2_LRU"}) + @Value(hasDefault = true) + public String evictionPolicy = "DISABLED"; + + @OneOf({"RANDOM_LRU", "SEGMENTED_LRU", "CLOCK"}) + @Value(hasDefault = true) + public String replacementMode = "CLOCK"; + + @Value(hasDefault = true) + public double evictionThreshold = 0.9; + + @Value(hasDefault = true) + public int emptyPagesPoolSize = 100; + + @Value(hasDefault = true) + public long checkpointPageBufSize = 0; + + @Value(hasDefault = true) + public boolean lazyMemoryAllocation = true; + + // Warmup. Review comment: Maybe jira ticket? ########## File path: modules/configuration/src/test/java/org/apache/ignite/internal/configuration/ConfigurationTestUtils.java ########## @@ -0,0 +1,32 @@ +/* + * 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.configuration; + +import org.apache.ignite.configuration.ConfigurationTree; + +/** + * Utility methods, related to testing configurations. + */ +public class ConfigurationTestUtils { + /** + * Casts dynamic configuration to its specific type. Can be applied to polymorphic configuration instances. + */ + public static <C extends ConfigurationTree> C fixConfiguration(C cfg) { Review comment: ```suggestion public static <C extends ConfigurationTree> C fixConfiguration(C cfg) { ``` ########## File path: modules/api/src/main/java/org/apache/ignite/configuration/schemas/store/PageMemoryDataRegionConfigurationSchema.java ########## @@ -0,0 +1,79 @@ +/* + * 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.configuration.schemas.store; + +import static org.apache.ignite.configuration.schemas.store.PageMemoryDataRegionConfigurationSchema.PAGE_MEMORY_DATA_REGION_TYPE; + +import org.apache.ignite.configuration.annotation.ConfigValue; +import org.apache.ignite.configuration.annotation.PolymorphicConfigInstance; +import org.apache.ignite.configuration.annotation.Value; +import org.apache.ignite.configuration.validation.Immutable; +import org.apache.ignite.configuration.validation.OneOf; + +/** + * Data region configuration for Page Memory storage engine. + */ +@PolymorphicConfigInstance(PAGE_MEMORY_DATA_REGION_TYPE) +public class PageMemoryDataRegionConfigurationSchema extends DataRegionConfigurationSchema { + /** Type of the Page Memory data region. */ + public static final String PAGE_MEMORY_DATA_REGION_TYPE = "pagemem"; + + /** Default initial size. */ + public static final long DFLT_DATA_REGION_INITIAL_SIZE = 256 * 1024 * 1024; + + /** Default max size. */ + public static final long DFLT_DATA_REGION_MAX_SIZE = 256 * 1024 * 1024; + + @Immutable + @Value(hasDefault = true) + public int pageSize = 16 * 1024; + + @Value(hasDefault = true) + public boolean persistent = false; + + @Value(hasDefault = true) + public long initSize = DFLT_DATA_REGION_INITIAL_SIZE; + + @Value(hasDefault = true) + public long maxSize = DFLT_DATA_REGION_MAX_SIZE; + + @ConfigValue + public MemoryAllocatorConfigurationSchema memoryAllocator; + + @OneOf({"DISABLED", "RANDOM_LRU", "RANDOM_2_LRU"}) + @Value(hasDefault = true) + public String evictionPolicy = "DISABLED"; + + @OneOf({"RANDOM_LRU", "SEGMENTED_LRU", "CLOCK"}) + @Value(hasDefault = true) + public String replacementMode = "CLOCK"; Review comment: Can use constants? -- 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]
