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

TiFlash results materialization #11701

Merged
merged 39 commits into from Dec 8, 2022

Conversation

moyun
Copy link
Contributor

@moyun moyun commented Oct 19, 2022

First-time contributors' checklist

What is changed, added or deleted? (Required)

Add a new doc for explaining how TiFlash can save the query results to a TiDB table via a txn.

Which TiDB version(s) do your changes apply to? (Required)

Tips for choosing the affected version(s):

By default, CHOOSE MASTER ONLY so your changes will be applied to the next TiDB major or minor releases. If your PR involves a product feature behavior change or a compatibility change, CHOOSE THE AFFECTED RELEASE BRANCH(ES) AND MASTER.

For details, see tips for choosing the affected versions (in Chinese).

  • master (the latest development version)
  • v6.4 (TiDB 6.4 versions)
  • v6.3 (TiDB 6.3 versions)
  • v6.1 (TiDB 6.1 versions)
  • v5.4 (TiDB 5.4 versions)
  • v5.3 (TiDB 5.3 versions)
  • v5.2 (TiDB 5.2 versions)
  • v5.1 (TiDB 5.1 versions)
  • v5.0 (TiDB 5.0 versions)

What is the related PR or file link(s)?

Do your changes match any of the following descriptions?

  • Delete files
  • Change aliases
  • Need modification after applied to another branch
  • Might cause conflicts after applied to another branch

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Oct 19, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Oreoxmt
  • qiancai

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 19, 2022
@ti-chi-bot ti-chi-bot added missing-translation-status This PR does not have translation status info. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 19, 2022
@moyun moyun changed the title [WIP][Do Not Merge] TiFlash results materialization [WIP] [Do Not Merge] TiFlash results materialization Oct 19, 2022
@qiancai qiancai requested review from qiancai and removed request for TomShawn October 20, 2022 02:24
@qiancai qiancai self-assigned this Oct 20, 2022
@qiancai qiancai added translation/doing This PR’s assignee is translating this PR. area/bigdata Indicates that the Issue or PR belongs to the area of TiFlash, TiSpark, and OLAP. labels Oct 20, 2022
@ti-chi-bot ti-chi-bot removed the missing-translation-status This PR does not have translation status info. label Oct 20, 2022
@qiancai qiancai added the v6.4 This PR/issue applies to TiDB v6.4. label Oct 20, 2022
@moyun moyun changed the title [WIP] [Do Not Merge] TiFlash results materialization TiFlash results materialization Oct 21, 2022
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 21, 2022
@qiancai qiancai requested a review from gengliqi October 21, 2022 09:30
Copy link
Contributor

@gengliqi gengliqi left a comment

Choose a reason for hiding this comment

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

需要提一下 tidb_enable_tiflash_read_for_write_stmt 吗?


### 限制

* 对写入部分事务大小(SELECT 子句返回的结果集)的硬性限制为 1 GB,推荐的使用场景是 100 MB以下。
Copy link
Contributor

@gengliqi gengliqi Oct 24, 2022

Choose a reason for hiding this comment

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

这里可以引用一下 https://docs.pingcap.com/zh/tidb/dev/transaction-overview#%E4%BA%8B%E5%8A%A1%E9%99%90%E5%88%B6
这里的逻辑跟普通写入事务是一样的。默认事务大小是 100MB,要更大得调整 txn-total-size-limit.

Copy link
Contributor

Choose a reason for hiding this comment

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

事务太大还有另外一种方法是 https://docs.pingcap.com/zh/tidb/dev/system-variables#tidb_enable_batch_dml
把大事务拆成多个小事务,我理解这个也是值得一提的?如果出错用户可以删表重新来。

@Oreoxmt Oreoxmt self-requested a review October 25, 2022 03:50
* TiDB 对 `INSERT INTO SELECT` 语句的并发没有硬性限制,但是推荐考虑以下用法:

* 当“写事务”较大时,例如接近 1 GB, 建议控制并发不超过 10。
* 当“写事务”较小时,例如小于 100 MB, 建议控制并发不超过 30。
Copy link
Contributor

Choose a reason for hiding this comment

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

限制这个还是没有改,根据事务文档 https://docs.pingcap.com/zh/tidb/stable/transaction-overview#%E4%BA%8B%E5%8A%A1%E9%99%90%E5%88%B6。

TiDB 中,单个事务的总大小默认不超过 100 MB,这个默认值可以通过配置文件中的配置项 txn-total-size-limit 进行修改,最大支持 1 TB。单个事务的实际大小限制还取决于服务器剩余可用内存的大小,执行事务时 TiDB 进程的内存消耗相对于事务大小会存在一定程度的放大,最大可能达到提交事务大小的 2 到 3 倍以上。

