Skip to content

Commit

Permalink
Merge branch 'master' into go-sql-driver
Browse files Browse the repository at this point in the history
	修改:     doc/example/main_test.sh
  • Loading branch information
martianzhang committed Dec 25, 2018
2 parents ddd0a90 + 0f3893c commit dba2504
Show file tree
Hide file tree
Showing 97 changed files with 13,801 additions and 12,337 deletions.
51 changes: 39 additions & 12 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,58 @@
# CHANGELOG

## 2018-11
## 2018-12

- DOING: english translation

## 2018-11

- add all third-party lib into vendor
- support `-report-type chardet`
- add more heuristic rules: TBL.008, KEY.010, ARG.012, KWR.004
- add -cleanup-test-database command-line arg
- add -check-config parameter
- fix #146 pretty cause syntax error
- fix #140 COL.012, COL.015 NULL type about TEXT/BLOB
- fix #141 empty output when query execute failed on mysql
- fix #89 index advisor give wrong database name, `optimizer_xx`
- fix #121 RemoveSQLComment trim space
- fix #120 trimspace before check single line comment
- fix mac os stdout print buffer truncate
- fix -config arg load file error
- fix #87 RuleImplicitConversion value type mistach check bug
- fix #116 SplitStatement check if single comment line is in multi-line sql.
- fix #112 multi-line comment will cause line counter error, when -report-type=lint
- fix #110 remove bom before auditing
- fix #104 case insensitive regex @ CLA.009
- fix #87 RuleImplicitConversion value type mismatch check bug
- fix #38 always true where condition check
- abandon stdin terminal interactive mod, which may seems like hangup

## 2018-10
- Fix SplitStatement mulitstatement eof bug #66

- Fix SplitStatement multistatement eof bug #66
- Fix pretty func hangup issue #47
- Fix some foolish code spell error
- Use travis for CI
- Fix Go 1.8 defapth GOPATH compatible issue BUG #5
- Fix Go 1.8 default GOPATH compatible issue BUG #5
- 2018-10-20 开源先锋日(OSCAR)对外正式开源发布代码

## 2018-09

- 修复多个启发式建议不准确BUG,优化部分建议文案使得建议更清晰
- 基于TiDB Parser完善多个DDL类型语句的建议
- 基于 TiDB Parser 完善多个 DDL 类型语句的建议
- 新增lint report-type类型,支持Vim Plugin优化建议输出
- 更新整理项目文档,开源准备
- 2018-09-21 Gdevops SOAR首次对外进行技术分享宣传

## 2018-08
- 利用docker临时容器进行daily测试

- 利用 docker 临时容器进行 daily 测试
- 添加main_test全功能回归测试
- 修复在测试中发现的问题
- mymysql合并MySQL8.0相关PR,修改vendor依赖
- mymysql 合并 MySQL8.0 相关PR,修改vendor依赖
- 改善HeuristicRule中的文案
- 持续集成Vitess Parser的改进
- NewQuery4Audit结构体中引入TiDB Parser
- NewQuery4Audit 结构体中引入 TiDB Parser
- 通过TiAST完成大量与 DDL 相关的TODO
- 修改heuristic rules检查的返回值,提升拓展性
- 建议中引入Position,用于表示建议产生于SQL的位置
Expand All @@ -41,22 +63,25 @@
- 优化 doc 文档

## 2018-07

- 补充文档,添加项目LOGO
- 改善代码质量提升测试覆盖度
- mymysql升级,支持MySQL 8.0
- 提供remove-comment小工具
- 提供索引重复检查小工具
- HeuristicRule新增RuleSpaceAfterDot
- HeuristicRule 新增 RuleSpaceAfterDot
- 支持字符集和Collation不相同时的隐式数据类型转换的检查

## 2018-06

- 支持更多的SQL Rewrite规则
- 添加SQL执行超时限制
- 索引优化建议支持对约束的检查
- 修复数据采样中null值处理不正确的问题
- Explain支持last_query_cost
- 修复数据采样中 NULL 值处理不正确的问题
- Explain 支持 last_query_cost

## 2018-05

- 添加数据采样功能
- 添加语句执行安全检查
- 支持DDL语法检查
Expand All @@ -67,6 +92,7 @@
- 支持SQL Pretty输出

## 2018-04

- 支持语法检查
- 支持测试环境
- 支持MySQL原数据的获取
Expand All @@ -76,7 +102,8 @@
- 引入配置文件

## 2018-03

- 基本架构设计
- 添加大量底层函数用于处理AST
- 添加Insert、Delete、Update转写成Select的基本函数
- 添加Insert、Delete、Update 转写成 Select 的基本函数
- 支持MySQL Explain信息输出
32 changes: 23 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ BUILD_TIME=`date +%Y%m%d%H%M`
COMMIT_VERSION=`git rev-parse HEAD`

