diff --git a/community/kernel/src/main/java/org/neo4j/graphdb/factory/GraphDatabaseSettings.java b/community/kernel/src/main/java/org/neo4j/graphdb/factory/GraphDatabaseSettings.java index aa25a77b595c8..6029814f3140c 100644 --- a/community/kernel/src/main/java/org/neo4j/graphdb/factory/GraphDatabaseSettings.java +++ b/community/kernel/src/main/java/org/neo4j/graphdb/factory/GraphDatabaseSettings.java @@ -344,13 +344,12 @@ public class GraphDatabaseSettings implements LoadableConfig @Description( "Configures the general policy for when check-points should occur. The default policy is to " + "check-point 'periodically', as specified by the 'dbms.checkpoint.interval.tx' and " + "'dbms.checkpoint.interval.time' settings. " + - "There are two alternative policies: " + + "The Neo4j Enterprise Edition provides two alternative policies: " + "The first is to check-point 'continuously', which will ignore those settings and run the " + "check-point process all the time. " + - "The second (Enterprise only) alternative policy is the 'volumetric' policy, which makes a " + - "best-effort at check-pointing often enough so that the database doesn't get too far behind on " + - "deleting old transaction logs in accordance with the 'dbms.tx_log.rotation.retention_policy' " + - "setting." ) + "The second is the 'volumetric' policy, which makes a best-effort at check-pointing often enough " + + "so that the database doesn't get too far behind on deleting old transaction logs in accordance " + + "with the 'dbms.tx_log.rotation.retention_policy' setting." ) public static final Setting check_point_policy = setting( "dbms.checkpoint", STRING, "periodically" ); @Description( "Configures the transaction interval between check-points. The database will not check-point more " + diff --git a/community/kernel/src/main/resources/META-INF/services/org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointThresholdPolicy b/community/kernel/src/main/resources/META-INF/services/org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointThresholdPolicy index ea1064fd5787b..0771d65488132 100644 --- a/community/kernel/src/main/resources/META-INF/services/org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointThresholdPolicy +++ b/community/kernel/src/main/resources/META-INF/services/org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointThresholdPolicy @@ -1,2 +1 @@ org.neo4j.kernel.impl.transaction.log.checkpoint.PeriodicThresholdPolicy -org.neo4j.kernel.impl.transaction.log.checkpoint.ContinuousThresholdPolicy diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/log/checkpoint/CheckPointThresholdTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/log/checkpoint/CheckPointThresholdTest.java index c5478a0f5b333..661b4eb903da2 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/log/checkpoint/CheckPointThresholdTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/log/checkpoint/CheckPointThresholdTest.java @@ -209,24 +209,4 @@ public void timeBasedThresholdMustSuggestSchedulingFrequency() throws Exception withIntervalTime( "100ms" ); assertThat( createThreshold().checkFrequencyMillis().min().getAsLong(), is( 100L ) ); } - - @SuppressWarnings( "ConstantConditions" ) - @Test - public void continuousPolicyMustAlwaysTriggerCheckPoints() throws Exception - { - withPolicy( "continuously" ); - CheckPointThreshold threshold = createThreshold(); - threshold.initialize( 2 ); - - assertThat( threshold.checkFrequencyMillis().min().getAsLong(), is( 0L ) ); - - assertTrue( threshold.isCheckPointingNeeded( 2, triggered ) ); - threshold.checkPointHappened( 3 ); - assertTrue( threshold.isCheckPointingNeeded( 3, triggered ) ); - assertTrue( threshold.isCheckPointingNeeded( 3, triggered ) ); - verifyTriggered( "continuous" ); - verifyTriggered( "continuous" ); - verifyTriggered( "continuous" ); - verifyNoMoreTriggers(); - } } diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/log/checkpoint/ContinuousCheckPointThreshold.java b/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/enterprise/transaction/log/checkpoint/ContinuousCheckPointThreshold.java similarity index 65% rename from community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/log/checkpoint/ContinuousCheckPointThreshold.java rename to enterprise/kernel/src/main/java/org/neo4j/kernel/impl/enterprise/transaction/log/checkpoint/ContinuousCheckPointThreshold.java index b0236729684f7..94017bcfcd53d 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/log/checkpoint/ContinuousCheckPointThreshold.java +++ b/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/enterprise/transaction/log/checkpoint/ContinuousCheckPointThreshold.java @@ -5,22 +5,24 @@ * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ -package org.neo4j.kernel.impl.transaction.log.checkpoint; +package org.neo4j.kernel.impl.enterprise.transaction.log.checkpoint; import java.util.stream.LongStream; +import org.neo4j.kernel.impl.transaction.log.checkpoint.AbstractCheckPointThreshold; + class ContinuousCheckPointThreshold extends AbstractCheckPointThreshold { ContinuousCheckPointThreshold() diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/log/checkpoint/ContinuousThresholdPolicy.java b/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/enterprise/transaction/log/checkpoint/ContinuousThresholdPolicy.java similarity index 64% rename from community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/log/checkpoint/ContinuousThresholdPolicy.java rename to enterprise/kernel/src/main/java/org/neo4j/kernel/impl/enterprise/transaction/log/checkpoint/ContinuousThresholdPolicy.java index b9a08ebd1a5fa..b9212ef60858a 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/log/checkpoint/ContinuousThresholdPolicy.java +++ b/enterprise/kernel/src/main/java/org/neo4j/kernel/impl/enterprise/transaction/log/checkpoint/ContinuousThresholdPolicy.java @@ -5,24 +5,26 @@ * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU Affero General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . */ -package org.neo4j.kernel.impl.transaction.log.checkpoint; +package org.neo4j.kernel.impl.enterprise.transaction.log.checkpoint; import java.time.Clock; import org.neo4j.helpers.Service; import org.neo4j.kernel.configuration.Config; +import org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointThreshold; +import org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointThresholdPolicy; import org.neo4j.kernel.impl.transaction.log.pruning.LogPruning; import org.neo4j.logging.LogProvider; diff --git a/enterprise/kernel/src/main/resources/META-INF/services/org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointThresholdPolicy b/enterprise/kernel/src/main/resources/META-INF/services/org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointThresholdPolicy index 03088aaa9eb2f..ade513b1f350d 100644 --- a/enterprise/kernel/src/main/resources/META-INF/services/org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointThresholdPolicy +++ b/enterprise/kernel/src/main/resources/META-INF/services/org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointThresholdPolicy @@ -1 +1,2 @@ org.neo4j.kernel.impl.enterprise.transaction.log.checkpoint.VolumetricCheckPointPolicy +org.neo4j.kernel.impl.enterprise.transaction.log.checkpoint.ContinuousThresholdPolicy diff --git a/enterprise/kernel/src/test/java/org/neo4j/kernel/impl/enterprise/transaction/log/checkpoint/VolumetricCheckPointThresholdTest.java b/enterprise/kernel/src/test/java/org/neo4j/kernel/impl/enterprise/transaction/log/checkpoint/EnterpriseCheckPointThresholdTest.java similarity index 73% rename from enterprise/kernel/src/test/java/org/neo4j/kernel/impl/enterprise/transaction/log/checkpoint/VolumetricCheckPointThresholdTest.java rename to enterprise/kernel/src/test/java/org/neo4j/kernel/impl/enterprise/transaction/log/checkpoint/EnterpriseCheckPointThresholdTest.java index 907c82cf56b0c..f5ffc5b608929 100644 --- a/enterprise/kernel/src/test/java/org/neo4j/kernel/impl/enterprise/transaction/log/checkpoint/VolumetricCheckPointThresholdTest.java +++ b/enterprise/kernel/src/test/java/org/neo4j/kernel/impl/enterprise/transaction/log/checkpoint/EnterpriseCheckPointThresholdTest.java @@ -26,11 +26,13 @@ import org.neo4j.kernel.impl.transaction.log.checkpoint.CheckPointThresholdTestSupport; import org.neo4j.kernel.impl.transaction.log.pruning.LogPruning; +import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -public class VolumetricCheckPointThresholdTest extends CheckPointThresholdTestSupport +public class EnterpriseCheckPointThresholdTest extends CheckPointThresholdTestSupport { private boolean haveLogsToPrune; @@ -77,4 +79,24 @@ public void checkPointIsInitiallyNotNeededIfWeHaveNoLogsToPrune() throws Excepti assertFalse( threshold.isCheckPointingNeeded( 2, notTriggered ) ); verifyNoMoreTriggers(); } + + @SuppressWarnings( "ConstantConditions" ) + @Test + public void continuousPolicyMustAlwaysTriggerCheckPoints() throws Exception + { + withPolicy( "continuously" ); + CheckPointThreshold threshold = createThreshold(); + threshold.initialize( 2 ); + + assertThat( threshold.checkFrequencyMillis().min().getAsLong(), is( 0L ) ); + + assertTrue( threshold.isCheckPointingNeeded( 2, triggered ) ); + threshold.checkPointHappened( 3 ); + assertTrue( threshold.isCheckPointingNeeded( 3, triggered ) ); + assertTrue( threshold.isCheckPointingNeeded( 3, triggered ) ); + verifyTriggered( "continuous" ); + verifyTriggered( "continuous" ); + verifyTriggered( "continuous" ); + verifyNoMoreTriggers(); + } }