Skip to content

Commit 16490bc

Browse files
committed
update flashback en
Signed-off-by: husharp <ihusharp@gmail.com>
1 parent 35264cd commit 16490bc

File tree

15 files changed

+1973
-572
lines changed

15 files changed

+1973
-572
lines changed

.DS_Store

0 Bytes
Binary file not shown.

_posts/2023-05-15-Flashback-in-TiKV.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: blog
3-
title: "Flashback TiKV"
3+
title: "Flashback TiKV Chinese"
44
date: 2023-05-20 17:43:28 +0800
55
category: distributed
66
---
@@ -223,13 +223,13 @@ async fn start_flashback/end_flashback {
223223

224224
Admin request 通过 RaftStoreRouter 构成一条 RaftCommand 发送,会按照 Propose 流程,通过 pre_propose 的检查后到 PeerFsmDelegate.fsm.peer.propose 完成 Propose 一条 Raft Log。
225225

226-
之后PeerFsm会将 Proposal 以及已提交日志发送给对应的 ApplyFsm来到 apply 流程。
226+
之后 PeerFsm 会将 Proposal 以及已提交日志发送给对应的 ApplyFsm 来到 apply 流程。
227227

228-
ApplyFsm会针对这些日志进行(见 ApplyFsm::handle_apply):
228+
ApplyFsm 会针对这些日志进行(见 ApplyFsm::handle_apply):
229229

230230
1. 完成数据的持久化。
231231
2. 向 PeerFsm发送 ApplyRes,用于更新 PeerFsm中的 Region 状态。
232-
在 exec_raft_cmd 会加上 check_flashback_state,进行 Flashback 持久态的判断。此处 region 将在下面的 exec 函数中设置上,由于为串行 apply,因此在下条 cmd 来之前,便会设置好 region 信息。
232+
在 exec_raft_cmd 会加上 check_flashback_state,进行 Flashback 持久态的判断。此处 region 将在下面的 exec 函数中设置上,由于为串行 apply,因此在下条 cmd 来之前,便会设置好 region 信息。
233233

234234
```rust
235235
check_flashback_state(self.region.get_is_in_flashback());
@@ -266,7 +266,7 @@ fn exec_flashback() -> Result<> {
266266
}
267267
```
268268

269-
ApplyFSM 在应用一批日志之后会发送一条 ApplyRes 的消息到 PeerFsm。
269+
ApplyFSM 在应用一批日志之后会发送一条 ApplyRes 的消息到 PeerFsm。
270270

271271
最终又回到 PeerFsm 的PeerFsmDelegate::handle_msgs 函数,走到 PeerMsg::ApplyRes { res } 分支,调用 PeerFsmDelegate::on_apply_res 完成对 Flashback 的持久态更新。
272272

@@ -306,7 +306,7 @@ fn propose_raft_command() {
306306

307307
这样很自然地对于除 ReadLocal 和 StaleRead 外的 req,都可以做出以下隔断:
308308

309-
在进入 read 之前,判断一下 req 中是否有 Flashback 参数,便实现了在开启 Flashback 之后,只能让 Flashback 相关的读指令通行。
309+
在进入 read 之前,判断一下 req 中是否有 Flashback flag,便实现了在开启 Flashback 之后,只能让 Flashback 相关的读指令通行。
310310

311311
```rust
312312
fn exec_snapshot() {
@@ -484,7 +484,7 @@ fn exec_snapshot() {
484484
- 这部分的改动会带上 1PC 的 flag,让 CDC 等工具将其视为一阶段事务的修改
485485
2. commit 在 1.b 中写入的锁,完成 Flashback
486486

487-
回到最开始的 future_flashback_to_version 中,也会内部进行 req.into 后走到 FlashbackToVersionReadPhase 和 FlashbackToVersion 进行读写,大致流程在「读写阶段介绍」小节已经详细介绍,就不再赘述。
487+
回到最开始的 future_flashback_to_version 中,也会内部进行 req.into 后走到 FlashbackToVersionReadPhase 和 FlashbackToVersion 进行读写,大致流程在「读写阶段介绍」小节已经详细介绍,就不再赘述。
488488

489489
### Phase2-2: Finish
490490

_posts/2023-10-25-Flashback-in-TiKV-en.md

Lines changed: 538 additions & 0 deletions
Large diffs are not rendered by default.

_site/blogs.html

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,13 @@ <h1>Blogpost</h1>
101101

102102
<li id="hide-li"><b>2023</b></li>
103103

104-
<li>05-20 - <a href="/distributed/2023/05/20/Flashback-in-TiKV.html">Flashback TiKV</a></li>
104+
<li>10-25 - <a href="/distributed/2023/10/25/Flashback-in-TiKV-en.html">Flashback TiKV</a></li>
105+
106+
107+
108+
109+
110+
<li>05-20 - <a href="/distributed/2023/05/20/Flashback-in-TiKV.html">Flashback TiKV Chinese</a></li>
105111

106112

107113

@@ -223,7 +229,11 @@ <h1>Blogpost</h1>
223229

224230

225231

226-
<li>2023-05-20 - <a href="/distributed/2023/05/20/Flashback-in-TiKV.html">Flashback TiKV</a></li>
232+
<li>2023-10-25 - <a href="/distributed/2023/10/25/Flashback-in-TiKV-en.html">Flashback TiKV</a></li>
233+
234+
235+
236+
<li>2023-05-20 - <a href="/distributed/2023/05/20/Flashback-in-TiKV.html">Flashback TiKV Chinese</a></li>
227237

228238

229239

_site/distributed/2023/05/20/Flashback-in-TiKV.html

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<meta name="viewport" content="width=device-width, initial-scale=1.0">
1515
<meta name="theme-color" content="#ffffff">
1616

17-
<title>Flashback TiKV</title>
17+
<title>Flashback TiKV Chinese</title>
1818
<style>
1919
.main {
2020
padding: 20px 10px;
@@ -38,18 +38,18 @@
3838
}
3939
</style>
4040
<!-- Begin Jekyll SEO tag v2.8.0 -->
41-
<title>Flashback TiKV</title>
41+
<title>Flashback TiKV Chinese</title>
4242
<meta name="generator" content="Jekyll v4.3.2" />
43-
<meta property="og:title" content="Flashback TiKV" />
43+
<meta property="og:title" content="Flashback TiKV Chinese" />
4444
<meta property="og:locale" content="en_US" />
4545
<link rel="canonical" href="http://localhost:4000/distributed/2023/05/20/Flashback-in-TiKV.html" />
4646
<meta property="og:url" content="http://localhost:4000/distributed/2023/05/20/Flashback-in-TiKV.html" />
4747
<meta property="og:type" content="article" />
4848
<meta property="article:published_time" content="2023-05-20T17:43:28+08:00" />
4949
<meta name="twitter:card" content="summary" />
50-
<meta property="twitter:title" content="Flashback TiKV" />
50+
<meta property="twitter:title" content="Flashback TiKV Chinese" />
5151
<script type="application/ld+json">
52-
{"@context":"https://schema.org","@type":"BlogPosting","dateModified":"2023-05-20T17:43:28+08:00","datePublished":"2023-05-20T17:43:28+08:00","headline":"Flashback TiKV","mainEntityOfPage":{"@type":"WebPage","@id":"http://localhost:4000/distributed/2023/05/20/Flashback-in-TiKV.html"},"url":"http://localhost:4000/distributed/2023/05/20/Flashback-in-TiKV.html"}</script>
52+
{"@context":"https://schema.org","@type":"BlogPosting","dateModified":"2023-05-20T17:43:28+08:00","datePublished":"2023-05-20T17:43:28+08:00","headline":"Flashback TiKV Chinese","mainEntityOfPage":{"@type":"WebPage","@id":"http://localhost:4000/distributed/2023/05/20/Flashback-in-TiKV.html"},"url":"http://localhost:4000/distributed/2023/05/20/Flashback-in-TiKV.html"}</script>
5353
<!-- End Jekyll SEO tag -->
5454

5555
</head>
@@ -74,7 +74,7 @@
7474

7575
<div class="snowframe">
7676

77-
<h1>Flashback TiKV</h1>
77+
<h1>Flashback TiKV Chinese</h1>
7878

7979

8080

@@ -349,14 +349,14 @@ <h4 id="prepare-flashback">Prepare Flashback</h4>
349349

350350
<p>Admin request 通过 RaftStoreRouter 构成一条 RaftCommand 发送,会按照 Propose 流程,通过 pre_propose 的检查后到 PeerFsmDelegate.fsm.peer.propose 完成 Propose 一条 Raft Log。</p>
351351

352-
<p>之后PeerFsm会将 Proposal 以及已提交日志发送给对应的 ApplyFsm来到 apply 流程。</p>
352+
<p>之后 PeerFsm 会将 Proposal 以及已提交日志发送给对应的 ApplyFsm 来到 apply 流程。</p>
353353

354-
<p>ApplyFsm会针对这些日志进行(见 ApplyFsm::handle_apply):</p>
354+
<p>ApplyFsm 会针对这些日志进行(见 ApplyFsm::handle_apply):</p>
355355

356356
<ol>
357357
<li>完成数据的持久化。</li>
358358
<li>向 PeerFsm发送 ApplyRes,用于更新 PeerFsm中的 Region 状态。
359-
在 exec_raft_cmd 会加上 check_flashback_state,进行 Flashback 持久态的判断。此处 region 将在下面的 exec 函数中设置上,由于为串行 apply,因此在下条 cmd 来之前,便会设置好 region 信息。</li>
359+
在 exec_raft_cmd 会加上 check_flashback_state,进行 Flashback 持久态的判断。此处 region 将在下面的 exec 函数中设置上,由于为串行 apply,因此在下条 cmd 来之前,便会设置好 region 信息。</li>
360360
</ol>
361361

362362
<div class="language-rust highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nf">check_flashback_state</span><span class="p">(</span><span class="k">self</span><span class="py">.region</span><span class="nf">.get_is_in_flashback</span><span class="p">());</span>
@@ -429,7 +429,7 @@ <h4 id="停读">停读</h4>
429429

430430
<p>这样很自然地对于除 ReadLocal 和 StaleRead 外的 req,都可以做出以下隔断:</p>
431431

432-
<p>在进入 read 之前,判断一下 req 中是否有 Flashback 参数,便实现了在开启 Flashback 之后,只能让 Flashback 相关的读指令通行。</p>
432+
<p>在进入 read 之前,判断一下 req 中是否有 Flashback flag,便实现了在开启 Flashback 之后,只能让 Flashback 相关的读指令通行。</p>
433433

434434
<div class="language-rust highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">fn</span> <span class="nf">exec_snapshot</span><span class="p">()</span> <span class="p">{</span>
435435
<span class="o">...</span>
@@ -670,13 +670,19 @@ <h3 id="改进点">改进点</h3>
670670

671671
<h3 id="参考文档">参考文档</h3>
672672

673-
<p><a href="https://cn.pingcap.com/blog/tikv-source-code-reading-read">TiKV 源码阅读三部曲(二)读流程 来阅读详细读过程</a>
674-
<a href="https://cn.pingcap.com/blog/tikv-source-code-reading-write">TiKV 源码阅读三部曲(三)写流程</a>
675-
<a href="https://cn.pingcap.com/blog/tikv-source-code-reading-7">TiKV 源码解析系列文章(七)gRPC Server 的初始化和启动流程</a>
676-
<a href="https://cn.pingcap.com/blog/tikv-source-code-reading-12/">TiKV 源码解析系列文章(十二)分布式事务</a>
677-
<a href="https://cn.pingcap.com/blog/tikv-source-code-reading-13">TiKV 源码解析系列文章(十三)MVCC 数据读取</a>
678-
<a href="https://cn.pingcap.com/blog/tikv-source-code-reading-17">TiKV 源码解析系列文章(十七)raftstore 概览</a>
679-
<a href="https://cn.pingcap.com/blog/tikv-source-code-reading-18">TiKV 源码解析系列文章(十八)Raft Propose 的 Commit 和 Apply 情景分析</a></p>
673+
<p><a href="https://cn.pingcap.com/blog/tikv-source-code-reading-read">TiKV 源码阅读三部曲(二)读流程 来阅读详细读过程</a></p>
674+
675+
<p><a href="https://cn.pingcap.com/blog/tikv-source-code-reading-write">TiKV 源码阅读三部曲(三)写流程</a></p>
676+
677+
<p><a href="https://cn.pingcap.com/blog/tikv-source-code-reading-7">TiKV 源码解析系列文章(七)gRPC Server 的初始化和启动流程</a></p>
678+
679+
<p><a href="https://cn.pingcap.com/blog/tikv-source-code-reading-12/">TiKV 源码解析系列文章(十二)分布式事务</a></p>
680+
681+
<p><a href="https://cn.pingcap.com/blog/tikv-source-code-reading-13">TiKV 源码解析系列文章(十三)MVCC 数据读取</a></p>
682+
683+
<p><a href="https://cn.pingcap.com/blog/tikv-source-code-reading-17">TiKV 源码解析系列文章(十七)raftstore 概览</a></p>
684+
685+
<p><a href="https://cn.pingcap.com/blog/tikv-source-code-reading-18">TiKV 源码解析系列文章(十八)Raft Propose 的 Commit 和 Apply 情景分析</a></p>
680686

681687

682688
</div>

0 commit comments

Comments
 (0)