Skip to content

Commit

Permalink
Move the continuous check-point policy to Enterprise.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvest committed Dec 1, 2017
1 parent 57f43d1 commit 51598a8
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 41 deletions.
Expand Up @@ -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<String> check_point_policy = setting( "dbms.checkpoint", STRING, "periodically" );

@Description( "Configures the transaction interval between check-points. The database will not check-point more " +
Expand Down
@@ -1,2 +1 @@
org.neo4j.kernel.impl.transaction.log.checkpoint.PeriodicThresholdPolicy
org.neo4j.kernel.impl.transaction.log.checkpoint.ContinuousThresholdPolicy
Expand Up @@ -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();
}
}
Expand Up @@ -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 <http://www.gnu.org/licenses/>.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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()
Expand Down
Expand Up @@ -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 <http://www.gnu.org/licenses/>.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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;

Expand Down
@@ -1 +1,2 @@
org.neo4j.kernel.impl.enterprise.transaction.log.checkpoint.VolumetricCheckPointPolicy
org.neo4j.kernel.impl.enterprise.transaction.log.checkpoint.ContinuousThresholdPolicy
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
}
}

0 comments on commit 51598a8

Please sign in to comment.