Skip to content

Commit

Permalink
Renaming around ExecutableQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
alexaverbuch authored and fickludd committed Jun 26, 2018
1 parent ceedbed commit 070b2ec
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 62 deletions.
Expand Up @@ -21,7 +21,7 @@ package org.neo4j.cypher.internal


import org.neo4j.cypher.CypherExecutionMode import org.neo4j.cypher.CypherExecutionMode
import org.neo4j.graphdb.Result import org.neo4j.graphdb.Result
import org.neo4j.kernel.api.query.PlannerInfo import org.neo4j.kernel.api.query.CompilerInfo
import org.neo4j.kernel.impl.query.TransactionalContext import org.neo4j.kernel.impl.query.TransactionalContext
import org.neo4j.values.virtual.MapValue import org.neo4j.values.virtual.MapValue


Expand All @@ -38,15 +38,17 @@ trait ExecutableQuery {
* @param params the parameters * @param params the parameters
* @return the query result * @return the query result
*/ */
def run(transactionalContext: TransactionalContext, executionMode: CypherExecutionMode, params: MapValue): Result def execute(transactionalContext: TransactionalContext, executionMode: CypherExecutionMode, params: MapValue): Result


/** /**
* The reusability state of this executable query. * The reusability state of this executable query.
*/ */
def reusabilityState(lastCommittedTxId: () => Long, ctx: TransactionalContext): ReusabilityState def reusabilityState(lastCommittedTxId: () => Long, ctx: TransactionalContext): ReusabilityState


// This is to force eager calculation /**
val plannerInfo: PlannerInfo * Meta-data about the compiled used for this query.
*/
val compilerInfo: CompilerInfo // val to force eager calculation


/** /**
* Names of all parameters for this query, explicit and auto-parametrized. * Names of all parameters for this query, explicit and auto-parametrized.
Expand Down
Expand Up @@ -96,8 +96,8 @@ class ExecutionEngine(val queryService: GraphDatabaseQueryService,
checkParameters(executableQuery.paramNames, params, executableQuery.extractedParams) checkParameters(executableQuery.paramNames, params, executableQuery.extractedParams)
} }
val combinedParams = params.updatedWith(executableQuery.extractedParams) val combinedParams = params.updatedWith(executableQuery.extractedParams)
context.executingQuery().planningCompleted(executableQuery.plannerInfo) context.executingQuery().compilationCompleted(executableQuery.compilerInfo)
executableQuery.run(context, preParsedQuery.executionMode, combinedParams) executableQuery.execute(context, preParsedQuery.executionMode, combinedParams)


} catch { } catch {
case t: Throwable => case t: Throwable =>
Expand Down
Expand Up @@ -63,7 +63,7 @@ class SchemaHelper(val queryCache: QueryCache[_,_]) {
import scala.collection.JavaConverters._ import scala.collection.JavaConverters._


def planLabels = { def planLabels = {
plan.plannerInfo.indexes().asScala.collect { case item: SchemaIndexUsage => item.getLabelId.toLong } plan.compilerInfo.indexes().asScala.collect { case item: SchemaIndexUsage => item.getLabelId.toLong }
} }


def allLabels: Seq[Long] = { def allLabels: Seq[Long] = {
Expand Down
Expand Up @@ -30,7 +30,7 @@ import org.neo4j.cypher.internal.runtime.interpreted.{TransactionBoundQueryConte
import org.neo4j.cypher.internal.v3_5.logical.plans.{ExplicitNodeIndexUsage, ExplicitRelationshipIndexUsage, SchemaIndexScanUsage, SchemaIndexSeekUsage} import org.neo4j.cypher.internal.v3_5.logical.plans.{ExplicitNodeIndexUsage, ExplicitRelationshipIndexUsage, SchemaIndexScanUsage, SchemaIndexSeekUsage}
import org.neo4j.cypher.internal._ import org.neo4j.cypher.internal._
import org.neo4j.graphdb.{Notification, Result} import org.neo4j.graphdb.{Notification, Result}
import org.neo4j.kernel.api.query.{ExplicitIndexUsage, PlannerInfo, SchemaIndexUsage} import org.neo4j.kernel.api.query.{ExplicitIndexUsage, CompilerInfo, SchemaIndexUsage}
import org.neo4j.kernel.impl.query.{QueryExecutionMonitor, TransactionalContext} import org.neo4j.kernel.impl.query.{QueryExecutionMonitor, TransactionalContext}
import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors} import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors}
import org.neo4j.values.virtual.MapValue import org.neo4j.values.virtual.MapValue
Expand Down Expand Up @@ -103,8 +103,8 @@ case class CypherCurrentCompiler[CONTEXT <: RuntimeContext](planner: CypherPlann
new ExceptionTranslatingQueryContext(ctx) new ExceptionTranslatingQueryContext(ctx)
} }


def run(transactionalContext: TransactionalContext, executionMode: CypherExecutionMode, def execute(transactionalContext: TransactionalContext, executionMode: CypherExecutionMode,
params: MapValue): Result = { params: MapValue): Result = {
val innerExecutionMode = executionMode match { val innerExecutionMode = executionMode match {
case CypherExecutionMode.explain => ExplainMode case CypherExecutionMode.explain => ExplainMode
case CypherExecutionMode.profile => ProfileMode case CypherExecutionMode.profile => ProfileMode
Expand All @@ -127,8 +127,8 @@ case class CypherCurrentCompiler[CONTEXT <: RuntimeContext](planner: CypherPlann


def reusabilityState(lastCommittedTxId: () => Long, ctx: TransactionalContext): ReusabilityState = reusabilityState def reusabilityState(lastCommittedTxId: () => Long, ctx: TransactionalContext): ReusabilityState = reusabilityState


override val plannerInfo: PlannerInfo = { override val compilerInfo: CompilerInfo = {
new PlannerInfo(inner.plannerUsed.name, inner.runtimeUsed.name, inner.plannedIndexUsage.map { new CompilerInfo(inner.plannerUsed.name, inner.runtimeUsed.name, inner.plannedIndexUsage.map {
case SchemaIndexSeekUsage(identifier, labelId, label, propertyKeys) => new SchemaIndexUsage(identifier, labelId, label, propertyKeys: _*) case SchemaIndexSeekUsage(identifier, labelId, label, propertyKeys) => new SchemaIndexUsage(identifier, labelId, label, propertyKeys: _*)
case SchemaIndexScanUsage(identifier, labelId, label, propertyKey) => new SchemaIndexUsage(identifier, labelId, label, propertyKey) case SchemaIndexScanUsage(identifier, labelId, label, propertyKey) => new SchemaIndexUsage(identifier, labelId, label, propertyKey)
case ExplicitNodeIndexUsage(identifier, index) => new ExplicitIndexUsage(identifier, "NODE", index) case ExplicitNodeIndexUsage(identifier, index) => new ExplicitIndexUsage(identifier, "NODE", index)
Expand Down
Expand Up @@ -37,7 +37,7 @@ import org.neo4j.cypher.internal.spi.v2_3.{TransactionBoundGraphStatistics, Tran
import org.neo4j.function.ThrowingBiConsumer import org.neo4j.function.ThrowingBiConsumer
import org.neo4j.graphdb.{Node, Relationship, Result} import org.neo4j.graphdb.{Node, Relationship, Result}
import org.neo4j.kernel.GraphDatabaseQueryService import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api.query.{IndexUsage, PlannerInfo} import org.neo4j.kernel.api.query.{IndexUsage, CompilerInfo}
import org.neo4j.kernel.impl.core.EmbeddedProxySPI import org.neo4j.kernel.impl.core.EmbeddedProxySPI
import org.neo4j.kernel.impl.query.{QueryExecutionMonitor, TransactionalContext} import org.neo4j.kernel.impl.query.{QueryExecutionMonitor, TransactionalContext}
import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors} import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors}
Expand Down Expand Up @@ -106,11 +106,11 @@ trait Cypher23Compiler extends CachingPlanner[PreparedQuery] with Compiler {
FineToReuse FineToReuse
} }


override val plannerInfo = new PlannerInfo(inner.plannerUsed.name, inner.runtimeUsed.name, emptyList[IndexUsage]) override val compilerInfo = new CompilerInfo(inner.plannerUsed.name, inner.runtimeUsed.name, emptyList[IndexUsage])


override def run(transactionalContext: TransactionalContext, override def execute(transactionalContext: TransactionalContext,
executionMode: CypherExecutionMode, executionMode: CypherExecutionMode,
params: MapValue): Result = { params: MapValue): Result = {
var map: mutable.Map[String, Any] = mutable.Map[String, Any]() var map: mutable.Map[String, Any] = mutable.Map[String, Any]()
params.foreach(new ThrowingBiConsumer[String, AnyValue, RuntimeException] { params.foreach(new ThrowingBiConsumer[String, AnyValue, RuntimeException] {
override def accept(t: String, u: AnyValue): Unit = map.put(t, valueHelper.fromValue(u)) override def accept(t: String, u: AnyValue): Unit = map.put(t, valueHelper.fromValue(u))
Expand Down
Expand Up @@ -37,7 +37,7 @@ import org.neo4j.cypher.internal.spi.v3_1.{TransactionalContextWrapper => Transa
import org.neo4j.function.ThrowingBiConsumer import org.neo4j.function.ThrowingBiConsumer
import org.neo4j.graphdb.Result import org.neo4j.graphdb.Result
import org.neo4j.kernel.GraphDatabaseQueryService import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api.query.{IndexUsage, PlannerInfo} import org.neo4j.kernel.api.query.{IndexUsage, CompilerInfo}
import org.neo4j.kernel.impl.query.{QueryExecutionMonitor, TransactionalContext} import org.neo4j.kernel.impl.query.{QueryExecutionMonitor, TransactionalContext}
import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors} import org.neo4j.kernel.monitoring.{Monitors => KernelMonitors}
import org.neo4j.logging.Log import org.neo4j.logging.Log
Expand Down Expand Up @@ -110,9 +110,9 @@ trait Cypher31Compiler extends CachingPlanner[PreparedQuerySyntax] with Compiler
FineToReuse FineToReuse
} }


override val plannerInfo = new PlannerInfo(inner.plannerUsed.name, inner.runtimeUsed.name, emptyList[IndexUsage]) override val compilerInfo = new CompilerInfo(inner.plannerUsed.name, inner.runtimeUsed.name, emptyList[IndexUsage])


override def run(transactionalContext: TransactionalContext, executionMode: CypherExecutionMode, params: MapValue): Result = { override def execute(transactionalContext: TransactionalContext, executionMode: CypherExecutionMode, params: MapValue): Result = {
var map: mutable.Map[String, Any] = mutable.Map[String, Any]() var map: mutable.Map[String, Any] = mutable.Map[String, Any]()
params.foreach(new ThrowingBiConsumer[String, AnyValue, RuntimeException] { params.foreach(new ThrowingBiConsumer[String, AnyValue, RuntimeException] {
override def accept(t: String, u: AnyValue): Unit = map.put(t, valueHelper.fromValue(u)) override def accept(t: String, u: AnyValue): Unit = map.put(t, valueHelper.fromValue(u))
Expand Down
Expand Up @@ -27,7 +27,7 @@ import org.neo4j.internal.kernel.api.security.SecurityContext
import org.neo4j.kernel.GraphDatabaseQueryService import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api.KernelTransaction.Revertable import org.neo4j.kernel.api.KernelTransaction.Revertable
import org.neo4j.kernel.api.dbms.DbmsOperations import org.neo4j.kernel.api.dbms.DbmsOperations
import org.neo4j.kernel.api.query.PlannerInfo import org.neo4j.kernel.api.query.CompilerInfo
import org.neo4j.kernel.api.txstate.TxStateHolder import org.neo4j.kernel.api.txstate.TxStateHolder
import org.neo4j.kernel.api.{KernelTransaction, ResourceTracker, Statement} import org.neo4j.kernel.api.{KernelTransaction, ResourceTracker, Statement}
import org.neo4j.kernel.impl.factory.DatabaseInfo import org.neo4j.kernel.impl.factory.DatabaseInfo
Expand Down Expand Up @@ -80,7 +80,7 @@ case class TransactionalContextWrapper(tc: TransactionalContext) extends QueryTr


def securityContext: SecurityContext = tc.securityContext def securityContext: SecurityContext = tc.securityContext


def notifyPlanningCompleted(plannerInfo: PlannerInfo): Unit = tc.executingQuery().planningCompleted(plannerInfo) def notifyCompilationCompleted(compilerInfo: CompilerInfo): Unit = tc.executingQuery().compilationCompleted(compilerInfo)


def kernelStatisticProvider: KernelStatisticProvider = new ProfileKernelStatisticProvider(tc.kernelStatisticProvider()) def kernelStatisticProvider: KernelStatisticProvider = new ProfileKernelStatisticProvider(tc.kernelStatisticProvider())


Expand Down
Expand Up @@ -23,13 +23,13 @@


import javax.annotation.Nonnull; import javax.annotation.Nonnull;


public class PlannerInfo public class CompilerInfo
{ {
private final String planner; private final String planner;
private final String runtime; private final String runtime;
private final List<IndexUsage> indexes; private final List<IndexUsage> indexes;


public PlannerInfo( @Nonnull String planner, @Nonnull String runtime, @Nonnull List<IndexUsage> indexes ) public CompilerInfo( @Nonnull String planner, @Nonnull String runtime, @Nonnull List<IndexUsage> indexes )
{ {
this.planner = planner; this.planner = planner;
this.runtime = runtime; this.runtime = runtime;
Expand Down
Expand Up @@ -58,7 +58,7 @@ public class ExecutingQuery
private final long startTimeNanos; private final long startTimeNanos;
private final long startTimestampMillis; private final long startTimestampMillis;
/** Uses write barrier of {@link #status}. */ /** Uses write barrier of {@link #status}. */
private long planningDoneNanos; private long compilationCompletedNanos;
private final long threadExecutingTheQueryId; private final long threadExecutingTheQueryId;
@SuppressWarnings( {"unused", "FieldCanBeLocal"} ) @SuppressWarnings( {"unused", "FieldCanBeLocal"} )
private final String threadExecutingTheQueryName; private final String threadExecutingTheQueryName;
Expand All @@ -71,7 +71,7 @@ public class ExecutingQuery
private final long heapAllocatedBytesWhenQueryStarted; private final long heapAllocatedBytesWhenQueryStarted;
private final Map<String,Object> transactionAnnotationData; private final Map<String,Object> transactionAnnotationData;
/** Uses write barrier of {@link #status}. */ /** Uses write barrier of {@link #status}. */
private PlannerInfo plannerInfo; private CompilerInfo compilerInfo;
private volatile ExecutingQueryStatus status = SimpleState.planning(); private volatile ExecutingQueryStatus status = SimpleState.planning();
/** Updated through {@link #WAIT_TIME} */ /** Updated through {@link #WAIT_TIME} */
@SuppressWarnings( "unused" ) @SuppressWarnings( "unused" )
Expand Down Expand Up @@ -116,10 +116,10 @@ public ExecutingQuery(


// update state // update state


public void planningCompleted( PlannerInfo plannerInfo ) public void compilationCompleted( CompilerInfo compilerInfo )
{ {
this.plannerInfo = plannerInfo; this.compilerInfo = compilerInfo;
this.planningDoneNanos = clock.nanos(); this.compilationCompletedNanos = clock.nanos();
this.status = SimpleState.running(); // write barrier - must be last this.status = SimpleState.running(); // write barrier - must be last
} }


Expand Down Expand Up @@ -159,9 +159,9 @@ public QuerySnapshot snapshot()
} }
while ( this.status != status ); while ( this.status != status );
// guarded by barrier - unused if status is planning, stable otherwise // guarded by barrier - unused if status is planning, stable otherwise
long planningDoneNanos = this.planningDoneNanos; long compilationCompletedNanos = this.compilationCompletedNanos;
// guarded by barrier - like planningDoneNanos // guarded by barrier - like compilationCompletedNanos
PlannerInfo planner = status.isPlanning() ? null : this.plannerInfo; CompilerInfo planner = status.isPlanning() ? null : this.compilerInfo;
List<ActiveLock> waitingOnLocks = status.isWaitingOnLocks() ? status.waitingOnLocks() : Collections.emptyList(); List<ActiveLock> waitingOnLocks = status.isWaitingOnLocks() ? status.waitingOnLocks() : Collections.emptyList();
// activeLockCount is not atomic to capture, so we capture it after the most sensitive part. // activeLockCount is not atomic to capture, so we capture it after the most sensitive part.
long totalActiveLocks = this.activeLockCount.getAsLong(); long totalActiveLocks = this.activeLockCount.getAsLong();
Expand All @@ -170,7 +170,7 @@ public QuerySnapshot snapshot()
PageCounterValues pageCounters = new PageCounterValues( pageCursorCounters ); PageCounterValues pageCounters = new PageCounterValues( pageCursorCounters );


