Skip to content

Commit 2036650

Browse files
committed
mysql store实例注册及实例查询性能优化
1 parent 2f2eaab commit 2036650

40 files changed

+13370
-0
lines changed

build.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
# Tencent is pleased to support the open source community by making Polaris available.
3+
#
4+
# Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
5+
#
6+
# Licensed under the BSD 3-Clause License (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# https://opensource.org/licenses/BSD-3-Clause
11+
#
12+
# Unless required by applicable law or agreed to in writing, software distributed
13+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations under the License.
16+
17+
store_mysql_opt_plugin_version=$1
18+
polaris_server_tag=$2
19+
20+
if [ "${store_mysql_opt_plugin_version}" == "" ]; then
21+
echo -e "you must set store_pg_plugin_version info, eg bash build.sh v1.0.0"
22+
exit 1
23+
fi
24+
25+
workdir=$(pwd)
26+
27+
## 清理之前的临时资源
28+
rm -rf build_resource
29+
30+
## 准备临时构建资源文件夹
31+
mkdir build_resource
32+
cp plugin_store_mysql_opt.go.temp ./build_resource
33+
cd build_resource
34+
35+
git clone https://github.com/polarismesh/polaris.git
36+
cd polaris
37+
if [ "${polaris_server_tag}" != "" ]; then
38+
git checkout ${polaris_server_tag}
39+
fi
40+
41+
cat ../plugin_store_mysql_opt.go.temp > plugin_store_mysql_opt.go
42+
43+
go clean --modcache
44+
go get github.com/polaris-contrib/store-mysqlopt@${store_mysql_opt_plugin_version}
45+
go mod tidy
46+
47+
make build VERSION=${polaris_server_tag}
48+
49+
release_file=$(ls -lstrh | grep ".zip" | awk '{print $10}' | grep -v "md5")
50+
51+
cp ${release_file} ${workdir}
52+

go.mod

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
module github.com/polaris-contrib/store-mysqlopt
2+
3+
go 1.21
4+
5+
require (
6+
github.com/DATA-DOG/go-sqlmock v1.5.0
7+
github.com/golang/mock v1.6.0
8+
github.com/pkg/errors v0.9.1
9+
github.com/polarismesh/polaris v1.18.0-beta.1
10+
github.com/polarismesh/specification v1.4.2-alpha.7
11+
github.com/smartystreets/goconvey v1.6.4
12+
github.com/stretchr/testify v1.8.3
13+
go.uber.org/zap v1.23.0
14+
)
15+
16+
require (
17+
github.com/beorn7/perks v1.0.1 // indirect
18+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
19+
github.com/davecgh/go-spew v1.1.1 // indirect
20+
github.com/dlclark/regexp2 v1.10.0 // indirect
21+
github.com/golang/protobuf v1.5.3 // indirect
22+
github.com/google/uuid v1.3.0 // indirect
23+
github.com/gopherjs/gopherjs v0.0.0-20191106031601-ce3c9ade29de // indirect
24+
github.com/hashicorp/errwrap v1.1.0 // indirect
25+
github.com/hashicorp/go-multierror v1.1.1 // indirect
26+
github.com/jtolds/gls v4.20.0+incompatible // indirect
27+
github.com/kr/text v0.2.0 // indirect
28+
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
29+
github.com/natefinch/lumberjack v2.0.0+incompatible // indirect
30+
github.com/pmezard/go-difflib v1.0.0 // indirect
31+
github.com/prometheus/client_golang v1.18.0 // indirect
32+
github.com/prometheus/client_model v0.5.0 // indirect
33+
github.com/prometheus/common v0.45.0 // indirect
34+
github.com/prometheus/procfs v0.12.0 // indirect
35+
github.com/smartystreets/assertions v1.0.1 // indirect
36+
go.uber.org/atomic v1.10.0 // indirect
37+
go.uber.org/multierr v1.8.0 // indirect
38+
golang.org/x/net v0.17.0 // indirect
39+
golang.org/x/sys v0.15.0 // indirect
40+
golang.org/x/text v0.14.0 // indirect
41+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230526203410-71b5a4ffd15e // indirect
42+
google.golang.org/grpc v1.55.0 // indirect
43+
google.golang.org/protobuf v1.31.0 // indirect
44+
gopkg.in/yaml.v3 v3.0.1 // indirect
45+
)

mysqloptstore.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Tencent is pleased to support the open source community by making Polaris available.
3+
*
4+
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
5+
*
6+
* Licensed under the BSD 3-Clause License (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* https://opensource.org/licenses/BSD-3-Clause
11+
*
12+
* Unless required by applicable law or agreed to in writing, software distributed
13+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations under the License.
16+
*/
17+
18+
package store_mysqlopt
19+
20+
import (
21+
"github.com/polarismesh/polaris/common/log"
22+
"github.com/polarismesh/polaris/store"
23+
24+
"github.com/polaris-contrib/store-mysqlopt/store/mysqlopt"
25+
)
26+
27+
func init() {
28+
s := &mysqlopt.StableOptStore{}
29+
err := store.RegisterStore(s)
30+
if err != nil {
31+
log.Errorf("[Store][database] RegisterStore err: %+v", err)
32+
}
33+
}

plugin_store_mysql_opt.go.temp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Tencent is pleased to support the open source community by making Polaris available.
3+
*
4+
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
5+
*
6+
* Licensed under the BSD 3-Clause License (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* https://opensource.org/licenses/BSD-3-Clause
11+
*
12+
* Unless required by applicable law or agreed to in writing, software distributed
13+
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14+
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations under the License.
16+
*/
17+
18+
package main
19+
20+
import (
21+
_ "github.com/polaris-contrib/store-mysqlopt"
22+
)

0 commit comments

Comments
 (0)