From f8a11bda8bb2c6fa740a45075cbac03d730f559e Mon Sep 17 00:00:00 2001
From: Manish R Jain <manishrjain@gmail.com>
Date: Wed, 2 Mar 2016 16:52:37 +1100
Subject: [PATCH] Change flag names, and switch from Error log to debug log

---
 loader/loader.go      |  2 +-
 server/loader/main.go | 12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/loader/loader.go b/loader/loader.go
index aa46cd22..64fd1b66 100644
--- a/loader/loader.go
+++ b/loader/loader.go
@@ -165,7 +165,7 @@ func (s *state) getUidForString(str string) error {
 		if err == posting.E_TMP_ERROR {
 			time.Sleep(time.Microsecond)
 			glog.WithError(err).WithField("nq.Subject", str).
-				Error("Temporary error")
+				Debug("Temporary error")
 		} else {
 			glog.WithError(err).WithField("nq.Subject", str).
 				Error("While getting UID")
diff --git a/server/loader/main.go b/server/loader/main.go
index 3b5bc31f..63302a10 100644
--- a/server/loader/main.go
+++ b/server/loader/main.go
@@ -41,8 +41,9 @@ var instanceIdx = flag.Uint64("instanceIdx", 0,
 var numInstances = flag.Uint64("numInstances", 1,
 	"Total number of instances among which uid assigning is shared")
 var postingDir = flag.String("postings", "", "Directory to store posting lists")
-var uidDir = flag.String("uidDir", "", "Directory to read UID posting lists")
+var uidDir = flag.String("uids", "", "Directory to read UID posting lists")
 var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to file")
+var memprofile = flag.String("memprofile", "", "write memory profile to file")
 var numcpu = flag.Int("numCpu", runtime.NumCPU(),
 	"Number of cores to be used by the process")
 
@@ -108,4 +109,13 @@ func main() {
 	}
 	glog.Info("Calling merge lists")
 	posting.MergeLists(100 * numCpus) // 100 per core.
+
+	if len(*memprofile) > 0 {
+		f, err := os.Create(*memprofile)
+		if err != nil {
+			glog.Fatal(err)
+		}
+		pprof.WriteHeapProfile(f)
+		f.Close()
+	}
 }
-- 
GitLab