Skip to content

Commit

Permalink
Deprecating apoc.warmup.run procedure
Browse files Browse the repository at this point in the history
Also changing tests of the procedure not to assert
the exact number of loaded pages as this is extremely
kernel-internals specific
  • Loading branch information
PetrJanouch committed Feb 14, 2022
1 parent da93e3f commit 84d6e43
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions core/src/main/java/apoc/warmup/Warmup.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ private String subPath(File file, String fromParent) {
return sb.toString();
}

@Deprecated
@Procedure
@Description("apoc.warmup.run(loadProperties=false,loadDynamicProperties=false,loadIndexes=false) - quickly loads all nodes and rels into memory by skipping one page at a time")
public Stream<WarmupResult> run(@Name(value = "loadProperties", defaultValue = "false") boolean loadProperties, @Name(value = "loadDynamicProperties", defaultValue = "false") boolean loadDynamicProperties, @Name(value = "loadIndexes", defaultValue = "false") boolean loadIndexes) throws IOException {
Expand Down
11 changes: 6 additions & 5 deletions core/src/test/java/apoc/warmup/WarmupTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.neo4j.test.rule.ImpermanentDbmsRule;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

/**
* @author Sascha Peukert
Expand Down Expand Up @@ -37,17 +38,17 @@ public void setUp() throws Exception {
public void testWarmup() throws Exception {
TestUtil.testCall(db, "CALL apoc.warmup.run()", r -> {
assertEquals(4L, r.get("nodesTotal"));
assertEquals(2L, r.get("nodePages"));
assertNotEquals(0L, r.get("nodePages"));
assertEquals(2L, r.get("relsTotal"));
assertEquals(2L, r.get("relPages"));
assertNotEquals(0L, r.get("relPages"));
});
}

@Test
public void testWarmupProperties() throws Exception {
TestUtil.testCall(db, "CALL apoc.warmup.run(true)", r -> {
assertEquals(true, r.get("propertiesLoaded"));
assertEquals(5L, r.get("propPages"));
assertNotEquals(0L, r.get("propPages"));
});
}

Expand All @@ -56,15 +57,15 @@ public void testWarmupDynamicProperties() throws Exception {
TestUtil.testCall(db, "CALL apoc.warmup.run(true,true)", r -> {
assertEquals(true, r.get("propertiesLoaded"));
assertEquals(true, r.get("dynamicPropertiesLoaded"));
assertEquals(5L, r.get("arrayPropPages"));
assertNotEquals(0L, r.get("arrayPropPages"));
});
}

@Test
public void testWarmupIndexes() throws Exception {
TestUtil.testCall(db, "CALL apoc.warmup.run(true,true,true)", r -> {
assertEquals(true, r.get("indexesLoaded"));
assertEquals(6L, r.get("indexPages"));
assertNotEquals( 0L, r.get("indexPages") );
});
}
}

0 comments on commit 84d6e43

Please sign in to comment.