diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/SchemaDescriptorTranslation.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/SchemaDescriptorTranslation.scala index ec751d3f0396..91669958f55d 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/SchemaDescriptorTranslation.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/SchemaDescriptorTranslation.scala @@ -20,16 +20,13 @@ package org.neo4j.cypher.internal.spi.v2_3 import org.neo4j.cypher.internal.compiler.v2_3.spi.SchemaTypes +import org.neo4j.internal.kernel.api.{IndexReference => KernelIndexReference} import org.neo4j.kernel.api.schema.constaints.{NodeExistenceConstraintDescriptor, RelExistenceConstraintDescriptor, UniquenessConstraintDescriptor} -import org.neo4j.kernel.api.schema.index.{IndexDescriptorFactory, IndexDescriptor => KernelIndexDescriptor} trait SchemaDescriptorTranslation { - implicit def cypherToKernel(index: SchemaTypes.IndexDescriptor): KernelIndexDescriptor = - IndexDescriptorFactory.forLabel(index.labelId, index.propertyId) - - implicit def kernelToCypher(index: KernelIndexDescriptor): SchemaTypes.IndexDescriptor = - if (index.schema().getPropertyIds.length == 1) - SchemaTypes.IndexDescriptor(index.schema().keyId, index.schema().getPropertyId) + implicit def kernelToCypher(index: KernelIndexReference): SchemaTypes.IndexDescriptor = + if (index.properties().length == 1) + SchemaTypes.IndexDescriptor(index.label(), index.properties()(0)) else throw new UnsupportedOperationException("Cypher 2.3 does not support composite indexes") diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundGraphStatistics.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundGraphStatistics.scala index 0c074d00c262..5c84d912a61b 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundGraphStatistics.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundGraphStatistics.scala @@ -44,7 +44,7 @@ object TransactionBoundGraphStatistics { // Probability of any node with the given label, to have a property with a given value val indexEntrySelectivity = schemaRead.indexUniqueValuesSelectivity( - DefaultIndexReference.general(label, property.id)) + schemaRead.indexReferenceUnchecked(label, property.id)) val frequencyOfNodesWithSameValue = 1.0 / indexEntrySelectivity val indexSelectivity = frequencyOfNodesWithSameValue / labeledNodes @@ -60,7 +60,7 @@ object TransactionBoundGraphStatistics { // Probability of any node with the given label, to have a given property val indexSize = schemaRead.indexSize( - DefaultIndexReference.general(label, property.id)) + schemaRead.indexReferenceUnchecked(label, property.id)) val indexSelectivity = indexSize / labeledNodes Selectivity.of(indexSelectivity) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundQueryContext.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundQueryContext.scala index 89aa3adbd32c..d2f35247fd2b 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundQueryContext.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v2_3/TransactionBoundQueryContext.scala @@ -55,7 +55,6 @@ import org.neo4j.kernel.api.exceptions.schema.{AlreadyConstrainedException, Alre import org.neo4j.kernel.api.schema.SchemaDescriptorFactory import org.neo4j.kernel.api.schema.constaints.ConstraintDescriptorFactory import org.neo4j.kernel.api.{SilentTokenNameLookup, StatementConstants} -import org.neo4j.kernel.impl.api.store.DefaultIndexReference import org.neo4j.kernel.impl.core.EmbeddedProxySPI import org.neo4j.values.storable.Values @@ -210,7 +209,7 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper, val re } def indexSeek(index: SchemaTypes.IndexDescriptor, value: Any) = - seek(DefaultIndexReference.general(index.labelId, index.propertyId), + seek(tc.schemaRead.indexReferenceUnchecked(index.labelId, index.propertyId), IndexQuery.exact(index.propertyId, value)) def indexSeekByRange(index: SchemaTypes.IndexDescriptor, value: Any) = value match { @@ -302,19 +301,19 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper, val re } private def indexSeekByPrefixRange(index: SchemaTypes.IndexDescriptor, prefix: String): scala.Iterator[Node] = - seek(DefaultIndexReference.general(index.labelId, index.propertyId), IndexQuery.stringPrefix(index.propertyId, prefix)) + seek(tc.schemaRead.indexReferenceUnchecked(index.labelId, index.propertyId), IndexQuery.stringPrefix(index.propertyId, prefix)) private def indexSeekByNumericalRange(index: SchemaTypes.IndexDescriptor, range: InequalitySeekRange[Number]): scala.Iterator[Node] = (range match { case rangeLessThan: RangeLessThan[Number] => rangeLessThan.limit(BY_NUMBER).map { limit => val rangePredicate = IndexQuery.range(index.propertyId, null, false, limit.endPoint, limit.isInclusive) - seek(DefaultIndexReference.general(index.labelId, index.propertyId), rangePredicate) + seek(tc.schemaRead.indexReferenceUnchecked(index.labelId, index.propertyId), rangePredicate) } case rangeGreaterThan: RangeGreaterThan[Number] => rangeGreaterThan.limit(BY_NUMBER).map { limit => val rangePredicate = IndexQuery.range(index.propertyId, limit.endPoint, limit.isInclusive, null, false) - seek(DefaultIndexReference.general(index.labelId, index.propertyId), rangePredicate) + seek(tc.schemaRead.indexReferenceUnchecked(index.labelId, index.propertyId), rangePredicate) } case RangeBetween(rangeGreaterThan, rangeLessThan) => @@ -324,7 +323,7 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper, val re .range(index.propertyId, greaterThanLimit.endPoint, greaterThanLimit.isInclusive, lessThanLimit.endPoint, lessThanLimit.isInclusive) - seek(DefaultIndexReference.general(index.labelId, index.propertyId), rangePredicate) + seek(tc.schemaRead.indexReferenceUnchecked(index.labelId, index.propertyId), rangePredicate) } } }).getOrElse(Iterator.empty) @@ -335,14 +334,14 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper, val re rangeLessThan.limit(BY_STRING).map { limit => val rangePredicate = IndexQuery .range(index.propertyId, null, false, limit.endPoint.asInstanceOf[String], limit.isInclusive) - seek(DefaultIndexReference.general(index.labelId, index.propertyId), rangePredicate) + seek(tc.schemaRead.indexReferenceUnchecked(index.labelId, index.propertyId), rangePredicate) }.getOrElse(Iterator.empty) case rangeGreaterThan: RangeGreaterThan[String] => rangeGreaterThan.limit(BY_STRING).map { limit => val rangePredicate = IndexQuery .range(index.propertyId, limit.endPoint.asInstanceOf[String], limit.isInclusive, null, false) - seek(DefaultIndexReference.general(index.labelId, index.propertyId), rangePredicate) + seek(tc.schemaRead.indexReferenceUnchecked(index.labelId, index.propertyId), rangePredicate) }.getOrElse(Iterator.empty) case RangeBetween(rangeGreaterThan, rangeLessThan) => @@ -351,14 +350,14 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper, val re val rangePredicate = IndexQuery .range(index.propertyId, greaterThanLimit.endPoint.asInstanceOf[String], greaterThanLimit.isInclusive, lessThanLimit.endPoint.asInstanceOf[String], lessThanLimit.isInclusive) - seek(DefaultIndexReference.general(index.labelId, index.propertyId), rangePredicate) + seek(tc.schemaRead.indexReferenceUnchecked(index.labelId, index.propertyId), rangePredicate) } }.getOrElse(Iterator.empty) } def indexScan(index: SchemaTypes.IndexDescriptor) = { val cursor = allocateAndTraceNodeValueIndexCursor() - reads().nodeIndexScan(DefaultIndexReference.general(index.labelId, index.propertyId), cursor, IndexOrder.NONE) + reads().nodeIndexScan(tc.schemaRead.indexReferenceUnchecked(index.labelId, index.propertyId), cursor, IndexOrder.NONE) new CursorIterator[Node] { override protected def fetchNext(): Node = { if (cursor.next()) proxySpi.newNodeProxy(cursor.nodeReference()) @@ -369,7 +368,7 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper, val re } override def lockingExactUniqueIndexSearch(index: SchemaTypes.IndexDescriptor, value: Any): Option[Node] = { - val nodeId: Long = tc.dataRead.lockingNodeUniqueIndexSeek(DefaultIndexReference.general(index.labelId, index.propertyId), + val nodeId: Long = tc.dataRead.lockingNodeUniqueIndexSeek(tc.schemaRead.indexReferenceUnchecked(index.labelId, index.propertyId), IndexQuery.exact(index.propertyId, Values.of(value))) if (StatementConstants.NO_SUCH_NODE == nodeId) None else Some(nodeOps.getById(nodeId)) } @@ -719,8 +718,7 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper, val re def addIndexRule(labelId: Int, propertyKeyId: Int): IdempotentResult[SchemaTypes.IndexDescriptor] = try { IdempotentResult( - DefaultIndexReference.toDescriptor( - tc.kernelTransaction.schemaWrite().indexCreate(SchemaDescriptorFactory.forLabel(labelId, propertyKeyId))) + tc.kernelTransaction.schemaWrite().indexCreate(SchemaDescriptorFactory.forLabel(labelId, propertyKeyId)) ) } catch { case _: AlreadyIndexedException => @@ -729,11 +727,11 @@ final class TransactionBoundQueryContext(tc: TransactionalContextWrapper, val re if (tc.schemaRead.indexGetState(index) == InternalIndexState.FAILED) throw new FailedIndexException(index.userDescription(tokenNameLookup)) - IdempotentResult(DefaultIndexReference.toDescriptor(index), wasCreated = false) + IdempotentResult(index, wasCreated = false) } def dropIndexRule(labelId: Int, propertyKeyId: Int) = - tc.kernelTransaction.schemaWrite().indexDrop(DefaultIndexReference.general( labelId, propertyKeyId )) + tc.kernelTransaction.schemaWrite().indexDrop(tc.schemaRead.indexReferenceUnchecked( labelId, propertyKeyId )) def createUniqueConstraint(labelId: Int, propertyKeyId: Int): IdempotentResult[SchemaTypes.UniquenessConstraint] = try { tc.kernelTransaction.schemaWrite().uniquePropertyConstraintCreate( diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/SchemaDescriptorTranslation.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/SchemaDescriptorTranslation.scala index caa119749223..feab23c97b67 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/SchemaDescriptorTranslation.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/SchemaDescriptorTranslation.scala @@ -20,17 +20,14 @@ package org.neo4j.cypher.internal.spi.v3_1 import org.neo4j.cypher.internal.compiler.v3_1.spi.SchemaTypes +import org.neo4j.internal.kernel.api.{IndexReference => KernelIndexReference} import org.neo4j.internal.kernel.api.schema.SchemaDescriptor import org.neo4j.kernel.api.schema.constaints.{ConstraintDescriptorFactory, NodeExistenceConstraintDescriptor, RelExistenceConstraintDescriptor, UniquenessConstraintDescriptor => KernelUniquenessConstraint} -import org.neo4j.kernel.api.schema.index.{IndexDescriptorFactory, IndexDescriptor => KernelIndexDescriptor} trait SchemaDescriptorTranslation { - implicit def toKernel(index: SchemaTypes.IndexDescriptor): KernelIndexDescriptor = - IndexDescriptorFactory.forLabel(index.labelId, index.propertyId) - - implicit def toCypher(index: KernelIndexDescriptor): SchemaTypes.IndexDescriptor = { - assertSingleProperty(index.schema()) - SchemaTypes.IndexDescriptor(index.schema().keyId, index.schema().getPropertyId()) + implicit def toCypher(index: KernelIndexReference): SchemaTypes.IndexDescriptor = { + assertSingleProperty(index.properties()) + SchemaTypes.IndexDescriptor(index.label(), index.properties()(0)) } implicit def toKernel(constraint: SchemaTypes.UniquenessConstraint): KernelUniquenessConstraint = @@ -52,6 +49,9 @@ trait SchemaDescriptorTranslation { } def assertSingleProperty(schema: SchemaDescriptor):Unit = - if (schema.getPropertyIds.length != 1) + assertSingleProperty(schema.getPropertyIds) + + def assertSingleProperty(properties: Array[Int]): Unit = + if (properties.length != 1) throw new UnsupportedOperationException("Cypher 3.1 does not support composite indexes or constraints") } diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundGraphStatistics.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundGraphStatistics.scala index 64dac4dfb8c8..e9441d43b66c 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundGraphStatistics.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundGraphStatistics.scala @@ -44,7 +44,7 @@ object TransactionBoundGraphStatistics { // Probability of any node with the given label, to have a property with a given value val indexEntrySelectivity = schemaRead.indexUniqueValuesSelectivity( - DefaultIndexReference.general(label.id, property.id) + schemaRead.indexReferenceUnchecked(label.id, property.id) ) val frequencyOfNodesWithSameValue = 1.0 / indexEntrySelectivity val indexSelectivity = frequencyOfNodesWithSameValue / labeledNodes @@ -60,7 +60,7 @@ object TransactionBoundGraphStatistics { val labeledNodes = read.countsForNodeWithoutTxState( label ).toDouble // Probability of any node with the given label, to have a given property - val indexSize = schemaRead.indexSize(DefaultIndexReference.general(label.id, property.id)) + val indexSize = schemaRead.indexSize(schemaRead.indexReferenceUnchecked(label.id, property.id)) val indexSelectivity = indexSize / labeledNodes Selectivity.of(indexSelectivity) diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundQueryContext.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundQueryContext.scala index 1773b2a91e0c..7165066c10e2 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundQueryContext.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_1/TransactionBoundQueryContext.scala @@ -207,7 +207,7 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper, } override def indexSeek(index: IndexDescriptor, value: Any) = - seek(DefaultIndexReference.general(index.labelId, index.propertyId), + seek(txContext.kernelTransaction.schemaRead().indexReferenceUnchecked(index.labelId, index.propertyId), IndexQuery.exact(index.propertyId, value)) override def indexSeekByRange(index: IndexDescriptor, value: Any) = value match { @@ -295,19 +295,19 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper, } private def indexSeekByPrefixRange(index: IndexDescriptor, prefix: String): scala.Iterator[Node] = - seek(DefaultIndexReference.general(index.labelId, index.propertyId), IndexQuery.stringPrefix(index.propertyId, prefix)) + seek(txContext.kernelTransaction.schemaRead().indexReferenceUnchecked(index.labelId, index.propertyId), IndexQuery.stringPrefix(index.propertyId, prefix)) private def indexSeekByNumericalRange(index: IndexDescriptor, range: InequalitySeekRange[Number]): scala.Iterator[Node] =(range match { case rangeLessThan: RangeLessThan[Number] => rangeLessThan.limit(BY_NUMBER).map { limit => val rangePredicate = IndexQuery.range(index.propertyId, null, false, limit.endPoint, limit.isInclusive) - seek(DefaultIndexReference.general(index.labelId, index.propertyId), rangePredicate) + seek(txContext.kernelTransaction.schemaRead().indexReferenceUnchecked(index.labelId, index.propertyId), rangePredicate) } case rangeGreaterThan: RangeGreaterThan[Number] => rangeGreaterThan.limit(BY_NUMBER).map { limit => val rangePredicate = IndexQuery.range(index.propertyId, limit.endPoint, limit.isInclusive, null, false) - seek(DefaultIndexReference.general(index.labelId, index.propertyId), rangePredicate) + seek(txContext.kernelTransaction.schemaRead().indexReferenceUnchecked(index.labelId, index.propertyId), rangePredicate) } case RangeBetween(rangeGreaterThan, rangeLessThan) => @@ -317,7 +317,7 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper, .range(index.propertyId, greaterThanLimit.endPoint, greaterThanLimit.isInclusive, lessThanLimit.endPoint, lessThanLimit.isInclusive) - seek(DefaultIndexReference.general(index.labelId, index.propertyId), rangePredicate) + seek(txContext.kernelTransaction.schemaRead().indexReferenceUnchecked(index.labelId, index.propertyId), rangePredicate) } } }).getOrElse(Iterator.empty) @@ -329,14 +329,14 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper, rangeLessThan.limit(BY_STRING).map { limit => val rangePredicate = IndexQuery .range(index.propertyId, null, false, limit.endPoint.asInstanceOf[String], limit.isInclusive) - seek(DefaultIndexReference.general(index.labelId, index.propertyId), rangePredicate) + seek(txContext.kernelTransaction.schemaRead().indexReferenceUnchecked(index.labelId, index.propertyId), rangePredicate) }.getOrElse(Iterator.empty) case rangeGreaterThan: RangeGreaterThan[String] => rangeGreaterThan.limit(BY_STRING).map { limit => val rangePredicate = IndexQuery .range(index.propertyId, limit.endPoint.asInstanceOf[String], limit.isInclusive, null, false) - seek(DefaultIndexReference.general(index.labelId, index.propertyId), rangePredicate) + seek(txContext.kernelTransaction.schemaRead().indexReferenceUnchecked(index.labelId, index.propertyId), rangePredicate) }.getOrElse(Iterator.empty) case RangeBetween(rangeGreaterThan, rangeLessThan) => @@ -345,14 +345,14 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper, val rangePredicate = IndexQuery .range(index.propertyId, greaterThanLimit.endPoint.asInstanceOf[String], greaterThanLimit.isInclusive, lessThanLimit.endPoint.asInstanceOf[String], lessThanLimit.isInclusive) - seek(DefaultIndexReference.general(index.labelId, index.propertyId), rangePredicate) + seek(txContext.kernelTransaction.schemaRead().indexReferenceUnchecked(index.labelId, index.propertyId), rangePredicate) } }.getOrElse(Iterator.empty) } override def indexScan(index: IndexDescriptor) = { val cursor = allocateAndTraceNodeValueIndexCursor() - reads().nodeIndexScan(DefaultIndexReference.general(index.labelId, index.propertyId), cursor, IndexOrder.NONE) + reads().nodeIndexScan(txContext.kernelTransaction.schemaRead().indexReferenceUnchecked(index.labelId, index.propertyId), cursor, IndexOrder.NONE) new CursorIterator[Node] { override protected def fetchNext(): Node = { if (cursor.next()) entityAccessor.newNodeProxy(cursor.nodeReference()) @@ -363,14 +363,14 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper, } override def indexScanByContains(index: IndexDescriptor, value: String) = - seek(DefaultIndexReference.general(index.labelId, index.propertyId), IndexQuery.stringContains(index.propertyId, value)) + seek(txContext.kernelTransaction.schemaRead().indexReferenceUnchecked(index.labelId, index.propertyId), IndexQuery.stringContains(index.propertyId, value)) override def indexScanByEndsWith(index: IndexDescriptor, value: String) = - seek(DefaultIndexReference.general(index.labelId, index.propertyId), IndexQuery.stringSuffix(index.propertyId, value)) + seek(txContext.kernelTransaction.schemaRead().indexReferenceUnchecked(index.labelId, index.propertyId), IndexQuery.stringSuffix(index.propertyId, value)) override def lockingUniqueIndexSeek(index: IndexDescriptor, value: Any): Option[Node] = { indexSearchMonitor.lockingUniqueIndexSeek(index, value) - val nodeId = reads().lockingNodeUniqueIndexSeek(DefaultIndexReference.general(index.labelId, index.propertyId), IndexQuery.exact(index.propertyId, value)) + val nodeId = reads().lockingNodeUniqueIndexSeek(txContext.kernelTransaction.schemaRead().indexReferenceUnchecked(index.labelId, index.propertyId), IndexQuery.exact(index.propertyId, value)) if (StatementConstants.NO_SUCH_NODE == nodeId) None else Some(nodeOps.getById(nodeId)) } @@ -731,8 +731,7 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper, override def addIndexRule(labelId: Int, propertyKeyId: Int): IdempotentResult[IndexDescriptor] = try { IdempotentResult( - DefaultIndexReference.toDescriptor( - txContext.kernelTransaction.schemaWrite().indexCreate(SchemaDescriptorFactory.forLabel(labelId, propertyKeyId))) + txContext.kernelTransaction.schemaWrite().indexCreate(SchemaDescriptorFactory.forLabel(labelId, propertyKeyId)) ) } catch { case _: AlreadyIndexedException => @@ -742,11 +741,11 @@ final class TransactionBoundQueryContext(txContext: TransactionalContextWrapper, if (read.indexGetState(index) == InternalIndexState.FAILED) throw new FailedIndexException(index.userDescription(tokenNameLookup)) - IdempotentResult(DefaultIndexReference.toDescriptor(index), wasCreated = false) + IdempotentResult(index, wasCreated = false) } override def dropIndexRule(labelId: Int, propertyKeyId: Int) = - txContext.kernelTransaction.schemaWrite().indexDrop(DefaultIndexReference.general( labelId, propertyKeyId )) + txContext.kernelTransaction.schemaWrite().indexDrop(txContext.kernelTransaction.schemaRead().indexReferenceUnchecked( labelId, propertyKeyId )) override def createUniqueConstraint(labelId: Int, propertyKeyId: Int): IdempotentResult[UniquenessConstraint] = try { txContext.kernelTransaction.schemaWrite().uniquePropertyConstraintCreate( diff --git a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundGraphStatistics.scala b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundGraphStatistics.scala index 979dc37c50bd..e3f3bc6393d3 100644 --- a/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundGraphStatistics.scala +++ b/community/cypher/cypher/src/main/scala/org/neo4j/cypher/internal/spi/v3_3/TransactionBoundGraphStatistics.scala @@ -40,7 +40,7 @@ object TransactionBoundGraphStatistics { // Probability of any node with the given label, to have a property with a given value val indexEntrySelectivity = schemaRead.indexUniqueValuesSelectivity( - DefaultIndexReference.general(index.label, index.properties.map(_.id):_*)) + schemaRead.indexReferenceUnchecked(index.label, index.properties.map(_.id):_*)) val frequencyOfNodesWithSameValue = 1.0 / indexEntrySelectivity val indexSelectivity = frequencyOfNodesWithSameValue / labeledNodes @@ -55,7 +55,7 @@ object TransactionBoundGraphStatistics { val labeledNodes = read.countsForNodeWithoutTxState( index.label ).toDouble // Probability of any node with the given label, to have a given property - val indexSize = schemaRead.indexSize(DefaultIndexReference.general(index.label, index.properties.map(_.id):_*)) + val indexSize = schemaRead.indexSize(schemaRead.indexReferenceUnchecked(index.label, index.properties.map(_.id):_*)) val indexSelectivity = indexSize / labeledNodes Selectivity.of(indexSelectivity) diff --git a/community/cypher/interpreted-runtime/src/main/scala/org/neo4j/cypher/internal/runtime/interpreted/TransactionBoundGraphStatistics.scala b/community/cypher/interpreted-runtime/src/main/scala/org/neo4j/cypher/internal/runtime/interpreted/TransactionBoundGraphStatistics.scala index d92822596915..30feb5bc6bfd 100644 --- a/community/cypher/interpreted-runtime/src/main/scala/org/neo4j/cypher/internal/runtime/interpreted/TransactionBoundGraphStatistics.scala +++ b/community/cypher/interpreted-runtime/src/main/scala/org/neo4j/cypher/internal/runtime/interpreted/TransactionBoundGraphStatistics.scala @@ -41,7 +41,7 @@ object TransactionBoundGraphStatistics { // Probability of any node with the given label, to have a property with a given value val indexEntrySelectivity = schemaRead.indexUniqueValuesSelectivity( - DefaultIndexReference.general(index.label, index.properties.map(_.id):_*)) + schemaRead.indexReferenceUnchecked(index.label, index.properties.map(_.id):_*)) val frequencyOfNodesWithSameValue = 1.0 / indexEntrySelectivity val indexSelectivity = frequencyOfNodesWithSameValue / labeledNodes @@ -56,7 +56,7 @@ object TransactionBoundGraphStatistics { val labeledNodes = read.countsForNodeWithoutTxState( index.label ).toDouble // Probability of any node with the given label, to have a given property - val indexSize = schemaRead.indexSize(DefaultIndexReference.general(index.label, index.properties.map(_.id):_*)) + val indexSize = schemaRead.indexSize(schemaRead.indexReferenceUnchecked(index.label, index.properties.map(_.id):_*)) val indexSelectivity = indexSize / labeledNodes Selectivity.of(indexSelectivity) diff --git a/community/cypher/interpreted-runtime/src/main/scala/org/neo4j/cypher/internal/runtime/interpreted/TransactionBoundQueryContext.scala b/community/cypher/interpreted-runtime/src/main/scala/org/neo4j/cypher/internal/runtime/interpreted/TransactionBoundQueryContext.scala index b57126bd9f7f..1e413e271afa 100644 --- a/community/cypher/interpreted-runtime/src/main/scala/org/neo4j/cypher/internal/runtime/interpreted/TransactionBoundQueryContext.scala +++ b/community/cypher/interpreted-runtime/src/main/scala/org/neo4j/cypher/internal/runtime/interpreted/TransactionBoundQueryContext.scala @@ -318,7 +318,7 @@ sealed class TransactionBoundQueryContext(val transactionalContext: Transactiona override def lockingUniqueIndexSeek(indexReference: IndexReference, queries: Seq[IndexQuery.ExactPredicate]): Option[NodeValue] = { indexSearchMonitor.lockingUniqueIndexSeek(indexReference, queries) - val index = DefaultIndexReference.general(indexReference.label(), indexReference.properties():_*) + val index = transactionalContext.kernelTransaction.schemaRead().indexReferenceUnchecked(indexReference.label(), indexReference.properties():_*) val nodeId = reads().lockingNodeUniqueIndexSeek(index, queries:_*) if (StatementConstants.NO_SUCH_NODE == nodeId) None else Some(nodeOps.getById(nodeId)) } @@ -658,7 +658,7 @@ sealed class TransactionBoundQueryContext(val transactionalContext: Transactiona override def dropIndexRule(descriptor: IndexDescriptor): Unit = transactionalContext.kernelTransaction.schemaWrite().indexDrop( - DefaultIndexReference.general(descriptor.label, descriptor.properties.map(_.id):_*) + transactionalContext.kernelTransaction.schemaRead().indexReferenceUnchecked(descriptor.label, descriptor.properties.map(_.id):_*) ) override def createNodeKeyConstraint(descriptor: IndexDescriptor): Boolean = try { diff --git a/community/kernel-api/src/main/java/org/neo4j/internal/kernel/api/SchemaRead.java b/community/kernel-api/src/main/java/org/neo4j/internal/kernel/api/SchemaRead.java index b82f85c49837..cdb42738d612 100644 --- a/community/kernel-api/src/main/java/org/neo4j/internal/kernel/api/SchemaRead.java +++ b/community/kernel-api/src/main/java/org/neo4j/internal/kernel/api/SchemaRead.java @@ -45,6 +45,16 @@ public interface SchemaRead */ CapableIndexReference index( int label, int... properties ); + /** + * Acquire an index reference of the given {@code label} and {@code properties}. This method does not assert + * that the created reference points to a valid online index. + * + * @param label the index label + * @param properties the index properties + * @return a IndexReference for the given label and properties + */ + CapableIndexReference indexReferenceUnchecked( int label, int... properties ); + /** * Returns all indexes associated with the given label * diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/DefaultIndexReference.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/DefaultIndexReference.java index 3201e57d1b92..7070a29c5c00 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/DefaultIndexReference.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/store/DefaultIndexReference.java @@ -68,28 +68,6 @@ public String providerVersion() throw new UnsupportedOperationException( "not yet" ); } - public static IndexReference unique( int label, int...properties ) - { - return new DefaultIndexReference( true, label, properties ); - } - - public static IndexReference general( int label, int...properties ) - { - return new DefaultIndexReference( false, label, properties ); - } - - public static IndexDescriptor toDescriptor( IndexReference reference ) - { - if ( reference.isUnique() ) - { - return IndexDescriptorFactory.uniqueForLabel( reference.label(), reference.properties() ); - } - else - { - return IndexDescriptorFactory.forLabel( reference.label(), reference.properties() ); - } - } - @Override public boolean equals( Object o ) { diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/newapi/AllStoreHolder.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/newapi/AllStoreHolder.java index 096a999a898b..b7f13b0385c6 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/newapi/AllStoreHolder.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/newapi/AllStoreHolder.java @@ -66,7 +66,6 @@ import org.neo4j.kernel.impl.api.index.CapableIndexDescriptor; import org.neo4j.kernel.impl.api.security.OverriddenAccessMode; import org.neo4j.kernel.impl.api.security.RestrictedAccessMode; -import org.neo4j.kernel.impl.api.store.DefaultIndexReference; import org.neo4j.kernel.impl.index.ExplicitIndexStore; import org.neo4j.kernel.impl.index.IndexEntityType; import org.neo4j.kernel.impl.locking.ResourceTypes; @@ -361,6 +360,12 @@ public CapableIndexReference index( int label, int... properties ) return indexDescriptor != null ? indexDescriptor : CapableIndexReference.NO_INDEX; } + @Override + public CapableIndexReference indexReferenceUnchecked( int label, int... properties ) + { + return IndexDescriptorFactory.forLabel( label, properties ); + } + @Override public Iterator indexesGetForLabel( int labelId ) { @@ -477,7 +482,7 @@ public long indexSize( IndexReference index ) throws IndexNotFoundKernelExceptio public long nodesCountIndexed( IndexReference index, long nodeId, Value value ) throws KernelException { ktx.assertOpen(); - IndexReader reader = storageReader.getIndexReader( DefaultIndexReference.toDescriptor( index ) ); + IndexReader reader = storageReader.getIndexReader( (IndexDescriptor) index ); return reader.countIndexedNodes( nodeId, value ); } diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/storageengine/impl/recordstorage/RecordStorageReader.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/storageengine/impl/recordstorage/RecordStorageReader.java index 4629657c87c1..4bd139fac404 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/storageengine/impl/recordstorage/RecordStorageReader.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/storageengine/impl/recordstorage/RecordStorageReader.java @@ -894,13 +894,13 @@ private IndexReaderFactory indexReaderFactory() } @Override - public IndexReader getIndexReader( PendingIndexDescriptor descriptor ) throws IndexNotFoundKernelException + public IndexReader getIndexReader( IndexDescriptor descriptor ) throws IndexNotFoundKernelException { return indexReaderFactory().newReader( descriptor ); } @Override - public IndexReader getFreshIndexReader( PendingIndexDescriptor descriptor ) throws IndexNotFoundKernelException + public IndexReader getFreshIndexReader( IndexDescriptor descriptor ) throws IndexNotFoundKernelException { return indexReaderFactory().newUnCachedReader( descriptor ); } diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/util/dbstructure/GraphDbStructureGuide.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/util/dbstructure/GraphDbStructureGuide.java index 38a0fc3399e5..3effa8536bc2 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/util/dbstructure/GraphDbStructureGuide.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/util/dbstructure/GraphDbStructureGuide.java @@ -42,7 +42,7 @@ import org.neo4j.kernel.api.schema.constaints.NodeKeyConstraintDescriptor; import org.neo4j.kernel.api.schema.constaints.RelExistenceConstraintDescriptor; import org.neo4j.kernel.api.schema.constaints.UniquenessConstraintDescriptor; -import org.neo4j.kernel.impl.api.store.DefaultIndexReference; +import org.neo4j.kernel.api.schema.index.IndexDescriptor; import org.neo4j.kernel.impl.core.ThreadToStatementContextBridge; import org.neo4j.kernel.internal.GraphDatabaseAPI; @@ -144,7 +144,7 @@ private void showIndices( DbStructureVisitor visitor, KernelTransaction ktx, Tok .userDescription( nameLookup ); double uniqueValuesPercentage = schemaRead.indexUniqueValuesSelectivity( reference ); long size = schemaRead.indexSize( reference ); - visitor.visitIndex( DefaultIndexReference.toDescriptor( reference ), userDescription, uniqueValuesPercentage, size ); + visitor.visitIndex( (IndexDescriptor) reference, userDescription, uniqueValuesPercentage, size ); } } diff --git a/community/kernel/src/main/java/org/neo4j/storageengine/api/StorageReader.java b/community/kernel/src/main/java/org/neo4j/storageengine/api/StorageReader.java index f6d6f98299ea..52b711c391ee 100644 --- a/community/kernel/src/main/java/org/neo4j/storageengine/api/StorageReader.java +++ b/community/kernel/src/main/java/org/neo4j/storageengine/api/StorageReader.java @@ -160,11 +160,11 @@ Cursor acquireSinglePropertyCursor( long propertyId, int propertyK * Reader returned from this method should not be closed. All such readers will be closed during {@link #close()} * of the current statement. * - * @param index {@link PendingIndexDescriptor} to get reader for. + * @param index {@link IndexDescriptor} to get reader for. * @return {@link IndexReader} capable of searching entity ids given property values. * @throws IndexNotFoundKernelException if no such index exists. */ - IndexReader getIndexReader( PendingIndexDescriptor index ) throws IndexNotFoundKernelException; + IndexReader getIndexReader( IndexDescriptor index ) throws IndexNotFoundKernelException; /** * Returns an {@link IndexReader} for searching entity ids given property values. A new reader is allocated @@ -174,11 +174,11 @@ Cursor acquireSinglePropertyCursor( long propertyId, int propertyK * NOTE: * It is caller's responsibility to close the returned reader. * - * @param index {@link PendingIndexDescriptor} to get reader for. + * @param index {@link IndexDescriptor} to get reader for. * @return {@link IndexReader} capable of searching entity ids given property values. * @throws IndexNotFoundKernelException if no such index exists. */ - IndexReader getFreshIndexReader( PendingIndexDescriptor index ) throws IndexNotFoundKernelException; + IndexReader getFreshIndexReader( IndexDescriptor index ) throws IndexNotFoundKernelException; /** * Access to low level record cursors diff --git a/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/BuiltInProceduresTest.java b/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/BuiltInProceduresTest.java index db2e8655c3c0..cc6304ce4328 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/BuiltInProceduresTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/builtinprocs/BuiltInProceduresTest.java @@ -56,9 +56,9 @@ import org.neo4j.kernel.api.proc.Key; import org.neo4j.kernel.api.schema.constaints.ConstraintDescriptor; import org.neo4j.kernel.api.schema.constaints.ConstraintDescriptorFactory; +import org.neo4j.kernel.api.schema.index.IndexDescriptorFactory; import org.neo4j.kernel.impl.api.index.inmemory.InMemoryIndexProviderFactory; import org.neo4j.kernel.impl.api.store.DefaultCapableIndexReference; -import org.neo4j.kernel.impl.api.store.DefaultIndexReference; import org.neo4j.kernel.impl.factory.Edition; import org.neo4j.kernel.impl.proc.Procedures; import org.neo4j.kernel.internal.GraphDatabaseAPI; @@ -415,7 +415,7 @@ private void givenIndex( String label, String propKey ) int labelId = token( label, labels ); int propId = token( propKey, propKeys ); - IndexReference index = DefaultIndexReference.general( labelId, propId ); + IndexReference index = IndexDescriptorFactory.forLabel( labelId, propId ); indexes.add( index ); } @@ -424,7 +424,7 @@ private void givenUniqueConstraint( String label, String propKey ) int labelId = token( label, labels ); int propId = token( propKey, propKeys ); - IndexReference index = DefaultIndexReference.unique( labelId, propId ); + IndexReference index = IndexDescriptorFactory.uniqueForLabel( labelId, propId ); uniqueIndexes.add( index ); constraints.add( ConstraintDescriptorFactory.uniqueForLabel( labelId, propId ) ); } diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexStatisticsTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexStatisticsTest.java index 07760a07d279..be0787729f35 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexStatisticsTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/api/index/IndexStatisticsTest.java @@ -53,8 +53,8 @@ import org.neo4j.kernel.api.KernelTransaction; import org.neo4j.kernel.api.Statement; import org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException; +import org.neo4j.kernel.api.schema.index.IndexDescriptor; import org.neo4j.kernel.api.schema.index.StoreIndexDescriptor; -import org.neo4j.kernel.impl.api.store.DefaultIndexReference; import org.neo4j.kernel.impl.core.ThreadToStatementContextBridge; import org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine; import org.neo4j.kernel.impl.store.NeoStores; @@ -204,7 +204,7 @@ public void shouldRemoveIndexStatisticsAfterIndexIsDeleted() throws KernelExcept awaitIndexesOnline(); SchemaStorage storage = new SchemaStorage( neoStores().getSchemaStore() ); - long indexId = storage.indexGetForSchema( DefaultIndexReference.toDescriptor( index ) ).getId(); + long indexId = storage.indexGetForSchema( (IndexDescriptor) index ).getId(); // when dropIndex( index ); diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/newapi/MockStore.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/newapi/MockStore.java index e7bd17197f7c..a1795ac0a8de 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/newapi/MockStore.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/newapi/MockStore.java @@ -634,6 +634,12 @@ public CapableIndexReference index( int label, int... properties ) throw new UnsupportedOperationException( "not implemented" ); } + @Override + public CapableIndexReference indexReferenceUnchecked( int label, int... properties ) + { + throw new UnsupportedOperationException( "not implemented" ); + } + @Override public Iterator indexesGetForLabel( int labelId ) { diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/GraphDbStructureGuideTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/GraphDbStructureGuideTest.java index f2cc1ceb0e49..4533add5bcdd 100644 --- a/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/GraphDbStructureGuideTest.java +++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/util/dbstructure/GraphDbStructureGuideTest.java @@ -48,7 +48,6 @@ import static org.neo4j.graphdb.RelationshipType.withName; import static org.neo4j.kernel.api.StatementConstants.ANY_LABEL; import static org.neo4j.kernel.api.StatementConstants.ANY_RELATIONSHIP_TYPE; -import static org.neo4j.kernel.impl.api.store.DefaultIndexReference.toDescriptor; public class GraphDbStructureGuideTest { @@ -141,7 +140,7 @@ public void visitsIndexes() throws Exception accept( visitor ); // THEN - verify( visitor ).visitIndex( toDescriptor( reference ), ":Person(name)", 1.0d, 0L ); + verify( visitor ).visitIndex( (IndexDescriptor) reference, ":Person(name)", 1.0d, 0L ); } @Test diff --git a/community/lucene-index/src/test/java/org/neo4j/concurrencytest/ConstraintIndexConcurrencyTest.java b/community/lucene-index/src/test/java/org/neo4j/concurrencytest/ConstraintIndexConcurrencyTest.java index d7c5fd387604..00addc8fbd8f 100644 --- a/community/lucene-index/src/test/java/org/neo4j/concurrencytest/ConstraintIndexConcurrencyTest.java +++ b/community/lucene-index/src/test/java/org/neo4j/concurrencytest/ConstraintIndexConcurrencyTest.java @@ -86,7 +86,7 @@ public void shouldNotAllowConcurrentViolationOfConstraint() throws Exception Read read = ktx.dataRead(); try ( NodeValueIndexCursor cursor = ktx.cursors().allocateNodeValueIndexCursor() ) { - read.nodeIndexSeek( DefaultIndexReference.unique( labelId, propertyKeyId ), cursor, IndexOrder.NONE, + read.nodeIndexSeek( ktx.schemaRead().index( labelId, propertyKeyId ), cursor, IndexOrder.NONE, IndexQuery.exact( index.schema().getPropertyId(), "The value is irrelevant, we just want to perform some sort of lookup against this " + "index" ) ); diff --git a/community/neo4j/src/test/java/org/neo4j/kernel/impl/index/schema/NativeStringIndexingIT.java b/community/neo4j/src/test/java/org/neo4j/kernel/impl/index/schema/NativeStringIndexingIT.java index f532519c4dc8..fd554af9ba33 100644 --- a/community/neo4j/src/test/java/org/neo4j/kernel/impl/index/schema/NativeStringIndexingIT.java +++ b/community/neo4j/src/test/java/org/neo4j/kernel/impl/index/schema/NativeStringIndexingIT.java @@ -34,7 +34,7 @@ import org.neo4j.internal.kernel.api.NodeValueIndexCursor; import org.neo4j.internal.kernel.api.exceptions.KernelException; import org.neo4j.kernel.api.KernelTransaction; -import org.neo4j.kernel.impl.api.store.DefaultIndexReference; +import org.neo4j.kernel.api.schema.index.IndexDescriptorFactory; import org.neo4j.kernel.impl.core.ThreadToStatementContextBridge; import org.neo4j.test.TestLabels; import org.neo4j.test.rule.DatabaseRule; @@ -151,10 +151,10 @@ public void shouldHandleCompositeSizesCloseToTheLimit() throws KernelException int propertyKeyId2 = ktx.tokenRead().propertyKey( KEY2 ); try ( NodeValueIndexCursor cursor = ktx.cursors().allocateNodeValueIndexCursor() ) { - ktx.dataRead().nodeIndexSeek( DefaultIndexReference.general( labelId, propertyKeyId1, propertyKeyId2 ), - cursor, IndexOrder.NONE, - IndexQuery.exact( propertyKeyId1, string1 ), - IndexQuery.exact( propertyKeyId2, string2 ) ); + ktx.dataRead().nodeIndexSeek( IndexDescriptorFactory.forLabel( labelId, propertyKeyId1, propertyKeyId2 ), + cursor, IndexOrder.NONE, + IndexQuery.exact( propertyKeyId1, string1 ), + IndexQuery.exact( propertyKeyId2, string2 ) ); assertTrue( cursor.next() ); assertEquals( node.getId(), cursor.nodeReference() ); assertFalse( cursor.next() ); diff --git a/community/neo4j/src/test/java/schema/IndexPopulationFlipRaceIT.java b/community/neo4j/src/test/java/schema/IndexPopulationFlipRaceIT.java index bc0cb5e60de9..0688f7a1a389 100644 --- a/community/neo4j/src/test/java/schema/IndexPopulationFlipRaceIT.java +++ b/community/neo4j/src/test/java/schema/IndexPopulationFlipRaceIT.java @@ -30,8 +30,8 @@ import org.neo4j.internal.kernel.api.Kernel; import org.neo4j.internal.kernel.api.Session; import org.neo4j.kernel.api.KernelTransaction; +import org.neo4j.kernel.api.schema.index.IndexDescriptorFactory; import org.neo4j.kernel.api.security.AnonymousContext; -import org.neo4j.kernel.impl.api.store.DefaultIndexReference; import org.neo4j.test.rule.DatabaseRule; import org.neo4j.test.rule.EmbeddedDatabaseRule; import org.neo4j.test.rule.RandomRule; @@ -145,8 +145,8 @@ private void verifyThatThereAreExactlyOneIndexEntryPerNodeInTheIndexes( int i, P int keyAId = tx.tokenRead().propertyKey( keyA( i ) ); int labelBId = tx.tokenRead().nodeLabel( labelB( i ).name() ); int keyBId = tx.tokenRead().propertyKey( keyB( i ) ); - IndexReference indexA = DefaultIndexReference.general( labelAId, keyAId ); - IndexReference indexB = DefaultIndexReference.general( labelBId, keyBId ); + IndexReference indexA = IndexDescriptorFactory.forLabel( labelAId, keyAId ); + IndexReference indexB = IndexDescriptorFactory.forLabel( labelBId, keyBId ); for ( int j = 0; j < NODES_PER_INDEX; j++ ) { diff --git a/enterprise/ha/src/test/java/org/neo4j/kernel/ha/HaCountsIT.java b/enterprise/ha/src/test/java/org/neo4j/kernel/ha/HaCountsIT.java index 18dc09faec89..a03a4502e181 100644 --- a/enterprise/ha/src/test/java/org/neo4j/kernel/ha/HaCountsIT.java +++ b/enterprise/ha/src/test/java/org/neo4j/kernel/ha/HaCountsIT.java @@ -38,7 +38,6 @@ import org.neo4j.kernel.api.schema.SchemaDescriptorFactory; import org.neo4j.kernel.api.schema.index.IndexDescriptor; import org.neo4j.kernel.impl.api.index.IndexingService; -import org.neo4j.kernel.impl.api.store.DefaultIndexReference; import org.neo4j.kernel.impl.core.ThreadToStatementContextBridge; import org.neo4j.kernel.impl.ha.ClusterManager.ManagedCluster; import org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine; @@ -191,7 +190,7 @@ private IndexDescriptor createAnIndex( HighlyAvailableGraphDatabase db, Label la IndexReference index = ktx.schemaWrite() .indexCreate( SchemaDescriptorFactory.forLabel( labelId, propertyKeyId ) ); tx.success(); - return DefaultIndexReference.toDescriptor( index ); + return (IndexDescriptor) index; } }