Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void showIndices(DbStructureVisitor visitor, org.neo4j.kernel.api.KernelTransaction ktx, org.neo4j.internal.kernel.api.TokenNameLookup nameLookup) throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotFoundKernelException
        private void ShowIndices(DbStructureVisitor visitor, KernelTransaction ktx, TokenNameLookup nameLookup)
        {
            SchemaRead schemaRead = ktx.SchemaRead();

            foreach (IndexReference reference in loop(sortByType(schemaRead.IndexesGetAll())))
            {
                string userDescription        = reference.Schema().userDescription(nameLookup);
                double uniqueValuesPercentage = schemaRead.IndexUniqueValuesSelectivity(reference);
                long   size = schemaRead.IndexSize(reference);
                visitor.VisitIndex(( IndexDescriptor )reference, userDescription, uniqueValuesPercentage, size);
            }
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void checkIndexCounts(Store store, org.neo4j.kernel.internal.GraphDatabaseAPI db) throws org.neo4j.internal.kernel.api.exceptions.KernelException
        private static void CheckIndexCounts(Store store, GraphDatabaseAPI db)
        {
            InwardKernel kernel = Db.DependencyResolver.resolveDependency(typeof(InwardKernel));

            using (KernelTransaction tx = kernel.BeginTransaction(@implicit, AnonymousContext.read()), Statement ignore = tx.AcquireStatement())
            {
                SchemaRead schemaRead = tx.SchemaRead();
                IEnumerator <IndexReference> indexes  = IndexReference.sortByType(GetAllIndexes(schemaRead));
                Register_DoubleLongRegister  register = Registers.newDoubleLongRegister();
                for (int i = 0; indexes.MoveNext(); i++)
                {
                    IndexReference reference = indexes.Current;

                    // wait index to be online since sometimes we need to rebuild the indexes on migration
                    AwaitOnline(schemaRead, reference);

                    AssertDoubleLongEquals(store.IndexCounts[i][0], store.IndexCounts[i][1], schemaRead.IndexUpdatesAndSize(reference, register));
                    AssertDoubleLongEquals(store.IndexCounts[i][2], store.IndexCounts[i][3], schemaRead.IndexSample(reference, register));
                    double selectivity = schemaRead.IndexUniqueValuesSelectivity(reference);
                    assertEquals(store.IndexSelectivity[i], selectivity, 0.0000001d);
                }
            }
        }