示例#1
0
        internal Page ModifyPage(long num, Tree tree, Page page)
        {
            _env.AssertFlushingNotFailed();

            page = page ?? GetReadOnlyPage(num);
            if (page.Dirty)
            {
                return(page);
            }

            if (_dirtyPages.Contains(num))
            {
                page.Dirty = true;
                return(page);
            }

            var newPage = AllocatePage(1, PageFlags.None, num); // allocate new page in a log file but with the same number

            Memory.Copy(newPage.Base, page.Base, AbstractPager.PageSize);
            newPage.LastSearchPosition = page.LastSearchPosition;
            newPage.LastMatch          = page.LastMatch;
            tree.RecentlyFoundPages.Reset(num);

            TrackWritablePage(newPage);

            return(newPage);
        }
示例#2
0
        internal Page ModifyPage(long num, Page page)
        {
            _env.AssertFlushingNotFailed();

            if (_dirtyPages.Contains(num))
            {
                page       = GetPageForModification(num, page);
                page.Dirty = true;

                return(page);
            }

            page = GetPageForModification(num, page);

            var newPage = AllocatePage(1, PageFlags.None, num);             // allocate new page in a log file but with the same number

            MemoryUtils.Copy(newPage.Base, page.Base, AbstractPager.PageSize);
            newPage.LastSearchPosition = page.LastSearchPosition;
            newPage.LastMatch          = page.LastMatch;

            return(newPage);
        }