-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
When calculating a snapshot, retrieve entries in batches. #3409
Conversation
Calculating a snapshot can lead to an OOM issue since the entries might not be able to fit into memory. This PR changes to logic to instead retrieve the entries in batches of 64MB.
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.
Nice. Got a few comments.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @manishrjain and @martinmr)
worker/draft.go, line 1255 at r1 (raw file):
batchSize = 64 * (1 << 20) batchFirst := first for batchFirst < last+1 {
for first <= last {
}
worker/draft.go, line 1256 at r1 (raw file):
batchFirst := first for batchFirst < last+1 { entries, err := n.Store.Entries(batchFirst, last+1, batchSize)
s/batchSize/64<<20
s/batchFirst/first
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.
One comment. Address that and merge.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @manishrjain and @martinmr)
worker/draft.go, line 1301 at r2 (raw file):
// It is possible that there are no pending transactions. In that case, // snapshotIdx would be zero. if foundEntries {
No need for this var.
Calculating a snapshot can lead to an OOM issue since the entries might not be able to fit into memory. This PR changes to logic to instead retrieve the entries in batches of 64MB.
…3409) Calculating a snapshot can lead to an OOM issue since the entries might not be able to fit into memory. This PR changes to logic to instead retrieve the entries in batches of 64MB.
Calculating a snapshot can lead to an OOM issue since the entries might
not be able to fit into memory. This PR changes to logic to instead
retrieve the entries in batches of 64MB.
This change is