matrixorigin / matrixone

Hyperconverged cloud-edge native database
https://docs.matrixorigin.cn/en
Apache License 2.0
1.78k stars 276 forks source link

[Bug]: Wrong version value is used when building mo-service of previous release version #14903

Closed aronchanisme closed 6 months ago

aronchanisme commented 7 months ago

Is there an existing issue for the same bug?

Branch Name

v1.0.0

Commit ID

6d1f96eb9

Other Environment Information

- Hardware parameters: 8c 16g
- OS type:linux
- Others: Debian 11, 5.10.0-26-amd64

Actual Behavior

When deploy mo using git source code, we checkout to a tag named v1.0.0 in order to deploy previous mo release version. When building mo-service, the -X 'github.com/matrixorigin/matrixone/pkg/version.Version=v1.1.1'" command leads to a wrong version to v1.1.1.

企业微信截图_33d9312e-6f52-4d04-945d-2b8f939c089a image 企业微信截图_9ace63f6-8daa-4678-8010-26429e0d282d 企业微信截图_c541f8cf-09b8-44d5-9e7b-52a640a783e9 企业微信截图_9ace63f6-8daa-4678-8010-26429e0d282d

Expected Behavior

When mysql client connects to mo, the Server version: xxx and sql cmd Select version() should display the same and correct version of what is deployed.

Steps to Reproduce

1. git clone https://github.com/matrixorigin/matrixone.git
2. cd matrixone && git checkout v1.0.0
3. git branch
4. git log -n 1 
5. make build
6. ./mo-service -daemon -debug-http :9876 -launch ./etc/launch/launch.toml
7. mysql -uroot -p111 -h127.0.0.1 -P6001
8. select version();

Additional information

none

aronchanisme commented 7 months ago

cc @yangj1211

YANGGMM commented 7 months ago

@guguducken , 麻烦看一下这个

guguducken commented 7 months ago

下周修改一下

guguducken commented 7 months ago

已经提pr

guguducken commented 6 months ago

等待pr合并

guguducken commented 6 months ago

pr merged @aronchanisme

aronchanisme commented 6 months ago

Seems like not fixed? deploy v1.0.2 but select version() displays as v1.1.2.

