mvcc/backend: correct RLock in test

Should use RLock instead of Lock.
release-3.4
Jingyi Hu 2019-06-11 16:24:44 -07:00
parent 833620b864
commit b873fbd127
1 changed files with 4 additions and 4 deletions

View File

@ -241,9 +241,9 @@ func TestBackendWriteback(t *testing.T) {
}
rtx := b.ReadTx()
for i, tt := range keys {
rtx.Lock()
rtx.RLock()
k, v := rtx.UnsafeRange([]byte("key"), tt.key, tt.end, tt.limit)
rtx.Unlock()
rtx.RUnlock()
if !reflect.DeepEqual(tt.wkey, k) || !reflect.DeepEqual(tt.wval, v) {
t.Errorf("#%d: want k=%+v, v=%+v; got k=%+v, v=%+v", i, tt.wkey, tt.wval, k, v)
}
@ -282,9 +282,9 @@ func TestBackendWritebackForEach(t *testing.T) {
return nil
}
rtx := b.ReadTx()
rtx.Lock()
rtx.RLock()
rtx.UnsafeForEach([]byte("key"), getSeq)
rtx.Unlock()
rtx.RUnlock()
partialSeq := seq