Skip to content

Commit 7e87b69

Browse files
committed
v23.1.0-rc1 compilation
1 parent ea0ac1a commit 7e87b69

File tree

285 files changed

+67236
-32885
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

285 files changed

+67236
-32885
lines changed

go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
module github.com/cockroachdb/cockroachdb-parser
22

3-
go 1.17
3+
go 1.18
44

55
require (
66
github.com/biogo/store v0.0.0-20201120204734-aad293a2328f
7+
github.com/blevesearch/snowballstem v0.9.0
78
github.com/cockroachdb/apd/v3 v3.1.0
89
github.com/cockroachdb/errors v1.9.0
910
github.com/cockroachdb/gostdlib v1.19.0
1011
github.com/cockroachdb/redact v1.1.3
12+
github.com/dave/dst v0.27.2
1113
github.com/dustin/go-humanize v1.0.0
1214
github.com/gogo/protobuf v1.3.2
1315
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551
@@ -35,6 +37,7 @@ require (
3537
github.com/pmezard/go-difflib v1.0.0 // indirect
3638
github.com/rogpeppe/go-internal v1.8.1 // indirect
3739
github.com/twpayne/go-kml v1.5.2 // indirect
40+
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
3841
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
3942
google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84 // indirect
4043
google.golang.org/grpc v1.38.0 // indirect

go.sum

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5
2727
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
2828
github.com/biogo/store v0.0.0-20201120204734-aad293a2328f h1:+6okTAeUsUrdQr/qN7fIODzowrjjCrnJDg/gkYqcSXY=
2929
github.com/biogo/store v0.0.0-20201120204734-aad293a2328f/go.mod h1:z52shMwD6SGwRg2iYFjjDwX5Ene4ENTw6HfXraUy/08=
30+
github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s=
31+
github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs=
3032
github.com/broady/gogeohash v0.0.0-20120525094510-7b2c40d64042 h1:iEdmkrNMLXbM7ecffOAtZJQOQUTE4iMonxrb5opUgE4=
3133
github.com/broady/gogeohash v0.0.0-20120525094510-7b2c40d64042/go.mod h1:f1L9YvXvlt9JTa+A17trQjSMM6bV40f+tHjB+Pi+Fqk=
3234
github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs=
@@ -57,6 +59,9 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz
5759
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
5860
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
5961
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
62+
github.com/dave/dst v0.27.2 h1:4Y5VFTkhGLC1oddtNwuxxe36pnyLxMFXT51FOzH8Ekc=
63+
github.com/dave/dst v0.27.2/go.mod h1:jHh6EOibnHgcUW3WjKHisiooEkYwqpHLBSX1iOBhEyc=
64+
github.com/dave/jennifer v1.5.0 h1:HmgPN93bVDpkQyYbqhCHj5QlgvUkvEOzMyEvKLgCRrg=
6065
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
6166
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
6267
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -264,6 +269,7 @@ github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtm
264269
github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw=
265270
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
266271
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
272+
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
267273
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
268274
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
269275
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
@@ -315,7 +321,6 @@ github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZ
315321
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
316322
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
317323
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
318-
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
319324
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
320325
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
321326
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
@@ -334,6 +339,7 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
334339
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
335340
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
336341
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
342+
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
337343
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
338344
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
339345
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -357,7 +363,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
357363
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
358364
golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
359365
golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=
360-
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
361366
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
362367
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
363368
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -368,7 +373,6 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
368373
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
369374
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
370375
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
371-
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
372376
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
373377
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
374378
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -399,11 +403,9 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
399403
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
400404
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
401405
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
402-
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
403406
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
404407
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
405408
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
406-
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
407409
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
408410
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
409411
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=

patches/0003-builtin-fix.patch

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From 54d336fe9bb80f56dd9ac4b5ef8a306b25fd28ec Mon Sep 17 00:00:00 2001
2+
From: Oliver Tan <[email protected]>
3+
Date: Mon, 15 May 2023 10:51:31 +1000
4+
Subject: [PATCH] temp
5+
6+
---
7+
pkg/sql/sem/tree/function_name.go | 4 ++--
8+
1 file changed, 2 insertions(+), 2 deletions(-)
9+
10+
diff --git a/pkg/sql/sem/tree/function_name.go b/pkg/sql/sem/tree/function_name.go
11+
index 3b0ac48..fd524d3 100644
12+
--- a/pkg/sql/sem/tree/function_name.go
13+
+++ b/pkg/sql/sem/tree/function_name.go
14+
@@ -19,7 +19,6 @@ import (
15+
"github.com/cockroachdb/cockroachdb-parser/pkg/sql/pgwire/pgerror"
16+
"github.com/cockroachdb/cockroachdb-parser/pkg/sql/sem/catconstants"
17+
"github.com/cockroachdb/errors"
18+
- "github.com/cockroachdb/redact"
19+
"github.com/lib/pq/oid"
20+
)
21+
22+
@@ -146,7 +145,8 @@ func (ref *ResolvableFunctionReference) Resolve(
23+
func WrapFunction(n string) ResolvableFunctionReference {
24+
fd, ok := FunDefs[n]
25+
if !ok {
26+
- panic(errors.AssertionFailedf("function %s() not defined", redact.Safe(n)))
27+
+ // Make every builtin parse.
28+
+ return ResolvableFunctionReference{ReferenceByName: &UnresolvedObjectName{NumParts: 1, Parts: [3]string{n, "", ""}}}
29+
}
30+
return ResolvableFunctionReference{FunctionReference: fd}
31+
}
32+
--
33+
2.39.2 (Apple Git-143)
34+

pkg/build/info.go

Lines changed: 54 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ package build
1212

1313
import (
1414
"bytes"
15+
_ "embed"
1516
"fmt"
1617
"runtime"
18+
"strings"
1719
"text/tabwriter"
1820
"time"
1921

@@ -26,20 +28,27 @@ import (
2628
const TimeFormat = "2006/01/02 15:04:05"
2729

2830
var (
29-
// These variables are initialized via the linker -X flag in the
30-
// top-level Makefile when compiling release binaries.
31-
tag = "unknown" // Tag of this build (git describe --tags w/ optional '-dirty' suffix)
32-
utcTime string // Build time in UTC (year/month/day hour:min:sec)
33-
rev string // SHA-1 of this build (git rev-parse)
34-
cgoCompiler = cgoVersion()
35-
cgoTargetTriple string
36-
platform = fmt.Sprintf("%s %s", runtime.GOOS, runtime.GOARCH)
31+
// These variables are initialized by Bazel via the linker -X flag
32+
// when compiling release binaries.
33+
utcTime string // Build time in UTC (year/month/day hour:min:sec)
34+
rev string // SHA-1 of this build (git rev-parse)
35+
buildTagOverride string
36+
cgoCompiler = cgoVersion()
37+
cgoTargetTriple string
38+
platform = fmt.Sprintf("%s %s", runtime.GOOS, runtime.GOARCH)
3739
// Distribution is changed by the CCL init-time hook in non-APL builds.
38-
Distribution = "OSS"
39-
typ string // Type of this build: <empty>, "development", or "release"
40-
channel = "unknown"
41-
envChannel = envutil.EnvOrDefaultString("COCKROACH_CHANNEL", "unknown")
42-
binaryVersion = computeVersion(tag)
40+
Distribution = "OSS"
41+
typ string // Type of this build: <empty>, "development", or "release"
42+
channel string
43+
envChannel = envutil.EnvOrDefaultString("COCKROACH_CHANNEL", "unknown")
44+
//go:embed version.txt
45+
cockroachVersion string
46+
binaryVersion = computeBinaryVersion(cockroachVersion, rev)
47+
)
48+
49+
const (
50+
DefaultTelemetryChannel = "official-binary"
51+
FIPSTelemetryChannel = "official-fips-binary"
4352
)
4453

4554
// IsRelease returns true if the binary was produced by a "release" build.
@@ -50,15 +59,25 @@ func IsRelease() bool {
5059
// SeemsOfficial reports whether this binary is likely to have come from an
5160
// official release channel.
5261
func SeemsOfficial() bool {
53-
return channel == "official-binary" || channel == "source-archive"
62+
return channel == DefaultTelemetryChannel || channel == FIPSTelemetryChannel
5463
}
5564

56-
func computeVersion(tag string) string {
57-
v, err := version.Parse(tag)
65+
func computeBinaryVersion(versionTxt, revision string) string {
66+
if buildTagOverride != "" {
67+
return buildTagOverride
68+
}
69+
txt := strings.TrimSuffix(versionTxt, "\n")
70+
v, err := version.Parse(txt)
5871
if err != nil {
59-
return "dev"
72+
panic(fmt.Errorf("could not parse version.txt: %w", err))
6073
}
61-
return v.String()
74+
if IsRelease() {
75+
return v.String()
76+
}
77+
if revision != "" {
78+
return fmt.Sprintf("%s-dev-%s", v.String(), revision)
79+
}
80+
return fmt.Sprintf("%s-dev", v.String())
6281
}
6382

6483
// BinaryVersion returns the version prefix, patch number and metadata of the current build.
@@ -68,18 +87,18 @@ func BinaryVersion() string {
6887

6988
// BinaryVersionPrefix returns the version prefix of the current build.
7089
func BinaryVersionPrefix() string {
71-
v, err := version.Parse(tag)
90+
v, err := version.Parse(binaryVersion)
7291
if err != nil {
7392
return "dev"
7493
}
7594
return fmt.Sprintf("v%d.%d", v.Major(), v.Minor())
7695
}
7796

7897
func init() {
79-
// Allow tests to override the tag.
80-
if tagOverride := envutil.EnvOrDefaultString(
81-
"COCKROACH_TESTING_VERSION_TAG", ""); tagOverride != "" {
82-
tag = tagOverride
98+
// Allow tests to override the version.txt contents.
99+
if versionOverride := envutil.EnvOrDefaultString(
100+
"COCKROACH_TESTING_VERSION_OVERRIDE", ""); versionOverride != "" {
101+
TestingOverrideVersion(versionOverride)
83102
}
84103
}
85104

@@ -133,28 +152,31 @@ func (b Info) Timestamp() (int64, error) {
133152

134153
// GetInfo returns an Info struct populated with the build information.
135154
func GetInfo() Info {
155+
ch := channel
156+
if ch == "" {
157+
ch = "unknown"
158+
}
136159
return Info{
137160
GoVersion: runtime.Version(),
138-
Tag: tag,
161+
Tag: binaryVersion,
139162
Time: utcTime,
140163
Revision: rev,
141164
CgoCompiler: cgoCompiler,
142165
CgoTargetTriple: cgoTargetTriple,
143166
Platform: platform,
144167
Distribution: Distribution,
145168
Type: typ,
146-
Channel: channel,
169+
Channel: ch,
147170
EnvChannel: envChannel,
148171
}
149172
}
150173

151-
// TestingOverrideTag allows tests to override the build tag.
152-
func TestingOverrideTag(t string) func() {
153-
prev := tag
154-
prevVersion := binaryVersion
155-
tag = t
156-
binaryVersion = computeVersion(tag)
157-
return func() { tag = prev; binaryVersion = prevVersion }
174+
// TestingOverrideVersion allows tests to override the binary version
175+
// reported by cockroach.
176+
func TestingOverrideVersion(v string) func() {
177+
prevBinaryVersion := binaryVersion
178+
binaryVersion = v
179+
return func() { binaryVersion = prevBinaryVersion }
158180
}
159181

160182
// MakeIssueURL produces a URL to a CockroachDB issue.

pkg/build/info.pb.go

Lines changed: 27 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/build/info.proto

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@
1010

1111
syntax = "proto2";
1212
package cockroach.build;
13-
option go_package = "build";
13+
option go_package = "github.com/cockroachdb/cockroach/pkg/build";
1414

1515
import "gogoproto/gogo.proto";
1616

1717
// Info describes build information for this CockroachDB binary.
1818
message Info {
1919
// go_version is the version of the Go toolchain used to compile this executable.
2020
optional string go_version = 1 [(gogoproto.nullable) = false];
21-
// tag is the git tag for the revision of the source code for this executable.
21+
// tag is the binary version for the revision of the source code for
22+
// this executable. This used to be the git tag for the build, but
23+
// has since moved to the contents of the `version.txt` file.
2224
optional string tag = 2 [(gogoproto.nullable) = false];
2325
// time is the time at which the build started.
2426
optional string time = 3 [(gogoproto.nullable) = false];

0 commit comments

Comments
 (0)