From 82562abc3c7630ed98a63b2113d5b0b60ed19ada Mon Sep 17 00:00:00 2001 From: Benjamin Wang Date: Fri, 19 Jan 2024 15:29:37 +0000 Subject: [PATCH] Fix test issue in TestScheduleCompaction It always reuse the same memory space. Each next iteration will always overwrite previous data Signed-off-by: Benjamin Wang --- server/storage/mvcc/kvstore_compaction_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/storage/mvcc/kvstore_compaction_test.go b/server/storage/mvcc/kvstore_compaction_test.go index fdab56b419b..8e98dae3bb9 100644 --- a/server/storage/mvcc/kvstore_compaction_test.go +++ b/server/storage/mvcc/kvstore_compaction_test.go @@ -76,8 +76,8 @@ func TestScheduleCompaction(t *testing.T) { tx := s.b.BatchTx() tx.Lock() - ibytes := NewRevBytes() for _, rev := range revs { + ibytes := NewRevBytes() ibytes = RevToBytes(rev, ibytes) tx.UnsafePut(schema.Key, ibytes, []byte("bar")) } @@ -90,6 +90,7 @@ func TestScheduleCompaction(t *testing.T) { tx.Lock() for _, rev := range tt.wrevs { + ibytes := NewRevBytes() ibytes = RevToBytes(rev, ibytes) keys, _ := tx.UnsafeRange(schema.Key, ibytes, nil, 0) if len(keys) != 1 {