Skip to content

Commit 5fe8ad8

Browse files
author
Zhen Li
committed
profilePageCacheHitRatio should default to 0.
As a result, fix how `hasPageCacheStats` is computed too.
1 parent 1f3f405 commit 5fe8ad8

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

driver/src/main/java/org/neo4j/driver/internal/summary/InternalProfiledPlan.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public long records()
6161
@Override
6262
public boolean hasPageCacheStats()
6363
{
64-
return pageCacheHits > 0 || pageCacheMisses > 0 || !Double.isNaN( pageCacheHitRatio );
64+
return pageCacheHits > 0 || pageCacheMisses > 0 || pageCacheHitRatio > 0;
6565
}
6666

6767
@Override
@@ -96,7 +96,7 @@ public ProfiledPlan create( String operatorType, Map<String,Value> arguments, Li
9696
{
9797
return new InternalProfiledPlan( operatorType, arguments, identifiers, children, originalPlanValue.get( "dbHits" ).asLong( 0 ),
9898
originalPlanValue.get( "rows" ).asLong( 0 ), originalPlanValue.get( "pageCacheHits" ).asLong( 0 ),
99-
originalPlanValue.get( "pageCacheMisses" ).asLong( 0 ), originalPlanValue.get( "pageCacheHitRatio" ).asDouble( Double.NaN ),
99+
originalPlanValue.get( "pageCacheMisses" ).asLong( 0 ), originalPlanValue.get( "pageCacheHitRatio" ).asDouble( 0 ),
100100
originalPlanValue.get( "time" ).asLong( 0 ) );
101101
}
102102
};

driver/src/main/java/org/neo4j/driver/summary/ProfiledPlan.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public interface ProfiledPlan extends Plan
5353
long pageCacheMisses();
5454

5555
/**
56-
* @return the ratio of page cache hits to total number of lookups or {@link Double#NaN} if no data is available
56+
* @return the ratio of page cache hits to total number of lookups or 0 if no data is available
5757
*/
5858
double pageCacheHitRatio();
5959

driver/src/test/java/org/neo4j/driver/internal/util/MetadataExtractorTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void shouldBuildResultSummaryWithProfiledPlan()
252252
assertEquals( 242424, summary.profile().dbHits() );
253253
assertEquals( 999, summary.profile().time() );
254254
assertFalse( summary.profile().hasPageCacheStats() );
255-
assertEquals( Double.NaN, summary.profile().pageCacheHitRatio() );
255+
assertEquals( 0, summary.profile().pageCacheHitRatio() );
256256
assertEquals( 0, summary.profile().pageCacheMisses() );
257257
assertEquals( 0, summary.profile().pageCacheHits() );
258258

0 commit comments

Comments
 (0)