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

fix: Don't allow idx flag to be set to 0 on dgraph zero #6156

Merged
merged 2 commits into from
Aug 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion dgraph/cmd/zero/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ instances to achieve high-availability.
"addr:port of this server, so other Dgraph alphas can talk to this.")
flag.IntP("port_offset", "o", 0,
"Value added to all listening port numbers. [Grpc=5080, HTTP=6080]")
flag.Uint64("idx", 1, "Unique node index for this server.")
flag.Uint64("idx", 1, "Unique node index for this server. idx cannot be 0.")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

flag.Int("replicas", 1, "How many replicas to run per data shard."+
" The count includes the original shard.")
flag.String("peer", "", "Address of another dgraphzero server.")
Expand Down Expand Up @@ -186,6 +186,10 @@ func run() {
}
glog.Infof("Setting Config to: %+v", opts)

if opts.nodeId == 0 {
log.Fatalf("ERROR: Cannot idx flag cannot be 0. Please try again with idx as a positive integer")
}

x.WorkerConfig = x.WorkerOptions{
LudicrousMode: Zero.Conf.GetBool("ludicrous_mode"),
}
Expand Down