From c0fa4a9c099cffc4cf1392333eb1284b5078a084 Mon Sep 17 00:00:00 2001 From: Jackson Owens Date: Wed, 25 Sep 2024 15:41:37 -0400 Subject: [PATCH] sstable: populate CompareSuffixes on test4bSuffixComparer Previously, the test4bSuffixComparer test comparer wasn't setting CompareSuffixes. Update the comparer to simply copy the default comparer override Split and Name. --- sstable/suffix_rewriter_test.go | 13 +++++++++++++ sstable/writer_test.go | 14 -------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/sstable/suffix_rewriter_test.go b/sstable/suffix_rewriter_test.go index f94e9c6e87..be3c184ea0 100644 --- a/sstable/suffix_rewriter_test.go +++ b/sstable/suffix_rewriter_test.go @@ -240,3 +240,16 @@ func BenchmarkRewriteSST(b *testing.B) { }) } } + +var test4bSuffixComparer = func() *base.Comparer { + c := new(base.Comparer) + *c = *base.DefaultComparer + c.Split = func(key []byte) int { + if len(key) > 4 { + return len(key) - 4 + } + return len(key) + } + c.Name = "comparer-split-4b-suffix" + return c +}() diff --git a/sstable/writer_test.go b/sstable/writer_test.go index dfdf4f044f..53c8e18737 100644 --- a/sstable/writer_test.go +++ b/sstable/writer_test.go @@ -1200,17 +1200,3 @@ func runWriterBench(b *testing.B, keys [][]byte, comparer *base.Comparer, format }) } } - -var test4bSuffixComparer = &base.Comparer{ - Compare: base.DefaultComparer.Compare, - Equal: base.DefaultComparer.Equal, - Separator: base.DefaultComparer.Separator, - Successor: base.DefaultComparer.Successor, - Split: func(key []byte) int { - if len(key) > 4 { - return len(key) - 4 - } - return len(key) - }, - Name: "comparer-split-4b-suffix", -}