refactor flush db

This commit is contained in:
finley
2022-07-11 22:42:17 +08:00
parent 461d1a7a3f
commit ab0754e2a5
6 changed files with 82 additions and 73 deletions

View File

@@ -8,17 +8,20 @@ import (
"github.com/hdt3213/godis/redis/connection"
"github.com/hdt3213/godis/redis/protocol"
"github.com/hdt3213/godis/redis/protocol/asserts"
"sync/atomic"
"testing"
"time"
)
func TestReplication(t *testing.T) {
mdb := &MultiDB{}
mdb.dbSet = make([]*DB, 16)
mdb.dbSet = make([]*atomic.Value, 16)
for i := range mdb.dbSet {
singleDB := makeDB()
singleDB.index = i
mdb.dbSet[i] = singleDB
holder := &atomic.Value{}
holder.Store(singleDB)
mdb.dbSet[i] = holder
}
mdb.replication = initReplStatus()
masterCli, err := client.MakeClient("127.0.0.1:6379")