Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
74211: protectedts: add target field to pts record r=irfansharif,arulajmani a=adityamaru

Protected timestamp records are moving away from
the notion of protecting spans, and instead will operate
on objects. Objects will be defined as:

- Cluster
- Tenant
- Schema objects (database and table)

This change deprecates the Spans field on `ptpb.Record`.
Additionally, it adds a `oneof` target field that reflects
which of the above objects the record corresponds to.
This information will be needed by the SQLTranslator/Reconciler
in future work to emit SpanConfigurations based on the type
of object the job is protecting.

Informs: #73727

Release note: None

74313: build: use mode default and valid_archive=False in bazel proto gen r=dt a=dt

Prior to this change, there were some known-broken go targets in the tree, defined by `go_proto_library` rules, that were unbuildable for reasons explained below. They existed only to be embedded in other `go_library` targets which could then be built, tested, etc and were not _intended_ to be built or tested on their own, but their presence in the tree still caused problems for workflows that inadvertently tried to build them, such as `build //some/prefix/...` or test-changed-packages.

Specifically, some options used in protos to control code generation can result in a generated file that cannot be compiled on its own. For example, several of our proto messages use `gogo.stringer=false` which causes the generated message to not include a String() method, but it still asserts that it implements the Message interface which requires that method. It is expected that the generated file is passed to the go compiler along with a hand-written file that adds the missing method to the message type, so that it them implements the interface.

That hand-written file depends on the generated file, e.g. the type is appears in the receiver when defining the String() method, so it too cannot be built on its own. Thus simply wrapping it in a go_library of its own to `embed` in the `go_proto_library` doesn't solve this; now *that* target fails to build.

Instead, we can set the `valid_archive=False` flag on the proto compiler used to generate these go_proto_library targets. Doing so causes these targets to no longer yeidld a `GoArchive`, which believes it should be able to be built, and instead only yeild the `GoLibrary` and `GoSource` that can then be embedded in `go_library` to complete it.

To use the above, we also switch gazelle's proto mode from `package` to `default`; the latter instructs it to generate these `go_library` wrapper targets that embded the `go_proto_library`.

74345: kv: return RangeIterator by value from constructor r=erikgrinaker,irfansharif a=nvanbenschoten

This commit changes `RangeIterator`'s constructor to return the struct
by value. The methods on `RangeIterator` continue to use a pointer
receiver, but this allows the struct to remain on the stack in some
cases and to be embedded in larger structs (e.g. `spanResolverIterator`)
in others. As a result, it avoids some heap allocations.

```
name                   old time/op    new time/op    delta
KV/Scan/SQL/rows=1-10    92.5µs ± 4%    94.4µs ± 5%    ~     (p=0.211 n=9+10)

name                   old alloc/op   new alloc/op   delta
KV/Scan/SQL/rows=1-10    20.1kB ± 0%    20.1kB ± 0%    ~     (p=0.782 n=10+10)

name                   old allocs/op  new allocs/op  delta
KV/Scan/SQL/rows=1-10       245 ± 0%       244 ± 0%  -0.41%  (p=0.000 n=10+8)
```
----

This is part of a collection of assorted micro-optimizations:
- #74336
- #74337
- #74338
- #74339
- #74340
- #74341
- #74342
- #74343
- #74344
- #74345
- #74346
- #74347
- #74348

