-
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
Bulk loader allocates reserved predicates in first reduce shard. #4202
Conversation
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.
✅ A review job has been created and sent to the PullRequest network.
@martinmr you can click here to see the review status or cancel the code review job.
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.
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.
Just one minor comment on the raft id conditional. Rest are readability.
Reviewed with ❤️ by PullRequest
output was assumed to be sorted but that assumption is wrong. Fix is to explicitly sort.
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.
Reviewable status: 0 of 9 files reviewed, 6 unresolved discussions (waiting on @golangcibot and @pullrequest[bot])
dgraph/cmd/bulk/merge_shards.go, line 35 at r1 (raw file):
Previously, pullrequest[bot] wrote…
let's rename
mapShards
toshards
, andshardDirs
toreadShardDirs
. This will help us with readability and logging at line 52.
Done.
dgraph/cmd/bulk/merge_shards.go, line 52 at r1 (raw file):
Previously, pullrequest[bot] wrote…
this could print
fmt.Printf("Reduced MapShards %v to %s\n", shardDirs, reduceShard
so we can see what reduced to what
Output is this way because shards are not reduced all at once.
dgraph/cmd/bulk/run.go, line 199 at r2 (raw file):
Previously, golangcibot (Bot from GolangCI) wrote…
File is not
gofmt
-ed with-s
(fromgofmt
)x.Check2(f.WriteString(strconv.Itoa(i + 1)))
Done.
edgraph/server.go, line 106 at r1 (raw file):
Previously, pullrequest[bot] wrote…
You could also post the
contents
here to help more with debugging.
File might be long or contain special characters. Path to the file is already included so users could inspect the contents themselves.
worker/groups.go, line 100 at r1 (raw file):
Previously, pullrequest[bot] wrote…
Should this check be outside of the
x.WorkerConfig.RaftId == 0
check? ifRaftId
is already non-zero, then the groupId will not be 0.
This is the right place. The check is to prevent servers from using the group id in the file if they already have RAFT information of their own.
worker/groups.go, line 109 at r1 (raw file):
Previously, pullrequest[bot] wrote…
Let's add tests to ensure that the
ProposedGroupId
is propagated to theGroupId
field, and not if the raft id info exists.
Modified an existing test to check this PR works as expected.
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.
Reviewed it. But, please look at the comments and get it approved by @pawanrawal .
Reviewed 1 of 6 files at r1.
Reviewable status: 1 of 10 files reviewed, 10 unresolved discussions (waiting on @golangcibot, @manishrjain, @martinmr, and @pullrequest[bot])
edgraph/server.go, line 106 at r4 (raw file):
contents, err := ioutil.ReadFile(filepath.Join(Config.PostingDir, groupFile)) if err != nil { glog.Warningf("%s file not found or could not be opened", groupFile)
Dont' spit out anything.
edgraph/server.go, line 109 at r4 (raw file):
return }
message here. Info log. Found a group_id file. Attempting ...
edgraph/server.go, line 110 at r4 (raw file):
} groupId, err := strconv.ParseUint(strings.TrimSpace(string(contents)), 10, 32)
ParseUint(, 0, 32)
edgraph/server.go, line 111 at r4 (raw file):
groupId, err := strconv.ParseUint(strings.TrimSpace(string(contents)), 10, 32) x.Checkf(err, "Error reading %s file inside posting directory %s",
Don't check fail. Spit out an error and just say it is going to be ignored.
worker/groups.go, line 109 at r1 (raw file):
Previously, martinmr (Martin Martinez Rivera) wrote…
Modified an existing test to check this PR works as expected.
check multiple things here:
- If the group doesnt exist in Zero, do you get assigned to it.
- If the group is already over capacity, do you get assigned to it.
|
||
glog.Infof("Found group_id file inside posting directory %s. Will attempt to read.", | ||
Config.PostingDir) | ||
groupId, err := strconv.ParseUint(strings.TrimSpace(string(contents)), 0, 32) |
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.
ineffectual assignment to err
(from ineffassign
)
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.
Reviewable status: 1 of 13 files reviewed, 11 unresolved discussions (waiting on @golangcibot, @manishrjain, and @pullrequest[bot])
edgraph/server.go, line 106 at r4 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
Dont' spit out anything.
Done.
edgraph/server.go, line 109 at r4 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
message here. Info log. Found a group_id file. Attempting ...
Done.
edgraph/server.go, line 110 at r4 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
ParseUint(, 0, 32)
Done.
edgraph/server.go, line 111 at r4 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
Don't check fail. Spit out an error and just say it is going to be ignored.
Done.
edgraph/server.go, line 111 at r5 (raw file):
Previously, golangcibot (Bot from GolangCI) wrote…
ineffectual assignment to
err
(fromineffassign
)
Done.
worker/groups.go, line 109 at r1 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
check multiple things here:
- If the group doesnt exist in Zero, do you get assigned to it.
- If the group is already over capacity, do you get assigned to it.
- If the group doesn't exist, Zero proposes creating the group with the alpha as its first member. This is the behavior we want.
- If the group is over capacity, it will be assigned to another group with capacity. I have changed the behavior to force the alpha in the group if the group id comes from the file.
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 am assuming that you have verified the fix on the original data set mentioned in the issue? I have some comments, please address them and then this should be good to go.
Reviewed 2 of 6 files at r1, 2 of 4 files at r2, 3 of 4 files at r4, 1 of 2 files at r5, 5 of 5 files at r6.
Reviewable status: all files reviewed, 14 unresolved discussions (waiting on @golangcibot, @manishrjain, @martinmr, and @pullrequest[bot])
dgraph/cmd/bulk/merge_shards.go, line 37 at r6 (raw file):
shardDirs := readShardDirs(filepath.Join(opt.TmpDir, mapShardDir)) // First shard is handled differently because it contains reserved predicates. firstShard := shardDirs[0]
Are we sure, we'll have atleast one element in the slice always?
protos/pb.proto, line 133 at r6 (raw file):
bool cluster_info_only = 13; bool force_group_id = 14;
The indentation is messed up.
worker/groups.go, line 110 at r6 (raw file):
// Connect with Zero leader and figure out what group we should belong to. m := &pb.Member{Id: x.WorkerConfig.RaftId, GroupId: x.WorkerConfig.ProposedGroupId, Addr: x.WorkerConfig.MyAddr, ForceGroupId: true}
Shouldn't ForceGroupId
only be true if ProposedGroupId
> 0? What happens if a alpha node restarts, we would send GroupId
as 0 (we should be sending the actual group id in that case) and ForceGroupId
as true. Doesn't that cause issues?
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.
Reviewable status: 10 of 13 files reviewed, 14 unresolved discussions (waiting on @golangcibot, @manishrjain, @pawanrawal, and @pullrequest[bot])
dgraph/cmd/bulk/merge_shards.go, line 37 at r6 (raw file):
Previously, pawanrawal (Pawan Rawal) wrote…
Are we sure, we'll have atleast one element in the slice always?
Yes, there should be at least one map shard to be merged into the reduced shards. I added an assert just in case.
protos/pb.proto, line 133 at r6 (raw file):
Previously, pawanrawal (Pawan Rawal) wrote…
The indentation is messed up.
Done.
worker/groups.go, line 110 at r6 (raw file):
Previously, pawanrawal (Pawan Rawal) wrote…
Shouldn't
ForceGroupId
only be true ifProposedGroupId
> 0? What happens if a alpha node restarts, we would sendGroupId
as 0 (we should be sending the actual group id in that case) andForceGroupId
as true. Doesn't that cause issues?
It's fine right now because the field is only used if the group ID is > 0. But I am following your suggestion just for more robustness.
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 didn't use the original data set. It doesn't really matter. The issue happens because of the presence of dgraph.type
predicates. I used the 21 million dataset to test this, which contains a lot of those predicates.
Reviewable status: 10 of 13 files reviewed, 14 unresolved discussions (waiting on @golangcibot, @manishrjain, @pawanrawal, and @pullrequest[bot])
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.
Reviewed 3 of 3 files at r7.
Reviewable status: all files reviewed, 14 unresolved discussions (waiting on @golangcibot, @manishrjain, @pawanrawal, and @pullrequest[bot])
This PR contains a couple of related changes.
also writes a file in the posting directories with the proposed group ID for
each shard.
ID from zero.
The change is being tested by modifying the 21million test to use multiple groups
and add a new query to verify the number of nodes with a
dgraph.type
predicate.If the test runs without the fix, dgraph.type sometime ends up in a different group.
Fixes #3968.
This change is