コード例 #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void doNotMarkContextAsDirtyWhenAnyEvictedPageHaveModificationTransactionLowerThenReader() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void DoNotMarkContextAsDirtyWhenAnyEvictedPageHaveModificationTransactionLowerThenReader()
        {
            TestVersionContext     cursorContext          = new TestVersionContext(() => 15);
            VersionContextSupplier versionContextSupplier = new ConfiguredVersionContextSupplier(cursorContext);

            using (MuninnPageCache pageCache = createPageCache(fs, 2, PageCacheTracer.NULL, Org.Neo4j.Io.pagecache.tracing.cursor.PageCursorTracerSupplier_Fields.Null, versionContextSupplier), PagedFile pagedFile = map(pageCache, file("a"), 8))
            {
                cursorContext.InitWrite(3);
                using (PageCursor cursor = pagedFile.Io(0, PF_SHARED_WRITE_LOCK))
                {
                    assertTrue(cursor.Next());
                    cursor.PutLong(3);
                }

                cursorContext.InitWrite(13);
                using (PageCursor cursor = pagedFile.Io(1, PF_SHARED_WRITE_LOCK))
                {
                    assertTrue(cursor.Next());
                    cursor.PutLong(4);
                }

                EvictAllPages(pageCache);

                cursorContext.InitRead();
                using (PageCursor cursor = pagedFile.Io(0, PF_SHARED_READ_LOCK))
                {
                    assertTrue(cursor.Next());
                    assertEquals(3, cursor.Long);
                    assertFalse(cursorContext.Dirty);
                }
            }
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void pageModificationTracksHighestModifierTransactionId() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void PageModificationTracksHighestModifierTransactionId()
        {
            TestVersionContext     cursorContext          = new TestVersionContext(() => 0);
            VersionContextSupplier versionContextSupplier = new ConfiguredVersionContextSupplier(cursorContext);

            using (MuninnPageCache pageCache = createPageCache(fs, 2, PageCacheTracer.NULL, Org.Neo4j.Io.pagecache.tracing.cursor.PageCursorTracerSupplier_Fields.Null, versionContextSupplier), PagedFile pagedFile = map(pageCache, file("a"), 8))
            {
                cursorContext.InitWrite(1);
                using (PageCursor cursor = pagedFile.Io(0, PF_SHARED_WRITE_LOCK))
                {
                    assertTrue(cursor.Next());
                    cursor.PutLong(1);
                }
                cursorContext.InitWrite(12);
                using (PageCursor cursor = pagedFile.Io(0, PF_SHARED_WRITE_LOCK))
                {
                    assertTrue(cursor.Next());
                    cursor.PutLong(2);
                }
                cursorContext.InitWrite(7);
                using (PageCursor cursor = pagedFile.Io(0, PF_SHARED_WRITE_LOCK))
                {
                    assertTrue(cursor.Next());
                    cursor.PutLong(3);
                }

                using (PageCursor cursor = pagedFile.Io(0, PF_SHARED_READ_LOCK))
                {
                    assertTrue(cursor.Next());
                    MuninnPageCursor pageCursor = ( MuninnPageCursor )cursor;
                    assertEquals(12, pageCursor.PagedFile.getLastModifiedTxId(pageCursor.PinnedPageRef));
                    assertEquals(3, cursor.Long);
                }
            }
        }
コード例 #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void markCursorContextDirtyWhenRepositionCursorOnItsCurrentPage() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void MarkCursorContextDirtyWhenRepositionCursorOnItsCurrentPage()
        {
            TestVersionContext     cursorContext          = new TestVersionContext(() => 3);
            VersionContextSupplier versionContextSupplier = new ConfiguredVersionContextSupplier(cursorContext);

            using (MuninnPageCache pageCache = createPageCache(fs, 2, PageCacheTracer.NULL, Org.Neo4j.Io.pagecache.tracing.cursor.PageCursorTracerSupplier_Fields.Null, versionContextSupplier), PagedFile pagedFile = map(pageCache, file("a"), 8))
            {
                cursorContext.InitRead();
                using (PageCursor cursor = pagedFile.Io(0, PF_SHARED_WRITE_LOCK))
                {
                    assertTrue(cursor.Next(0));
                    assertFalse(cursorContext.Dirty);

                    MuninnPageCursor pageCursor = ( MuninnPageCursor )cursor;
                    pageCursor.PagedFile.setLastModifiedTxId((( MuninnPageCursor )cursor).PinnedPageRef, 17);

                    assertTrue(cursor.Next(0));
                    assertTrue(cursorContext.Dirty);
                }
            }
        }
コード例 #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void pageModificationTrackingNoticeWriteFromAnotherThread() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void PageModificationTrackingNoticeWriteFromAnotherThread()
        {
            TestVersionContext     cursorContext          = new TestVersionContext(() => 0);
            VersionContextSupplier versionContextSupplier = new ConfiguredVersionContextSupplier(cursorContext);

            using (MuninnPageCache pageCache = createPageCache(fs, 2, PageCacheTracer.NULL, Org.Neo4j.Io.pagecache.tracing.cursor.PageCursorTracerSupplier_Fields.Null, versionContextSupplier), PagedFile pagedFile = map(pageCache, file("a"), 8))
            {
                cursorContext.InitWrite(7);

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.concurrent.Future<?> future = executor.submit(() ->
                Future <object> future = executor.submit(() =>
                {
                    try
                    {
                        using (PageCursor cursor = pagedFile.Io(0, PF_SHARED_WRITE_LOCK))
                        {
                            assertTrue(cursor.Next());
                            cursor.PutLong(1);
                        }
                    }
                    catch (IOException e)
                    {
                        throw new Exception(e);
                    }
                });
                future.get();

                using (PageCursor cursor = pagedFile.Io(0, PF_SHARED_READ_LOCK))
                {
                    assertTrue(cursor.Next());
                    MuninnPageCursor pageCursor = ( MuninnPageCursor )cursor;
                    assertEquals(7, pageCursor.PagedFile.getLastModifiedTxId(pageCursor.PinnedPageRef));
                    assertEquals(1, cursor.Long);
                }
            }
        }
コード例 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void markCursorContextAsDirtyWhenReadingDataFromMoreRecentTransactions() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void MarkCursorContextAsDirtyWhenReadingDataFromMoreRecentTransactions()
        {
            TestVersionContext     cursorContext          = new TestVersionContext(() => 3);
            VersionContextSupplier versionContextSupplier = new ConfiguredVersionContextSupplier(cursorContext);

            using (MuninnPageCache pageCache = createPageCache(fs, 2, PageCacheTracer.NULL, Org.Neo4j.Io.pagecache.tracing.cursor.PageCursorTracerSupplier_Fields.Null, versionContextSupplier), PagedFile pagedFile = map(pageCache, file("a"), 8))
            {
                cursorContext.InitWrite(7);
                using (PageCursor cursor = pagedFile.Io(0, PF_SHARED_WRITE_LOCK))
                {
                    assertTrue(cursor.Next());
                    cursor.PutLong(3);
                }

                cursorContext.InitRead();
                assertFalse(cursorContext.Dirty);
                using (PageCursor cursor = pagedFile.Io(0, PF_SHARED_READ_LOCK))
                {
                    assertTrue(cursor.Next());
                    assertEquals(3, cursor.Long);
                    assertTrue(cursorContext.Dirty);
                }
            }
        }