Skip to content

Commit

Permalink
*: upgrade to go 1.21.0
Browse files Browse the repository at this point in the history
* [ ] Adjust the Pebble tests to run in new version.
* [ ] Adjust version in Docker image ([source](./builder/Dockerfile)).
* [ ] Adjust version in the TeamCity agent image ([setup script](./packer/teamcity-agent.sh))
* [ ] Rebuild and push the Docker image (following [Basic Process](#basic-process))
* [ ] Update `build/teamcity/internal/release/build-and-publish-patched-go/impl.sh` with the new version and adjust SHA256 sums as necessary.
* [ ] Run the `Internal / Cockroach / Build / Toolchains / Publish Patched Go for Mac` build configuration in TeamCity with your latest version of the script above. Note the job depends on another job `Build and Publish Patched Go`. That job prints out the SHA256 of all tarballs, which you will need to copy-paste into `WORKSPACE` (see below). `Publish Patched Go for Mac` is an extra step that publishes the *signed* `go` binaries for macOS. That job also prints out the SHA256 of the Mac tarballs in particular.
* [ ] Bump the version in `WORKSPACE` under `go_download_sdk`. You may need to bump [rules_go](https://github.com/bazelbuild/rules_go/releases). Also edit the filenames listed in `sdks` and update all the hashes to match what you built in the step above.
* [ ] Run `./dev generate bazel` to refresh `distdir_files.bzl`, then `bazel fetch @distdir//:archives` to ensure you've updated all hashes to the correct value.
* [ ] Bump the version in `builder.sh` accordingly ([source](./builder.sh#L6)).
* [ ] Bump the version in `go-version-check.sh` ([source](./go-version-check.sh)), unless bumping to a new patch release.
* [ ] Bump the go version in `go.mod`.
* [ ] Bump the default installed version of Go in `bootstrap-debian.sh` ([source](./bootstrap/bootstrap-debian.sh)).
* [ ] Replace other mentions of the older version of go (grep for `golang:<old_version>` and `go<old_version>`).
* [ ] Update the `builder.dockerImage` parameter in the TeamCity [`Cockroach`](https://teamcity.cockroachdb.com/admin/editProject.html?projectId=Cockroach&tab=projectParams) and [`Internal`](https://teamcity.cockroachdb.com/admin/editProject.html?projectId=Internal&tab=projectParams) projects.
* [ ] Ask the Developer Infrastructure team to deploy new TeamCity agent images according to [packer/README.md](./packer/README.md)

Release note (build change): upgrade to go 1.21.0
Epic: none
  • Loading branch information
healthy-pod committed Aug 30, 2023
1 parent fa4f9ba commit e003793
Show file tree
Hide file tree
Showing 27 changed files with 439 additions and 99 deletions.
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ exports_files([
# gazelle:resolve go github.com/cockroachdb/cockroach/pkg/util/json_test //pkg/util/json:json_test
# gazelle:resolve go google.golang.org/genproto/googleapis/pubsub/v1 @org_golang_google_genproto//googleapis/pubsub/v1:pubsub
# gazelle:resolve go google.golang.org/genproto/googleapis/cloud/kms/v1 @org_golang_google_genproto//googleapis/cloud/kms/v1:kms
# gazelle:resolve go google.golang.org/genproto/googleapis/devtools/build/v1 @org_golang_google_genproto//googleapis/devtools/build/v1:build

# See pkg/kv/kvpb/gen/BUILD.bazel for more details.
#
Expand Down
38 changes: 19 additions & 19 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Load go bazel tools. This gives us access to the go bazel SDK/toolchains.
http_archive(
name = "io_bazel_rules_go",
sha256 = "7ab77b5bd3ac04a65860b0e26f2855c977d463d8e9b5ce2458e516b110eb5eeb",
strip_prefix = "cockroachdb-rules_go-f1ab269",
sha256 = "824f524fed040e3844025a4274ad03523c38aabe1017c52f72e6d721311f07e3",
strip_prefix = "cockroachdb-rules_go-310eb8a",
urls = [
# cockroachdb/rules_go as of f1ab26925b5da24119d38115a657f27a90288db5
# (upstream release-0.40 plus a few patches).
"https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-341-gf1ab269.tar.gz",
# cockroachdb/rules_go as of 310eb8ab3c7d53c21c8a5805d1ea77e39cf8552b
# (upstream release-0.41 plus a few patches).
"https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-352-g310eb8a.tar.gz",
]
)

Expand Down Expand Up @@ -129,22 +129,22 @@ http_archive(
"-p1",
],
patches = [
"@io_bazel_rules_go//third_party:go_googleapis-deletebuild.patch",
"@io_bazel_rules_go//third_party:go_googleapis-directives.patch",
"@io_bazel_rules_go//third_party:go_googleapis-gazelle.patch",
"@com_github_cockroachdb_cockroach//build/patches:go_googleapis.patch",
],
sha256 = "ba694861340e792fd31cb77274eacaf6e4ca8bda97707898f41d8bebfd8a4984",
strip_prefix = "googleapis-83c3605afb5a39952bf0a0809875d41cf2a558ca",
# master, as of 2022-12-05
# NB: You may have to update this when bumping rules_go. Bumping to the same
# version in rules_go (go/private/repositories.bzl) is probably what you
# want to do.
urls = [
"https://storage.googleapis.com/public-bazel-artifacts/bazel/googleapis-83c3605afb5a39952bf0a0809875d41cf2a558ca.zip",
],
)

load("@go_googleapis//:repository_rules.bzl", "switched_rules_by_language")

switched_rules_by_language(
name = "com_google_googleapis_imports",
)

# com_github_golang_mock handled in DEPS.bzl.

# Load the go dependencies and invoke them.
Expand All @@ -162,15 +162,15 @@ load(
go_download_sdk(
name = "go_sdk",
sdks = {
"darwin_amd64": ("go1.19.10.darwin-amd64.tar.gz", "48361d76271f9a725942bdc17012ae9fef72359f7b0aa303deb1098e05ef818c"),
"darwin_arm64": ("go1.19.10.darwin-arm64.tar.gz", "7cc8ab7e8e1225b57f44ec8fb26bce70ddea8e076dfdf118ed63fef0c9ff19fb"),
"freebsd_amd64": ("go1.19.10.freebsd-amd64.tar.gz", "0d22265662eaa9b8136223f8ab68f5c06c58c6a6311748fb810e830ebd17cbe2"),
"linux_amd64": ("go1.19.10.linux-amd64.tar.gz", "dfc8a696686d00065ba374209a3a7858926641e0fb55741dd89c357446d69a1e"),
"linux_arm64": ("go1.19.10.linux-arm64.tar.gz", "e36d6ebfce3f244e245a2969f83d26c8dff2bf8b72207822d9d66829cd93d067"),
"windows_amd64": ("go1.19.10.windows-amd64.tar.gz", "dab9df83e0768ff96eddd85a4def88db05ce5a8a0c439abcecd066888906c516"),
"darwin_amd64": ("go1.21.0.darwin-amd64.tar.gz", "5f5fc609686c1a80c18fb5cc57a2251e2ce97a2a0d5da651fc2a4a0a3240deb3"),
"darwin_arm64": ("go1.21.0.darwin-arm64.tar.gz", "974b76bc36f8438d111201fc799a96ee03d7f2f1464a957cdff671d8f0aeac2e"),
"freebsd_amd64": ("go1.21.0.freebsd-amd64.tar.gz", "b8eaa36654625df799654f77f4af0ea7bd9e5e760ebe86e68fe7c484748ae995"),
"linux_amd64": ("go1.21.0.linux-amd64.tar.gz", "0a6cb41bad7ce4065cda66f39fa9bb55ae3f8e0c4bfd9ac452e68192bddc2308"),
"linux_arm64": ("go1.21.0.linux-arm64.tar.gz", "fcb3dc6a5cf5c8870b0407889d23d2aa4eb93f7b6f02a39fcd93f0883d2d5980"),
"windows_amd64": ("go1.21.0.windows-amd64.tar.gz", "50262e5cfeac027f4fde3cffdf6d7dce166ee754e7d980dc31f8ae374ae2c6c7"),
},
urls = ["https://storage.googleapis.com/public-bazel-artifacts/go/20230614-165357/{}"],
version = "1.19.10",
urls = ["https://storage.googleapis.com/public-bazel-artifacts/go/20230828-221325/{}"],
version = "1.21.0",
)

# To point to a local SDK path, use the following instead. We'll call the
Expand Down
14 changes: 7 additions & 7 deletions build/bazelutil/distdir_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/public-bazel-artifacts/bazel/bmatcuk-doublestar-v4.0.1-0-gf7a8118.tar.gz": "d11c3b3a45574f89d6a6b2f50e53feea50df60407b35f36193bf5815d32c79d1",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-protobuf-3f5d91f.tar.gz": "6d4e7fe1cbd958dee69ce9becbf8892d567f082b6782d3973a118d0aa00807a8",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_foreign_cc-6f7f1b1.tar.gz": "272ac2cde4efd316c8d7c0140dee411c89da104466701ac179286ef5a89c7b58",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-341-gf1ab269.tar.gz": "7ab77b5bd3ac04a65860b0e26f2855c977d463d8e9b5ce2458e516b110eb5eeb",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-352-g310eb8a.tar.gz": "824f524fed040e3844025a4274ad03523c38aabe1017c52f72e6d721311f07e3",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/google-starlark-go-e043a3d.tar.gz": "a35c6468e0e0921833a63290161ff903295eaaf5915200bbce272cbc8dfd1c1c",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/googleapis-83c3605afb5a39952bf0a0809875d41cf2a558ca.zip": "ba694861340e792fd31cb77274eacaf6e4ca8bda97707898f41d8bebfd8a4984",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/platforms-0.0.4.tar.gz": "079945598e4b6cc075846f7fd6a9d0857c33a7afc0de868c2ccb96405225135d",
Expand All @@ -1190,13 +1190,13 @@ 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/20230614-165357/go1.19.10.darwin-amd64.tar.gz": "48361d76271f9a725942bdc17012ae9fef72359f7b0aa303deb1098e05ef818c",
"https://storage.googleapis.com/public-bazel-artifacts/go/20230614-165357/go1.19.10.darwin-arm64.tar.gz": "7cc8ab7e8e1225b57f44ec8fb26bce70ddea8e076dfdf118ed63fef0c9ff19fb",
"https://storage.googleapis.com/public-bazel-artifacts/go/20230614-165357/go1.19.10.freebsd-amd64.tar.gz": "0d22265662eaa9b8136223f8ab68f5c06c58c6a6311748fb810e830ebd17cbe2",
"https://storage.googleapis.com/public-bazel-artifacts/go/20230614-165357/go1.19.10.linux-amd64.tar.gz": "dfc8a696686d00065ba374209a3a7858926641e0fb55741dd89c357446d69a1e",
"https://storage.googleapis.com/public-bazel-artifacts/go/20230614-165357/go1.19.10.linux-arm64.tar.gz": "e36d6ebfce3f244e245a2969f83d26c8dff2bf8b72207822d9d66829cd93d067",
"https://storage.googleapis.com/public-bazel-artifacts/go/20230614-165357/go1.19.10.windows-amd64.tar.gz": "dab9df83e0768ff96eddd85a4def88db05ce5a8a0c439abcecd066888906c516",
"https://storage.googleapis.com/public-bazel-artifacts/go/20230614-165357/go1.19.10fips.linux-amd64.tar.gz": "c9348fc964fb2893471a6ba91feead205a6f83cd427bc3847949382417005496",
"https://storage.googleapis.com/public-bazel-artifacts/go/20230828-221325/go1.21.0.darwin-amd64.tar.gz": "5f5fc609686c1a80c18fb5cc57a2251e2ce97a2a0d5da651fc2a4a0a3240deb3",
"https://storage.googleapis.com/public-bazel-artifacts/go/20230828-221325/go1.21.0.darwin-arm64.tar.gz": "974b76bc36f8438d111201fc799a96ee03d7f2f1464a957cdff671d8f0aeac2e",
"https://storage.googleapis.com/public-bazel-artifacts/go/20230828-221325/go1.21.0.freebsd-amd64.tar.gz": "b8eaa36654625df799654f77f4af0ea7bd9e5e760ebe86e68fe7c484748ae995",
"https://storage.googleapis.com/public-bazel-artifacts/go/20230828-221325/go1.21.0.linux-amd64.tar.gz": "0a6cb41bad7ce4065cda66f39fa9bb55ae3f8e0c4bfd9ac452e68192bddc2308",
"https://storage.googleapis.com/public-bazel-artifacts/go/20230828-221325/go1.21.0.linux-arm64.tar.gz": "fcb3dc6a5cf5c8870b0407889d23d2aa4eb93f7b6f02a39fcd93f0883d2d5980",
"https://storage.googleapis.com/public-bazel-artifacts/go/20230828-221325/go1.21.0.windows-amd64.tar.gz": "50262e5cfeac027f4fde3cffdf6d7dce166ee754e7d980dc31f8ae374ae2c6c7",
"https://storage.googleapis.com/public-bazel-artifacts/gomod/github.com/bazelbuild/buildtools/v6.1.2-0-gb182fc4/bazelbuild-buildtools-v6.1.2-0-gb182fc4.tar.gz": "d71a889e3bc50cc8b9d42c859e15a74f7c8d10b6786f8dd82f08f2bf24e5bdc6",
"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",
Expand Down
2 changes: 1 addition & 1 deletion build/builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -euo pipefail

image=cockroachdb/builder
version=20230815-142459
version=20230828-185934

function init() {
docker build --tag="${image}" "$(dirname "${0}")/builder"
Expand Down
7 changes: 4 additions & 3 deletions build/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ RUN curl -fsSL https://github.com/Kitware/CMake/releases/download/v3.20.3/cmake-
# NB: care needs to be taken when updating this version because earlier
# releases of Go will no longer be run in CI once it is changed. Consider
# bumping the minimum allowed version of Go in /build/go-version-check.sh.
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends golang \
&& curl -fsSL https://storage.googleapis.com/golang/go1.19.10.src.tar.gz -o golang.tar.gz \
&& echo '13755bcce529747d5f2930dee034730c86d02bd3e521ab3e2bbede548d3b953f golang.tar.gz' | sha256sum -c - \
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common && add-apt-repository ppa:longsleep/golang-backports \
&& apt-get install -y --no-install-recommends golang-go \
&& curl -fsSL https://storage.googleapis.com/golang/go1.21.0.src.tar.gz -o golang.tar.gz \
&& echo '818d46ede85682dd551ad378ef37a4d247006f12ec59b5b755601d2ce114369a golang.tar.gz' | sha256sum -c - \
&& tar -C /usr/local -xzf golang.tar.gz \
&& rm golang.tar.gz \
&& cd /usr/local/go/src \
Expand Down
4 changes: 2 additions & 2 deletions build/packer/teamcity-agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ tar --strip-components=1 -C /usr -xzf /tmp/cmake.tar.gz
rm -f /tmp/cmake.tar.gz

if [[ $ARCH = x86_64 ]]; then
curl -fsSL https://dl.google.com/go/go1.19.10.linux-amd64.tar.gz > /tmp/go.tgz
curl -fsSL https://dl.google.com/go/go1.21.0.linux-amd64.tar.gz > /tmp/go.tgz
sha256sum -c - <<EOF
8b045a483d3895c6edba2e90a9189262876190dbbd21756870cdd63821810677 /tmp/go.tgz
d0398903a16ba2232b389fb31032ddf57cac34efda306a0eebac34f0965a0742 /tmp/go.tgz
EOF
tar -C /usr/local -zxf /tmp/go.tgz && rm /tmp/go.tgz
# Explicitly symlink the pinned version to /usr/bin.
Expand Down
25 changes: 13 additions & 12 deletions build/patches/go_googleapis.patch
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
diff -urN a/google/cloud/kms/v1/BUILD.bazel b/google/cloud/kms/v1/BUILD.bazel
--- a/google/cloud/kms/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
+++ b/google/cloud/kms/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
@@ -23,5 +23,11 @@
@@ -128,8 +128,11 @@
importpath = "google.golang.org/genproto/googleapis/cloud/kms/v1",
proto = ":kms_proto",
visibility = ["//visibility:public"],
- deps = ["//google/api:annotations_go_proto"],
+ deps = [
protos = [":kms_proto"],
deps = [
- "//google/api:annotations_go_proto",
- "//google/iam/v1:iam_go_proto",
+ "@com_github_golang_protobuf//ptypes/duration:go_default_library",
+ "@com_github_golang_protobuf//ptypes/timestamp:go_default_library",
+ "@com_github_golang_protobuf//ptypes/wrappers:go_default_library",
+ "@org_golang_google_genproto//googleapis/api/annotations:go_default_library",
+ "@org_golang_google_genproto//protobuf/field_mask:go_default_library",
+ ],
],
)

diff -urN a/google/devtools/build/v1/BUILD.bazel a/google/devtools/build/v1/BUILD.bazel
--- a/google/devtools/build/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
+++ b/google/devtools/build/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
@@ -25,5 +25,13 @@
@@ -129,7 +129,13 @@
importpath = "google.golang.org/genproto/googleapis/devtools/build/v1",
proto = ":build_proto",
visibility = ["//visibility:public"],
- deps = ["//google/api:annotations_go_proto"],
+ deps = [
protos = [":build_proto"],
deps = [
- "//google/api:annotations_go_proto",
+ "@com_github_golang_protobuf//ptypes/any:go_default_library",
+ "@com_github_golang_protobuf//ptypes/duration:go_default_library",
+ "@com_github_golang_protobuf//ptypes/empty:go_default_library",
+ "@com_github_golang_protobuf//ptypes/timestamp:go_default_library",
+ "@com_github_golang_protobuf//ptypes/wrappers:go_default_library",
+ "@org_golang_google_genproto//googleapis/api/annotations:go_default_library",
+ "@org_golang_google_genproto//protobuf/field_mask:go_default_library",
+ ],
],
)

Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 3991a48b10..4a50ae650d 100644
index 554a60d747..8d64ee31c8 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -994,8 +994,19 @@ func casgstatus(gp *g, oldval, newval uint32) {
@@ -1027,7 +1027,18 @@ func casgstatus(gp *g, oldval, newval uint32) {
}
}

- // Handle tracking for scheduling latencies.
+ // Handle tracking for scheduling and running latencies.
+ now := nanotime()
+ if newval == _Grunning {
+ // We're transitioning into the running state, record the timestamp for
Expand All @@ -20,26 +18,40 @@ index 3991a48b10..4a50ae650d 100644
+ // state.
+ gp.runningnanos += now - gp.lastsched
+
// Track every 8th time a goroutine transitions out of running.
if gp.trackingSeq%gTrackingPeriod == 0 {
// Track every gTrackingPeriod time a goroutine transitions out of running.
if casgstatusAlwaysTrack || gp.trackingSeq%gTrackingPeriod == 0 {
gp.tracking = true
@@ -1007,14 +1018,12 @@ func casgstatus(gp *g, oldval, newval uint32) {
// We transitioned out of runnable, so measure how much
// time we spent in this state and add it to
// runnableTime.
- now := nanotime()
gp.runnableTime += now - gp.runnableStamp
gp.runnableStamp = 0
@@ -1048,7 +1059,6 @@ func casgstatus(gp *g, oldval, newval uint32) {
// We transitioned out of runnable, so measure how much
// time we spent in this state and add it to
// runnableTime.
- now := nanotime()
gp.runnableTime += now - gp.trackingStamp
gp.trackingStamp = 0
case _Gwaiting:
@@ -1061,7 +1071,6 @@ func casgstatus(gp *g, oldval, newval uint32) {
// a more representative estimate of the absolute value.
// gTrackingPeriod also represents an accurate sampling period
// because we can only enter this state from _Grunning.
- now := nanotime()
sched.totalMutexWaitTime.Add((now - gp.trackingStamp) * gTrackingPeriod)
gp.trackingStamp = 0
}
@@ -1072,12 +1081,10 @@ func casgstatus(gp *g, oldval, newval uint32) {
break
}
if newval == _Grunnable {
// We just transitioned into runnable, so record what
// time that happened.
- now := nanotime()
gp.runnableStamp = now
} else if newval == _Grunning {
// We're transitioning into running, so turn off
@@ -3258,6 +3267,14 @@ func dropg() {
setGNoWB(&_g_.m.curg, nil)
// Blocking on a lock. Write down the timestamp.
- now := nanotime()
gp.trackingStamp = now
case _Grunnable:
// We just transitioned into runnable, so record what
// time that happened.
- now := nanotime()
gp.trackingStamp = now
case _Grunning:
// We're transitioning into running, so turn off
@@ -3412,6 +3419,14 @@ func dropg() {
setGNoWB(&gp.m.curg, nil)
}

+// grunningnanos returns the wall time spent by current g in the running state.
Expand All @@ -53,7 +65,7 @@ index 3991a48b10..4a50ae650d 100644
// checkTimers runs any timers for the P that are ready.
// If now is not 0 it is the current time.
// It returns the passed time or the current time if now was passed as 0.
@@ -3491,6 +3508,8 @@ func goexit0(gp *g) {
@@ -3646,6 +3661,8 @@ func goexit0(gp *g) {
gp.param = nil
gp.labels = nil
gp.timer = nil
Expand All @@ -63,37 +75,37 @@ index 3991a48b10..4a50ae650d 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 e1788223e7..5ed1fb40ba 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 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) {
_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
}

Loading

0 comments on commit e003793

Please sign in to comment.