Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
74343: sql: use FastIntMap for QueryState.RangesPerNode r=nvanbenschoten a=nvanbenschoten

This commit switches `QueryState.RangesPerNode` from a `map[roachpb.NodeID]int`
to a `util.FastIntMap`. This avoids a pair of heap allocation as long as node
IDs say below 32 and the number of ranges for each node stays below 14.

```
name                   old time/op    new time/op    delta
KV/Scan/SQL/rows=1-10    94.5µs ± 4%    94.1µs ± 6%    ~     (p=0.796 n=10+10)

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

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

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)
```


74461: ci: additionally build go-test-teamcity in ci r=rail a=rickystewart

It's used in examples-orms.

Release note: None

74510: deps: rename/upgrade xdg/scram -> xdg-go/scram r=rafiss,shermanCRL a=knz

Prereq for #74301

Release note: None

74529: pgwire: fix an assertion r=rafiss a=knz

When a client connects over a unix socket, we don't support TLS.
The assertion for this was wrong, it did not properly report
the invalid situation to the client.

We can't really test this - I was not able to find a single client
that gets this wrong.

Release note: None

Co-authored-by: Nathan VanBenschoten <[email protected]>
Co-authored-by: Ricky Stewart <[email protected]>
Co-authored-by: Raphael 'kena' Poss <[email protected]>
  • Loading branch information
4 people committed Jan 6, 2022
5 parents 5c27c74 + fad1ef7 + 8590bd2 + 156f986 + 3aaf3ab commit 20ec845
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 54 deletions.
9 changes: 5 additions & 4 deletions build/teamcity/cockroach/ci/builds/build_impl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ fi

CONFIG="$1"

# Only build generated files on Linux x86_64.
GENFILES_TARGETS=
# Extra targets to build on Linux x86_64 only.
EXTRA_TARGETS=
if [ "$CONFIG" == "crosslinux" ]
then
DOC_TARGETS=$(grep '^//' docs/generated/bazel_targets.txt)
GO_TARGETS=$(grep -v '^#' build/bazelutil/checked_in_genfiles.txt | cut -d'|' -f1)
GENFILES_TARGETS="$DOC_TARGETS $GO_TARGETS"
BINARY_TARGETS=@com_github_cockroachdb_go_test_teamcity//:go-test-teamcity
EXTRA_TARGETS="$DOC_TARGETS $GO_TARGETS $BINARY_TARGETS"
fi

