From b182819fa2e7bb5f9f65d4461e473c600c974d50 Mon Sep 17 00:00:00 2001 From: Anton Persson Date: Tue, 18 Apr 2017 11:09:07 +0200 Subject: [PATCH] More explicit variable naming for NativeLabelScanStore --- .../index/labelscan/NativeLabelScanStore.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/labelscan/NativeLabelScanStore.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/labelscan/NativeLabelScanStore.java index 2e171d6e2c4cb..bfb33f25beef2 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/index/labelscan/NativeLabelScanStore.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/index/labelscan/NativeLabelScanStore.java @@ -90,9 +90,9 @@ public class NativeLabelScanStore implements LabelScanStore private static final byte CLEAN = (byte) 0x00; /** - * Written in header to indicate native label scan store is dirty + * Written in header to indicate native label scan store is rebuilding */ - private static final byte DIRTY = (byte) 0x01; + private static final byte REBUILDING = (byte) 0x01; /** * Whether or not this label scan store is read-only. @@ -149,12 +149,12 @@ public class NativeLabelScanStore implements LabelScanStore private final NativeLabelScanWriter singleWriter; /** - * Write dirty bit to header + * Write rebuilding bit to header. */ - private static final Consumer writeDirty = pageCursor -> pageCursor.putByte( DIRTY ); + private static final Consumer writeRebuilding = pageCursor -> pageCursor.putByte( REBUILDING ); /** - * Remove dirty bit from header + * Write clean header. */ private static final Consumer writeClean = pageCursor -> pageCursor.putByte( CLEAN ); @@ -340,16 +340,17 @@ private FileHandle storeFileHandle() throws IOException } /** - * @return true instantiated tree needs to be rebuilt + * @return true if instantiated tree needs to be rebuilt. */ private boolean instantiateTree() throws IOException { monitors.addMonitorListener( treeMonitor() ); GBPTree.Monitor monitor = monitors.newMonitor( GBPTree.Monitor.class ); - MutableBoolean isDirty = new MutableBoolean(); - Header.Reader getDirty = (pageCursor, length) -> isDirty.setValue( pageCursor.getByte() == DIRTY ); - index = new GBPTree<>( pageCache, storeFile, new LabelScanLayout(), pageSize, monitor, getDirty ); - return isDirty.getValue(); + MutableBoolean isRebuilding = new MutableBoolean(); + Header.Reader readRebuilding = + (pageCursor, length) -> isRebuilding.setValue( pageCursor.getByte() == REBUILDING ); + index = new GBPTree<>( pageCache, storeFile, new LabelScanLayout(), pageSize, monitor, readRebuilding ); + return isRebuilding.getValue(); } private GBPTree.Monitor treeMonitor() @@ -405,7 +406,7 @@ public void start() throws IOException monitor.rebuilding(); long numberOfNodes; - index.checkpoint( IOLimiter.unlimited(), writeDirty ); + index.checkpoint( IOLimiter.unlimited(), writeRebuilding ); // Intentionally ignore read-only flag here when rebuilding. try ( LabelScanWriter writer = writer() )