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 committed Aug 10, 2018
1 parent 8692564 commit f180344
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 f180344

Please sign in to comment.