Skip to content

Commit 8c4bab1

Browse files
authored
*: upgrade go1.23.2 (pingcap#51126)
close pingcap#50765
1 parent 6e84244 commit 8c4bab1

Some content is hidden

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

64 files changed

+872
-932
lines changed

DEPS.bzl

+307-385
Large diffs are not rendered by default.

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# production environment, please refer to https://github.com/PingCAP-QE/artifacts/blob/main/dockerfiles/cd/builders/tidb/Dockerfile.
1717

1818
# Builder image
19-
FROM golang:1.21 as builder
19+
FROM golang:1.23 as builder
2020
WORKDIR /tidb
2121

2222
COPY . .

Dockerfile.enterprise

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
# The current dockerfile is only used for development purposes.
1616
# Builder image
17-
FROM golang:1.21 as builder
17+
FROM golang:1.23 as builder
1818
WORKDIR /tidb
1919

2020
COPY . .

WORKSPACE

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ go_download_sdk(
8585
"https://mirrors.aliyun.com/golang/{}",
8686
"https://dl.google.com/go/{}",
8787
],
88-
version = "1.21.13",
88+
version = "1.23.2",
8989
)
9090

9191
go_register_toolchains(

br/pkg/restore/internal/prealloc_table_id/alloc.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -43,23 +43,23 @@ func New(tables []*metautil.Table) *PreallocIDs {
4343
}
4444
}
4545

46-
max := int64(0)
46+
maxv := int64(0)
4747