bazel build //pkg/cmd/bazci --config=ci
$(bazel info bazel-bin --config=ci)/pkg/cmd/bazci/bazci_/bazci --compilation_mode opt \
--config "$CONFIG" --config ci --config with_ui \
build //pkg/cmd/cockroach-short //pkg/cmd/cockroach \
//pkg/cmd/cockroach-oss //c-deps:libgeos $GENFILES_TARGETS
//pkg/cmd/cockroach-oss //c-deps:libgeos $EXTRA_TARGETS
45 changes: 23 additions & 22 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ require (
github.com/Azure/go-autorest/autorest/azure/auth v0.5.8
github.com/Azure/go-autorest/autorest/to v0.4.0
github.com/BurntSushi/toml v0.4.1
github.com/DataDog/zstd v1.4.8 // indirect
github.com/MichaelTJones/walk v0.0.0-20161122175330-4748e29d5718
github.com/PuerkitoBio/goquery v1.5.1
github.com/Shopify/sarama v1.29.0
Expand All @@ -20,7 +19,6 @@ require (
github.com/abourget/teamcity v0.0.0-00010101000000-000000000000
github.com/alessio/shellescape v1.4.1
github.com/andy-kimball/arenaskl v0.0.0-20200617143215-f701008588b9
github.com/andybalholm/cascadia v1.2.0 // indirect
github.com/apache/arrow/go/arrow v0.0.0-20200923215132-ac86123a3f01
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e
github.com/aws/aws-sdk-go v1.40.37
Expand Down Expand Up @@ -55,7 +53,6 @@ require (
github.com/containerd/containerd v1.5.4
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/dave/dst v0.24.0
github.com/dgryski/go-metro v0.0.0-20180109044635-280f6062b5bc // indirect
github.com/docker/distribution v2.7.1+incompatible
github.com/docker/docker v20.10.8+incompatible
github.com/docker/go-connections v0.4.0
Expand All @@ -66,17 +63,11 @@ require (
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a
github.com/fraugster/parquet-go v0.4.0
github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-sql-driver/mysql v1.6.0
github.com/go-swagger/go-swagger v0.26.1
github.com/gogo/protobuf v1.3.2
github.com/golang-commonmark/html v0.0.0-20180910111043-7d7c804e1d46 // indirect
github.com/golang-commonmark/linkify v0.0.0-20180910111149-f05efb453a0e // indirect
github.com/golang-commonmark/markdown v0.0.0-20180910011815-a8f139058164
github.com/golang-commonmark/mdurl v0.0.0-20180910110917-8d018c6567d6 // indirect
github.com/golang-commonmark/puny v0.0.0-20180910110745-050be392d8b8 // indirect
github.com/golang/geo v0.0.0-20200319012246-673a6f80352d
github.com/golang/glog v0.0.0-20210429001901-424d2337a529 // indirect
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.2
github.com/golang/snappy v0.0.4
Expand Down Expand Up @@ -112,53 +103,44 @@ require (
github.com/maruel/panicparse/v2 v2.2.0
github.com/marusama/semaphore v0.0.0-20190110074507-6952cef993b2
github.com/mattn/go-isatty v0.0.14
github.com/mattn/go-zglob v0.0.3 // indirect
github.com/mattn/goveralls v0.0.2
github.com/mibk/dupl v1.0.0
github.com/mitchellh/reflectwalk v1.0.0
github.com/mmatczuk/go_generics v0.0.0-20181212143635-0aaa050f9bab
github.com/montanaflynn/stats v0.6.3
github.com/olekukonko/tablewriter v0.0.5-0.20200416053754-163badb3bac6
github.com/opencontainers/image-spec v1.0.1
github.com/opennota/wd v0.0.0-20180911144301-b446539ab1e7 // indirect
github.com/peterbourgon/g2s v0.0.0-20170223122336-d4e7ad98afea // indirect
github.com/petermattis/goid v0.0.0-20211229010228-4d14c490ee36
github.com/pierrre/geohash v1.0.0
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a
github.com/prometheus/common v0.30.0
github.com/prometheus/prometheus v1.8.2-0.20210914090109-37468d88dce8
github.com/pseudomuto/protoc-gen-doc v1.3.2
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
github.com/russross/blackfriday v1.6.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1
github.com/shirou/gopsutil/v3 v3.21.12
github.com/slack-go/slack v0.9.5
github.com/spf13/cobra v1.1.3
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.0
github.com/tklauser/go-sysconf v0.3.9 // indirect
github.com/twpayne/go-geom v1.4.1
github.com/wadey/gocovmerge v0.0.0-20160331181800-b5bfa59ec0ad
github.com/xdg/scram v1.0.3
github.com/xdg-go/scram v1.0.2
github.com/xdg-go/stringprep v1.0.2
github.com/zabawaba99/go-gitignore v0.0.0-20200117185801-39e6bddfb292
go.etcd.io/etcd/raft/v3 v3.0.0-20210320072418-e51c697ec6e8
go.opentelemetry.io/otel v1.0.0-RC3
go.opentelemetry.io/otel/exporters/jaeger v1.0.0-RC3
// The indicated commit is required on top of v1.0.0-RC3 because
// it fixes an import comment that otherwise breaks our prereqs tool.
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.0-RC3.0.20210907151655-df2bdbbadb26 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.0.0-RC3
go.opentelemetry.io/otel/exporters/zipkin v1.0.0-RC3
go.opentelemetry.io/otel/sdk v1.0.0-RC3
go.opentelemetry.io/otel/trace v1.0.0-RC3
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5
golang.org/x/exp v0.0.0-20210514180818-737f94c0881e
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616
golang.org/x/mod v0.5.1 // indirect
golang.org/x/net v0.0.0-20210913180222-943fd674d43e
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852
Expand All @@ -171,7 +153,6 @@ require (
google.golang.org/api v0.63.0
google.golang.org/genproto v0.0.0-20211222154725-9823f7ba7562
google.golang.org/grpc v1.43.0
google.golang.org/grpc/examples v0.0.0-20210324172016-702608ffae4d // indirect
google.golang.org/protobuf v1.27.1
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
Expand All @@ -191,13 +172,15 @@ require (
github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/DataDog/zstd v1.4.8 // indirect
github.com/Masterminds/goutils v1.1.0 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/Microsoft/go-winio v0.4.17 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/alexbrainman/sspi v0.0.0-20180613141037-e580b900e9f5 // indirect
github.com/andybalholm/cascadia v1.2.0 // indirect
github.com/apache/thrift v0.13.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.4.2 // indirect
Expand All @@ -216,6 +199,7 @@ require (
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-metro v0.0.0-20180109044635-280f6062b5bc // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/eapache/go-resiliency v1.2.0 // indirect
Expand All @@ -228,6 +212,7 @@ require (
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-kit/log v0.1.0 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/analysis v0.20.0 // indirect
github.com/go-openapi/errors v0.20.0 // indirect
github.com/go-openapi/inflect v0.19.0 // indirect
Expand All @@ -244,7 +229,12 @@ require (
github.com/gofrs/uuid v4.0.0+incompatible // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/status v1.1.0 // indirect
github.com/golang-commonmark/html v0.0.0-20180910111043-7d7c804e1d46 // indirect
github.com/golang-commonmark/linkify v0.0.0-20180910111149-f05efb453a0e // indirect
github.com/golang-commonmark/mdurl v0.0.0-20180910110917-8d018c6567d6 // indirect
github.com/golang-commonmark/puny v0.0.0-20180910110745-050be392d8b8 // indirect
github.com/golang-jwt/jwt/v4 v4.0.0 // indirect
github.com/golang/glog v0.0.0-20210429001901-424d2337a529 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/google/uuid v1.3.0 // indirect
Expand Down Expand Up @@ -280,6 +270,7 @@ require (
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-ieproxy v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.7 // indirect
github.com/mattn/go-zglob v0.0.3 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
Expand All @@ -291,14 +282,18 @@ require (
github.com/mwitkow/go-proto-validators v0.0.0-20180403085117-0950a7990007 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opennota/wd v0.0.0-20180911144301-b446539ab1e7 // indirect
github.com/openzipkin/zipkin-go v0.2.5 // indirect
github.com/pelletier/go-toml v1.8.1 // indirect
github.com/peterbourgon/g2s v0.0.0-20170223122336-d4e7ad98afea // indirect
github.com/pierrec/lz4 v2.6.0+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/profile v1.6.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/pquerna/cachecontrol v0.0.0-20200921180117-858c6e7e6b7e // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/pseudomuto/protokit v0.2.0 // indirect
github.com/russross/blackfriday v1.6.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
Expand All @@ -307,20 +302,26 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.7.1 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/tklauser/go-sysconf v0.3.9 // indirect
github.com/tklauser/numcpus v0.3.0 // indirect
github.com/toqueteos/webbrowser v1.2.0 // indirect
github.com/twitchtv/twirp v7.1.1+incompatible // indirect
github.com/twpayne/go-kml v1.5.2 // indirect
github.com/xdg/stringprep v1.0.3 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.mongodb.org/mongo-driver v1.5.1 // indirect
go.opencensus.io v0.23.0 // indirect
// The indicated commit is required on top of v1.0.0-RC3 because
// it fixes an import comment that otherwise breaks our prereqs tool.
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.0.0-RC3.0.20210907151655-df2bdbbadb26 // indirect
go.opentelemetry.io/proto/otlp v0.9.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
go.uber.org/zap v1.19.0 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/grpc/examples v0.0.0-20210324172016-702608ffae4d // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
)
Expand Down
5 changes: 3 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1975,15 +1975,16 @@ github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPyS
github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.0.2 h1:akYIkZ28e6A96dkWNJQu3nmCzH3YfwMPQExUYDaRv7w=
github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs=
github.com/xdg-go/stringprep v1.0.2 h1:6iq84/ryjjeRmMJwxutI51F2GIPlP5BfTvXHeYjyhBc=
github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM=
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
github.com/xdg/scram v1.0.3 h1:nTadYh2Fs4BK2xdldEa2g5bbaZp0/+1nJMMPtPxS/to=
github.com/xdg/scram v1.0.3/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
github.com/xdg/stringprep v1.0.3 h1:cmL5Enob4W83ti/ZHuZLuKD/xqJfus4fVPwE+/BDm+4=
github.com/xdg/stringprep v1.0.3/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
Expand Down
7 changes: 5 additions & 2 deletions pkg/build/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import (

// OutputOfBinaryRule returns the path of the binary produced by the
// given build target, relative to bazel-bin. That is,
// filepath.Join(bazelBin, OutputOfBinaryRule(target)) is the absolute
// filepath.Join(bazelBin, OutputOfBinaryRule(target, isWindows)) is the absolute
// path to the build binary for the target.
func OutputOfBinaryRule(target string) string {
func OutputOfBinaryRule(target string, isWindows bool) string {
colon := strings.Index(target, ":")
var bin string
if colon >= 0 {
Expand All @@ -42,6 +42,9 @@ func OutputOfBinaryRule(target string) string {
} else {
head = strings.TrimPrefix(target, "//")
}
if isWindows {
return filepath.Join(head, bin+"_", bin+".exe")
}
return filepath.Join(head, bin+"_", bin)
}

Expand Down
21 changes: 15 additions & 6 deletions pkg/build/util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,26 @@ import (
)

func TestOutputOfBinaryRule(t *testing.T) {
require.Equal(t, OutputOfBinaryRule("//pkg/cmd/cockroach-short"),
require.Equal(t, OutputOfBinaryRule("//pkg/cmd/cockroach-short", false),
"pkg/cmd/cockroach-short/cockroach-short_/cockroach-short")
require.Equal(t, OutputOfBinaryRule("//pkg/cmd/cockroach-short:cockroach-short"),
require.Equal(t, OutputOfBinaryRule("//pkg/cmd/cockroach-short", true),
"pkg/cmd/cockroach-short/cockroach-short_/cockroach-short.exe")
require.Equal(t, OutputOfBinaryRule("//pkg/cmd/cockroach-short:cockroach-short", false),
"pkg/cmd/cockroach-short/cockroach-short_/cockroach-short")
require.Equal(t, OutputOfBinaryRule("pkg/cmd/cockroach-short"),
require.Equal(t, OutputOfBinaryRule("//pkg/cmd/cockroach-short:cockroach-short", true),
"pkg/cmd/cockroach-short/cockroach-short_/cockroach-short.exe")
require.Equal(t, OutputOfBinaryRule("pkg/cmd/cockroach-short", false),
"pkg/cmd/cockroach-short/cockroach-short_/cockroach-short")

require.Equal(t, OutputOfBinaryRule("@com_github_cockroachdb_stress//:stress"),
require.Equal(t, OutputOfBinaryRule("pkg/cmd/cockroach-short", true),
"pkg/cmd/cockroach-short/cockroach-short_/cockroach-short.exe")
require.Equal(t, OutputOfBinaryRule("@com_github_cockroachdb_stress//:stress", false),
"external/com_github_cockroachdb_stress/stress_/stress")
require.Equal(t, OutputOfBinaryRule("@com_github_bazelbuild_buildtools//buildifier:buildifier"),
require.Equal(t, OutputOfBinaryRule("@com_github_cockroachdb_stress//:stress", true),
"external/com_github_cockroachdb_stress/stress_/stress.exe")
require.Equal(t, OutputOfBinaryRule("@com_github_bazelbuild_buildtools//buildifier:buildifier", false),
"external/com_github_bazelbuild_buildtools/buildifier/buildifier_/buildifier")
require.Equal(t, OutputOfBinaryRule("@com_github_bazelbuild_buildtools//buildifier:buildifier", true),
"external/com_github_bazelbuild_buildtools/buildifier/buildifier_/buildifier.exe")
}

func TestOutputsOfGenrule(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/changefeedccl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ go_library(
"@com_github_google_btree//:btree",
"@com_github_linkedin_goavro_v2//:goavro",
"@com_github_shopify_sarama//:sarama",
"@com_github_xdg_scram//:scram",
"@com_github_xdg_go_scram//:scram",
"@com_google_cloud_go_pubsub//:pubsub",
"@org_golang_google_api//option",
"@org_golang_google_grpc//codes",
Expand Down
2 changes: 1 addition & 1 deletion pkg/ccl/changefeedccl/scram_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"crypto/sha512"

"github.com/Shopify/sarama"
"github.com/xdg/scram"
"github.com/xdg-go/scram"
)

var (
Expand Down
10 changes: 1 addition & 9 deletions pkg/cmd/bazci/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,7 @@ type xmlMessage struct {
// results.)
func (w watcher) stageBinaryArtifacts() error {
for _, bin := range w.info.goBinaries {
// Convert a target like `//pkg/cmd/cockroach-short` to the
// relative path atop bazel-bin where that file can be found --
// in this example, `pkg/cmd/cockroach-short/cockroach-short_/cockroach-short.
head := strings.ReplaceAll(strings.TrimPrefix(bin, "//"), ":", "/")
components := strings.Split(bin, ":")
relBinPath := path.Join(head+"_", components[len(components)-1])
if usingCrossWindowsConfig() {
relBinPath = relBinPath + ".exe"
}
relBinPath := bazelutil.OutputOfBinaryRule(bin, usingCrossWindowsConfig())
err := w.maybeStageArtifact(binSourceDir, relBinPath, 0755, finalizePhase,
copyContentTo)
if err != nil {
Expand Down
6 changes: 4 additions & 2 deletions pkg/cmd/dev/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"os"
"path"
"path/filepath"
"runtime"
"strings"

"github.com/alessio/shellescape"
Expand Down Expand Up @@ -133,7 +134,8 @@ func (d *dev) build(cmd *cobra.Command, commandLine []string) error {
script.WriteString(fmt.Sprintf("bazel %s\n", strings.Join(args, " ")))
script.WriteString(fmt.Sprintf("BAZELBIN=`bazel info bazel-bin --color=no --config=%s --config=ci`\n", cross))
for _, target := range buildTargets {
script.WriteString(fmt.Sprintf("cp $BAZELBIN/%s /artifacts\n", bazelutil.OutputOfBinaryRule(target.fullName)))
script.WriteString(fmt.Sprintf("cp $BAZELBIN/%s /artifacts\n",
bazelutil.OutputOfBinaryRule(target.fullName, strings.Contains(cross, "windows"))))
}
_, err = d.exec.CommandContextWithInput(ctx, script.String(), "docker", dockerArgs...)
if err != nil {
Expand Down Expand Up @@ -164,7 +166,7 @@ func (d *dev) stageArtifacts(ctx context.Context, targets []buildTarget, skipGen
// Skip staging for these.
continue
}
binaryPath := filepath.Join(bazelBin, bazelutil.OutputOfBinaryRule(target.fullName))
binaryPath := filepath.Join(bazelBin, bazelutil.OutputOfBinaryRule(target.fullName, runtime.GOOS == "windows"))
base := targetToBinBasename(target.fullName)
var symlinkPath string
// Binaries beginning with the string "cockroach" go right at
Expand Down
1 change: 1 addition & 0 deletions pkg/security/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ go_library(
"@com_github_cockroachdb_errors//:errors",
"@com_github_cockroachdb_errors//oserror",
"@com_github_cockroachdb_redact//:redact",
"@com_github_xdg_go_stringprep//:stringprep",
"@org_golang_x_crypto//bcrypt",
"@org_golang_x_crypto//ocsp",
"@org_golang_x_sync//errgroup",
Expand Down
2 changes: 2 additions & 0 deletions pkg/security/password.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/cockroach/pkg/util/quotapool"
"github.com/cockroachdb/errors"
// Reserved import for PR #74301.
_ "github.com/xdg-go/stringprep"
"golang.org/x/crypto/bcrypt"
)

Expand Down
4 changes: 4 additions & 0 deletions pkg/sql/pgwire/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1042,8 +1042,12 @@ func (s *Server) maybeUpgradeToSecureConn(
}

if connType == hba.ConnLocal {
// No existing PostgreSQL driver ever tries to activate TLS over
// a unix socket. But in case someone, sometime, somewhere, makes
// that mistake, let them know that we don't want it.
clientErr = pgerror.New(pgcode.ProtocolViolation,
"cannot use SSL/TLS over local connections")
return
}

// Protocol sanity check.
Expand Down
Loading

0 comments on commit 20ec845

Please sign in to comment.