예제 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static int propertyKeyCount(org.neo4j.kernel.internal.GraphDatabaseAPI db) throws org.neo4j.internal.kernel.api.exceptions.TransactionFailureException
        private static int PropertyKeyCount(GraphDatabaseAPI db)
        {
            InwardKernel kernelAPI = Db.DependencyResolver.resolveDependency(typeof(InwardKernel));

            using (KernelTransaction tx = kernelAPI.BeginTransaction(KernelTransaction.Type.@implicit, AnonymousContext.read()))
            {
                return(tx.TokenRead().propertyKeyCount());
            }
        }
예제 #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);
                }
            }
        }