// - at this point we are done capturing the "live" state, and can start computing the snapshot - // - at this point we are done capturing the "live" state, and can start computing the snapshot -
long planningTimeNanos = (status.isPlanning() ? currentTimeNanos : planningDoneNanos) - startTimeNanos; long compilationTimeNanos = (status.isPlanning() ? currentTimeNanos : compilationCompletedNanos) - startTimeNanos;
long elapsedTimeNanos = currentTimeNanos - startTimeNanos; long elapsedTimeNanos = currentTimeNanos - startTimeNanos;
cpuTimeNanos -= cpuTimeNanosWhenQueryStarted; cpuTimeNanos -= cpuTimeNanosWhenQueryStarted;
waitTimeNanos += status.waitTimeNanos( currentTimeNanos ); waitTimeNanos += status.waitTimeNanos( currentTimeNanos );
Expand All @@ -184,7 +184,7 @@ public QuerySnapshot snapshot()
this, this,
planner, planner,
pageCounters, pageCounters,
NANOSECONDS.toMillis( planningTimeNanos ), NANOSECONDS.toMillis( compilationTimeNanos ),
NANOSECONDS.toMillis( elapsedTimeNanos ), NANOSECONDS.toMillis( elapsedTimeNanos ),
cpuTimeNanos == 0 && cpuTimeNanosWhenQueryStarted == -1 ? -1 : NANOSECONDS.toMillis( cpuTimeNanos ), cpuTimeNanos == 0 && cpuTimeNanosWhenQueryStarted == -1 ? -1 : NANOSECONDS.toMillis( cpuTimeNanos ),
NANOSECONDS.toMillis( waitTimeNanos ), NANOSECONDS.toMillis( waitTimeNanos ),
Expand Down
Expand Up @@ -31,8 +31,8 @@
public class QuerySnapshot public class QuerySnapshot
{ {
private final ExecutingQuery query; private final ExecutingQuery query;
private final PlannerInfo plannerInfo; private final CompilerInfo compilerInfo;
private final long planningTimeMillis; private final long compilationTimeMillis;
private final long elapsedTimeMillis; private final long elapsedTimeMillis;
private final long cpuTimeMillis; private final long cpuTimeMillis;
private final long waitTimeMillis; private final long waitTimeMillis;
Expand All @@ -43,14 +43,14 @@ public class QuerySnapshot
private final long allocatedBytes; private final long allocatedBytes;
private final PageCounterValues page; private final PageCounterValues page;


QuerySnapshot( ExecutingQuery query, PlannerInfo plannerInfo, PageCounterValues page, long planningTimeMillis, QuerySnapshot( ExecutingQuery query, CompilerInfo compilerInfo, PageCounterValues page, long compilationTimeMillis,
long elapsedTimeMillis, long cpuTimeMillis, long waitTimeMillis, String status, long elapsedTimeMillis, long cpuTimeMillis, long waitTimeMillis, String status,
Map<String,Object> resourceInfo, List<ActiveLock> waitingLocks, long activeLockCount, long allocatedBytes ) Map<String,Object> resourceInfo, List<ActiveLock> waitingLocks, long activeLockCount, long allocatedBytes )
{ {
this.query = query; this.query = query;
this.plannerInfo = plannerInfo; this.compilerInfo = compilerInfo;
this.page = page; this.page = page;
this.planningTimeMillis = planningTimeMillis; this.compilationTimeMillis = compilationTimeMillis;
this.elapsedTimeMillis = elapsedTimeMillis; this.elapsedTimeMillis = elapsedTimeMillis;
this.cpuTimeMillis = cpuTimeMillis; this.cpuTimeMillis = cpuTimeMillis;
this.waitTimeMillis = waitTimeMillis; this.waitTimeMillis = waitTimeMillis;
Expand Down Expand Up @@ -98,23 +98,23 @@ public long activeLockCount()


public String planner() public String planner()
{ {
return plannerInfo == null ? null : plannerInfo.planner(); return compilerInfo == null ? null : compilerInfo.planner();
} }


public String runtime() public String runtime()
{ {
return plannerInfo == null ? null : plannerInfo.runtime(); return compilerInfo == null ? null : compilerInfo.runtime();
} }


public List<Map<String,String>> indexes() public List<Map<String,String>> indexes()
{ {
if ( plannerInfo == null ) if ( compilerInfo == null )
{ {
return Collections.emptyList(); return Collections.emptyList();
} }
return plannerInfo.indexes().stream() return compilerInfo.indexes().stream()
.map( IndexUsage::asMap ) .map( IndexUsage::asMap )
.collect( Collectors.toList() ); .collect( Collectors.toList() );
} }


public String status() public String status()
Expand All @@ -137,9 +137,9 @@ public long startTimestampMillis()
* *
* @return the time in milliseconds spent planning the query. * @return the time in milliseconds spent planning the query.
*/ */
public long planningTimeMillis() public long compilationTimeMillis()
{ {
return planningTimeMillis; return compilationTimeMillis;
} }


/** /**
Expand Down
Expand Up @@ -25,16 +25,16 @@
import static org.hamcrest.core.Is.is; import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;


public class PlannerInfoTest public class CompilerInfoTest
{ {
@Test @Test
public void plannerInfoShouldBeInSmallCase() public void plannerInfoShouldBeInSmallCase()
{ {
// given // given
PlannerInfo plannerInfo = new PlannerInfo( "PLANNER", "RUNTIME", emptyList() ); CompilerInfo compilerInfo = new CompilerInfo( "PLANNER", "RUNTIME", emptyList() );


// then // then
assertThat( plannerInfo.planner(), is( "planner" ) ); assertThat( compilerInfo.planner(), is( "planner" ) );
assertThat( plannerInfo.runtime(), is( "runtime" ) ); assertThat( compilerInfo.runtime(), is( "runtime" ) );
} }
} }
Expand Up @@ -85,7 +85,7 @@ public void shouldTransitionBetweenStates()
assertEquals( "planning", query.snapshot().status() ); assertEquals( "planning", query.snapshot().status() );


// when // when
query.planningCompleted( new PlannerInfo( "the-planner", "the-runtime", emptyList() ) ); query.compilationCompleted( new CompilerInfo( "the-planner", "the-runtime", emptyList() ) );


// then // then
assertEquals( "running", query.snapshot().status() ); assertEquals( "running", query.snapshot().status() );
Expand Down Expand Up @@ -120,24 +120,24 @@ public void shouldReportPlanningTime()


// then // then
QuerySnapshot snapshot = query.snapshot(); QuerySnapshot snapshot = query.snapshot();
assertEquals( snapshot.planningTimeMillis(), snapshot.elapsedTimeMillis() ); assertEquals( snapshot.compilationTimeMillis(), snapshot.elapsedTimeMillis() );


// when // when
clock.forward( 16, TimeUnit.MILLISECONDS ); clock.forward( 16, TimeUnit.MILLISECONDS );
query.planningCompleted( new PlannerInfo( "the-planner", "the-runtime", emptyList() ) ); query.compilationCompleted( new CompilerInfo( "the-planner", "the-runtime", emptyList() ) );
clock.forward( 200, TimeUnit.MILLISECONDS ); clock.forward( 200, TimeUnit.MILLISECONDS );


// then // then
snapshot = query.snapshot(); snapshot = query.snapshot();
assertEquals( 140, snapshot.planningTimeMillis() ); assertEquals( 140, snapshot.compilationTimeMillis() );
assertEquals( 340, snapshot.elapsedTimeMillis() ); assertEquals( 340, snapshot.elapsedTimeMillis() );
} }


@Test @Test
public void shouldReportWaitTime() public void shouldReportWaitTime()
{ {
// given // given
query.planningCompleted( new PlannerInfo( "the-planner", "the-runtime", emptyList() ) ); query.compilationCompleted( new CompilerInfo( "the-planner", "the-runtime", emptyList() ) );


// then // then
assertEquals( "running", query.snapshot().status() ); assertEquals( "running", query.snapshot().status() );
Expand Down Expand Up @@ -189,7 +189,7 @@ public void shouldReportWaitTime()
public void shouldReportQueryWaitTime() public void shouldReportQueryWaitTime()
{ {
// given // given
query.planningCompleted( new PlannerInfo( "the-planner", "the-runtime", emptyList() ) ); query.compilationCompleted( new CompilerInfo( "the-planner", "the-runtime", emptyList() ) );


// when // when
query.waitsForQuery( subQuery ); query.waitsForQuery( subQuery );
Expand Down
Expand Up @@ -55,7 +55,7 @@ static void formatAllocatedBytes( StringBuilder result, QuerySnapshot query )


static void formatDetailedTime( StringBuilder result, QuerySnapshot query ) static void formatDetailedTime( StringBuilder result, QuerySnapshot query )
{ {
result.append( "(planning: " ).append( query.planningTimeMillis() ); result.append( "(planning: " ).append( query.compilationTimeMillis() );
Long cpuTime = query.cpuTimeMillis(); Long cpuTime = query.cpuTimeMillis();
if ( cpuTime != null ) if ( cpuTime != null )
{ {
Expand Down
Expand Up @@ -34,7 +34,7 @@
import org.neo4j.graphdb.factory.GraphDatabaseSettings; import org.neo4j.graphdb.factory.GraphDatabaseSettings;
import org.neo4j.io.pagecache.tracing.cursor.PageCursorCounters; import org.neo4j.io.pagecache.tracing.cursor.PageCursorCounters;
import org.neo4j.kernel.api.query.ExecutingQuery; import org.neo4j.kernel.api.query.ExecutingQuery;
import org.neo4j.kernel.api.query.PlannerInfo; import org.neo4j.kernel.api.query.CompilerInfo;
import org.neo4j.kernel.configuration.Config; import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo; import org.neo4j.kernel.impl.query.clientconnection.ClientConnectionInfo;
import org.neo4j.kernel.impl.query.clientconnection.ShellConnectionInfo; import org.neo4j.kernel.impl.query.clientconnection.ShellConnectionInfo;
Expand Down Expand Up @@ -489,7 +489,7 @@ public void shouldLogRuntime()


// when // when
clock.forward( 11, TimeUnit.MILLISECONDS ); clock.forward( 11, TimeUnit.MILLISECONDS );
query.planningCompleted( new PlannerInfo( "magic", "quantum", Collections.emptyList() ) ); query.compilationCompleted( new CompilerInfo( "magic", "quantum", Collections.emptyList() ) );
queryLogger.success( query ); queryLogger.success( query );


// then // then
Expand Down

0 comments on commit 070b2ec

Please sign in to comment.