tkalkirill commented on code in PR #939: URL: https://github.com/apache/ignite-3/pull/939#discussion_r924297270
########## modules/raft/src/main/java/org/apache/ignite/internal/raft/server/RaftGroupOptions.java: ########## @@ -17,13 +17,18 @@ package org.apache.ignite.internal.raft.server; +import org.jetbrains.annotations.Nullable; + /** * Options specific to a Raft group that is being started. */ public class RaftGroupOptions { /** Whether volatile stores should be used for the corresponding Raft Group. Classic Raft uses persistent ones. */ private final boolean volatileStores; + @Nullable + private final String volatileLogStoreBudgetClassName; Review Comment: ```suggestion private final @Nullable String volatileLogStoreBudgetClassName; ``` ########## modules/api/src/main/java/org/apache/ignite/configuration/schemas/table/RaftConfigurationSchema.java: ########## @@ -0,0 +1,33 @@ +/* + * 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.table; + +import org.apache.ignite.configuration.annotation.Config; +import org.apache.ignite.configuration.annotation.Value; +import org.apache.ignite.configuration.validation.Immutable; + +/** + * Configuration for Raft group corresponding to tables. + */ +@Config +public class RaftConfigurationSchema { + /** Class of log storage budget. */ + @Value(hasDefault = true) + @Immutable + public String logStorageBudgetClass = "org.apache.ignite.raft.jraft.storage.impl.UnlimitedBudget"; Review Comment: Is it correct for the user to set this through the configuration? Maybe through loading services or something like that? ########## modules/api/src/main/java/org/apache/ignite/configuration/schemas/table/RaftConfigurationSchema.java: ########## @@ -0,0 +1,33 @@ +/* + * 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.table; + +import org.apache.ignite.configuration.annotation.Config; +import org.apache.ignite.configuration.annotation.Value; +import org.apache.ignite.configuration.validation.Immutable; + +/** + * Configuration for Raft group corresponding to tables. + */ +@Config +public class RaftConfigurationSchema { + /** Class of log storage budget. */ + @Value(hasDefault = true) + @Immutable Review Comment: Why should it be immutable? after node restart can we change it? ########## modules/raft/src/main/java/org/apache/ignite/raft/jraft/storage/impl/LogStorageOverflowException.java: ########## @@ -0,0 +1,48 @@ +/* + * 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.raft.jraft.storage.impl; + +import org.apache.ignite.lang.IgniteException; + +/** + * Thrown by {@link org.apache.ignite.raft.jraft.storage.LogStorage} methods to indicate that some entries (a suffix of the + * collection of entries that was tried to be saved) were not saved due to an overflow. + */ +public class LogStorageOverflowException extends IgniteException { + private final int overflowedEntries; + + /** + * Constructs new instance. + * + * @param overflowedEntries Length of the suffix that was not saved. + */ + public LogStorageOverflowException(int overflowedEntries) { + super(overflowedEntries + " entries were not saved due to log storage overflow"); + + this.overflowedEntries = overflowedEntries; + } + + /** + * Returns number of entries that were not saved in the current attempt to append entries. + * + * @return Number of entries that were not saved in the current attempt to append entries. Review Comment: ```suggestion * Returns number of entries that were not saved in the current attempt to append entries. ``` ########## modules/api/src/main/java/org/apache/ignite/configuration/schemas/table/TableConfigurationSchema.java: ########## @@ -61,4 +61,8 @@ public class TableConfigurationSchema { /** Indices configuration. */ @NamedConfigValue public TableIndexConfigurationSchema indices; + + /** Configuration for Raft groups corresponding to table partitions. */ + @ConfigValue + public RaftConfigurationSchema raft; Review Comment: I don't know if this is correct or not, but I have a feeling that it is not. @sanpwc WDYT? ########## .gitignore: ########## @@ -4,3 +4,8 @@ target work .DS_Store .flattened-pom.xml + +.classpath Review Comment: At what point are these files/directories created? ########## modules/raft/src/main/java/org/apache/ignite/internal/raft/server/RaftGroupOptions.java: ########## @@ -75,4 +81,15 @@ private RaftGroupOptions(boolean volatileStores) { public boolean volatileStores() { return volatileStores; } + + /** + * Returns name of a class implementing {@link org.apache.ignite.raft.jraft.storage.impl.LogStorageBudget} that + * will be used by volatile Raft log storage (if it's used). + * + * @return Name of a budget class. + */ + @Nullable + public String volatileLogStoreBudgetClassName() { Review Comment: ```suggestion public @Nullable String volatileLogStoreBudgetClassName() { ``` ########## modules/raft/src/main/java/org/apache/ignite/raft/jraft/storage/impl/EntryCountBudget.java: ########## @@ -0,0 +1,96 @@ +/* + * 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.raft.jraft.storage.impl; + +import java.util.List; +import org.apache.ignite.raft.jraft.entity.LogEntry; + +/** + * {@link LogStorageBudget} that makes sure that no more entries than the provided limit is stored. + */ +public class EntryCountBudget implements LogStorageBudget { Review Comment: Should it work in one thread? -- 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