Skip to content

Commit f180344

Browse files
committed
Fix wording and check for negative number of replicas.
1 parent 8692564 commit f180344

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

dgraph/cmd/zero/run.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,11 @@ func run() {
141141
rebalanceInterval: Zero.Conf.GetDuration("rebalance_interval"),
142142
}
143143

144-
if opts.numReplicas % 2 == 0 {
145-
log.Fatalf("Invalid flag value --replicas=%d - number of replicas cannot be divisible by 2", opts.numReplicas)
144+
if opts.numReplicas < 0 || opts.numReplicas%2 == 0 {
145+
log.Fatalf("ERROR: Number of replicas must be odd for consensus. Found: %d",
146+
opts.numReplicas)
146147
}
147-
148+
148149
if Zero.Conf.GetBool("expose_trace") {
149150
trace.AuthRequest = func(req *http.Request) (any, sensitive bool) {
150151
return true, true

0 commit comments

Comments
 (0)