diff --git a/ledis/batch.go b/ledis/batch.go index 526b4b6..b0d04b9 100644 --- a/ledis/batch.go +++ b/ledis/batch.go @@ -18,7 +18,7 @@ type batch struct { } func (b *batch) Commit() error { - if b.l.IsReadOnly() { + if b.l.cfg.GetReadonly() { return ErrWriteInROnly } @@ -104,6 +104,10 @@ func (l *Ledis) handleCommit(g commitDataGetter, c commiter) error { var err error if l.r != nil { + if b, _ := l.r.CommitIDBehind(); b { + return ErrWriteInROnly + } + var rl *rpl.Log if rl, err = l.r.Log(g.Data()); err != nil { log.Fatal("write wal error %s", err.Error())