Skip to content

Commit

Permalink
*: upgrade to go 1.19.1
Browse files Browse the repository at this point in the history
* [ ] Adjust the Pebble tests to run in new version.
* [x] Adjust version in Docker image ([source](./builder/Dockerfile)).
* [x] Adjust version in the TeamCity agent image ([setup script](./packer/teamcity-agent.sh))
* [x] Rebuild and push the Docker image (following [Basic Process](#basic-process))
* [x] Update `build/teamcity/internal/release/build-and-publish-patched-go/impl.sh` with the new version and adjust SHA256 sums as necessary.
* [x] Run the `Internal / Release / Build and Publish Patched Go` build configuration in TeamCity with your latest version of the script above. This will print out the new URL's and SHA256 sums for the patched Go that you built above.
* [x] 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.
* [x] 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.
* [x] Bump the version in `builder.sh` accordingly ([source](./builder.sh#L6)).
* [x] 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`. You may also need to rerun `make vendor_rebuild` if vendoring has changed.
* [x] Bump the default installed version of Go in `bootstrap-debian.sh` ([source](./bootstrap/bootstrap-debian.sh)).
* [x] 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)

Closes #85908.

Release justification: Upgrade to latest Go version
Release note (build change): upgrade to go 1.19.1
  • Loading branch information
rickystewart committed Sep 7, 2022
1 parent d68046c commit 2675c7c
Show file tree
Hide file tree
Showing 788 changed files with 13,965 additions and 13,231 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,8 @@ SQLPARSER_TARGETS = \

PROTOBUF_TARGETS := bin/.go_protobuf_sources bin/.gw_protobuf_sources

SWAGGER_TARGETS := \
docs/generated/swagger/spec.json
SWAGGER_TARGETS :=
#docs/generated/swagger/spec.json

DOCGEN_TARGETS := \
bin/.docgen_bnfs \
Expand Down
37 changes: 20 additions & 17 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,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 = "72f7456307988b1ee4f2d32bae8ac88b50c857b126b164f667f94427d85fb705",
strip_prefix = "cockroachdb-rules_go-5a4682c",
sha256 = "12f619147ab74d6d50741652ba1cdd48707d80ffd13a2cc79fb630265ff03de5",
strip_prefix = "cockroachdb-rules_go-cb54c66",
urls = [
# cockroachdb/rules_go as of 5a4682cd1eda7e7308107f3ff4adb981a81a953c
# (upstream release-0.33 plus a few patches).
"https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-130-g5a4682c.tar.gz",
# cockroachdb/rules_go as of cb54c66bc3e23a9533a2d04459f6262a6abb8fad
# (upstream release-0.34 plus a few patches).
"https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-164-gcb54c66.tar.gz",
],
)

Expand Down Expand Up @@ -141,11 +141,14 @@ http_archive(
"@io_bazel_rules_go//third_party:go_googleapis-gazelle.patch",
"@com_github_cockroachdb_cockroach//build/patches:go_googleapis.patch",
],
sha256 = "9181bb36a1df4f397375ec5aa480db797b882073518801e3a20b0e46418f2f90",
strip_prefix = "googleapis-530ca55953b470ab3b37dc9de37fcfa59410b741",
# master, as of 2022-06-05
sha256 = "73831cbb41f2750f3181d126bbabcd3e58b5188e131ecbc309793fa54d5439c9",
strip_prefix = "googleapis-53377c165584e84c410a0905d9effb3fe5df2806",
# master, as of 2022-07-19
# 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/530ca55953b470ab3b37dc9de37fcfa59410b741.zip",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/53377c165584e84c410a0905d9effb3fe5df2806.zip",
],
)

Expand All @@ -166,15 +169,15 @@ load(
go_download_sdk(
name = "go_sdk",
sdks = {
"darwin_amd64": ("go1.18.4.darwin-amd64.tar.gz", "5202f77d94b1bf1ff9ffdae2a663e4cda123d6f9a3851340291ae741e25672f9"),
"darwin_arm64": ("go1.18.4.darwin-arm64.tar.gz", "04eed623d5143ffa44965b618b509e0beccccfd3a4a1bfebc0cdbcf906046769"),
"freebsd_amd64": ("go1.18.4.freebsd-amd64.tar.gz", "fb00f8aaffcc80e0a2bd39db1d8e8e21ef0a691c564f7b7601383dd6adad4042"),
"linux_amd64": ("go1.18.4.linux-amd64.tar.gz", "87fdb4133707d90c1e8f303348302f2db61dc4f2478bcfcdf7c7de26ae14188b"),
"linux_arm64": ("go1.18.4.linux-arm64.tar.gz", "19a7c55563e9c09c916f5ddd350779ceeaba7178070b716f623f736780fae09e"),
"windows_amd64": ("go1.18.4.windows-amd64.tar.gz", "65cf73c972ab1a1d9b29eaa0d791f557677085c57e7f8901072ad9df13885501"),
"darwin_amd64": ("go1.19.1.darwin-amd64.tar.gz", "96a164130f532c0ed65e437aaf9cc66b518f0b887d5830b2dc01ebfee9d58f52"),
"darwin_arm64": ("go1.19.1.darwin-arm64.tar.gz", "e46aecce83a9289be16ce4ba9b8478a5b89b8aa0230171d5c6adbc0c66640548"),
"freebsd_amd64": ("go1.19.1.freebsd-amd64.tar.gz", "db5b8f232e12c655cc6cde6af1adf4d27d842541807802d747c86161e89efa0a"),
"linux_amd64": ("go1.19.1.linux-amd64.tar.gz", "b8c00cd587c49beef8943887d52d77aeda66a30e94effbc1e6d39e1c80f01d37"),
"linux_arm64": ("go1.19.1.linux-arm64.tar.gz", "49d7c2badb24de8dd75e6c709d4f26d0b5e9509da2fa8c9d79929952b2607c55"),
"windows_amd64": ("go1.19.1.windows-amd64.tar.gz", "a507d42a457175a50695cf5df8efc64309dec5aa2ebf28d8d28bcd8317d6350c"),
},
urls = ["https://storage.googleapis.com/public-bazel-artifacts/go/20220727-185937/{}"],
version = "1.18.4",
urls = ["https://storage.googleapis.com/public-bazel-artifacts/go/20220907-175858/{}"],
version = "1.19.1",
)

# To point to a local SDK path, use the following instead. We'll call the
Expand Down
4 changes: 2 additions & 2 deletions build/bazelutil/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pkg/security/certmgr/cert.go://go:generate mockgen -package=certmgr -destination
pkg/security/securitytest/securitytest.go://go:generate go-bindata -mode 0600 -modtime 1400000000 -pkg securitytest -o embedded.go -ignore README.md -ignore regenerate.sh test_certs
pkg/security/securitytest/securitytest.go://go:generate gofmt -s -w embedded.go
pkg/security/securitytest/securitytest.go://go:generate goimports -w embedded.go
pkg/server/api_v2.go://go:generate swagger generate spec -w . -o ../../docs/generated/swagger/spec.json --scan-models
pkg/server/api_v2.go://-go:generate swagger generate spec -w . -o ../../docs/generated/swagger/spec.json --scan-models
pkg/spanconfig/spanconfigstore/span_store.go://go:generate ../../util/interval/generic/gen.sh *entry spanconfigstore
pkg/sql/conn_fsm.go://go:generate ../util/fsm/gen/reports.sh TxnStateTransitions stateNoTxn
pkg/sql/opt/optgen/lang/gen.go://go:generate langgen -out expr.og.go exprs lang.opt
Expand All @@ -40,7 +40,7 @@ pkg/sql/schemachanger/scop/validation.go://go:generate go run ./generate_visitor
pkg/sql/schemachanger/scpb/state.go://go:generate go run element_generator.go --in elements.proto --out elements_generated.go
pkg/sql/schemachanger/scpb/state.go://go:generate go run element_uml_generator.go --out uml/table.puml
pkg/sql/sem/tree/eval.go://go:generate go run ./evalgen *.go
pkg/util/interval/generic/doc.go: //go:generate ../../util/interval/generic/gen.sh *latch spanlatch
pkg/util/interval/generic/doc.go: //go:generate ../../util/interval/generic/gen.sh *latch spanlatch
pkg/util/interval/generic/example_t.go://go:generate ./gen.sh *example generic
pkg/util/log/channels.go://go:generate go run gen/main.go logpb/log.proto channel.go channel/channel_generated.go
pkg/util/log/channels.go://go:generate go run gen/main.go logpb/log.proto log_channels.go log_channels_generated.go
Expand Down
16 changes: 8 additions & 8 deletions build/bazelutil/distdir_files.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -964,15 +964,15 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/cockroach-godeps/gomod/sigs.k8s.io/structured-merge-diff/v4/io_k8s_sigs_structured_merge_diff_v4-v4.1.2.zip": "b32af97dadd79179a8f62aaf4ef1e0562e051be77053a60c7a4e724a5cbd00ce",
"https://storage.googleapis.com/cockroach-godeps/gomod/sigs.k8s.io/yaml/io_k8s_sigs_yaml-v1.2.0.zip": "55ed08c5df448a033bf7e2c2912d4daa85b856a05c854b0c87ccc85c7f3fbfc7",
"https://storage.googleapis.com/cockroach-godeps/gomod/sourcegraph.com/sourcegraph/appdash/com_sourcegraph_sourcegraph_appdash-v0.0.0-20190731080439-ebfcffb1b5c0.zip": "bd2492d9db05362c2fecd0b3d0f6002c89a6d90d678fb93b4158298ab883736f",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/530ca55953b470ab3b37dc9de37fcfa59410b741.zip": "9181bb36a1df4f397375ec5aa480db797b882073518801e3a20b0e46418f2f90",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/53377c165584e84c410a0905d9effb3fe5df2806.zip": "73831cbb41f2750f3181d126bbabcd3e58b5188e131ecbc309793fa54d5439c9",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/88ef31b429631b787ceb5e4556d773b20ad797c8.zip": "92a89a2bbe6c6db2a8b87da4ce723aff6253656e8417f37e50d362817c39b98b",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/bazel-gazelle-v0.25.0.tar.gz": "5982e5463f171da99e3bdaeff8c0f48283a7a5f396ec5282910b9e8a49c0dd7e",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/bazel-skylib-1.0.3.tar.gz": "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/bazel_gomock-fde78c91cf1783cc1e33ba278922ba67a6ee2a84.tar.gz": "692421b0c5e04ae4bc0bfff42fb1ce8671fe68daee2b8d8ea94657bb1fcddc0a",
"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-130-g5a4682c.tar.gz": "72f7456307988b1ee4f2d32bae8ac88b50c857b126b164f667f94427d85fb705",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_go-v0.27.0-164-gcb54c66.tar.gz": "12f619147ab74d6d50741652ba1cdd48707d80ffd13a2cc79fb630265ff03de5",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/cockroachdb-rules_nodejs-5.5.0-1-g59a92cc.tar.gz": "7f3f747db3f924547b9ffdf86da6c604335ad95e09d4e5a69fdcfdb505099421",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/google-starlark-go-e043a3d.tar.gz": "a35c6468e0e0921833a63290161ff903295eaaf5915200bbce272cbc8dfd1c1c",
"https://storage.googleapis.com/public-bazel-artifacts/bazel/platforms-0.0.4.tar.gz": "079945598e4b6cc075846f7fd6a9d0857c33a7afc0de868c2ccb96405225135d",
Expand All @@ -999,12 +999,12 @@ DISTDIR_FILES = {
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libproj_foreign.macos.20220708-170245.tar.gz": "fd342ce3e99d9df6de8fcdf09ff9735887d7025d88ba9814b4c73cff24691b26",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libproj_foreign.macosarm.20220708-170245.tar.gz": "6394f40dbc799909ee239e42c25d08b5b2af0ad0c8aa30f37553e936f1c1dc4e",
"https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libproj_foreign.windows.20220708-170245.tar.gz": "233c6cecef5e826bd1aea7c7c603fb86fc78299d2016c4d3afcb0c1509eff001",
"https://storage.googleapis.com/public-bazel-artifacts/go/20220727-185937/go1.18.4.darwin-amd64.tar.gz": "5202f77d94b1bf1ff9ffdae2a663e4cda123d6f9a3851340291ae741e25672f9",
"https://storage.googleapis.com/public-bazel-artifacts/go/20220727-185937/go1.18.4.darwin-arm64.tar.gz": "04eed623d5143ffa44965b618b509e0beccccfd3a4a1bfebc0cdbcf906046769",
"https://storage.googleapis.com/public-bazel-artifacts/go/20220727-185937/go1.18.4.freebsd-amd64.tar.gz": "fb00f8aaffcc80e0a2bd39db1d8e8e21ef0a691c564f7b7601383dd6adad4042",
"https://storage.googleapis.com/public-bazel-artifacts/go/20220727-185937/go1.18.4.linux-amd64.tar.gz": "87fdb4133707d90c1e8f303348302f2db61dc4f2478bcfcdf7c7de26ae14188b",
"https://storage.googleapis.com/public-bazel-artifacts/go/20220727-185937/go1.18.4.linux-arm64.tar.gz": "19a7c55563e9c09c916f5ddd350779ceeaba7178070b716f623f736780fae09e",
"https://storage.googleapis.com/public-bazel-artifacts/go/20220727-185937/go1.18.4.windows-amd64.tar.gz": "65cf73c972ab1a1d9b29eaa0d791f557677085c57e7f8901072ad9df13885501",
"https://storage.googleapis.com/public-bazel-artifacts/go/20220907-175858/go1.19.1.darwin-amd64.tar.gz": "96a164130f532c0ed65e437aaf9cc66b518f0b887d5830b2dc01ebfee9d58f52",
"https://storage.googleapis.com/public-bazel-artifacts/go/20220907-175858/go1.19.1.darwin-arm64.tar.gz": "e46aecce83a9289be16ce4ba9b8478a5b89b8aa0230171d5c6adbc0c66640548",
"https://storage.googleapis.com/public-bazel-artifacts/go/20220907-175858/go1.19.1.freebsd-amd64.tar.gz": "db5b8f232e12c655cc6cde6af1adf4d27d842541807802d747c86161e89efa0a",
"https://storage.googleapis.com/public-bazel-artifacts/go/20220907-175858/go1.19.1.linux-amd64.tar.gz": "b8c00cd587c49beef8943887d52d77aeda66a30e94effbc1e6d39e1c80f01d37",
"https://storage.googleapis.com/public-bazel-artifacts/go/20220907-175858/go1.19.1.linux-arm64.tar.gz": "49d7c2badb24de8dd75e6c709d4f26d0b5e9509da2fa8c9d79929952b2607c55",
"https://storage.googleapis.com/public-bazel-artifacts/go/20220907-175858/go1.19.1.windows-amd64.tar.gz": "a507d42a457175a50695cf5df8efc64309dec5aa2ebf28d8d28bcd8317d6350c",
"https://storage.googleapis.com/public-bazel-artifacts/gomod/github.com/bazelbuild/buildtools/v0.0.0-20200718160251-b1667ff58f71/buildtools-v0.0.0-20200718160251-b1667ff58f71.tar.gz": "a9ef5103739dfb5ed2a5b47ab1654842a89695812e4af09e57d7015a5caf97e0",
"https://storage.googleapis.com/public-bazel-artifacts/java/railroad/rr-1.63-java8.zip": "d2791cd7a44ea5be862f33f5a9b3d40aaad9858455828ebade7007ad7113fb41",
"https://storage.googleapis.com/public-bazel-artifacts/js/node/v16.13.0/node-v16.13.0-darwin-arm64.tar.gz": "46d83fc0bd971db5050ef1b15afc44a6665dee40bd6c1cbaec23e1b40fa49e6d",
Expand Down
5 changes: 3 additions & 2 deletions build/bazelutil/unused_checker/unused_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ func impl() error {
nogoX = filepath.Join(cwd, nogoX)
cmd := exec.Command(gobin, "tool", "pack", "x", nogoX, "unused.out")
cmd.Dir = tmpdir
if output, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("%w (got output %s while processing file %s)", err, string(output), nogoX)
if err := cmd.Run(); err != nil {
// The unused.out file might be missing -- this is fine.
continue
}
encoded, err := os.ReadFile(filepath.Join(tmpdir, "unused.out"))
if err != nil {
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 @@ -46,9 +46,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.18.4.linux-amd64.tar.gz > /tmp/go.tgz
curl -fsSL https://dl.google.com/go/go1.19.1.linux-amd64.tar.gz > /tmp/go.tgz
sha256sum -c - <<EOF
c9b099b68d93f5c5c8a8844a89f8db07eaa58270e3a1e01804f17f4cf8df02f5 /tmp/go.tgz
acc512fbab4f716a8f97a8b3fbaa9ddd39606a28be6c2515ef7c6c6311acffde /tmp/go.tgz
EOF
sudo tar -C /usr/local -zxf /tmp/go.tgz && rm /tmp/go.tgz

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=20220718-171426
version=20220907-174613

function init() {
docker build --tag="${image}" "$(dirname "${0}")/builder"
Expand Down
4 changes: 2 additions & 2 deletions build/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ RUN curl -fsSL https://github.com/Kitware/CMake/releases/download/v3.20.3/cmake-
# 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.18.4.src.tar.gz -o golang.tar.gz \
&& echo '4525aa6b0e3cecb57845f4060a7075aafc9ab752bb7b6b4cf8a212d43078e1e4 golang.tar.gz' | sha256sum -c - \
&& curl -fsSL https://storage.googleapis.com/golang/go1.19.1.src.tar.gz -o golang.tar.gz \
&& echo '27871baa490f3401414ad793fba49086f6c855b1c584385ed7771e1204c7e179 golang.tar.gz' | sha256sum -c - \
&& tar -C /usr/local -xzf golang.tar.gz \
&& rm golang.tar.gz \
&& cd /usr/local/go/src \
Expand Down
2 changes: 1 addition & 1 deletion build/go-version-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# To bump the required version of Go, edit the appropriate variables:

required_version_major=1
minimum_version_minor=18
minimum_version_minor=19

go=${1-go}

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 @@ -61,9 +61,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.18.4.linux-amd64.tar.gz > /tmp/go.tgz
curl -fsSL https://dl.google.com/go/go1.19.1.linux-amd64.tar.gz > /tmp/go.tgz
sha256sum -c - <<EOF
c9b099b68d93f5c5c8a8844a89f8db07eaa58270e3a1e01804f17f4cf8df02f5 /tmp/go.tgz
acc512fbab4f716a8f97a8b3fbaa9ddd39606a28be6c2515ef7c6c6311acffde /tmp/go.tgz
EOF
tar -C /usr/local -zxf /tmp/go.tgz && rm /tmp/go.tgz

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git c/src/runtime/proc.go i/src/runtime/proc.go
index b997a467ba..2619239dc8 100644
--- c/src/runtime/proc.go
+++ i/src/runtime/proc.go
@@ -990,8 +990,18 @@ func casgstatus(gp *g, oldval, newval uint32) {
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 3991a48b10..4a50ae650d 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -994,8 +994,19 @@ func casgstatus(gp *g, oldval, newval uint32) {
}
}

Expand All @@ -14,6 +14,7 @@ index b997a467ba..2619239dc8 100644
+ // subsequent use.
+ gp.lastsched = now
+ }
+
if oldval == _Grunning {
+ // We're transitioning out of running, record how long we were in the
+ // state.
Expand All @@ -22,7 +23,7 @@ index b997a467ba..2619239dc8 100644
// Track every 8th time a goroutine transitions out of running.
if gp.trackingSeq%gTrackingPeriod == 0 {
gp.tracking = true
@@ -1003,14 +1013,12 @@ func casgstatus(gp *g, oldval, newval uint32) {
@@ -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.
Expand All @@ -37,7 +38,7 @@ index b997a467ba..2619239dc8 100644
gp.runnableStamp = now
} else if newval == _Grunning {
// We're transitioning into running, so turn off
@@ -3240,6 +3248,14 @@ func dropg() {
@@ -3258,6 +3267,14 @@ func dropg() {
setGNoWB(&_g_.m.curg, nil)
}

Expand All @@ -52,7 +53,7 @@ index b997a467ba..2619239dc8 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.
@@ -3472,6 +3488,8 @@ func goexit0(gp *g) {
@@ -3491,6 +3508,8 @@ func goexit0(gp *g) {
gp.param = nil
gp.labels = nil
gp.timer = nil
Expand All @@ -61,38 +62,38 @@ index b997a467ba..2619239dc8 100644

if gcBlackenEnabled != 0 && gp.gcAssistBytes > 0 {
// Flush assist credit to the global pool. This gives
diff --git c/src/runtime/runtime2.go i/src/runtime/runtime2.go
index b40045e4a5..1196c41136 100644
--- c/src/runtime/runtime2.go
+++ i/src/runtime/runtime2.go
@@ -472,7 +472,6 @@ type g struct {
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index e1788223e7..5ed1fb40ba 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
@@ -486,6 +485,9 @@ type g struct {
@@ -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

// Per-G GC state

diff --git c/src/runtime/sizeof_test.go i/src/runtime/sizeof_test.go
index ebf544ad3b..1e1cf1be9c 100644
--- c/src/runtime/sizeof_test.go
+++ i/src/runtime/sizeof_test.go
// 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
--- 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{}, 236, 392}, // g, but exported for testing
+ {runtime.G{}, 244, 400}, // g, but exported for testing
- {runtime.G{}, 240, 392}, // g, but exported for testing
+ {runtime.G{}, 248, 400}, // g, but exported for testing
{runtime.Sudog{}, 56, 88}, // sudog, but exported for testing
}

Loading

0 comments on commit 2675c7c

Please sign in to comment.