Combined, these changes have the following effect on end-to-end SQL query performance:
```
name                      old time/op    new time/op    delta
KV/Scan/SQL/rows=1-10       94.4µs ±10%    92.3µs ±11%   -2.20%  (p=0.000 n=93+93)
KV/Scan/SQL/rows=10-10       102µs ±10%      99µs ±10%   -2.16%  (p=0.000 n=94+94)
KV/Update/SQL/rows=10-10     378µs ±15%     370µs ±11%   -2.04%  (p=0.003 n=95+91)
KV/Insert/SQL/rows=1-10      133µs ±14%     132µs ±12%     ~     (p=0.738 n=95+93)
KV/Insert/SQL/rows=10-10     197µs ±14%     196µs ±13%     ~     (p=0.902 n=95+94)
KV/Update/SQL/rows=1-10      186µs ±14%     185µs ±14%     ~     (p=0.351 n=94+93)
KV/Delete/SQL/rows=1-10      132µs ±13%     132µs ±14%     ~     (p=0.473 n=94+94)
KV/Delete/SQL/rows=10-10     254µs ±16%     250µs ±16%     ~     (p=0.086 n=100+99)

name                      old alloc/op   new alloc/op   delta
KV/Scan/SQL/rows=1-10       20.1kB ± 0%    19.1kB ± 1%   -4.91%  (p=0.000 n=96+96)
KV/Scan/SQL/rows=10-10      21.7kB ± 0%    20.7kB ± 1%   -4.61%  (p=0.000 n=96+97)
KV/Delete/SQL/rows=10-10    64.0kB ± 3%    63.7kB ± 3%   -0.55%  (p=0.000 n=100+100)
KV/Update/SQL/rows=1-10     45.8kB ± 1%    45.5kB ± 1%   -0.55%  (p=0.000 n=97+98)
KV/Update/SQL/rows=10-10     105kB ± 1%     105kB ± 1%   -0.10%  (p=0.008 n=97+98)
KV/Delete/SQL/rows=1-10     40.8kB ± 0%    40.7kB ± 0%   -0.08%  (p=0.001 n=95+96)
KV/Insert/SQL/rows=1-10     37.4kB ± 1%    37.4kB ± 0%     ~     (p=0.698 n=97+96)
KV/Insert/SQL/rows=10-10    76.4kB ± 1%    76.4kB ± 0%     ~     (p=0.822 n=99+98)

name                      old allocs/op  new allocs/op  delta
KV/Scan/SQL/rows=1-10          245 ± 0%       217 ± 0%  -11.43%  (p=0.000 n=95+92)
KV/Scan/SQL/rows=10-10         280 ± 0%       252 ± 0%  -10.11%  (p=0.000 n=75+97)
KV/Delete/SQL/rows=10-10       478 ± 0%       459 ± 0%   -4.04%  (p=0.000 n=94+97)
KV/Delete/SQL/rows=1-10        297 ± 1%       287 ± 1%   -3.34%  (p=0.000 n=97+97)
KV/Update/SQL/rows=1-10        459 ± 0%       444 ± 0%   -3.27%  (p=0.000 n=97+97)
KV/Insert/SQL/rows=1-10        291 ± 0%       286 ± 0%   -1.72%  (p=0.000 n=82+86)
KV/Update/SQL/rows=10-10       763 ± 1%       750 ± 1%   -1.68%  (p=0.000 n=96+98)
KV/Insert/SQL/rows=10-10       489 ± 0%       484 ± 0%   -1.03%  (p=0.000 n=98+98)
```


74351: sql: don't formatStatementHideConstants when profiling prepared stmt r=rafiss a=nvanbenschoten

This commit removes the call to `formatStatementHideConstants` when
executing a prepared statement while CPU profiling is enabled. The
formatted statement is already available, so there's no need to
re-format.

Formatting isn't excessively expensive and we do expect CPU profiling to
be disruptive, so the cost wasn't a big deal on its own. However, the
more important part of the change is that it helps clean up the CPU
profiles and make them more representative.

74365: pgwire: retrieve password credentials concurrently with client wait r=rafiss a=knz

Release note (performance improvement): CockroachDB now retrieves
the password credentials of the SQL client concurrently with waiting
for the password response during the authentication exchange.
This can yield a small latency reduction in new SQL connections.

Co-authored-by: Aditya Maru <[email protected]>
Co-authored-by: David Taylor <[email protected]>
Co-authored-by: Nathan VanBenschoten <[email protected]>
Co-authored-by: Raphael 'kena' Poss <[email protected]>
  • Loading branch information
5 people committed Jan 4, 2022
6 parents 8464fcf + 06bae23 + 311047e + d54e0dd + 8d9427b + 41ce35a commit 798a3e5
Show file tree
Hide file tree
Showing 64 changed files with 283 additions and 153 deletions.
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ load("//build/bazelutil/staticcheckanalyzers:def.bzl", "STATICCHECK_CHECKS")

# Enable protobuf generation.
#
# gazelle:proto package
# gazelle:proto default
# gazelle:proto_group go_package
# gazelle:go_proto_compilers //pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_compiler
# gazelle:go_grpc_compilers //pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_grpc_compiler
Expand Down
4 changes: 2 additions & 2 deletions pkg/blobs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ go_library(
importpath = "github.com/cockroachdb/cockroach/pkg/blobs",
visibility = ["//visibility:public"],
deps = [
"//pkg/blobs/blobspb:blobspb_go_proto",
"//pkg/blobs/blobspb",
"//pkg/roachpb:with-mocks",
"//pkg/rpc",
"//pkg/rpc/nodedialer",
Expand All @@ -36,7 +36,7 @@ go_test(
],
embed = [":blobs"],
deps = [
"//pkg/blobs/blobspb:blobspb_go_proto",
"//pkg/blobs/blobspb",
"//pkg/roachpb:with-mocks",
"//pkg/rpc",
"//pkg/rpc/nodedialer",
Expand Down
8 changes: 8 additions & 0 deletions pkg/blobs/blobspb/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

Expand All @@ -17,3 +18,10 @@ go_proto_library(
visibility = ["//visibility:public"],
deps = ["@com_github_gogo_protobuf//gogoproto"],
)

go_library(
name = "blobspb",
embed = [":blobspb_go_proto"],
importpath = "github.com/cockroachdb/cockroach/pkg/blobs/blobspb",
visibility = ["//visibility:public"],
)
2 changes: 1 addition & 1 deletion pkg/ccl/backupccl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ go_test(
"//pkg/kv/kvserver",
"//pkg/kv/kvserver/kvserverbase",
"//pkg/kv/kvserver/protectedts",
"//pkg/kv/kvserver/protectedts/ptpb:ptpb_go_proto",
"//pkg/kv/kvserver/protectedts/ptpb",
"//pkg/roachpb:with-mocks",
"//pkg/scheduledjobs",
"//pkg/security",
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/backupccl/schedule_pts_chaining.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func getSpansProtectedByBackup(
return nil, err
}

return ptsRecord.Spans, nil
return ptsRecord.DeprecatedSpans, nil
}

func protectTimestampRecordForSchedule(
Expand Down
4 changes: 2 additions & 2 deletions pkg/ccl/changefeedccl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ go_library(
"//pkg/kv/kvserver",
"//pkg/kv/kvserver/closedts",
"//pkg/kv/kvserver/protectedts",
"//pkg/kv/kvserver/protectedts/ptpb:ptpb_go_proto",
"//pkg/kv/kvserver/protectedts/ptpb",
"//pkg/roachpb:with-mocks",
"//pkg/security",
"//pkg/server/telemetry",
Expand Down Expand Up @@ -168,7 +168,7 @@ go_test(
"//pkg/kv/kvserver/kvserverbase",
"//pkg/kv/kvserver/liveness/livenesspb",
"//pkg/kv/kvserver/protectedts",
"//pkg/kv/kvserver/protectedts/ptpb:ptpb_go_proto",
"//pkg/kv/kvserver/protectedts/ptpb",
"//pkg/roachpb:with-mocks",
"//pkg/rpc",
"//pkg/security",
Expand Down
4 changes: 2 additions & 2 deletions pkg/ccl/changefeedccl/changefeed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3553,8 +3553,8 @@ func TestChangefeedProtectedTimestamps(t *testing.T) {
if ptr == nil {
return errors.Errorf("expected protected timestamp")
}
require.Equal(t, len(ptr.Spans), len(expectedKeys), ptr.Spans, expectedKeys)
for _, s := range ptr.Spans {
require.Equal(t, len(ptr.DeprecatedSpans), len(expectedKeys), ptr.DeprecatedSpans, expectedKeys)
for _, s := range ptr.DeprecatedSpans {
require.Contains(t, expectedKeys, string(s.Key))
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/changefeedccl/kvfeed/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func allRangeSpans(

ranges := make([]roachpb.Span, 0, len(spans))

it := kvcoord.NewRangeIterator(ds)
it := kvcoord.MakeRangeIterator(ds)

for i := range spans {
rSpan, err := keys.SpanAddr(spans[i])
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/cliccl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ go_library(
"//pkg/ccl/baseccl",
"//pkg/ccl/cliccl/cliflagsccl",
"//pkg/ccl/storageccl",
"//pkg/ccl/storageccl/engineccl/enginepbccl:enginepbccl_go_proto",
"//pkg/ccl/storageccl/engineccl/enginepbccl",
"//pkg/ccl/workloadccl/cliccl",
"//pkg/cli",
"//pkg/cli/clierrorplus",
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/cmdccl/enc_utils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ go_library(
importpath = "github.com/cockroachdb/cockroach/pkg/ccl/cmdccl/enc_utils",
visibility = ["//visibility:private"],
deps = [
"//pkg/ccl/storageccl/engineccl/enginepbccl:enginepbccl_go_proto",
"//pkg/ccl/storageccl/engineccl/enginepbccl",
"//pkg/storage/enginepb",
"//pkg/util/log",
"//pkg/util/protoutil",
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/serverccl/diagnosticsccl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ go_test(
"//pkg/security/securitytest",
"//pkg/server",
"//pkg/server/diagnostics",
"//pkg/server/diagnostics/diagnosticspb:diagnosticspb_go_proto",
"//pkg/server/diagnostics/diagnosticspb",
"//pkg/server/telemetry",
"//pkg/settings/cluster",
"//pkg/sql",
Expand Down
4 changes: 2 additions & 2 deletions pkg/ccl/storageccl/engineccl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//pkg/ccl/baseccl",
"//pkg/ccl/storageccl/engineccl/enginepbccl:enginepbccl_go_proto",
"//pkg/ccl/storageccl/engineccl/enginepbccl",
"//pkg/storage",
"//pkg/storage/enginepb",
"//pkg/storage/fs",
Expand Down Expand Up @@ -42,7 +42,7 @@ go_test(
deps = [
"//pkg/base",
"//pkg/ccl/baseccl",
"//pkg/ccl/storageccl/engineccl/enginepbccl:enginepbccl_go_proto",
"//pkg/ccl/storageccl/engineccl/enginepbccl",
"//pkg/keys",
"//pkg/roachpb:with-mocks",
"//pkg/settings/cluster",
Expand Down
8 changes: 8 additions & 0 deletions pkg/ccl/storageccl/engineccl/enginepbccl/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

Expand All @@ -20,3 +21,10 @@ go_proto_library(
visibility = ["//visibility:public"],
deps = ["@com_github_gogo_protobuf//gogoproto"],
)

go_library(
name = "enginepbccl",
embed = [":enginepbccl_go_proto"],
importpath = "github.com/cockroachdb/cockroach/pkg/ccl/storageccl/engineccl/enginepbccl",
visibility = ["//visibility:public"],
)
8 changes: 8 additions & 0 deletions pkg/ccl/streamingccl/streampb/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")

Expand Down Expand Up @@ -26,3 +27,10 @@ go_proto_library(
"@com_github_gogo_protobuf//gogoproto",
],
)

go_library(
name = "streampb",
embed = [":streampb_go_proto"],
importpath = "github.com/cockroachdb/cockroach/pkg/ccl/streamingccl/streampb",
visibility = ["//visibility:public"],
)
6 changes: 3 additions & 3 deletions pkg/ccl/streamingccl/streamproducer/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ go_library(
"//pkg/ccl/changefeedccl/changefeedbase",
"//pkg/ccl/changefeedccl/changefeeddist",
"//pkg/ccl/streamingccl",
"//pkg/ccl/streamingccl/streampb:streampb_go_proto",
"//pkg/ccl/streamingccl/streampb",
"//pkg/ccl/utilccl",
"//pkg/jobs",
"//pkg/jobs/jobspb",
Expand Down Expand Up @@ -65,13 +65,13 @@ go_test(
"//pkg/ccl/storageccl",
"//pkg/ccl/streamingccl",
"//pkg/ccl/streamingccl/streamingtest",
"//pkg/ccl/streamingccl/streampb:streampb_go_proto",
"//pkg/ccl/streamingccl/streampb",
"//pkg/ccl/utilccl",
"//pkg/jobs",
"//pkg/jobs/jobspb",
"//pkg/jobs/jobsprotectedts",
"//pkg/kv",
"//pkg/kv/kvserver/protectedts/ptpb:ptpb_go_proto",
"//pkg/kv/kvserver/protectedts/ptpb",
"//pkg/roachpb:with-mocks",
"//pkg/security",
"//pkg/security/securitytest",
Expand Down
4 changes: 2 additions & 2 deletions pkg/cli/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ go_library(
"//pkg/server/pgurl",
"//pkg/server/serverpb",
"//pkg/server/status",
"//pkg/server/status/statuspb:statuspb_go_proto",
"//pkg/server/status/statuspb",
"//pkg/server/telemetry",
"//pkg/settings",
"//pkg/settings/cluster",
Expand Down Expand Up @@ -344,7 +344,7 @@ go_test(
"//pkg/server",
"//pkg/server/serverpb",
"//pkg/server/status",
"//pkg/server/status/statuspb:statuspb_go_proto",
"//pkg/server/status/statuspb",
"//pkg/settings/cluster",
"//pkg/sql",
"//pkg/sql/catalog/descpb",
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/protoc-gen-gogoroach/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ go_proto_compiler(
"Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types",
],
plugin = ":protoc-gen-gogoroach",
valid_archive = True,
valid_archive = False,
visibility = ["//visibility:public"],
deps = [
"@com_github_gogo_protobuf//proto",
Expand All @@ -59,7 +59,7 @@ go_proto_compiler(
"Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types",
],
plugin = ":protoc-gen-gogoroach",
valid_archive = True,
valid_archive = False,
visibility = ["//visibility:public"],
deps = [
"@com_github_gogo_protobuf//proto",
Expand Down
4 changes: 2 additions & 2 deletions pkg/jobs/jobsprotectedts/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ go_library(
"//pkg/jobs",
"//pkg/jobs/jobspb",
"//pkg/kv",
"//pkg/kv/kvserver/protectedts/ptpb:ptpb_go_proto",
"//pkg/kv/kvserver/protectedts/ptpb",
"//pkg/kv/kvserver/protectedts/ptreconcile",
"//pkg/roachpb:with-mocks",
"//pkg/scheduledjobs",
Expand All @@ -35,7 +35,7 @@ go_test(
"//pkg/keys",
"//pkg/kv",
"//pkg/kv/kvserver/protectedts",
"//pkg/kv/kvserver/protectedts/ptpb:ptpb_go_proto",
"//pkg/kv/kvserver/protectedts/ptpb",
"//pkg/roachpb:with-mocks",
"//pkg/scheduledjobs",
"//pkg/security",
Expand Down
12 changes: 6 additions & 6 deletions pkg/jobs/jobsprotectedts/jobs_protected_ts.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ func MakeRecord(
metaType MetaType,
) *ptpb.Record {
return &ptpb.Record{
ID: recordID.GetBytesMut(),
Timestamp: tsToProtect,
Mode: ptpb.PROTECT_AFTER,
MetaType: metaTypes[metaType],
Meta: encodeID(metaID),
Spans: spans,
ID: recordID.GetBytesMut(),
Timestamp: tsToProtect,
Mode: ptpb.PROTECT_AFTER,
MetaType: metaTypes[metaType],
Meta: encodeID(metaID),
DeprecatedSpans: spans,
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/kv/kvclient/kvcoord/dist_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ func (ds *DistSender) getNodeDescriptor() *roachpb.NodeDescriptor {
// CountRanges returns the number of ranges that encompass the given key span.
func (ds *DistSender) CountRanges(ctx context.Context, rs roachpb.RSpan) (int64, error) {
var count int64
ri := NewRangeIterator(ds)
ri := MakeRangeIterator(ds)
for ri.Seek(ctx, rs.Key, Ascending); ri.Valid(); ri.Next(ctx) {
count++
if !ri.NeedAnother(rs) {
Expand Down Expand Up @@ -1165,7 +1165,7 @@ func (ds *DistSender) divideAndSendBatchToRanges(
scanDir = Descending
seekKey = rs.EndKey
}
ri := NewRangeIterator(ds)
ri := MakeRangeIterator(ds)
ri.Seek(ctx, seekKey, scanDir)
if !ri.Valid() {
return nil, roachpb.NewError(ri.Error())
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/kvcoord/dist_sender_rangefeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (ds *DistSender) divideAndSendRangeFeedToRanges(
// boundaries. So, as we go, keep track of the remaining uncovered part of
// `rs` in `nextRS`.
nextRS := rs
ri := NewRangeIterator(ds)
ri := MakeRangeIterator(ds)
for ri.Seek(ctx, nextRS.Key, Ascending); ri.Valid(); ri.Next(ctx) {
desc := ri.Desc()
partialRS, err := nextRS.Intersect(desc)
Expand Down
6 changes: 3 additions & 3 deletions pkg/kv/kvclient/kvcoord/range_iter.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ type RangeIterator struct {
err error
}

// NewRangeIterator creates a new RangeIterator.
func NewRangeIterator(ds *DistSender) *RangeIterator {
return &RangeIterator{
// MakeRangeIterator creates a new RangeIterator.
func MakeRangeIterator(ds *DistSender) RangeIterator {
return RangeIterator{
ds: ds,
}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/kv/kvclient/kvcoord/range_iter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestRangeIterForward(t *testing.T) {
Settings: cluster.MakeTestingClusterSettings(),
})

ri := NewRangeIterator(ds)
ri := MakeRangeIterator(ds)
i := 0
span := roachpb.RSpan{
Key: testMetaEndKey,
Expand Down Expand Up @@ -105,7 +105,7 @@ func TestRangeIterSeekForward(t *testing.T) {
Settings: cluster.MakeTestingClusterSettings(),
})

ri := NewRangeIterator(ds)
ri := MakeRangeIterator(ds)
i := 0
for ri.Seek(ctx, testMetaEndKey, Ascending); ri.Valid(); {
if !reflect.DeepEqual(alphaRangeDescriptors[i], *ri.Desc()) {
Expand Down Expand Up @@ -144,7 +144,7 @@ func TestRangeIterReverse(t *testing.T) {
Settings: cluster.MakeTestingClusterSettings(),
})

ri := NewRangeIterator(ds)
ri := MakeRangeIterator(ds)
i := len(alphaRangeDescriptors) - 1
span := roachpb.RSpan{
Key: testMetaEndKey,
Expand Down Expand Up @@ -180,7 +180,7 @@ func TestRangeIterSeekReverse(t *testing.T) {
Settings: cluster.MakeTestingClusterSettings(),
})

ri := NewRangeIterator(ds)
ri := MakeRangeIterator(ds)
i := len(alphaRangeDescriptors) - 1
for ri.Seek(ctx, roachpb.RKey([]byte{'z'}), Descending); ri.Valid(); {
if !reflect.DeepEqual(alphaRangeDescriptors[i], *ri.Desc()) {
Expand Down
3 changes: 2 additions & 1 deletion pkg/kv/kvclient/kvcoord/txn_interceptor_pipeliner.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ func (f rangeIteratorFactory) newRangeIterator() condensableSpanSetRangeIterator
return f.factory()
}
if f.ds != nil {
return NewRangeIterator(f.ds)
ri := MakeRangeIterator(f.ds)
return &ri
}
panic("no iterator factory configured")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvclient/rangefeed/db_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (dbc *dbAdapter) divideAndSendScanRequests(

currentScanLimit := parallelismFn()
exportLim := limit.MakeConcurrentRequestLimiter("rangefeedScanLimiter", parallelismFn())
ri := kvcoord.NewRangeIterator(dbc.distSender)
ri := kvcoord.MakeRangeIterator(dbc.distSender)

for _, sp := range sg.Slice() {
nextRS, err := keys.SpanAddr(sp)
Expand Down
4 changes: 2 additions & 2 deletions pkg/kv/kvserver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ go_library(
"//pkg/kv/kvserver/liveness",
"//pkg/kv/kvserver/liveness/livenesspb",
"//pkg/kv/kvserver/protectedts",
"//pkg/kv/kvserver/protectedts/ptpb:ptpb_go_proto",
"//pkg/kv/kvserver/protectedts/ptpb",
"//pkg/kv/kvserver/raftentry",
"//pkg/kv/kvserver/rangefeed",
"//pkg/kv/kvserver/rditer",
Expand Down Expand Up @@ -325,7 +325,7 @@ go_test(
"//pkg/kv/kvserver/liveness",
"//pkg/kv/kvserver/liveness/livenesspb",
"//pkg/kv/kvserver/protectedts",
"//pkg/kv/kvserver/protectedts/ptpb:ptpb_go_proto",
"//pkg/kv/kvserver/protectedts/ptpb",
"//pkg/kv/kvserver/protectedts/ptstorage",
"//pkg/kv/kvserver/protectedts/ptverifier",
"//pkg/kv/kvserver/raftentry",
Expand Down
2 changes: 1 addition & 1 deletion pkg/kv/kvserver/client_protectedts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func TestProtectedTimestamps(t *testing.T) {
ID: uuid.MakeV4().GetBytes(),
Timestamp: s0.Clock().Now(),
Mode: ptpb.PROTECT_AFTER,
Spans: []roachpb.Span{
DeprecatedSpans: []roachpb.Span{
{
Key: startKey,
EndKey: startKey.PrefixEnd(),
Expand Down
Loading

0 comments on commit 798a3e5

Please sign in to comment.