Skip to content
Snippets Groups Projects
Commit 3e024bc9 authored by Ashwin's avatar Ashwin
Browse files

Added a seperate store for xid & uid in server

parent 2a5f0529
No related branches found
No related tags found
No related merge requests found
...@@ -103,7 +103,7 @@ func TestNewGraph(t *testing.T) { ...@@ -103,7 +103,7 @@ func TestNewGraph(t *testing.T) {
t.Error(err) t.Error(err)
} }
worker.Init(ps) worker.Init(ps, nil)
uo := flatbuffers.GetUOffsetT(sg.result) uo := flatbuffers.GetUOffsetT(sg.result)
r := new(task.Result) r := new(task.Result)
...@@ -134,7 +134,7 @@ func populateGraph(t *testing.T) (string, *store.Store) { ...@@ -134,7 +134,7 @@ func populateGraph(t *testing.T) (string, *store.Store) {
ps := new(store.Store) ps := new(store.Store)
ps.Init(dir) ps.Init(dir)
worker.Init(ps) worker.Init(ps, nil)
clog := commit.NewLogger(dir, "mutations", 50<<20) clog := commit.NewLogger(dir, "mutations", 50<<20)
clog.Init() clog.Init()
......
...@@ -38,10 +38,15 @@ import ( ...@@ -38,10 +38,15 @@ import (
var glog = x.Log("server") var glog = x.Log("server")
var postingDir = flag.String("postings", "", "Directory to store posting lists") var postingDir = flag.String("postings", "", "Directory to store posting lists")
var xiduidDir = flag.String("xiduid", "", "XID UID posting lists directory")
var mutationDir = flag.String("mutations", "", "Directory to store mutations") var mutationDir = flag.String("mutations", "", "Directory to store mutations")
var port = flag.String("port", "8080", "Port to run server on.") var port = flag.String("port", "8080", "Port to run server on.")
var numcpu = flag.Int("numCpu", runtime.NumCPU(), var numcpu = flag.Int("numCpu", runtime.NumCPU(),
"Number of cores to be used by the process") "Number of cores to be used by the process")
var instanceIdx = flag.Uint64("instanceIdx", 0,
"serves only entities whose Fingerprint % numInstance == instanceIdx.")
var numInstances = flag.Uint64("numInstances", 1,
"Total number of server instances")
func addCorsHeaders(w http.ResponseWriter) { func addCorsHeaders(w http.ResponseWriter) {
w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Origin", "*")
...@@ -140,7 +145,14 @@ func main() { ...@@ -140,7 +145,14 @@ func main() {
defer clog.Close() defer clog.Close()
posting.Init(clog) posting.Init(clog)
worker.Init(ps) if *instanceIdx == 0 {
xiduidStore := new(store.Store)
xiduidStore.Init(*xiduidDir)
defer xiduidStore.Close()
worker.Init(ps, xiduidStore) //Only server instance 0 will have xiduidStore
} else {
worker.Init(ps, nil)
}
worker.Connect() worker.Connect()
uid.Init(ps) uid.Init(ps)
......
...@@ -62,7 +62,7 @@ func prepare() (dir1, dir2 string, ps *store.Store, clog *commit.Logger, rerr er ...@@ -62,7 +62,7 @@ func prepare() (dir1, dir2 string, ps *store.Store, clog *commit.Logger, rerr er
clog.Init() clog.Init()
posting.Init(clog) posting.Init(clog)
worker.Init(ps) worker.Init(ps, nil)
uid.Init(ps) uid.Init(ps)
loader.Init(ps, ps) loader.Init(ps, ps)
......
...@@ -21,11 +21,12 @@ var workerPort = flag.String("workerport", ":12345", ...@@ -21,11 +21,12 @@ var workerPort = flag.String("workerport", ":12345",
"Port used by worker for internal communication.") "Port used by worker for internal communication.")
var glog = x.Log("worker") var glog = x.Log("worker")
var dataStore *store.Store var dataStore, xiduidStore *store.Store
var pools []*conn.Pool var pools []*conn.Pool
func Init(ps *store.Store) { func Init(ps, xuStore *store.Store) {
dataStore = ps dataStore = ps
xiduidStore = xuStore
} }
func Connect() { func Connect() {
......
...@@ -58,7 +58,7 @@ func TestProcessTask(t *testing.T) { ...@@ -58,7 +58,7 @@ func TestProcessTask(t *testing.T) {
defer clog.Close() defer clog.Close()
posting.Init(clog) posting.Init(clog)
Init(ps) Init(ps, nil)
edge := x.DirectedEdge{ edge := x.DirectedEdge{
ValueId: 23, ValueId: 23,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment