Skip to content
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

Merged
merged 4 commits into from
May 14, 2019

Conversation

martinmr
Copy link
Contributor

@martinmr martinmr commented May 14, 2019

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 Reviewable

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.
@martinmr martinmr requested review from manishrjain and a team as code owners May 14, 2019 01:35
Copy link
Contributor

@manishrjain manishrjain left a 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

@martinmr martinmr requested a review from manishrjain May 14, 2019 02:07
Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: 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.

@martinmr martinmr merged commit 69d9403 into master May 14, 2019
@martinmr martinmr deleted the martinmr/batch-entry-retrieval branch May 14, 2019 02:19
martinmr added a commit that referenced this pull request May 14, 2019
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.
manishrjain pushed a commit that referenced this pull request May 14, 2019
)

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.
dna2github pushed a commit to dna2fork/dgraph that referenced this pull request Jul 19, 2019
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants