@@ -28,10 +28,12 @@ import (
28
28
"github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
29
29
"github.com/cockroachdb/cockroach/pkg/sql/types"
30
30
"github.com/cockroachdb/cockroach/pkg/storage"
31
+ "github.com/cockroachdb/cockroach/pkg/util/cancelchecker"
31
32
"github.com/cockroachdb/cockroach/pkg/util/encoding"
32
33
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
33
34
"github.com/cockroachdb/cockroach/pkg/util/mon"
34
35
"github.com/cockroachdb/cockroach/pkg/util/randutil"
36
+ utilsort "github.com/cockroachdb/cockroach/pkg/util/sort"
35
37
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
36
38
"github.com/cockroachdb/errors"
37
39
"github.com/stretchr/testify/require"
@@ -572,7 +574,7 @@ func TestDiskBackedIndexedRowContainer(t *testing.T) {
572
574
}
573
575
574
576
sorter := rowsSorter {evalCtx : & evalCtx , rows : sortedRows , ordering : ordering }
575
- sort . Sort (& sorter )
577
+ utilSort (& sorter , ctx )
576
578
if sorter .err != nil {
577
579
t .Fatal (sorter .err )
578
580
}
@@ -667,7 +669,7 @@ func TestDiskBackedIndexedRowContainer(t *testing.T) {
667
669
defer diskMonitor .Stop (ctx )
668
670
669
671
sorter := rowsSorter {evalCtx : & evalCtx , rows : sortedRows , ordering : ordering }
670
- sort . Sort (& sorter )
672
+ utilSort (& sorter , ctx )
671
673
if sorter .err != nil {
672
674
t .Fatal (sorter .err )
673
675
}
@@ -810,6 +812,17 @@ func TestDiskBackedIndexedRowContainer(t *testing.T) {
810
812
})
811
813
}
812
814
815
+ // Rows are sorted using an in-tree sort implementation that is the Go standard
816
+ // library's sort with cancellation checking added. Go 1.19 introduced a new
817
+ // sort algorithm which is also an unstable sort, but in a different way. It seems
818
+ // like a bad choice to change the sorting algorithm in v22.1.x, so we instead
819
+ // make the test use the same in-tree sort implementation.
820
+ func utilSort (data sort.Interface , ctx context.Context ) {
821
+ var cancelChecker cancelchecker.CancelChecker
822
+ cancelChecker .Reset (ctx )
823
+ utilsort .Sort (data , & cancelChecker )
824
+ }
825
+
813
826
// indexedRows are rows with the corresponding indices.
814
827
type indexedRows struct {
815
828
rows []IndexedRow
0 commit comments