Skip to content

Commit

Permalink
Fix #2300 issue with big collection sort
Browse files Browse the repository at this point in the history
  • Loading branch information
matsakiv committed Mar 21, 2023
1 parent 84faf67 commit 734515a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions LiteDB/Engine/Sort/SortDisk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ public void Write(long position, BufferSlice buffer)
// there is only a single writer instance, must be lock to ensure only 1 single thread are writing
lock(writer)
{
writer.Position = position;
writer.Write(buffer.Array, buffer.Offset, _containerSize);
for (var i = 0; i < _containerSize / PAGE_SIZE; ++i)
{
writer.Position = position + i * PAGE_SIZE;
writer.Write(buffer.Array, buffer.Offset + i * PAGE_SIZE, PAGE_SIZE);
}
}
}

Expand Down

0 comments on commit 734515a

Please sign in to comment.