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

spm: add upgrade checklist for SPM #6866

Merged
merged 12 commits into from
Aug 17, 2021
40 changes: 40 additions & 0 deletions sql-plan-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,43 @@ create global binding for select * from t where a < 100 and b < 100 using select
| max_execution_time | 查询过程最多消耗多少时间 |

+ `read_from_storage` 是一个非常特别的 hint,因为它指定了读表时选择从 TiKV 读还是从 TiFlash 读。由于 TiDB 提供隔离读的功能,当隔离条件变化时,这个 hint 对演进出来的执行计划影响很大,所以当最初创建的绑定中存在这个 hint,TiDB 会无视其所有演进的绑定。

## 升级检查 (Upgrade Checklist)

执行计划管理功能(SPM)在版本升级过程中可能会出现一些兼容性问题导致升级失败,你需要在版本升级前做一些检查,确保版本顺利升级。
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

* 当你尝试从 v5.2 以前的版本(即 v4.0、v5.0、v5.1)升级到此版本,需要注意在升级前检查自动演进的开关 `tidb_evolve_plan_baselines` 是否已经关闭。如果尚未关闭,则需要将其关闭后再进行升级。具体操作如下所示:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的此版本是指 v5.2 及以后的版本吗?


{{< copyable "sql" >}}
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

```sql
-- 在待升级的版本上检查自动演进的开关 `tidb_evolve_plan_baselines` 是否关闭。

select @@global.tidb_evolve_plan_baselines;

-- 如果演进的开关 `tidb_evolve_plan_baselines` 尚未关闭,则需要将其关闭。

set global tidb_evolve_plan_baselines = off;
```
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

* 当你尝试从 v4.0 版本升级到此版本,需要注意在升级前检查所有可用绑定对应的查询语句在新版本中是否存在语法错误。如果存在语法错误,则需要删除对应的绑定。
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该检查需要 cherry-pick 到 v5.0 和 v5.1 这两个版本的文档中。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在 v5.0 和 v5.1 文档中,这个【此版本】是指什么版本呢?


具体操作如下所示:
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

{{< copyable "sql" >}}
TomShawn marked this conversation as resolved.
Show resolved Hide resolved

```sql
-- 在待升级的版本上检查现有可用绑定对应的查询语句。

select bind_sql from mysql.bind_info where source != 'builtin' and status = 'using';

-- 将上一条查询得到的结果,在新版本的测试环境中进行验证。

bind_sql_0;
bind_sql_1;
...

-- 如果报错信息是语法错误(ERROR 1064 (42000): You have an error in your SQL syntax),则需要删除对应的绑定。
-- 如果是其他错误,如未找到表,则表示语法兼容,不需要进行额外的处理。
```