コード例 #1
0
        /// <summary>
        /// Create page cache </summary>
        /// <param name="fileSystem"> file system that page cache will be based on </param>
        /// <param name="pageCacheTracer"> global page cache tracer </param>
        /// <param name="pageCursorTracerSupplier"> supplier of thread local (transaction local) page cursor tracer that will provide
        /// thread local page cache statistics </param>
        /// <param name="config"> page cache configuration </param>
        /// <param name="versionContextSupplier"> version context supplier </param>
        /// <param name="jobScheduler"> page cache job scheduler </param>
        /// <returns> created page cache instance </returns>
        public static PageCache CreatePageCache(FileSystemAbstraction fileSystem, PageCacheTracer pageCacheTracer, PageCursorTracerSupplier pageCursorTracerSupplier, Config config, VersionContextSupplier versionContextSupplier, JobScheduler jobScheduler)
        {
            config.AugmentDefaults(GraphDatabaseSettings.pagecache_memory, "8M");
            ZoneId logTimeZone = config.Get(GraphDatabaseSettings.db_timezone).ZoneId;
            FormattedLogProvider        logProvider      = FormattedLogProvider.withZoneId(logTimeZone).toOutputStream(System.err);
            ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(fileSystem, config, pageCacheTracer, pageCursorTracerSupplier, logProvider.GetLog(typeof(PageCache)), versionContextSupplier, jobScheduler);

            return(pageCacheFactory.OrCreatePageCache);
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldWarnWhenCreatedWithConfiguredPageCache()
        public virtual void ShouldWarnWhenCreatedWithConfiguredPageCache()
        {
            // Given
            Config config = Config.defaults(stringMap(GraphDatabaseSettings.mapped_memory_page_size.name(), "4096", pagecache_swapper.name(), TEST_PAGESWAPPER_NAME));
            AssertableLogProvider logProvider = new AssertableLogProvider();
            Log log = logProvider.GetLog(typeof(PageCache));

            // When
            ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(FsRule.get(), config, PageCacheTracer.NULL, Org.Neo4j.Io.pagecache.tracing.cursor.PageCursorTracerSupplier_Fields.Null, log, EmptyVersionContextSupplier.EMPTY, _jobScheduler);

            // Then
            using (PageCache ignore = pageCacheFactory.OrCreatePageCache)
            {
                logProvider.RawMessageMatcher().assertContains("The setting unsupported.dbms.memory.pagecache.pagesize does not have any effect. It is " + "deprecated and will be removed in a future version.");
            }
        }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldFitAsManyPagesAsItCan()
        public virtual void ShouldFitAsManyPagesAsItCan()
        {
            // Given
            long   pageCount = 60;
            long   memory    = MuninnPageCache.memoryRequiredForPages(pageCount);
            Config config    = Config.defaults(pagecache_memory, Convert.ToString(memory));

            // When
            ConfiguringPageCacheFactory factory = new ConfiguringPageCacheFactory(FsRule.get(), config, PageCacheTracer.NULL, Org.Neo4j.Io.pagecache.tracing.cursor.PageCursorTracerSupplier_Fields.Null, NullLog.Instance, EmptyVersionContextSupplier.EMPTY, _jobScheduler);

            // Then
            using (PageCache cache = factory.OrCreatePageCache)
            {
                assertThat(cache.PageSize(), equalTo(Org.Neo4j.Io.pagecache.PageCache_Fields.PAGE_SIZE));
                assertThat(cache.MaxCachedPages(), equalTo(pageCount));
            }
        }
コード例 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustUseAndLogConfiguredPageSwapper()
        public virtual void MustUseAndLogConfiguredPageSwapper()
        {
            // Given
            Config config = Config.defaults(stringMap(pagecache_memory.name(), "8m", pagecache_swapper.name(), TEST_PAGESWAPPER_NAME));
            AssertableLogProvider logProvider = new AssertableLogProvider();
            Log log = logProvider.GetLog(typeof(PageCache));

            // When
            ConfiguringPageCacheFactory cacheFactory = new ConfiguringPageCacheFactory(FsRule.get(), config, PageCacheTracer.NULL, Org.Neo4j.Io.pagecache.tracing.cursor.PageCursorTracerSupplier_Fields.Null, log, EmptyVersionContextSupplier.EMPTY, _jobScheduler);

            cacheFactory.OrCreatePageCache.close();

            // Then
            assertThat(PageSwapperFactoryForTesting.CountCreatedPageSwapperFactories(), @is(1));
            assertThat(PageSwapperFactoryForTesting.CountConfiguredPageSwapperFactories(), @is(1));
            logProvider.RawMessageMatcher().assertContains(TEST_PAGESWAPPER_NAME);
        }