From 00b5fb4b24359f0fa68e568e4773b99abee17b6a Mon Sep 17 00:00:00 2001 From: siddontang Date: Wed, 11 Jun 2014 14:52:34 +0800 Subject: [PATCH] a liitle change --- cmd/ledis-server/main.go | 2 +- ledis/replication.go | 2 ++ server/app.go | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/ledis-server/main.go b/cmd/ledis-server/main.go index 8a76984..8513559 100644 --- a/cmd/ledis-server/main.go +++ b/cmd/ledis-server/main.go @@ -9,7 +9,7 @@ import ( "syscall" ) -var configFile = flag.String("config", "", "ledisdb config file") +var configFile = flag.String("config", "/etc/ledis.json", "ledisdb config file") func main() { runtime.GOMAXPROCS(runtime.NumCPU()) diff --git a/ledis/replication.go b/ledis/replication.go index 7cfc75d..e19da6a 100644 --- a/ledis/replication.go +++ b/ledis/replication.go @@ -123,7 +123,9 @@ func (l *Ledis) ReplicateFromBinLog(filePath string) error { rb := bufio.NewReaderSize(f, 4096) + l.Lock() err = l.ReplicateFromReader(rb) + l.Unlock() f.Close() diff --git a/server/app.go b/server/app.go index 3b28e7d..a1ba7f4 100644 --- a/server/app.go +++ b/server/app.go @@ -90,3 +90,7 @@ func (app *App) Run() { newClient(conn, app) } } + +func (app *App) Ledis() *ledis.DB { + return app.ldb +}