Skip to content

Commit

Permalink
Update MemoryCache.cs
Browse files Browse the repository at this point in the history
When readable page is updated from a writable page buffer, the ShareCounter was set to 1 before it is copied, but when writable page is discarded the Ensure will throw an exception because the ShareCounter isn't set to BUFFER_WRITABLE.
  • Loading branch information
Raymond Welch committed Aug 26, 2022
1 parent 6d9ac62 commit e5e5a6f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions LiteDB/Engine/Disk/MemoryCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@ public PageBuffer MoveToReadable(PageBuffer page)

added = false;

// Bug 2184: readable page was updated, need to set the page.ShareCounter back to writeable
// so that DiscardPage can free the page and put it into the queue.
page.ShareCounter = BUFFER_WRITABLE;

return current;
});

Expand Down

0 comments on commit e5e5a6f

Please # to comment.