Exemplo n.º 1
0
        public override MuninnPageCache CreatePageCache(PageSwapperFactory swapperFactory, int maxPages, PageCacheTracer tracer, PageCursorTracerSupplier cursorTracerSupplier, VersionContextSupplier contextSupplier, JobScheduler jobScheduler)
        {
            long memory = MuninnPageCache.MemoryRequiredForPages(maxPages);

            _allocator = MemoryAllocator.createAllocator(memory.ToString(), new LocalMemoryTracker());
            return(new MuninnPageCache(swapperFactory, _allocator, tracer, cursorTracerSupplier, contextSupplier, jobScheduler));
        }
Exemplo n.º 2
0
        public static PageCache CreatePageCache(FileSystemAbstraction fileSystem, JobScheduler jobScheduler)
        {
            SingleFilePageSwapperFactory factory = new SingleFilePageSwapperFactory();

            factory.Open(fileSystem, Configuration.EMPTY);

            PageCacheTracer cacheTracer = PageCacheTracer.NULL;
            DefaultPageCursorTracerSupplier cursorTracerSupplier   = DefaultPageCursorTracerSupplier.INSTANCE;
            VersionContextSupplier          versionContextSupplier = EmptyVersionContextSupplier.EMPTY;
            MemoryAllocator memoryAllocator = MemoryAllocator.createAllocator("8 MiB", GlobalMemoryTracker.INSTANCE);

            return(new MuninnPageCache(factory, memoryAllocator, cacheTracer, cursorTracerSupplier, versionContextSupplier, jobScheduler));
        }
Exemplo n.º 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void veryLargePageListsMustBeFullyAccessible()
        internal virtual void VeryLargePageListsMustBeFullyAccessible()
        {
            // We need roughly 2 GiBs of memory for the meta-data here, which is why this is an IT and not a Test.
            // We add one extra page worth of data to the size here, to avoid ending up on a "convenient" boundary.
            int  pageSize      = ( int )ByteUnit.kibiBytes(8);
            long pageCacheSize = ByteUnit.gibiBytes(513) + pageSize;
            int  pages         = Math.toIntExact(pageCacheSize / pageSize);

            MemoryAllocator mman       = MemoryAllocator.createAllocator("2 GiB", GlobalMemoryTracker.INSTANCE);
            SwapperSet      swappers   = new SwapperSet();
            long            victimPage = VictimPageReference.GetVictimPage(pageSize, GlobalMemoryTracker.INSTANCE);

            PageList pageList = new PageList(pages, pageSize, mman, swappers, victimPage, Long.BYTES);

            // Verify we end up with the correct number of pages.
            assertThat(pageList.PageCount, @is(pages));

            // Spot-check the accessibility in the bulk of the pages.
            IntStream.range(0, pages / 32).parallel().forEach(id => verifyPageMetaDataIsAccessible(pageList, id * 32));

            // Thoroughly check the accessibility around the tail end of the page list.
            IntStream.range(pages - 2000, pages).parallel().forEach(id => verifyPageMetaDataIsAccessible(pageList, id));
        }