Skip to content

Commit 8841f32

Browse files
committed
sql, kv revert btree uses to older version
Pebble recently started using `github.com/google/btree`. A recent Pebble bump caused a bump of this dependency. This bump causes a regression in terms of allocations. This PR is a temporary fix: we change the current uses to a fork at the old version. Separately we will look at switching each use to use the newer `btree` that uses generics instead of interfaces. Fixes: #144488 Informs: #144504 Release note: None
1 parent 647a27c commit 8841f32

File tree

34 files changed

+47
-33
lines changed

34 files changed

+47
-33
lines changed

DEPS.bzl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7972,6 +7972,16 @@ def go_deps():
79727972
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/RaduBerinde/axisds/com_github_raduberinde_axisds-v0.0.0-20250405232732-ecb85bedf677.zip",
79737973
],
79747974
)
7975+
go_repository(
7976+
name = "com_github_raduberinde_btree",
7977+
build_file_proto_mode = "disable_global",
7978+
importpath = "github.com/RaduBerinde/btree",
7979+
sha256 = "1c845dc6e77f27888fa66c8521df4d1d30f3ccf6892e8c1ba0aab4db24e717c1",
7980+
strip_prefix = "github.com/RaduBerinde/[email protected]",
7981+
urls = [
7982+
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/RaduBerinde/btree/com_github_raduberinde_btree-v1.0.2-0.20250415192849-8beea01764ce.zip",
7983+
],
7984+
)
79757985
go_repository(
79767986
name = "com_github_rcrowley_go_metrics",
79777987
build_file_proto_mode = "disable_global",

build/bazelutil/distdir_files.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ DISTDIR_FILES = {
206206
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/PuerkitoBio/purell/com_github_puerkitobio_purell-v1.1.1.zip": "59e636760d7f2ab41c2f80c1784b1c73d381d44888d1999228dedd634ddcf5ed",
207207
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/PuerkitoBio/urlesc/com_github_puerkitobio_urlesc-v0.0.0-20170810143723-de5bf2ad4578.zip": "1793124273dd94e7089e95716d40529bcf70b9e87162d60218f68dde4d6aeb9d",
208208
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/RaduBerinde/axisds/com_github_raduberinde_axisds-v0.0.0-20250405232732-ecb85bedf677.zip": "53a2821f7d7cc76e91278e457d5f58bc5a856c7968d4170435dac86f2d003a87",
209+
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/RaduBerinde/btree/com_github_raduberinde_btree-v1.0.2-0.20250415192849-8beea01764ce.zip": "1c845dc6e77f27888fa66c8521df4d1d30f3ccf6892e8c1ba0aab4db24e717c1",
209210
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/SAP/go-hdb/com_github_sap_go_hdb-v0.14.1.zip": "273de28a254c39e9f24293b864c1d664488e4a5d44d535755a5e5b68ae7eed8d",
210211
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/Shopify/goreferrer/com_github_shopify_goreferrer-v0.0.0-20220729165902-8cddb4f5de06.zip": "280a2f55812e8b475cfd9d467a3b3d5859315788e68592a8fc5d6cedadc0503f",
211212
"https://storage.googleapis.com/cockroach-godeps/gomod/github.com/Shopify/logrus-bugsnag/com_github_shopify_logrus_bugsnag-v0.0.0-20171204204709-577dee27f20d.zip": "a4cc3fa4b7b493b36b96ea035caa7afcf7307b0c4efc5e523a46597e171b95ce",

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ require (
3434
github.com/golang/mock v1.6.0
3535
github.com/golang/protobuf v1.5.4
3636
github.com/golang/snappy v0.0.5-0.20231225225746-43d5d4cd4e0e
37-
github.com/google/btree v1.1.3
37+
github.com/google/btree v1.1.3 // indirect
3838
github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7
3939
github.com/google/uuid v1.6.0 // indirect
4040
google.golang.org/api v0.114.0
@@ -103,6 +103,7 @@ require (
103103
github.com/MichaelTJones/walk v0.0.0-20161122175330-4748e29d5718
104104
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46
105105
github.com/PuerkitoBio/goquery v1.5.1
106+
github.com/RaduBerinde/btree v1.0.2-0.20250415192849-8beea01764ce
106107
github.com/VividCortex/ewma v1.1.1
107108
github.com/alessio/shellescape v1.4.1
108109
github.com/andy-kimball/arenaskl v0.0.0-20200617143215-f701008588b9

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,8 @@ github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdko
264264
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
265265
github.com/RaduBerinde/axisds v0.0.0-20250405232732-ecb85bedf677 h1:NofOMIO/Z3301wDc9gIM/M0/+YjvOYSvUe7+30bkxkA=
266266
github.com/RaduBerinde/axisds v0.0.0-20250405232732-ecb85bedf677/go.mod h1:YO26VdZg1RVVjEhjmeEJE/4bLnD2mowj5eDiZQSLtlE=
267+
github.com/RaduBerinde/btree v1.0.2-0.20250415192849-8beea01764ce h1:jmg1o6EkSTLFQ4vdTBzob5AjFBzNH4ELn56iKhMVk48=
268+
github.com/RaduBerinde/btree v1.0.2-0.20250415192849-8beea01764ce/go.mod h1:1+GykKoq3bIUWDVjNWWxWYblBduYahx5NGepZjgYqvI=
267269
github.com/SAP/go-hdb v0.14.1/go.mod h1:7fdQLVC2lER3urZLjZCm0AuMQfApof92n3aylBPEkMo=
268270
github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0=
269271
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ=

pkg/ccl/changefeedccl/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,12 @@ go_library(
165165
"@com_github_cockroachdb_redact//:redact",
166166
"@com_github_gogo_protobuf//jsonpb",
167167
"@com_github_gogo_protobuf//types",
168-
"@com_github_google_btree//:btree",
169168
"@com_github_ibm_sarama//:sarama",
170169
"@com_github_klauspost_compress//zstd",
171170
"@com_github_klauspost_pgzip//:pgzip",
172171
"@com_github_lib_pq//:pq",
173172
"@com_github_linkedin_goavro_v2//:goavro",
173+
"@com_github_raduberinde_btree//:btree",
174174
"@com_github_rcrowley_go_metrics//:go-metrics",
175175
"@com_github_twmb_franz_go//pkg/kerr",
176176
"@com_github_twmb_franz_go//pkg/kgo",

pkg/ccl/changefeedccl/sink_cloudstorage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"sync/atomic"
1919
"time"
2020

21+
"github.com/RaduBerinde/btree" // TODO(#144504): switch to the newer btree
2122
"github.com/cockroachdb/cockroach/pkg/base"
2223
"github.com/cockroachdb/cockroach/pkg/ccl/changefeedccl/changefeedbase"
2324
"github.com/cockroachdb/cockroach/pkg/ccl/changefeedccl/kvevent"
@@ -34,7 +35,6 @@ import (
3435
"github.com/cockroachdb/cockroach/pkg/util/log/logcrash"
3536
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
3637
"github.com/cockroachdb/errors"
37-
"github.com/google/btree"
3838
// Placeholder for pgzip and zdstd.
3939
_ "github.com/klauspost/compress/zstd"
4040
_ "github.com/klauspost/pgzip"

pkg/ccl/sqlproxyccl/acl/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ go_library(
2121
"//pkg/util/syncutil",
2222
"//pkg/util/timeutil",
2323
"@com_github_cockroachdb_errors//:errors",
24-
"@com_github_google_btree//:btree",
2524
"@com_github_pires_go_proxyproto//:go-proxyproto",
2625
"@com_github_pires_go_proxyproto//tlvparse",
26+
"@com_github_raduberinde_btree//:btree",
2727
"@in_gopkg_yaml_v2//:yaml_v2",
2828
],
2929
)
@@ -48,9 +48,9 @@ go_test(
4848
"//pkg/util/stop",
4949
"//pkg/util/timeutil",
5050
"@com_github_cockroachdb_errors//:errors",
51-
"@com_github_google_btree//:btree",
5251
"@com_github_pires_go_proxyproto//:go-proxyproto",
5352
"@com_github_pires_go_proxyproto//tlvparse",
53+
"@com_github_raduberinde_btree//:btree",
5454
"@com_github_stretchr_testify//require",
5555
"@in_gopkg_yaml_v2//:yaml_v2",
5656
],

pkg/ccl/sqlproxyccl/acl/watcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import (
99
"context"
1010
"time"
1111

12+
"github.com/RaduBerinde/btree" // TODO(#144504): switch to the newer btree
1213
"github.com/cockroachdb/cockroach/pkg/util/log"
1314
"github.com/cockroachdb/cockroach/pkg/util/metric"
1415
"github.com/cockroachdb/cockroach/pkg/util/syncutil"
1516
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
16-
"github.com/google/btree"
1717
)
1818

1919
// Watcher maintains a list of connections waiting for changes to the

pkg/ccl/sqlproxyccl/acl/watcher_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"testing"
1212
"time"
1313

14+
"github.com/RaduBerinde/btree" // TODO(#144504): switch to the newer btree
1415
"github.com/cockroachdb/cockroach/pkg/ccl/sqlproxyccl/tenant"
1516
"github.com/cockroachdb/cockroach/pkg/ccl/sqlproxyccl/tenantdirsvr"
1617
"github.com/cockroachdb/cockroach/pkg/ccl/testutilsccl"
@@ -19,7 +20,6 @@ import (
1920
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
2021
"github.com/cockroachdb/cockroach/pkg/util/stop"
2122
"github.com/cockroachdb/errors"
22-
"github.com/google/btree"
2323
"github.com/stretchr/testify/require"
2424
)
2525

pkg/kv/kvclient/kvcoord/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ go_library(
9898
"@com_github_cockroachdb_logtags//:logtags",
9999
"@com_github_cockroachdb_redact//:redact",
100100
"@com_github_gogo_protobuf//proto",
101-
"@com_github_google_btree//:btree",
101+
"@com_github_raduberinde_btree//:btree",
102102
"@io_opentelemetry_go_otel//attribute",
103103
],
104104
)

0 commit comments

Comments
 (0)