replication add log

This commit is contained in:
siddontang 2014-10-09 11:47:14 +08:00
parent 137bd19951
commit 884de89cb8
1 changed files with 5 additions and 2 deletions

View File

@ -287,7 +287,10 @@ func (app *App) removeSlave(c *client) {
app.slock.Lock() app.slock.Lock()
defer app.slock.Unlock() defer app.slock.Unlock()
if _, ok := app.slaves[c]; ok {
delete(app.slaves, c) delete(app.slaves, c)
log.Info("remove slave %s", c.remoteAddr)
}
if c.ack != nil { if c.ack != nil {
asyncNotifyUint64(c.ack.ch, c.lastLogID) asyncNotifyUint64(c.ack.ch, c.lastLogID)
@ -313,7 +316,7 @@ func (app *App) publishNewLog(l *rpl.Log) {
logId := l.ID logId := l.ID
for s, _ := range app.slaves { for s, _ := range app.slaves {
if s.lastLogID >= logId { if s.lastLogID >= logId {
//slave has already this log //slave has already owned this log
ss = []*client{} ss = []*client{}
break break
} else { } else {