Skip to content

Commit

Permalink
Fix wording and check for negative number of replicas.
Browse files Browse the repository at this point in the history
  • Loading branch information
manishrjain authored and dna2github committed Jul 19, 2019
1 parent e612b65 commit 9957e22
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dgraph/cmd/zero/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ func run() {
rebalanceInterval: Zero.Conf.GetDuration("rebalance_interval"),
}

if opts.numReplicas % 2 == 0 {
log.Fatalf("Invalid flag value --replicas=%d - number of replicas cannot be divisible by 2", opts.numReplicas)
if opts.numReplicas < 0 || opts.numReplicas%2 == 0 {
log.Fatalf("ERROR: Number of replicas must be odd for consensus. Found: %d",
opts.numReplicas)
}

if Zero.Conf.GetBool("expose_trace") {
trace.AuthRequest = func(req *http.Request) (any, sensitive bool) {
return true, true
Expand Down

0 comments on commit 9957e22

Please sign in to comment.