diff --git a/aof/rewrite.go b/aof/rewrite.go index ad073cd..78dd59d 100644 --- a/aof/rewrite.go +++ b/aof/rewrite.go @@ -151,7 +151,7 @@ func (handler *Handler) FinishRewrite(ctx *RewriteCtx) { } handler.aofFile = aofFile - // reset selected db 重新写入一次 select 指令保证 aof 中的数据库与 handler.currentDB 一致 + // write select command again to ensure aof file has the same db index with handler.currentDB data = protocol.MakeMultiBulkReply(utils.ToCmdLine("SELECT", strconv.Itoa(handler.currentDB))).ToBytes() _, err = handler.aofFile.Write(data) if err != nil { diff --git a/database/keys.go b/database/keys.go index 9146cd8..f36452c 100644 --- a/database/keys.go +++ b/database/keys.go @@ -294,7 +294,7 @@ func execKeys(db *DB, args [][]byte) redis.Reply { func toTTLCmd(db *DB, key string) *protocol.MultiBulkReply { raw, exists := db.ttlMap.Get(key) if !exists { - // 无 TTL + // has no TTL return protocol.MakeMultiBulkReply(utils.ToCmdLine("PERSIST", key)) } expireTime, _ := raw.(time.Time) diff --git a/database/replication.go b/database/replication.go index 3128ff1..72d7cfd 100644 --- a/database/replication.go +++ b/database/replication.go @@ -309,6 +309,7 @@ func (mdb *MultiDB) doPsync() error { } // there is no CRLF between RDB and following AOF, reset stream to avoid parser error mdb.replication.masterChan = parser.ParseStream(mdb.replication.masterConn) + // fixme: update aof file return nil }