Skip to content

Commit

Permalink
minor cleanups from review
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd committed Nov 9, 2017
1 parent 812d133 commit fdc825f
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 10 deletions.
Expand Up @@ -31,6 +31,12 @@

public abstract class IndexQuery
{
/**
* Scans all entries in the index.
*/
@SuppressWarnings( "StaticInitializerReferencesSubClass" )
public static ExistsPredicate SCAN = new ExistsPredicate( -1 );

/**
* Searches the index for all entries that has the given property.
*
Expand Down
Expand Up @@ -28,8 +28,6 @@
import org.neo4j.graphdb.schema.IndexDefinition;

import static java.util.concurrent.TimeUnit.SECONDS;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.neo4j.graphdb.Label.label;
import static org.neo4j.internal.kernel.api.ExplicitIndexCursorTestBase.assertFoundNodes;

Expand Down
Expand Up @@ -63,7 +63,7 @@
import static org.neo4j.kernel.impl.store.record.AbstractBaseRecord.NO_ID;
import static org.neo4j.kernel.impl.store.record.RecordLoad.NORMAL;

class Store extends Read implements Token
class AllStoreHolder extends Read implements Token
{
private final RelationshipGroupStore groupStore;
private final PropertyStore propertyStore;
Expand All @@ -73,7 +73,7 @@ class Store extends Read implements Token
private final StoreReadLayer read;
private final Lazy<ExplicitIndexTransactionState> explicitIndexes;

Store( RecordStorageEngine engine, Supplier<ExplicitIndexTransactionState> explicitIndexes )
AllStoreHolder( RecordStorageEngine engine, Supplier<ExplicitIndexTransactionState> explicitIndexes )
{
read = engine.storeReadLayer();
statement = read.newStatement();
Expand Down
Expand Up @@ -41,7 +41,7 @@ class NodeCursor extends NodeRecord implements org.neo4j.internal.kernel.api.Nod

NodeCursor( Read read )
{
super( -1 );
super( NO_ID );
this.read = read;
this.labelCursor = read.labelCursor();
}
Expand Down Expand Up @@ -184,6 +184,7 @@ public void close()

private void reset()
{
setId( next = NO_ID );
next = NO_ID;
setId( NO_ID );
}
}
Expand Up @@ -56,7 +56,7 @@ public class PropertyCursor extends PropertyRecord implements org.neo4j.internal

public PropertyCursor( Read read )
{
super( -1 );
super( NO_ID );
this.read = read;
}

Expand Down
Expand Up @@ -79,7 +79,7 @@ public void close()
{
}

private static class Transaction extends Store implements org.neo4j.internal.kernel.api.Transaction
private static class Transaction extends AllStoreHolder implements org.neo4j.internal.kernel.api.Transaction
{
Transaction( RecordStorageEngine engine, KernelTransactions ktx )
{
Expand Down
Expand Up @@ -27,6 +27,8 @@
import org.neo4j.kernel.impl.newapi.IndexCursorProgressor;
import org.neo4j.values.storable.Value;

import static org.neo4j.internal.kernel.api.IndexQuery.SCAN;

/**
* Reader for an index. Must honor repeatable reads, which means that if a lookup is executed multiple times the
* same result set must be returned.
Expand Down Expand Up @@ -127,8 +129,7 @@ default void scan( IndexCursorProgressor.NodeValueCursor cursor )
// 2. For compound indexes all nodes have all properties assigned.
// While we violate 1. here, we are at least "well intended", we don't actually care about what the key is.
// 2. holds because compound indexes are only created through node keys.
IndexQuery.ExistsPredicate scan = IndexQuery.exists( -1 );
cursor.initialize( new NodeValueIndexProgressor( query( scan ), cursor ), null );
cursor.initialize( new NodeValueIndexProgressor( query( SCAN ), cursor ), null );
}
catch ( IndexNotApplicableKernelException e )
{
Expand Down

0 comments on commit fdc825f

Please sign in to comment.