Copy link
Collaborator

Choose a reason for hiding this comment

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

@gengliqi 你建议这里如何修改下呢

Copy link
Contributor

@gengliqi gengliqi Oct 28, 2022

Choose a reason for hiding this comment

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

  • TiDB 对 SELECT 子句返回的结果集(即 INSERT 写入的事务)大小的硬性限制为 1 GB,推荐的使用场景是 100 MB 以下。

    若 SELECT 返回结果大小超过了 1 GB,那么整条语句将会被强制终止。用户会得到以下出错信息:

    The query produced a too large intermediate result and thus failed

我建议这段直接引用事务的文档,因为这里逻辑是一样的,没有专门针对 insert select 的限制。

Copy link
Collaborator

Choose a reason for hiding this comment

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

@moyun PTAL

Copy link
Contributor Author

@moyun moyun Oct 28, 2022

Choose a reason for hiding this comment

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

限制这个还是没有改,根据事务文档 https://docs.pingcap.com/zh/tidb/stable/transaction-overview#%E4%BA%8B%E5%8A%A1%E9%99%90%E5%88%B6。

TiDB 中,单个事务的总大小默认不超过 100 MB,这个默认值可以通过配置文件中的配置项 txn-total-size-limit 进行修改,最大支持 1 TB。单个事务的实际大小限制还取决于服务器剩余可用内存的大小,执行事务时 TiDB 进程的内存消耗相对于事务大小会存在一定程度的放大,最大可能达到提交事务大小的 2 到 3 倍以上。

there is no conflict here with the tidb doc, and the conclusion here is specifically for this scenario but just happenly being same with the tidb doc.

tiflash/tiflash-results-materialization.md Outdated Show resolved Hide resolved
tiflash/tiflash-results-materialization.md Outdated Show resolved Hide resolved
tiflash/tiflash-results-materialization.md Outdated Show resolved Hide resolved
tiflash/tiflash-results-materialization.md Outdated Show resolved Hide resolved
Co-authored-by: Aolin <aolinz@outlook.com>
Copy link
Collaborator

@Oreoxmt Oreoxmt left a comment

Choose a reason for hiding this comment

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

Rest LGTM

tiflash/tiflash-results-materialization.md Outdated Show resolved Hide resolved
tiflash/tiflash-results-materialization.md Outdated Show resolved Hide resolved
tiflash/tiflash-results-materialization.md Outdated Show resolved Hide resolved
tiflash/tiflash-results-materialization.md Outdated Show resolved Hide resolved
tiflash/tiflash-results-materialization.md Outdated Show resolved Hide resolved
tiflash/tiflash-results-materialization.md Outdated Show resolved Hide resolved
Co-authored-by: Aolin <aolinz@outlook.com>
Copy link
Contributor

@gengliqi gengliqi left a comment

Choose a reason for hiding this comment

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

rest LGTM

tiflash/tiflash-results-materialization.md Outdated Show resolved Hide resolved
update as suggested

Co-authored-by: Liqi Geng <gengliqiii@gmail.com>
system-variables.md Outdated Show resolved Hide resolved
system-variables.md Outdated Show resolved Hide resolved
Co-authored-by: Liqi Geng <gengliqiii@gmail.com>
system-variables.md Outdated Show resolved Hide resolved
experimental-features.md Outdated Show resolved Hide resolved
system-variables.md Outdated Show resolved Hide resolved
system-variables.md Outdated Show resolved Hide resolved
system-variables.md Outdated Show resolved Hide resolved
Co-authored-by: Liqi Geng <gengliqiii@gmail.com>
Copy link
Collaborator

@Oreoxmt Oreoxmt left a comment

Choose a reason for hiding this comment

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

Rest LGTM

system-variables.md Outdated Show resolved Hide resolved
Co-authored-by: Aolin <aolinz@outlook.com>
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Dec 8, 2022
@qiancai
Copy link
Collaborator

qiancai commented Dec 8, 2022

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: c90460f

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Dec 8, 2022
@ti-chi-bot ti-chi-bot merged commit 6fc3b6f into pingcap:master Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/bigdata Indicates that the Issue or PR belongs to the area of TiFlash, TiSpark, and OLAP. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. translation/done This PR has been translated from English into Chinese and updated to pingcap/docs-cn in a PR. v6.5 This PR/issue applies to TiDB v6.5.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants