Skip to content

Optimize uid allocation in live loader.#5132

Merged
martinmr merged 1 commit intomasterfrom
martinmr/optimize-uid-alloc
Apr 9, 2020
Merged

Optimize uid allocation in live loader.#5132
martinmr merged 1 commit intomasterfrom
martinmr/optimize-uid-alloc

Conversation

@martinmr
Copy link
Copy Markdown
Contributor

@martinmr martinmr commented Apr 7, 2020

The live loader is having trouble loading exported data with the
existing uids because there are too many requests for new uids.
The current version requests new Uids to be allocated for every
uids greater than the maximum. In the exported data, the uids can come
in increasing order, which causes a new request for uids with every
NQuad.

This PR changes the code to pre-allocate the uids, once per batch of
NQuad received from the NQuad buffer channel.

Tested it with the 1 million movie data set and now I am getting times
similar to the live loader with the --new_uids option enabled.

Fixes #4996


This change is Reviewable

The live loader is having trouble loading exported data with the
existing uids because there are too many requests for new uids.
The current version requests new Uids to be allocated for every
uids greater than the maximum. In the exported data, the uids can come
in increasing order, which causes a new request for uids with every
NQuad.

This PR changes the code to pre-allocate the uids, once per batch of
NQuad received from the NQuad buffer channel.

Tested it with the 1 million movie data set and now I am getting times
similar to the live loader with the --new_uids option enabled.

Fixes #4996
@martinmr martinmr requested a review from manishrjain as a code owner April 7, 2020 21:31
@martinmr martinmr requested a review from a team April 7, 2020 21:31
Copy link
Copy Markdown
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:

Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @martinmr)


dgraph/cmd/live/run.go, line 233 at r1 (raw file):

		}

		oUid, err := strconv.ParseUint(nq.ObjectId, 0, 64)

And here.

Copy link
Copy Markdown
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.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@martinmr martinmr merged commit dac00bd into master Apr 9, 2020
@martinmr martinmr deleted the martinmr/optimize-uid-alloc branch April 9, 2020 18:02
martinmr added a commit that referenced this pull request Apr 9, 2020
The live loader is having trouble loading exported data with the
existing uids because there are too many requests for new uids.
The current version requests new Uids to be allocated for every
uids greater than the maximum. In the exported data, the uids can come
in increasing order, which causes a new request for uids with every
NQuad.

This PR changes the code to pre-allocate the uids, once per batch of
NQuad received from the NQuad buffer channel.

Tested it with the 1 million movie data set and now I am getting times
similar to the live loader with the --new_uids option enabled.

Fixes #4996
dna2github pushed a commit to dna2fork/dgraph that referenced this pull request Jul 18, 2020
The live loader is having trouble loading exported data with the
existing uids because there are too many requests for new uids.
The current version requests new Uids to be allocated for every
uids greater than the maximum. In the exported data, the uids can come
in increasing order, which causes a new request for uids with every
NQuad.

This PR changes the code to pre-allocate the uids, once per batch of
NQuad received from the NQuad buffer channel.

Tested it with the 1 million movie data set and now I am getting times
similar to the live loader with the --new_uids option enabled.

Fixes dgraph-io#4996
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.

Bug when importing dataset exported previously (--new_uids flag fix this issue).

2 participants