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

*: upgrade go1.23.2 | tidb-test=pr/2411 #51126

Merged
merged 26 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
668 changes: 295 additions & 373 deletions DEPS.bzl

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# production environment, please refer to https://github.com/PingCAP-QE/artifacts/blob/main/dockerfiles/cd/builders/tidb/Dockerfile.

# Builder image
FROM golang:1.21 as builder
FROM golang:1.22 as builder
WORKDIR /tidb

COPY . .
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.enterprise
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

# The current dockerfile is only used for development purposes.
# Builder image
FROM golang:1.21 as builder
FROM golang:1.22 as builder
WORKDIR /tidb

COPY . .
Expand Down
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ go_download_sdk(
"https://mirrors.aliyun.com/golang/{}",
"https://dl.google.com/go/{}",
],
version = "1.21.13",
version = "1.23.2",
)

go_register_toolchains(
Expand Down
12 changes: 6 additions & 6 deletions br/pkg/restore/internal/prealloc_table_id/alloc.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,23 @@ func New(tables []*metautil.Table) *PreallocIDs {
}
}

max := int64(0)
maxv := int64(0)

for _, t := range tables {
if t.Info.ID > max && t.Info.ID < insaneTableIDThreshold {
max = t.Info.ID
if t.Info.ID > maxv && t.Info.ID < insaneTableIDThreshold {
maxv = t.Info.ID
}

if t.Info.Partition != nil && t.Info.Partition.Definitions != nil {
for _, part := range t.Info.Partition.Definitions {
if part.ID > max && part.ID < insaneTableIDThreshold {
max = part.ID
if part.ID > maxv && part.ID < insaneTableIDThreshold {
maxv = part.ID
}
}
}
}
return &PreallocIDs{
end: max + 1,
end: maxv + 1,

allocedFrom: math.MaxInt64,
}
Expand Down
104 changes: 74 additions & 30 deletions build/image/base
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,77 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM hub.pingcap.net/jenkins/centos7_jenkins

USER root
WORKDIR /root

ENV GOLANG_VERSION 1.21.13
ENV GOLANG_DOWNLOAD_URL https://dl.google.com/go/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA256 b3075ae1ce5dab85f89bc7905d1632de23ca196bd8336afd93fa97434cfa55ae
ENV GOPATH /go
ENV GOROOT /usr/local/go
ENV PATH $GOPATH/bin:$GOROOT/bin:$PATH
ADD https://github.com/bazelbuild/bazel/releases/download/6.3.2/bazel-6.3.2-linux-x86_64 /usr/bin/bazel
ADD https://uploader.codecov.io/latest/linux/codecov /usr/bin/codecov
RUN curl https://setup.ius.io | sh || true && \
chmod u+x /usr/bin/bazel && yum update -y && \
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 && \
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 && \
pip3 install s3cmd requests && pip3 install requests && \
curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
&& tar -C /usr/local -xzf golang.tar.gz \
&& rm golang.tar.gz && \
mkdir /go && chown jenkins:jenkins /go && \
curl -fsSL "http://pingcap-dev.hk.ufileos.com/jenkins/jenkins-slave-docker-sqllogictest.tar.gz" | tar xz -C "/git" \
&& chown -R jenkins:jenkins /git && \
chown jenkins:jenkins /usr/bin/bazel && \
chown jenkins:jenkins /usr/bin/codecov && \
chmod +x /usr/bin/codecov
USER jenkins
WORKDIR /home/jenkins
# Base image
FROM quay.io/rockylinux/rockylinux:8.10.20240528

LABEL org.opencontainers.image.authors "wuhui.zuo@pingcap.com"
LABEL org.opencontainers.image.description "CI Base image for building/testing"
LABEL org.opencontainers.image.source "https://github.com/PingCAP-QE/artifacts"

# setup mariadb repo
# ref: https://mariadb.com/docs/server/connect/clients/mariadb-client/#Linux_(Repository)
RUN curl -LsSO https://r.mariadb.com/downloads/mariadb_repo_setup \
&& echo "6083ef1974d11f49d42ae668fb9d513f7dc2c6276ffa47caed488c4b47268593 mariadb_repo_setup" | sha256sum -c - \
&& chmod +x mariadb_repo_setup \
&& ./mariadb_repo_setup \
&& rm mariadb_repo_setup

# install OS packages.
RUN --mount=type=cache,target=/var/cache/dnf \
dnf upgrade-minimal -y && \
dnf install -y make git gcc wget unzip psmisc lsof jq MariaDB-client

# install golang toolchain
# renovate: datasource=docker depName=golang
ARG GOLANG_VERSION=1.23.2
RUN OS=linux; ARCH=$([ "$(arch)" = "x86_64" ] && echo amd64 || echo arm64); \
curl -fsSL https://dl.google.com/go/go${GOLANG_VERSION}.linux-${ARCH}.tar.gz | tar -C /usr/local -xz
ENV PATH /usr/local/go/bin/:$PATH
LABEL go-version="${GOLANG_VERSION}"

# install rust toolchain
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s - -y --default-toolchain nightly
ENV PATH /root/.cargo/bin:$PATH

# install nodejs toolchain
ARG NODE_VERSION=18
RUN curl -fsSL https://rpm.nodesource.com/setup_${NODE_VERSION}.x | bash - \
&& dnf install -y nsolid \
&& npm install -g yarn@1.22.22 pnpm@8.15.9

#### install java tool chains: open-jdk, gradle, apache-maven
# -> open-jdk
ARG JAVA_VER=17
RUN --mount=type=cache,target=/var/cache/dnf \
dnf install -y java-${JAVA_VER}-openjdk-devel
ENV JAVA_HOME=/usr/lib/jvm/jre-openjdk

# -> gradle
ARG GRADLE_VER=7.4.2
RUN wget https://services.gradle.org/distributions/gradle-${GRADLE_VER}-bin.zip && \
unzip gradle-${GRADLE_VER}-bin.zip -d /opt && \
rm gradle-${GRADLE_VER}-bin.zip
ENV PATH=$PATH:/opt/gradle-${GRADLE_VER}/bin

# -> apache-maven
ARG MAVEN_VER=3.8.8
RUN wget https://downloads.apache.org/maven/maven-3/${MAVEN_VER}/binaries/apache-maven-${MAVEN_VER}-bin.tar.gz && \
tar -xf apache-maven-${MAVEN_VER}-bin.tar.gz -C /opt && \
rm apache-maven-${MAVEN_VER}-bin.tar.gz
ENV PATH=$PATH:/opt/apache-maven-${MAVEN_VER}/bin

#### install tools: bazelisk, codecov, oras
# renovate: datasource=github-tags depName=bazelbuild/bazelisk
ADD https://github.com/bazelbuild/bazel/releases/download/6.5.0/bazel-6.5.0-linux-x86_64 /usr/bin/bazel
chmod u+x /usr/bin/bazel

# codecov tool
# renovate: datasource=github-tags depName=codecov/uploader
ARG CODECOV_VERSION=v0.8.0
RUN folder=$([ "$(arch)" = "x86_64" ] && echo linux || echo aarch64); \
curl -fsSL https://uploader.codecov.io/${CODECOV_VERSION}/${folder}/codecov -o /usr/local/bin/codecov && \
chmod +x /usr/local/bin/codecov

# oras tool
# renovate: datasource=github-tags depName=oras-project/oras
COPY --from=bitnami/oras:1.2.0 /oras /usr/local/bin/oras
11 changes: 10 additions & 1 deletion build/image/centos7_jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM hub.pingcap.net/wangweizhen/base_image:go121020230809
FROM ghcr.io/pingcap-qe/ci/jenkins:v20240901-46-g07d1689-go1.23
USER root
WORKDIR /root
COPY .ci_bazel /data/bazel
RUN mkdir -p /data/tikv1 /data/tikv2 /data/tikv3 /data/pd && \
chown -R jenkins:jenkins /data
# create user jenkins and add it to sudoers.
RUN --mount=type=cache,target=/var/cache/dnf \
dnf install -y sudo
RUN groupadd -g 1000 jenkins && \
useradd -u 1000 -g 1000 -m -s /bin/bash jenkins && \
echo "jenkins:password" | chpasswd && \
echo "jenkins ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers

# Switch to the non-root user jenkins and set the working directory
USER jenkins
WORKDIR /home/jenkins
RUN go install github.com/hawkingrei/bazel_collect@latest && \
Expand Down
2 changes: 1 addition & 1 deletion build/image/parser_test
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

FROM rockylinux:9

ENV GOLANG_VERSION 1.21.13
ENV GOLANG_VERSION 1.23.2
ENV ARCH amd64
ENV GOLANG_DOWNLOAD_URL https://dl.google.com/go/go$GOLANG_VERSION.linux-$ARCH.tar.gz
ENV GOPATH /home/prow/go
Expand Down
14 changes: 7 additions & 7 deletions cmd/benchdb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ func (ut *benchDB) truncateTable() {
func (ut *benchDB) runCountTimes(name string, count int, f func()) {
var (
sum, first, last time.Duration
min = time.Minute
max = time.Nanosecond
minv = time.Minute
maxv = time.Nanosecond
)
cLogf("%s started", name)
for i := 0; i < count; i++ {
Expand All @@ -213,16 +213,16 @@ func (ut *benchDB) runCountTimes(name string, count int, f func()) {
first = dur
}
last = dur
if dur < min {
min = dur
if dur < minv {
minv = dur
}
if dur > max {
max = dur
if dur > maxv {
maxv = dur
}
sum += dur
}
cLogf("%s done, avg %s, count %d, sum %s, first %s, last %s, max %s, min %s\n\n",
name, sum/time.Duration(count), count, sum, first, last, max, min)
name, sum/time.Duration(count), count, sum, first, last, maxv, minv)
}

// #nosec G404
Expand Down
8 changes: 4 additions & 4 deletions cmd/importer/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ func newDatum() *datum {
return &datum{step: 1, repeats: 1, remains: 1, probability: 100}
}

func (d *datum) setInitInt64Value(min int64, max int64) {
func (d *datum) setInitInt64Value(minv int64, maxv int64) {
d.Lock()
defer d.Unlock()

if d.init {
return
}

d.minIntValue = min
d.maxIntValue = max
d.minIntValue = minv
d.maxIntValue = maxv
d.useRange = true
if d.step < 0 {
d.intValue = (min + max) / 2
d.intValue = (minv + maxv) / 2
}

d.init = true
Expand Down
20 changes: 10 additions & 10 deletions cmd/importer/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,23 @@ import (
"go.uber.org/zap"
)

func intRangeValue(column *column, min int64, max int64) (int64, int64) {
func intRangeValue(column *column, minv, maxv int64) (int64, int64) {
var err error
if len(column.min) > 0 {
min, err = strconv.ParseInt(column.min, 10, 64)
minv, err = strconv.ParseInt(column.min, 10, 64)
if err != nil {
log.Fatal(err.Error())
}

if len(column.max) > 0 {
max, err = strconv.ParseInt(column.max, 10, 64)
maxv, err = strconv.ParseInt(column.max, 10, 64)
if err != nil {
log.Fatal(err.Error())
}
}
}

return min, max
return minv, maxv
}

func randStringValue(column *column, n int) string {
Expand All @@ -62,7 +62,7 @@ func randStringValue(column *column, n int) string {
return randString(randInt(1, n))
}

func randInt64Value(column *column, min int64, max int64) int64 {
func randInt64Value(column *column, minv, maxv int64) int64 {
if column.hist != nil {
return column.hist.randInt()
}
Expand All @@ -75,13 +75,13 @@ func randInt64Value(column *column, min int64, max int64) int64 {
return data
}

min, max = intRangeValue(column, min, max)
return randInt64(min, max)
minv, maxv = intRangeValue(column, minv, maxv)
return randInt64(minv, maxv)
}

func nextInt64Value(column *column, min int64, max int64) int64 {
min, max = intRangeValue(column, min, max)
column.data.setInitInt64Value(min, max)
func nextInt64Value(column *column, minv int64, maxv int64) int64 {
minv, maxv = intRangeValue(column, minv, maxv)
column.data.setInitInt64Value(minv, maxv)
return column.data.nextInt64()
}

Expand Down
Loading
Loading