diff --git a/cmd/dgraph/main.go b/cmd/dgraph/main.go index 0cb0a586577..757c5cfe518 100644 --- a/cmd/dgraph/main.go +++ b/cmd/dgraph/main.go @@ -44,6 +44,7 @@ import ( "github.com/dgraph-io/dgraph/uid" "github.com/dgraph-io/dgraph/worker" "github.com/dgraph-io/dgraph/x" + "os" ) var postingDir = flag.String("postings", "", "Directory to store posting lists") @@ -319,6 +320,20 @@ func main() { if *port%2 != 0 { log.Fatalf("Port should be an even number: %v", *port) } + // Create parent directories for postings, uids and mutations + var err error + err = os.MkdirAll(*postingDir, 0700) + if err != nil { + log.Fatal("Error while creating the filepath for postings: %v", err) + } + err = os.MkdirAll(*mutationDir, 0700) + if err != nil { + log.Fatal("Error while creating the filepath for mutations: %v", err) + } + err = os.MkdirAll(*uidDir, 0700) + if err != nil { + log.Fatal("Error while creating the filepath for uids: %v", err) + } ps := new(store.Store) ps.Init(*postingDir) @@ -337,6 +352,7 @@ func main() { } posting.Init(clog) + if *instanceIdx != 0 { worker.Init(ps, nil, *instanceIdx, lenAddr) uid.Init(nil)