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 +}