# Add mysql version for testing `MYSQL_RELEASE=percona MYSQL_VERSION=5.7 make docker`
# MySQL 5.1 `MYSQL_RELEASE=vsamov/mysql-5.1.73 make docker`
# MYSQL_RELEASE: mysql, percona, mariadb ...
# MYSQL_VERSION: latest, 8.0, 5.7, 5.6, 5.5 ...
# use mysql:latest as default
Expand Down Expand Up @@ -45,8 +46,9 @@ deps:
@echo "\033[92mDependency check\033[0m"
@bash ./deps.sh
# The retool tools.json is setup from retool-install.sh
# some packages download need more open internet access
retool sync
retool do gometalinter.v2 intall
#retool do gometalinter.v2 --install

# Code format
.PHONY: fmt
Expand All @@ -64,6 +66,12 @@ test:
go test -race ./...
@echo "test Success!"

# Rule golang test cases with `-update` flag
test-update:
@echo "\033[92mRun all test cases with -update flag ...\033[0m"
go test ./... -update
@echo "test-update Success!"

# Code Coverage
# colorful coverage numerical >=90% GREEN, <80% RED, Other YELLOW
.PHONY: cover
Expand Down Expand Up @@ -107,7 +115,7 @@ doc: build

# Add or change a heuristic rule
.PHONY: heuristic
heuristic: doc docker
heuristic: doc
@echo "\033[92mUpdate Heuristic rule golden files ...\033[0m"
go test github.com/XiaoMi/soar/advisor -v -update -run TestListHeuristicRules
go test github.com/XiaoMi/soar/advisor -v -update -run TestMergeConflictHeuristicRules
Expand Down Expand Up @@ -146,7 +154,7 @@ lint: build
@echo "gometalinter check your code is pretty good"

.PHONY: release
release: deps build
release: build
@echo "\033[92mCross platform building for release ...\033[0m"
@mkdir -p release
@for GOOS in darwin linux windows; do \
Expand All @@ -163,6 +171,7 @@ release: deps build
docker:
@echo "\033[92mBuild mysql test enviorment\033[0m"
@docker stop soar-mysql 2>/dev/null || true
@docker wait soar-mysql 2>/dev/null || true
@echo "docker run --name soar-mysql $(MYSQL_RELEASE):$(MYSQL_VERSION)"
@docker run --name soar-mysql --rm -d \
-e MYSQL_ROOT_PASSWORD=1tIsB1g3rt \
Expand All @@ -171,17 +180,22 @@ docker:
-v `pwd`/doc/example/sakila.sql.gz:/docker-entrypoint-initdb.d/sakila.sql.gz \
$(MYSQL_RELEASE):$(MYSQL_VERSION)

@echo -n "waiting for sakila database initializing "
@while ! mysql -h 127.0.0.1 -u root sakila -p1tIsB1g3rt -NBe "do 1;" 2>/dev/null; do \
@echo "waiting for sakila database initializing "
@while ! docker exec soar-mysql mysql --user=root --password=1tIsB1g3rt --host "127.0.0.1" --silent -NBe "do 1" >/dev/null 2>&1 ; do \
printf '.' ; \
sleep 1 ; \
done ; \
echo '.'
@echo "mysql test enviorment is ready!"

.PHONY: connect
connect:
mysql -h 127.0.0.1 -u root -p1tIsB1g3rt sakila -c
.PHONY: docker-connect
docker-connect:
docker exec -it soar-mysql mysql --user=root --password=1tIsB1g3rt --host "127.0.0.1"

# attach docker container with bash interactive mode
.PHONY: docker-it
docker-it:
docker exec -it soar-mysql /bin/bash

.PHONY: main_test
main_test: install
Expand All @@ -196,7 +210,7 @@ daily: | deps fmt vendor docker cover doc lint release install main_test clean l

# vendor, docker will cost long time, if all those are ready, daily-quick will much more fast.
.PHONY: daily-quick
daily-quick: | deps fmt cover doc lint logo
daily-quick: | deps fmt cover main_test doc lint logo
@echo "\033[92mdaily-quick build finished\033[0m"

.PHONY: logo
Expand Down
2 changes: 1 addition & 1 deletion advisor/explainer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

func TestDigestExplainText(t *testing.T) {
common.Log.Debug("Enter function: %s", common.GetFunctionName())
common.Log.Debug("Entering function: %s", common.GetFunctionName())
var text = `+----+-------------+---------+-------+---------------------------------------------------------+-------------------+---------+---------------------------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+---------+-------+---------------------------------------------------------+-------------------+---------+---------------------------+------+-------------+
Expand Down
Loading

0 comments on commit dba2504

Please sign in to comment.