-
Notifications
You must be signed in to change notification settings - Fork 711
moved max size check; added test for post-max size functioning #1130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mattsains The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Signed-off-by: Matthew Sainsbury <msainsbury@microsoft.com>
| // however, I don't quite understand it. Why is the allocation increment added to the size required, | ||
| // rather than the size required rounded up to the next multiple of the allocation increment? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's over allocation, to amortize the cost of truncate and fsync
refer to a122e1c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My issue was mostly that what I think happens here is that if you ask for 1 byte, but the alloc size is 10 bytes, it actually allocates 11 bytes. Shouldn't it be 10?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, as mentioned above it's a bit over allocation. By default it's 16MB at most. It shouldn't be a big problem. The logic has been there for almost a decade, let's keep it as it's unless you have a very strong justification.
Co-authored-by: Benjamin Wang <benjamin.wang@broadcom.com> Signed-off-by: Matthew Sainsbury <msainsbury@microsoft.com>
Signed-off-by: Matthew Sainsbury <msainsbury@microsoft.com>
|
@ahrtr I'm going to have to add special logic for windows because on that platform, to open a file with an mmap size larger than the file, you have to expand the file |
I don't think we need a special logic for windows. I don't see an issue. If you see an issue, then pls add a test to reproduce/prove it first. |
| // that is beyond the maximum size does not grow the db on Windows. | ||
| // In Windows, the file must be expanded to the mmap initial size. | ||
| // https://github.com/etcd-io/bbolt/issues/928 | ||
| func TestDB_MaxSizeExceededDoesNotGrow(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ahrtr I've updated this test to demonstrate the issue on Windows I was talking about. When you set InitialMmapSize to be greater than the actual size of the file, the file must be expanded to map it that way.
The assertion on line 1666 fails because newSize is exactly double expandedSize (or, exactly equal to InitialMmapSize)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see.
I think we need to disable InitialMmapSize for Windows; in other words, we don't use it for Windows.
Signed-off-by: Matthew Sainsbury <msainsbury@microsoft.com>
Signed-off-by: Matthew Sainsbury <msainsbury@microsoft.com>
Fixes #1108