学习时长:
5min
课程收获:
对 TiDB 整体架构以及读写路程有大概的了解
课程内容:
本课程主要包括 TiDB 架构的简单介绍、各个组件的作用,以及读写请求在 TiDB 中的过程
TiDB 整体架构
- TiDB
- TiKV
- PD
TiDB 对读请求的处理
- the client establish connection to TiDB and send a request to TiDB
- TIDB gets SQL from the request
- TiDB parses and compiles the SQL, make and optimize the query plan
- TiDB gets start_ts from PD
- TiDB gets the metadata of table and transfers the query plan to a series of executor
- TiDB sends the coprocessor request to TiKV through gRPC
- TiKV receives the request, searches for the data, and sends thse result to TiDB
- TiDB receives all the data from TiKVand handles the result
- TiDB sends the result to the client
TiDB 对写请求的处理
- The client establish connection to TiDB and send a request to TiDB
- TiDB gets SQL from the request
- TiDB parses and compiles the SQL, make and optimize the query plan
- TiDB gets start_ts from PD
- TiDB gets the metadata of table and transfers the query plan to a series of executor
- TiDB make a commit request
- TiKV commit the data using two-ghase commit (prewrite/commit) according to the percolator, TiDB will gets_commit_ts at commit phase (2PC)
- TiKV send the result to TiDB
- TiDB send the result to client