undoing f92ab131e4
we now guarantee bytes were copied earlier in the chain the kv store is NOT responsible for making an additional copy closes #181
This commit is contained in:
parent
443c0252e0
commit
dd921d31e3
|
@ -163,7 +163,7 @@ func (w *Writer) Close() error {
|
|||
|
||||
func (w *Writer) Set(k, v []byte) (err error) {
|
||||
w.s.m.Lock()
|
||||
w.s.t = w.s.t.Upsert(&Item{k: k, v: append([]byte(nil), v...)}, rand.Int())
|
||||
w.s.t = w.s.t.Upsert(&Item{k: k, v: v}, rand.Int())
|
||||
w.s.m.Unlock()
|
||||
|
||||
return nil
|
||||
|
@ -283,7 +283,7 @@ func (w *Iterator) Close() error {
|
|||
}
|
||||
|
||||
func (w *Batch) Set(k, v []byte) {
|
||||
w.items = append(w.items, &Item{k, append([]byte(nil), v...)})
|
||||
w.items = append(w.items, &Item{k, v})
|
||||
}
|
||||
|
||||
func (w *Batch) Delete(k []byte) {
|
||||
|
|
|
@ -167,7 +167,6 @@ func CommonTestReaderIsolation(t *testing.T, s store.KVStore) {
|
|||
t.Fatal(err)
|
||||
}
|
||||
writer.Close()
|
||||
valB[0] = 'X' // Modify the bytes so we check that writer got its own copy.
|
||||
|
||||
// ensure that a newer reader sees it
|
||||
newReader, err := s.Reader()
|
||||
|
@ -180,7 +179,7 @@ func CommonTestReaderIsolation(t *testing.T, s store.KVStore) {
|
|||
t.Error(err)
|
||||
}
|
||||
if !reflect.DeepEqual(val, []byte("val-b")) {
|
||||
t.Errorf("expected val-b, got nil")
|
||||
t.Errorf("expected val-b, got %s", val)
|
||||
}
|
||||
|
||||
// ensure that the director iterator sees it
|
||||
|
|
Loading…
Reference in New Issue
Block a user