Skip to content

Commit

Permalink
Fixed PR comments round two
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd committed Mar 21, 2017
1 parent 4f82e15 commit 65d1ea6
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 40 deletions.
Expand Up @@ -238,15 +238,15 @@ private PrimitiveLongIterator queryIndexOrEmpty( IndexReader reader, IndexQuery[
catch ( IndexNotApplicableKernelException e )
{
throw new RuntimeException( format(
"Cannot continue %s, as index provider does not support exact composite query: %s",
this.getClass().getSimpleName(), Arrays.toString( query ) ), e );
"Consistency checking error: index provider does not support exact query %s",
Arrays.toString( query ) ), e );
}

indexedNodeIds = LookupFilter.exactIndexMatches( propertyReader, indexedNodeIds, query );
return indexedNodeIds;
}

public static boolean nodeHasSchemaProperties(
private static boolean nodeHasSchemaProperties(
PrimitiveIntObjectMap<PropertyBlock> nodePropertyMap, int[] indexPropertyIds )
{
for ( int indexPropertyId : indexPropertyIds )
Expand Down
Expand Up @@ -189,7 +189,7 @@ interface NodeConsistencyReport extends PrimitiveConsistencyReport
@Documented( "This node was found in the expected index, although multiple times" )
void indexedMultipleTimes( IndexRule index, Object[] propertyValues, long count );

@Documented( "There is another node in the unique index with the same property values." )
@Documented( "There is another node in the unique index with the same property value(s)." )
void uniqueIndexNotUnique( IndexRule index, Object[] propertyValues, long duplicateNodeId );

@Documented( "The referenced relationship group record is not in use." )
Expand Down
Expand Up @@ -1084,38 +1084,6 @@ protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx,
.andThatsAllFolks();
}

public static Collection<DynamicRecord> serializeRule( SchemaRule rule, DynamicRecord... records )
{
return serializeRule( rule, asList( records ) );
}

public static Collection<DynamicRecord> serializeRule( SchemaRule rule, Collection<DynamicRecord> records )
{
byte[] data = rule.serialize();
DynamicRecordAllocator dynamicRecordAllocator =
new ReusableRecordsCompositeAllocator( records, schemaAllocator );
Collection<DynamicRecord> result = new ArrayList<>();
AbstractDynamicStore.allocateRecordsFromBytes( result, data, dynamicRecordAllocator );
return result;
}

private static DynamicRecordAllocator schemaAllocator = new DynamicRecordAllocator()
{
private int next = 10000; // we start high to not conflict with real ids

@Override
public int getRecordDataSize()
{
return SchemaStore.BLOCK_SIZE;
}

@Override
public DynamicRecord nextRecord()
{
return new DynamicRecord( next++ );
}
};

@Test
public void shouldReportArrayPropertyInconsistencies() throws Exception
{
Expand Down Expand Up @@ -1542,14 +1510,14 @@ protected void transactionData( GraphStoreFixture.TransactionDataBuilder tx,
.andThatsAllFolks();
}

protected RelationshipRecord withNext( RelationshipRecord relationship, long next )
private RelationshipRecord withNext( RelationshipRecord relationship, long next )
{
relationship.setFirstNextRel( next );
relationship.setSecondNextRel( next );
return relationship;
}

protected RelationshipRecord withPrev( RelationshipRecord relationship, long prev )
private RelationshipRecord withPrev( RelationshipRecord relationship, long prev )
{
relationship.setFirstInFirstChain( false );
relationship.setFirstInSecondChain( false );
Expand Down Expand Up @@ -2317,4 +2285,31 @@ public void andThatsAllFolks()
assertEquals( "Total number of inconsistencies: " + stats, total, stats.getTotalInconsistencyCount() );
}
}

private static Collection<DynamicRecord> serializeRule( SchemaRule rule, DynamicRecord... records )
{
byte[] data = rule.serialize();
DynamicRecordAllocator dynamicRecordAllocator =
new ReusableRecordsCompositeAllocator( asList( records ), schemaAllocator );
Collection<DynamicRecord> result = new ArrayList<>();
AbstractDynamicStore.allocateRecordsFromBytes( result, data, dynamicRecordAllocator );
return result;
}

private static DynamicRecordAllocator schemaAllocator = new DynamicRecordAllocator()
{
private int next = 10000; // we start high to not conflict with real ids

@Override
public int getRecordDataSize()
{
return SchemaStore.BLOCK_SIZE;
}

@Override
public DynamicRecord nextRecord()
{
return new DynamicRecord( next++ );
}
};
}
Expand Up @@ -68,8 +68,8 @@ public static PrimitiveLongIterator exactIndexMatches( PropertyAccessor accessor
for ( IndexQuery predicate : numericPredicates )
{
int propertyKeyId = predicate.propertyKeyId();
Property property = accessor.getProperty( nodeId, propertyKeyId );
if ( property.isDefined() && !predicate.test( ((DefinedProperty)property).value() ) )
Object value = accessor.getProperty( nodeId, propertyKeyId ).value( null );
if ( !predicate.test( value ) )
{
return false;
}
Expand Down

0 comments on commit 65d1ea6

Please sign in to comment.