From 443bba798247799e6a51d01ae9679d6730f5bd59 Mon Sep 17 00:00:00 2001
From: Pawan Rawal <pawan@dgraph.io>
Date: Mon, 30 May 2016 08:17:08 +0530
Subject: [PATCH] Adding check for existence of mutations directory in
 commit/log.go.

---
 commit/log.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/commit/log.go b/commit/log.go
index 6311bbe3..6fec71e6 100644
--- a/commit/log.go
+++ b/commit/log.go
@@ -282,6 +282,12 @@ func (l *Logger) Init() {
 
 	glog.Debug("Logger init started.")
 	{
+		// Checking if the directory exists.
+		if _, err := os.Stat(l.dir); err != nil {
+			if os.IsNotExist(err) {
+				glog.WithError(err).Fatal("Unable to find dir.")
+			}
+		}
 		// First check if we have a current file.
 		path := filepath.Join(l.dir, fmt.Sprintf("%s-current.log", l.filePrefix))
 		fi, err := os.Stat(path)
-- 
GitLab