From 113a4aed52a246a5ae24fb00eff8195d7223f4a0 Mon Sep 17 00:00:00 2001 From: Rahul Gurnani Date: Fri, 14 Aug 2020 10:04:11 +0530 Subject: [PATCH] fix: Don't allow idx flag to be set to 0 on dgraph zero (#6156) * Fix DGRAPH-2185 * Update the help message for idx flag in dgraph zero --- dgraph/cmd/zero/run.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dgraph/cmd/zero/run.go b/dgraph/cmd/zero/run.go index 54b5f990e83..4c59eb28fa5 100644 --- a/dgraph/cmd/zero/run.go +++ b/dgraph/cmd/zero/run.go @@ -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.") 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.") @@ -185,6 +185,10 @@ func run() { LudicrousMode: Zero.Conf.GetBool("ludicrous_mode"), } + 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"), }