Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: upgrade to golang v1.21.3 #112349

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ build:crosslinuxfips '--workspace_status_command=./build/bazelutil/stamp.sh x86_
build:crosslinuxfips --config=crosslinuxfipsbase
build:crosslinuxfipsbase --platforms=//build/toolchains:cross_linux
build:crosslinuxfipsbase --config=cross
build:crosslinuxfipsbase --@io_bazel_rules_go//go/toolchain:sdk_version=1.20.7fips
build:crosslinuxfipsbase --@io_bazel_rules_go//go/toolchain:sdk_version=1.21.3fips
build:crosswindows '--workspace_status_command=./build/bazelutil/stamp.sh x86_64-w64-mingw32'
build:crosswindows --config=crosswindowsbase
build:crosswindowsbase --platforms=//build/toolchains:cross_windows
Expand Down
20 changes: 10 additions & 10 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@ load(
go_download_sdk(
name = "go_sdk",
sdks = {
"darwin_amd64": ("go1.20.10.darwin-amd64.tar.gz", "9f554a97818568cdcb58b8860ebdc0d25cbe7a6441e7f8fc9612c00330d3f145"),
"darwin_arm64": ("go1.20.10.darwin-arm64.tar.gz", "4920629c1e65cf28f4fb8c74d7b2f90a1bb6333df60d2fd7e756a3436209f004"),
"linux_amd64": ("go1.20.10.linux-amd64.tar.gz", "cb95ca59edf9d15d6e7949395756f78542383b612abced2565ad2349213a36e3"),
"linux_arm64": ("go1.20.10.linux-arm64.tar.gz", "5fa30f7c4f39c96d31756d7eab6c560ac129caf0462512c9f1fc2afa00570778"),
"windows_amd64": ("go1.20.10.windows-amd64.tar.gz", "d84f04cf636033073c114ac5c51f38d948bf21bb53b3aa9442d362e970f94b32"),
"darwin_amd64": ("go1.21.3.darwin-amd64.tar.gz", "253d8d4b32a1d7731dff1245f009362858a0c685af8f52b671dd906b2c67d78d"),
"darwin_arm64": ("go1.21.3.darwin-arm64.tar.gz", "877543c11149341e4954cb2e625deb7974e94c3c77f5f71a24d35e54cb54fb05"),
"linux_amd64": ("go1.21.3.linux-amd64.tar.gz", "3b0307b4e91d6b34870ed1d29366aba77cb864dc93b7098cdfb5d4619cb58566"),
"linux_arm64": ("go1.21.3.linux-arm64.tar.gz", "c0d2da5e1b9ff93d0e4262189e59586cc0c17c207578429f716de2d5799ba36a"),
"windows_amd64": ("go1.21.3.windows-amd64.tar.gz", "c0e2957014e72056ed1c2c080d772d7c8e96a3143f228f6b511231fc31c07593"),
},
urls = ["https://storage.googleapis.com/public-bazel-artifacts/go/20231011-170949/{}"],
version = "1.20.10",
urls = ["https://storage.googleapis.com/public-bazel-artifacts/go/20231019-214851/{}"],
version = "1.21.3",
)

# To point to a local SDK path, use the following instead. We'll call the
Expand Down Expand Up @@ -608,8 +608,8 @@ distdir_repositories()
go_download_sdk(
name = "go_sdk_fips",
sdks = {
"linux_amd64": ("go1.20.7fips.linux-amd64.tar.gz", "e153224976a6cc17cc24128609ef9eaf9fc94b33744ff00646ba36a6f448a074"),
"linux_amd64": ("go1.21.3fips.linux-amd64.tar.gz", "216acc2939bf16748ec240ffe1752b442ec098bd9ac5e12ecd44db4ff77e0ab9"),
},
urls = ["https://storage.googleapis.com/public-bazel-artifacts/go/20231011-170949/{}"],
version = "1.20.7fips",
urls = ["https://storage.googleapis.com/public-bazel-artifacts/go/20231019-214851/{}"],
version = "1.21.3fips",
)
12 changes: 6 additions & 6 deletions build/bazelutil/distdir_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1188,12 +1188,12 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20230718-202534/libproj_foreign.macos.20230718-202534.tar.gz": "96771a33542beb72067afcafaeb790134014e56798fa4cbe291894c4ebf8b68d",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20230718-202534/libproj_foreign.macosarm.20230718-202534.tar.gz": "b2c60ffe1f50c6e81ba906f773b95d3a6699538d57e71749579552f4211a1e3e",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20230718-202534/libproj_foreign.windows.20230718-202534.tar.gz": "16de1e76ee8de4bd144dc57bfde05385d086943ca1b64cc246055c8b0cd71c65",
"https://storage.googleapis.com/public-bazel-artifacts/go/20231011-170949/go1.20.10.darwin-amd64.tar.gz": "9f554a97818568cdcb58b8860ebdc0d25cbe7a6441e7f8fc9612c00330d3f145",
"https://storage.googleapis.com/public-bazel-artifacts/go/20231011-170949/go1.20.10.darwin-arm64.tar.gz": "4920629c1e65cf28f4fb8c74d7b2f90a1bb6333df60d2fd7e756a3436209f004",
"https://storage.googleapis.com/public-bazel-artifacts/go/20231011-170949/go1.20.10.linux-amd64.tar.gz": "cb95ca59edf9d15d6e7949395756f78542383b612abced2565ad2349213a36e3",
"https://storage.googleapis.com/public-bazel-artifacts/go/20231011-170949/go1.20.10.linux-arm64.tar.gz": "5fa30f7c4f39c96d31756d7eab6c560ac129caf0462512c9f1fc2afa00570778",
"https://storage.googleapis.com/public-bazel-artifacts/go/20231011-170949/go1.20.10.windows-amd64.tar.gz": "d84f04cf636033073c114ac5c51f38d948bf21bb53b3aa9442d362e970f94b32",
"https://storage.googleapis.com/public-bazel-artifacts/go/20231011-170949/go1.20.7fips.linux-amd64.tar.gz": "e153224976a6cc17cc24128609ef9eaf9fc94b33744ff00646ba36a6f448a074",
"https://storage.googleapis.com/public-bazel-artifacts/go/20231019-214851/go1.21.3.darwin-amd64.tar.gz": "253d8d4b32a1d7731dff1245f009362858a0c685af8f52b671dd906b2c67d78d",
"https://storage.googleapis.com/public-bazel-artifacts/go/20231019-214851/go1.21.3.darwin-arm64.tar.gz": "877543c11149341e4954cb2e625deb7974e94c3c77f5f71a24d35e54cb54fb05",
"https://storage.googleapis.com/public-bazel-artifacts/go/20231019-214851/go1.21.3.linux-amd64.tar.gz": "3b0307b4e91d6b34870ed1d29366aba77cb864dc93b7098cdfb5d4619cb58566",
"https://storage.googleapis.com/public-bazel-artifacts/go/20231019-214851/go1.21.3.linux-arm64.tar.gz": "c0d2da5e1b9ff93d0e4262189e59586cc0c17c207578429f716de2d5799ba36a",
"https://storage.googleapis.com/public-bazel-artifacts/go/20231019-214851/go1.21.3.windows-amd64.tar.gz": "c0e2957014e72056ed1c2c080d772d7c8e96a3143f228f6b511231fc31c07593",
"https://storage.googleapis.com/public-bazel-artifacts/go/20231019-214851/go1.21.3fips.linux-amd64.tar.gz": "216acc2939bf16748ec240ffe1752b442ec098bd9ac5e12ecd44db4ff77e0ab9",
"https://storage.googleapis.com/public-bazel-artifacts/java/railroad/rr-1.63-java8.zip": "d2791cd7a44ea5be862f33f5a9b3d40aaad9858455828ebade7007ad7113fb41",
"https://storage.googleapis.com/public-bazel-artifacts/js/rules_jest-v0.18.4.tar.gz": "d3bb833f74b8ad054e6bff5e41606ff10a62880cc99e4d480f4bdfa70add1ba7",
"https://storage.googleapis.com/public-bazel-artifacts/js/rules_js-v1.26.1.tar.gz": "08061ba5e5e7f4b1074538323576dac819f9337a0c7d75aee43afc8ae7cb6e18",
Expand Down
4 changes: 2 additions & 2 deletions build/bootstrap/bootstrap-debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ sudo tar -C /usr --strip-components=1 -zxf /tmp/cmake.tgz && rm /tmp/cmake.tgz

# Install Go.
trap 'rm -f /tmp/go.tgz' EXIT
curl -fsSL https://dl.google.com/go/go1.20.10.linux-amd64.tar.gz > /tmp/go.tgz
curl -fsSL https://dl.google.com/go/go1.21.3.linux-amd64.tar.gz > /tmp/go.tgz
sha256sum -c - <<EOF
80d34f1fd74e382d86c2d6102e0e60d4318461a7c2f457ec1efc4042752d4248 /tmp/go.tgz
1241381b2843fae5a9707eec1f8fb2ef94d827990582c7c7c32f5bdfbfd420c8 /tmp/go.tgz
EOF
sudo tar -C /usr/local -zxf /tmp/go.tgz && rm /tmp/go.tgz

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,37 +75,117 @@ index 554a60d747..8d64ee31c8 100644
if gcBlackenEnabled != 0 && gp.gcAssistBytes > 0 {
// Flush assist credit to the global pool. This gives
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index 9381d1e3f7..8182f8e9bc 100644
index f4c76abd1c..57672bd8c5 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -474,7 +474,6 @@ type g struct {
traceseq uint64 // trace event sequencer
tracelastp puintptr // last P emitted an event for this goroutine
lockedm muintptr
- sig uint32
writebuf []byte
sigcode0 uintptr
sigcode1 uintptr
@@ -488,6 +487,9 @@ type g struct {
labels unsafe.Pointer // profiler labels
timer *timer // cached timer for time.Sleep
selectDone atomic.Uint32 // are we participating in a select and did someone win the race?
+ sig uint32
+ lastsched int64 // timestamp when the G last started running
+ runningnanos int64 // wall time spent in the running state
@@ -477,7 +477,6 @@ type g struct {
trackingStamp int64 // timestamp of when the G last started being tracked
runnableTime int64 // the amount of time spent runnable, cleared when running, only used when tracking
lockedm muintptr
- sig uint32
writebuf []byte
sigcode0 uintptr
sigcode1 uintptr
@@ -492,6 +491,9 @@ type g struct {
labels unsafe.Pointer // profiler labels
timer *timer // cached timer for time.Sleep
selectDone atomic.Uint32 // are we participating in a select and did someone win the race?
+ sig uint32
+ lastsched int64 // timestamp when the G last started running
+ runningnanos int64 // wall time spent in the running state

// goroutineProfiled indicates the status of this goroutine's stack for the
// current in-progress goroutine profile
diff --git a/src/runtime/sizeof_test.go b/src/runtime/sizeof_test.go
index 9ce0a3afcd..bfb5d6e33e 100644
index fb9195481a..55e37287c2 100644
--- a/src/runtime/sizeof_test.go
+++ b/src/runtime/sizeof_test.go
@@ -21,7 +21,7 @@ func TestSizeof(t *testing.T) {
@@ -21,6 +21,6 @@ func TestSizeof(t *testing.T) {
_32bit uintptr // size on 32bit platforms
_64bit uintptr // size on 64bit platforms
}{
- {runtime.G{}, 240, 392}, // g, but exported for testing
+ {runtime.G{}, 248, 400}, // g, but exported for testing
- {runtime.G{}, 252, 408}, // g, but exported for testing
+ {runtime.G{}, 260, 416}, // g, but exported for testing
{runtime.Sudog{}, 56, 88}, // sudog, but exported for testing
}
diff -ru a/src/context/context.go b/src/context/context.go
--- a/src/context/context.go
+++ b/src/context/context.go
@@ -472,17 +472,7 @@

if p, ok := parentCancelCtx(parent); ok {
// parent is a *cancelCtx, or derives from one.
- p.mu.Lock()
- if p.err != nil {
- // parent has already been canceled
- child.cancel(false, p.err, p.cause)
- } else {
- if p.children == nil {
- p.children = make(map[canceler]struct{})
- }
- p.children[child] = struct{}{}
- }
- p.mu.Unlock()
+ p.addChild(child)
return
}

@@ -510,6 +500,22 @@
}()
}

+// addChild adds child to the list of children.
+// NB: CockroachDB runtime patch.
+func (c *cancelCtx) addChild(child canceler) {
+ c.mu.Lock()
+ if c.err != nil {
+ // parent has already been canceled
+ child.cancel(false, c.err, c.cause)
+ } else {
+ if c.children == nil {
+ c.children = make(map[canceler]struct{})
+ }
+ c.children[child] = struct{}{}
+ }
+ c.mu.Unlock()
+}
+
type stringer interface {
String() string
}
@@ -781,5 +787,35 @@
default:
return c.Value(key)
}
+ }
+}
+
+// CockroachDB runtime patch.
+// cancelerAdapter invokes f when cancel context completes.
+type cancelerAdapter struct {
+ *cancelCtx
+ f func()
+}
+
+func (c *cancelerAdapter) cancel(removeFromParent bool, err, cause error) {
+ if removeFromParent {
+ removeChild(c.cancelCtx, c)
}
+ c.f()
}
+
+// PropagateCancel arranges for f to be invoked when parent is done.
+// Parent must be one of the cancelable contexts.
+// Returns true if cancellation will be propagated, false if the parent
+// is not cancelable.
+// This is similar to AfterFunc(), but does not spin up goroutine, and instead
+// invokes f on whatever goroutine completed parent context.
+func PropagateCancel(parent Context, f func()) bool {
+ p, ok := parent.Value(&cancelCtxKey).(*cancelCtx)
+ if !ok {
+ return false
+ }
+ a := cancelerAdapter{cancelCtx: p, f: f}
+ p.addChild(&a)
+ return true
+}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ set -xeuo pipefail

# TODO: We may want to fork this repo and keep it up to date.
GO_FIPS_REPO=https://github.com/golang-fips/go
GO_FIPS_COMMIT=go1.20-fips-release
GO_VERSION=1.20.7
GO_FIPS_COMMIT=go1.21-fips-release
GO_VERSION=1.21.3

# Install build dependencies
yum install git golang golang-bin openssl openssl-devel -y
Expand All @@ -27,7 +27,7 @@ cd go/src
# Apply the CRL patch
patch -p2 < /bootstrap/diff.patch
# add a special version modifier so we can explicitly use it in bazel
sed -i 's/$/fips/' ../VERSION
sed -i '1 s/$/fips/' ../VERSION
./make.bash -v
cd ../..
GOVERS=$(go/bin/go env GOVERSION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
set -xeuo pipefail

# When updating to a new Go version, update all of these variables.
GOVERS=1.20.10
GOVERS=1.21.3
GOLINK=https://go.dev/dl/go$GOVERS.src.tar.gz
SRCSHASUM=72d2f51805c47150066c103754c75fddb2c19d48c9219fa33d1e46696c841dbb
SRCSHASUM=186f2b6f8c8b704e696821b09ab2041a5c1ee13dcbc3156a13adcf75931ee488
# We use this for bootstrapping (this is NOT re-published). Note the version
# matches the version we're publishing, although it doesn't technically have to.
GOLINUXLINK=https://go.dev/dl/go$GOVERS.linux-amd64.tar.gz
LINUXSHASUM=1241381b2843fae5a9707eec1f8fb2ef94d827990582c7c7c32f5bdfbfd420c8

apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
Expand All @@ -24,8 +28,8 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-10 100 \
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-10

curl -fsSL https://go.dev/dl/go1.20.8.linux-amd64.tar.gz -o golang.tar.gz \
&& echo 'cc97c28d9c252fbf28f91950d830201aa403836cbed702a05932e63f7f0c7bc4 golang.tar.gz' | sha256sum -c - \
curl -fsSL $GOLINUXLINK -o golang.tar.gz \
&& echo "$LINUXSHASUM golang.tar.gz" | sha256sum -c - \
&& rm -rf /usr/local/go && tar -C /usr/local -xzf golang.tar.gz \
&& rm golang.tar.gz

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/cockroachdb/cockroach

go 1.20
go 1.21

// The following dependencies are key infrastructure dependencies and
// should be updated as their own commit (i.e. not bundled with a dep
Expand Down
Loading