fix: string.go execSetBit did not record aof log

This commit is contained in:
Allen
2023-03-07 19:25:20 +08:00
committed by finley
parent 0e6d1ecf2e
commit 382fabb538

View File

@@ -1,6 +1,11 @@
package database package database
import ( import (
"math/bits"
"strconv"
"strings"
"time"
"github.com/hdt3213/godis/aof" "github.com/hdt3213/godis/aof"
"github.com/hdt3213/godis/datastruct/bitmap" "github.com/hdt3213/godis/datastruct/bitmap"
"github.com/hdt3213/godis/interface/database" "github.com/hdt3213/godis/interface/database"
@@ -8,10 +13,6 @@ import (
"github.com/hdt3213/godis/lib/utils" "github.com/hdt3213/godis/lib/utils"
"github.com/hdt3213/godis/redis/protocol" "github.com/hdt3213/godis/redis/protocol"
"github.com/shopspring/decimal" "github.com/shopspring/decimal"
"math/bits"
"strconv"
"strings"
"time"
) )
func (db *DB) getAsString(key string) ([]byte, protocol.ErrorReply) { func (db *DB) getAsString(key string) ([]byte, protocol.ErrorReply) {
@@ -676,6 +677,7 @@ func execSetBit(db *DB, args [][]byte) redis.Reply {
former := bm.GetBit(offset) former := bm.GetBit(offset)
bm.SetBit(offset, v) bm.SetBit(offset, v)
db.PutEntity(key, &database.DataEntity{Data: bm.ToBytes()}) db.PutEntity(key, &database.DataEntity{Data: bm.ToBytes()})
db.addAof(utils.ToCmdLine3("setBit", args...))
return protocol.MakeIntReply(int64(former)) return protocol.MakeIntReply(int64(former))
} }