mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-03 16:06:38 +08:00
bug fix: FlushDB command is not recorded by AOF (#142)
* bug fix: FlushDB command is not recorded by AOF * bug fix: Fix an error occurred while rewriting aof rename, windows.ERROR_SHARING_VIOLATION * bug fix: Fix an error occurred while rewriting aof rename, windows.ERROR_SHARING_VIOLATION * change the flushDB procedures * The savecmdline flushdb in the method is incorrectly selected, causing the testof error
This commit is contained in:
@@ -142,7 +142,7 @@ func (server *Server) Exec(c redis.Connection, cmdLine [][]byte) (result redis.R
|
||||
if c.InMultiState() {
|
||||
return protocol.MakeErrReply("ERR command 'FlushDB' cannot be used in MULTI")
|
||||
}
|
||||
return server.flushDB(c.GetDBIndex())
|
||||
return server.execFlushDB(c.GetDBIndex())
|
||||
} else if cmdName == "save" {
|
||||
return SaveRDB(server, cmdLine[1:])
|
||||
} else if cmdName == "bgsave" {
|
||||
@@ -203,6 +203,13 @@ func execSelect(c redis.Connection, mdb *Server, args [][]byte) redis.Reply {
|
||||
return protocol.MakeOkReply()
|
||||
}
|
||||
|
||||
func (server *Server) execFlushDB(dbIndex int) redis.Reply {
|
||||
if server.persister != nil {
|
||||
server.persister.SaveCmdLine(dbIndex, utils.ToCmdLine("FlushDB"))
|
||||
}
|
||||
return server.flushDB(dbIndex)
|
||||
}
|
||||
|
||||
func (server *Server) flushDB(dbIndex int) redis.Reply {
|
||||
if dbIndex >= len(server.dbSet) || dbIndex < 0 {
|
||||
return protocol.MakeErrReply("ERR DB index is out of range")
|
||||
|
Reference in New Issue
Block a user