[github@HOST-192-168-1-16 mo]$ mkdir 1.0.2
[github@HOST-192-168-1-16 mo]$ mo_ctl set_conf MO_PATH=/data/mo/1.0.2
2024-04-03 11:14:51.895 UTC+0000    [INFO]    Try to set conf: MO_PATH="/data/mo/1.0.2"
m2024-04-03 11:14:51.964 UTC+0000    [INFO]    Setting conf MO_PATH="/data/mo/1.0.2"
[github@HOST-192-168-1-16 mo]$ mo_ctl deploy v1.0.2
2024-04-03 11:14:57.801 UTC+0000    [INFO]    Get conf succeeded: MO_DEPLOY_MODE="binary"
2024-04-03 11:14:57.831 UTC+0000    [INFO]    MO_DEPLOY_MODE is set to 'binary', thus skipping deployment. Please download and decompress mo binary file into a folder and set conf MO_PATH and MO_CONF_FILE
[github@HOST-192-168-1-16 mo]$ mo_ctl set_conf MO_DEPLOY_MODE=git
2024-04-03 11:15:07.184 UTC+0000    [INFO]    Try to set conf: MO_DEPLOY_MODE="git"
2024-04-03 11:15:07.255 UTC+0000    [INFO]    Setting conf MO_DEPLOY_MODE="git"
[github@HOST-192-168-1-16 mo]$ mo_ctl deploy v1.0.2
2024-04-03 11:15:08.517 UTC+0000    [INFO]    Get conf succeeded: MO_DEPLOY_MODE="git"
2024-04-03 11:15:08.545 UTC+0000    [INFO]    Precheck on pre-requisite: go
2024-04-03 11:15:08.578 UTC+0000    [INFO]    Ok. go is installed
2024-04-03 11:15:08.656 UTC+0000    [INFO]    Version check on go. Current: 1.21.3, required: 1.20
2024-04-03 11:15:08.690 UTC+0000    [INFO]    Ok. go version is greater than or equal to required
2024-04-03 11:15:08.718 UTC+0000    [INFO]    Precheck on pre-requisite: gcc
2024-04-03 11:15:08.749 UTC+0000    [INFO]    Ok. gcc is installed
2024-04-03 11:15:08.796 UTC+0000    [INFO]    Version check on gcc. Current: 4.8.5, required: 4.8
2024-04-03 11:15:08.830 UTC+0000    [INFO]    Ok. gcc version is greater than or equal to required
2024-04-03 11:15:08.858 UTC+0000    [INFO]    Precheck on pre-requisite: git
2024-04-03 11:15:08.888 UTC+0000    [INFO]    Ok. git is installed
2024-04-03 11:15:08.916 UTC+0000    [INFO]    Precheck on pre-requisite: mysql
2024-04-03 11:15:08.947 UTC+0000    [INFO]    Ok. mysql is installed
2024-04-03 11:15:08.975 UTC+0000    [INFO]    Precheck on pre-requisite: docker
2024-04-03 11:15:09.003 UTC+0000    [INFO]    Conf MO_DEPLOY_MODE is set to 'git', ignoring docker
2024-04-03 11:15:09.031 UTC+0000    [INFO]    All pre-requisites are ok
2024-04-03 11:15:09.061 UTC+0000    [INFO]    Precheck passed, deploying mo now
2024-04-03 11:15:09.097 UTC+0000    [INFO]    Deploying mo on path /data/mo/1.0.2
2024-04-03 11:15:09.126 UTC+0000    [INFO]    Try number: 1
2024-04-03 11:15:09.155 UTC+0000    [INFO]    cd /data/mo/1.0.2 && git clone https://github.com/matrixorigin/matrixone.git
Cloning into 'matrixone'...
remote: Enumerating objects: 142409, done.
remote: Counting objects: 100% (1892/1892), done.
remote: Compressing objects: 100% (1255/1255), done.
error: RPC failed; result=18, HTTP code = 200 MiB | 2.28 MiB/s     
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
2024-04-03 11:16:28.103 UTC+0000    [INFO]    Try number: 2
2024-04-03 11:16:28.135 UTC+0000    [INFO]    cd /data/mo/1.0.2 && git clone https://github.com/matrixorigin/matrixone.git
Cloning into 'matrixone'...
remote: Enumerating objects: 142409, done.
remote: Counting objects: 100% (22812/22812), done.
remote: Compressing objects: 100% (1569/1569), done.
remote: Total 142409 (delta 21825), reused 21311 (delta 21237), pack-reused 119597
Receiving objects: 100% (142409/142409), 80.98 MiB | 15.86 MiB/s, done.
Resolving deltas: 100% (105025/105025), done.
2024-04-03 11:16:41.152 UTC+0000    [INFO]    Git clone succeeded.
2024-04-03 11:16:41.180 UTC+0000    [INFO]    checking out to version v1.0.2
Note: checking out 'v1.0.2'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at 8081e05... fix wait channel buf 1.0 (#13708)
2024-04-03 11:16:41.672 UTC+0000    [INFO]    Check out succeeded.
2024-04-03 11:16:41.699 UTC+0000    [INFO]    GOPROXY is set, setting go proxy to GOPROXY=https://goproxy.cn,direct
2024-04-03 11:16:41.732 UTC+0000    [INFO]    Try to build mo-service: make build
[Create build config]
go: downloading github.com/google/uuid v1.3.0
go: downloading golang.org/x/sys v0.11.0
go: downloading golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc
go: downloading github.com/smartystreets/goconvey v1.8.0
go: downloading github.com/aliyun/aliyun-oss-go-sdk v2.2.9+incompatible
go: downloading golang.org/x/sync v0.3.0
go: downloading github.com/hashicorp/go-multierror v1.0.0
go: downloading github.com/bits-and-blooms/bitset v1.2.0
go: downloading golang.org/x/net v0.14.0
go: downloading golang.org/x/tools v0.9.1
go: downloading github.com/hashicorp/errwrap v1.0.0
go: downloading golang.org/x/crypto v0.12.0
go: downloading github.com/gopherjs/gopherjs v1.17.2
go: downloading github.com/hashicorp/go-uuid v1.0.1
go: downloading golang.org/x/text v0.12.0
go: downloading golang.org/x/mod v0.10.0
make[1]: Entering directory `/data/mo/1.0.2/matrixone/cgo'
cc -std=c99 -g -O3 -Wall -Werror   -c -o mo.o mo.c
cc -std=c99 -g -O3 -Wall -Werror   -c -o arith.o arith.c
cc -std=c99 -g -O3 -Wall -Werror   -c -o compare.o compare.c
cc -std=c99 -g -O3 -Wall -Werror   -c -o logic.o logic.c
ar -rcs libmo.a *.o
make[1]: Leaving directory `/data/mo/1.0.2/matrixone/cgo'
[Build binary]
CGO_CFLAGS="-I/data/mo/1.0.2/matrixone/cgo" CGO_LDFLAGS="-L/data/mo/1.0.2/matrixone/cgo -lmo -lm" go build   -ldflags="-X 'github.com/matrixorigin/matrixone/pkg/version.GoVersion=go version go1.21.3 linux/amd64' -X 'github.com/matrixorigin/matrixone/pkg/version.BranchName=HEAD' -X 'github.com/matrixorigin/matrixone/pkg/version.CommitID=8081e05' -X 'github.com/matrixorigin/matrixone/pkg/version.BuildTime=1712143009' -X 'github.com/matrixorigin/matrixone/pkg/version.Version=v1.1.2'" -o mo-service ./cmd/mo-service
2024-04-03 11:18:04.573 UTC+0000    [INFO]    Build succeeded
2024-04-03 11:18:04.601 UTC+0000    [INFO]    Creating mo logs /data/mo/1.0.2/matrixone/logs path in case it does not exist
2024-04-03 11:18:04.630 UTC+0000    [INFO]    Deoloy succeeded
2024-04-03 11:18:04.659 UTC+0000    [INFO]    Setting mo conf file
2024-04-03 11:18:04.687 UTC+0000    [INFO]    Conf source path MO_CONF_SRC_PATH: , file name: cn.toml
2024-04-03 11:18:04.716 UTC+0000    [WARN]    File does not exist or is not set, skipping
2024-04-03 11:18:04.745 UTC+0000    [INFO]    Conf source path MO_CONF_SRC_PATH: , file name: tn.toml
2024-04-03 11:18:04.772 UTC+0000    [WARN]    File does not exist or is not set, skipping
2024-04-03 11:18:04.800 UTC+0000    [INFO]    Conf source path MO_CONF_SRC_PATH: , file name: log.toml
2024-04-03 11:18:04.828 UTC+0000    [WARN]    File does not exist or is not set, skipping
[github@HOST-192-168-1-16 mo]$ mo_ctl start 
2024-04-03 11:18:41.469 UTC+0000    [INFO]    No mo-service is running
2024-04-03 11:18:41.554 UTC+0000    [INFO]    Get conf succeeded: MO_DEPLOY_MODE="git"
2024-04-03 11:18:41.589 UTC+0000    [INFO]    GO memory limit(Mi): 14295
2024-04-03 11:18:41.646 UTC+0000    [INFO]    Starting mo-service: cd /data/mo/1.0.2/matrixone/ && GOMEMLIMIT=14295MiB /data/mo/1.0.2/matrixone/mo-service -daemon -debug-http :9876 -launch /data/mo/1.0.2/etc/launch/launch.toml >/data/mo/1.0.2/matrixone/logs/stdout-20240403_111841.log 2>/data/mo/1.0.2/matrixone/logs/stderr-20240403_111841.log
2024-04-03 11:18:41.753 UTC+0000    [INFO]    Wait for 2 seconds
2024-04-03 11:18:43.855 UTC+0000    [INFO]    No mo-service is running
2024-04-03 11:18:43.884 UTC+0000    [ERROR]    Start failed
[github@HOST-192-168-1-16 mo]$ mo_ctl get_conf MO_CONF_FILE
2024-04-03 11:18:55.720 UTC+0000    [INFO]    Get conf succeeded: MO_CONF_FILE="${MO_PATH}/etc/launch/launch.toml"
[github@HOST-192-168-1-16 mo]$ mo_ctl set_conf MO_CONF_FILE="\${MO_PATH}/matrixone/etc/launch/launch.toml"
2024-04-03 11:19:11.845 UTC+0000    [INFO]    Try to set conf: MO_CONF_FILE="${MO_PATH}/matrixone/etc/launch/launch.toml"
2024-04-03 11:19:11.919 UTC+0000    [INFO]    Setting conf MO_CONF_FILE="${MO_PATH}/matrixone/etc/launch/launch.toml"
[github@HOST-192-168-1-16 mo]$ mo_ctl restart 
2024-04-03 11:19:14.423 UTC+0000    [INFO]    No mo-service is running
2024-04-03 11:19:14.450 UTC+0000    [INFO]    No need to stop mo-service
2024-04-03 11:19:14.479 UTC+0000    [INFO]    Stop succeeded
2024-04-03 11:19:14.507 UTC+0000    [INFO]    Wait for 2 seconds
2024-04-03 11:19:16.612 UTC+0000    [INFO]    No mo-service is running
2024-04-03 11:19:16.698 UTC+0000    [INFO]    Get conf succeeded: MO_DEPLOY_MODE="git"
2024-04-03 11:19:16.734 UTC+0000    [INFO]    GO memory limit(Mi): 14295
2024-04-03 11:19:16.793 UTC+0000    [INFO]    Starting mo-service: cd /data/mo/1.0.2/matrixone/ && GOMEMLIMIT=14295MiB /data/mo/1.0.2/matrixone/mo-service -daemon -debug-http :9876 -launch /data/mo/1.0.2/matrixone/etc/launch/launch.toml >/data/mo/1.0.2/matrixone/logs/stdout-20240403_111916.log 2>/data/mo/1.0.2/matrixone/logs/stderr-20240403_111916.log
2024-04-03 11:19:16.900 UTC+0000    [INFO]    Wait for 2 seconds
2024-04-03 11:19:19.002 UTC+0000    [INFO]    At least one mo-service is running. Process info: 
github    3320     1 13 11:19 ?        00:00:00 /data/mo/1.0.2/matrixone/mo-service -daemon -debug-http :9876 -launch /data/mo/1.0.2/matrixone/etc/launch/launch.toml
2024-04-03 11:19:19.032 UTC+0000    [INFO]    List of pid(s): 
3320
2024-04-03 11:19:19.061 UTC+0000    [INFO]    Start succeeded
[github@HOST-192-168-1-16 mo]$ mo_ctl connect
2024-04-03 11:20:06.673 UTC+0000    [INFO]    Checking connectivity
2024-04-03 11:20:06.730 UTC+0000    [INFO]    Ok, connecting for user ... 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.30-MatrixOne-v1.1.2 MatrixOne

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> select git_version();
+---------------+
| git_version() |
+---------------+
| 8081e05       |
+---------------+
1 row in set (0.00 sec)

MySQL [(none)]> select version();
+-------------------------+
| version()               |
+-------------------------+
| 8.0.30-MatrixOne-v1.1.2 |
+-------------------------+
1 row in set (0.00 sec)

MySQL [(none)]> systemctl mo_ctl get_cid
    -> ;
ERROR 1064 (HY000): SQL parser error: You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at line 1 column 9 near "systemctl mo_ctl get_cid";
MySQL [(none)]> system mo_ctl get_cid
2024-04-03 11:20:37.532 UTC+0000    [INFO]    Try get mo commit id
commit 8081e0516065caf2531835c42f92e00c99f0082a
Author: aptend <49832303+aptend@users.noreply.github.com>
Date:   Thu Dec 21 22:57:04 2023 +0800

    fix wait channel buf 1.0 (#13708)
2024-04-03 11:20:37.571 UTC+0000    [INFO]    Get commit id succeeded
MySQL [(none)]> system mo_ctl get_branch
2024-04-03 11:20:40.753 UTC+0000    [INFO]    Try get mo branch
2024-04-03 11:20:40.791 UTC+0000    [INFO]    Get branch succeeded, current branch: (detached from v1.0.2)
aronchanisme commented 6 months ago

as per discussed, fixed and only fixed in main currently.

mysql> select version();
+-------------------------+
| version()               |
+-------------------------+
| 8.0.30-MatrixOne-v71605 |
+-------------------------+
1 row in set (0.00 sec)

mysql> select git_version();
+---------------+
| git_version() |
+---------------+
| b71d6d0c5     |
+---------------+
1 row in set (0.00 sec)

mysql> system mo_ctl get_cid
2024-04-04 17:12:47.716 UTC+0800    [INFO]    Try get mo commit id
commit b71d6d0c516579ef0012adff32a9422f2dee89f8
Author: aptend <49832303+aptend@users.noreply.github.com>
Date:   Thu Apr 4 14:54:27 2024 +0800

    two phase transfer in flushing (#15336)

    change the transfer deletes for flush and merge transaction into 2 phases

    Approved by: @XuPeng-SH
2024-04-04 17:12:47.860 UTC+0800    [INFO]    Get commit id succeeded
mysql> system mo_ctl get_branch
2024-04-04 17:12:50.453 UTC+0800    [INFO]    Try get mo branch
2024-04-04 17:12:50.538 UTC+0800    [INFO]    Get branch succeeded, current branch: main