4848
for _, t := range tables {
49-
if t.Info.ID > max && t.Info.ID < insaneTableIDThreshold {
50-
max = t.Info.ID
49+
if t.Info.ID > maxv && t.Info.ID < insaneTableIDThreshold {
50+
maxv = t.Info.ID
5151
}
5252

5353
if t.Info.Partition != nil && t.Info.Partition.Definitions != nil {
5454
for _, part := range t.Info.Partition.Definitions {
55-
if part.ID > max && part.ID < insaneTableIDThreshold {
56-
max = part.ID
55+
if part.ID > maxv && part.ID < insaneTableIDThreshold {
56+
maxv = part.ID
5757
}
5858
}
5959
}
6060
}
6161
return &PreallocIDs{
62-
end: max + 1,
62+
end: maxv + 1,
6363

6464
allocedFrom: math.MaxInt64,
6565
}

build/image/base

+63-30
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,66 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM hub.pingcap.net/jenkins/centos7_jenkins
16-
17-
USER root
18-
WORKDIR /root
19-
20-
ENV GOLANG_VERSION 1.21.13
21-
ENV GOLANG_DOWNLOAD_URL https://dl.google.com/go/go$GOLANG_VERSION.linux-amd64.tar.gz
22-
ENV GOLANG_DOWNLOAD_SHA256 b3075ae1ce5dab85f89bc7905d1632de23ca196bd8336afd93fa97434cfa55ae
23-
ENV GOPATH /go
24-
ENV GOROOT /usr/local/go
25-
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
26-
ADD https://github.com/bazelbuild/bazel/releases/download/6.3.2/bazel-6.3.2-linux-x86_64 /usr/bin/bazel
27-
ADD https://uploader.codecov.io/latest/linux/codecov /usr/bin/codecov
28-
RUN curl https://setup.ius.io | sh || true && \
29-
chmod u+x /usr/bin/bazel && yum update -y && \
30-
yum install -y supervisor tree libcurl-devel gettext autoconf python-pip python3-pip patch git wget gcc python autoconf make curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-CPAN perl-devel && \
31-
git clone --depth=1 --branch=v2.37.2 https://github.com/git/git && cd git && yum remove -y git && make configure && ./configure --prefix=/usr/local CFLAGS="-std=gnu99" && make -j16 install && cd .. && rm -rf git && \
32-
pip3 install s3cmd requests && pip3 install requests && \
33-
curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
34-
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
35-
&& tar -C /usr/local -xzf golang.tar.gz \
36-
&& rm golang.tar.gz && \
37-
mkdir /go && chown jenkins:jenkins /go && \
38-
curl -fsSL "http://pingcap-dev.hk.ufileos.com/jenkins/jenkins-slave-docker-sqllogictest.tar.gz" | tar xz -C "/git" \
39-
&& chown -R jenkins:jenkins /git && \
40-
chown jenkins:jenkins /usr/bin/bazel && \
41-
chown jenkins:jenkins /usr/bin/codecov && \
42-
chmod +x /usr/bin/codecov
43-
USER jenkins
44-
WORKDIR /home/jenkins
15+
# Base image
16+
FROM quay.io/rockylinux/rockylinux:8.10.20240528
17+
18+
# setup mariadb repo
19+
# ref: https://mariadb.com/docs/server/connect/clients/mariadb-client/#Linux_(Repository)
20+
RUN curl -LsSO https://r.mariadb.com/downloads/mariadb_repo_setup \
21+
&& echo "6083ef1974d11f49d42ae668fb9d513f7dc2c6276ffa47caed488c4b47268593 mariadb_repo_setup" | sha256sum -c - \
22+
&& chmod +x mariadb_repo_setup \
23+
&& ./mariadb_repo_setup \
24+
&& rm mariadb_repo_setup
25+
26+
# install OS packages.
27+
RUN --mount=type=cache,target=/var/cache/dnf \
28+
dnf upgrade-minimal -y && \
29+
dnf install -y make git gcc wget unzip psmisc lsof jq MariaDB-client
30+
31+
# install golang toolchain
32+
# renovate: datasource=docker depName=golang
33+
ARG GOLANG_VERSION=1.23.2
34+
RUN OS=linux; ARCH=$([ "$(arch)" = "x86_64" ] && echo amd64 || echo arm64); \
35+
curl -fsSL https://dl.google.com/go/go${GOLANG_VERSION}.linux-${ARCH}.tar.gz | tar -C /usr/local -xz
36+
ENV PATH /usr/local/go/bin/:$PATH
37+
LABEL go-version="${GOLANG_VERSION}"
38+
39+
# install rust toolchain
40+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s - -y --default-toolchain nightly
41+
ENV PATH /root/.cargo/bin:$PATH
42+
43+
# install nodejs toolchain
44+
ARG NODE_VERSION=18
45+
RUN curl -fsSL https://rpm.nodesource.com/setup_${NODE_VERSION}.x | bash - \
46+
&& dnf install -y nsolid \
47+
48+
49+
#### install java tool chains: open-jdk, gradle, apache-maven
50+
# -> open-jdk
51+
ARG JAVA_VER=17
52+
RUN --mount=type=cache,target=/var/cache/dnf \
53+
dnf install -y java-${JAVA_VER}-openjdk-devel
54+
ENV JAVA_HOME=/usr/lib/jvm/jre-openjdk
55+
56+
# -> gradle
57+
ARG GRADLE_VER=7.4.2
58+
RUN wget https://services.gradle.org/distributions/gradle-${GRADLE_VER}-bin.zip && \
59+
unzip gradle-${GRADLE_VER}-bin.zip -d /opt && \
60+
rm gradle-${GRADLE_VER}-bin.zip
61+
ENV PATH=$PATH:/opt/gradle-${GRADLE_VER}/bin
62+
63+
#### install tools: bazelisk, codecov, oras
64+
# renovate: datasource=github-tags depName=bazelbuild/bazelisk
65+
ADD https://github.com/bazelbuild/bazel/releases/download/6.5.0/bazel-6.5.0-linux-x86_64 /usr/bin/bazel
66+
RUN chmod +x /usr/bin/bazel
67+
68+
# codecov tool
69+
# renovate: datasource=github-tags depName=codecov/uploader
70+
ARG CODECOV_VERSION=v0.8.0
71+
RUN folder=$([ "$(arch)" = "x86_64" ] && echo linux || echo aarch64); \
72+
curl -fsSL https://uploader.codecov.io/${CODECOV_VERSION}/${folder}/codecov -o /usr/local/bin/codecov && \
73+
chmod +x /usr/local/bin/codecov
74+
75+
# oras tool
76+
# renovate: datasource=github-tags depName=oras-project/oras
77+
COPY --from=bitnami/oras:1.2.0 /oras /usr/local/bin/oras

build/image/centos7_jenkins

+16-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,25 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
FROM hub.pingcap.net/wangweizhen/base_image:go121020230809
15+
FROM hub.pingcap.net/wangweizhen/base_image:go12320241009
16+
ENV GOPATH /go
17+
ENV GOROOT /usr/local/go
18+
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
1619
USER root
1720
WORKDIR /root
1821
COPY .ci_bazel /data/bazel
19-
RUN mkdir -p /data/tikv1 /data/tikv2 /data/tikv3 /data/pd && \
20-
chown -R jenkins:jenkins /data
22+
# create user jenkins and add it to sudoers.
23+
RUN --mount=type=cache,target=/var/cache/dnf \
24+
dnf install -y sudo
25+
RUN groupadd -g 1000 jenkins && \
26+
useradd -u 1000 -g 1000 -m -s /bin/bash jenkins && \
27+
echo "jenkins:password" | chpasswd && \
28+
echo "jenkins ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
29+
RUN mkdir -p /data/tikv1 /data/tikv2 /data/tikv3 /data/pd && \
30+
mkdir /go && chown jenkins:jenkins /go && \
31+
chown -R jenkins:jenkins /data && \
32+
chown jenkins:jenkins /usr/bin/bazel
33+
# Switch to the non-root user jenkins and set the working directory
2134
USER jenkins
2235
WORKDIR /home/jenkins
2336
RUN go install github.com/hawkingrei/bazel_collect@latest && \

build/image/parser_test

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
FROM rockylinux:9
1616

17-
ENV GOLANG_VERSION 1.21.13
17+
ENV GOLANG_VERSION 1.23.2
1818
ENV ARCH amd64
1919
ENV GOLANG_DOWNLOAD_URL https://dl.google.com/go/go$GOLANG_VERSION.linux-$ARCH.tar.gz
2020
ENV GOPATH /home/prow/go

cmd/benchdb/main.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ func (ut *benchDB) truncateTable() {
201201
func (ut *benchDB) runCountTimes(name string, count int, f func()) {
202202
var (
203203
sum, first, last time.Duration
204-
min = time.Minute
205-
max = time.Nanosecond
204+
minv = time.Minute
205+
maxv = time.Nanosecond
206206
)
207207
cLogf("%s started", name)
208208
for i := 0; i < count; i++ {
@@ -213,16 +213,16 @@ func (ut *benchDB) runCountTimes(name string, count int, f func()) {
213213
first = dur
214214
}
215215
last = dur
216-
if dur < min {
217-
min = dur
216+
if dur < minv {
217+
minv = dur
218218
}
219-
if dur > max {
220-
max = dur
219+
if dur > maxv {
220+
maxv = dur
221221
}
222222
sum += dur
223223
}
224224
cLogf("%s done, avg %s, count %d, sum %s, first %s, last %s, max %s, min %s\n\n",
225-
name, sum/time.Duration(count), count, sum, first, last, max, min)
225+
name, sum/time.Duration(count), count, sum, first, last, maxv, minv)
226226
}
227227

228228
// #nosec G404

cmd/importer/data.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,19 @@ func newDatum() *datum {
4343
return &datum{step: 1, repeats: 1, remains: 1, probability: 100}
4444
}
4545

46-
func (d *datum) setInitInt64Value(min int64, max int64) {
46+
func (d *datum) setInitInt64Value(minv int64, maxv int64) {
4747
d.Lock()
4848
defer d.Unlock()
4949

5050
if d.init {
5151
return
5252
}
5353

54-
d.minIntValue = min
55-
d.maxIntValue = max
54+
d.minIntValue = minv
55+
d.maxIntValue = maxv
5656
d.useRange = true
5757
if d.step < 0 {
58-
d.intValue = (min + max) / 2
58+
d.intValue = (minv + maxv) / 2
5959
}
6060

6161
d.init = true

cmd/importer/db.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,23 @@ import (
2929
"go.uber.org/zap"
3030
)
3131

32-
func intRangeValue(column *column, min int64, max int64) (int64, int64) {
32+
func intRangeValue(column *column, minv, maxv int64) (int64, int64) {
3333
var err error
3434
if len(column.min) > 0 {
35-
min, err = strconv.ParseInt(column.min, 10, 64)
35+
minv, err = strconv.ParseInt(column.min, 10, 64)
3636
if err != nil {
3737
log.Fatal(err.Error())
3838
}
3939

4040
if len(column.max) > 0 {
41-
max, err = strconv.ParseInt(column.max, 10, 64)
41+
maxv, err = strconv.ParseInt(column.max, 10, 64)
4242
if err != nil {
4343
log.Fatal(err.Error())
4444
}
4545
}
4646
}
4747

48-
return min, max
48+
return minv, maxv
4949
}
5050

5151
func randStringValue(column *column, n int) string {
@@ -62,7 +62,7 @@ func randStringValue(column *column, n int) string {
6262
return randString(randInt(1, n))
6363
}
6464

65-
func randInt64Value(column *column, min int64, max int64) int64 {
65+
func randInt64Value(column *column, minv, maxv int64) int64 {
6666
if column.hist != nil {
6767
return column.hist.randInt()
6868
}
@@ -75,13 +75,13 @@ func randInt64Value(column *column, min int64, max int64) int64 {
7575
return data
7676
}
7777

78-
min, max = intRangeValue(column, min, max)
79-
return randInt64(min, max)
78+
minv, maxv = intRangeValue(column, minv, maxv)
79+
return randInt64(minv, maxv)
8080
}
8181

82-
func nextInt64Value(column *column, min int64, max int64) int64 {
83-
min, max = intRangeValue(column, min, max)
84-
column.data.setInitInt64Value(min, max)
82+
func nextInt64Value(column *column, minv int64, maxv int64) int64 {
83+
minv, maxv = intRangeValue(column, minv, maxv)
84+
column.data.setInitInt64Value(minv, maxv)
8585
return column.data.nextInt64()
8686
}
8787

0 commit comments

Comments
 (0)