Merge pull request #1463 from CyC2018/add-index-log-redis-topics

补充索引失效、MySQL 日志、Redis 编码与集群等内容
This commit is contained in:
CyC2018
2026-10-26 03:49:53 +08:00
committed by GitHub
7 changed files with 300 additions and 1 deletions
+65
View File
@@ -0,0 +1,65 @@
<svg xmlns="http://www.w3.org/2000/svg" width="720" height="300" viewBox="0 0 720 300">
<style>
text { font-family: "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif; fill: #666; font-size: 12px; }
.title { font-weight: bold; font-size: 15px; fill: #777; text-anchor: middle; }
.b { font-weight: bold; }
.c { text-anchor: middle; }
.e { text-anchor: end; }
.note { fill: #C0605A; }
.ok { fill: #6A9F68; }
.sub { font-size: 11px; fill: #888; }
.mono { font-family: Menlo, Consolas, monospace; }
.arrow { stroke: #666; stroke-width: 1.3; fill: none; marker-end: url(#a); }
.red { stroke: #C0605A; marker-end: url(#r); }
.green { stroke: #6A9F68; marker-end: url(#g); }
.dash { stroke-dasharray: 5 4; }
.line { stroke: #666; stroke-width: 1.3; fill: none; }
.frame { fill: none; stroke: #999; stroke-width: 1; stroke-dasharray: 4 3; }
.shadow { fill: #DADADA; }
</style>
<defs>
<marker id="a" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M1,1 L9,5 L1,9" fill="none" stroke="#666" stroke-width="1.6"/>
</marker>
<marker id="r" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M1,1 L9,5 L1,9" fill="none" stroke="#C0605A" stroke-width="1.6"/>
</marker>
<marker id="g" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M1,1 L9,5 L1,9" fill="none" stroke="#6A9F68" stroke-width="1.6"/>
</marker>
</defs>
<rect width="100%" height="100%" fill="#FFFFFF"/>
<text x="360" y="28" class="title">两阶段提交与崩溃恢复</text>
<rect x="10" y="64" width="124" height="60" rx="6" class="shadow"/>
<rect x="8" y="62" width="124" height="60" rx="6" fill="#E6E6E6"/>
<text x="70" y="90" class="b c">开始事务</text>
<text x="70" y="105" class="sub c">修改内存中的页</text>
<rect x="160" y="64" width="124" height="60" rx="6" class="shadow"/>
<rect x="158" y="62" width="124" height="60" rx="6" fill="#B1DDF0"/>
<text x="220" y="90" class="b c">① prepare</text>
<text x="220" y="105" class="sub c">写 redo log 并刷盘</text>
<rect x="340" y="64" width="124" height="60" rx="6" class="shadow"/>
<rect x="338" y="62" width="124" height="60" rx="6" fill="#B0E3E6"/>
<text x="400" y="90" class="b c">② 写 binlog</text>
<text x="400" y="105" class="sub c">含 Xid,刷盘</text>
<rect x="520" y="64" width="124" height="60" rx="6" class="shadow"/>
<rect x="518" y="62" width="124" height="60" rx="6" fill="#DDD7F6"/>
<text x="580" y="90" class="b c">③ commit</text>
<text x="580" y="105" class="sub c">redo log 标记提交</text>
<line x1="134" y1="92" x2="154" y2="92" class="arrow "/>
<line x1="284" y1="92" x2="334" y2="92" class="arrow "/>
<line x1="464" y1="92" x2="514" y2="92" class="arrow "/>
<line x1="310" y1="132" x2="310" y2="172" stroke="#C0605A" stroke-width="1.5" stroke-dasharray="4 3"/>
<text x="310" y="190" class="c note">崩溃 A</text>
<line x1="490" y1="132" x2="490" y2="172" stroke="#C0605A" stroke-width="1.5" stroke-dasharray="4 3"/>
<text x="490" y="190" class="c note">崩溃 B</text>
<rect x="200" y="210" width="220" height="54" rx="4" fill="#FFFFFF" stroke="#C8C8C8"/>
<text x="310" y="232" class="c sub">redo log 处于 prepare,binlog 中没有 Xid</text>
<text x="310" y="252" class="c ok">重启后回滚,主从都没有这次修改</text>
<rect x="430" y="210" width="270" height="54" rx="4" fill="#FFFFFF" stroke="#C8C8C8"/>
<text x="565" y="232" class="c sub">redo log 处于 prepare,binlog 中有 Xid</text>
<text x="565" y="252" class="c ok">重启后提交,从库也会通过 binlog 收到修改</text>
<line x1="310" y1="196" x2="310" y2="206" class="arrow "/>
<line x1="490" y1="196" x2="520" y2="206" class="arrow "/>
</svg>

After

Width:  |  Height:  |  Size: 3.9 KiB

+69
View File
@@ -0,0 +1,69 @@
<svg xmlns="http://www.w3.org/2000/svg" width="720" height="340" viewBox="0 0 720 340">
<style>
text { font-family: "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif; fill: #666; font-size: 12px; }
.title { font-weight: bold; font-size: 15px; fill: #777; text-anchor: middle; }
.b { font-weight: bold; }
.c { text-anchor: middle; }
.e { text-anchor: end; }
.note { fill: #C0605A; }
.ok { fill: #6A9F68; }
.sub { font-size: 11px; fill: #888; }
.mono { font-family: Menlo, Consolas, monospace; }
.arrow { stroke: #666; stroke-width: 1.3; fill: none; marker-end: url(#a); }
.red { stroke: #C0605A; marker-end: url(#r); }
.green { stroke: #6A9F68; marker-end: url(#g); }
.dash { stroke-dasharray: 5 4; }
.line { stroke: #666; stroke-width: 1.3; fill: none; }
.frame { fill: none; stroke: #999; stroke-width: 1; stroke-dasharray: 4 3; }
.shadow { fill: #DADADA; }
</style>
<defs>
<marker id="a" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M1,1 L9,5 L1,9" fill="none" stroke="#666" stroke-width="1.6"/>
</marker>
<marker id="r" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M1,1 L9,5 L1,9" fill="none" stroke="#C0605A" stroke-width="1.6"/>
</marker>
<marker id="g" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M1,1 L9,5 L1,9" fill="none" stroke="#6A9F68" stroke-width="1.6"/>
</marker>
</defs>
<rect width="100%" height="100%" fill="#FFFFFF"/>
<text x="360" y="28" class="title">Redis Cluster:3 主 3 从</text>
<rect x="22" y="54" width="210" height="54" rx="6" class="shadow"/>
<rect x="20" y="52" width="210" height="54" rx="6" fill="#DDD7F6"/>
<text x="125" y="74" class="c b mono">user:1001</text>
<text x="125" y="94" class="c sub mono">CRC16(key) % 16384 = 5712</text>
<rect x="252" y="152" width="140" height="52" rx="6" class="shadow"/>
<rect x="250" y="150" width="140" height="52" rx="6" fill="#B1DDF0"/>
<text x="320" y="174" class="b c">主节点 7001</text>
<text x="320" y="189" class="sub c">槽 0~5460</text>
<rect x="262" y="252" width="120" height="36" rx="6" class="shadow"/>
<rect x="260" y="250" width="120" height="36" rx="6" fill="#E6E6E6"/>
<text x="320" y="272.5" class="b c">从节点</text>
<line x1="320" y1="205" x2="320" y2="246" class="arrow dash"/>
<rect x="402" y="152" width="140" height="52" rx="6" class="shadow"/>
<rect x="400" y="150" width="140" height="52" rx="6" fill="#B1DDF0"/>
<text x="470" y="174" class="b c">主节点 7002</text>
<text x="470" y="189" class="sub c">槽 5461~10922</text>
<rect x="412" y="252" width="120" height="36" rx="6" class="shadow"/>
<rect x="410" y="250" width="120" height="36" rx="6" fill="#E6E6E6"/>
<text x="470" y="272.5" class="b c">从节点</text>
<line x1="470" y1="205" x2="470" y2="246" class="arrow dash"/>
<rect x="552" y="152" width="140" height="52" rx="6" class="shadow"/>
<rect x="550" y="150" width="140" height="52" rx="6" fill="#B1DDF0"/>
<text x="620" y="174" class="b c">主节点 7003</text>
<text x="620" y="189" class="sub c">槽 10923~16383</text>
<rect x="562" y="252" width="120" height="36" rx="6" class="shadow"/>
<rect x="560" y="250" width="120" height="36" rx="6" fill="#E6E6E6"/>
<text x="620" y="272.5" class="b c">从节点</text>
<line x1="620" y1="205" x2="620" y2="246" class="arrow dash"/>
<text x="325" y="236" class="sub">异步复制</text>
<path d="M232,92 C330,96 440,110 470,146" class="arrow"/>
<text x="380" y="104" class="c sub">槽 5712 在 7002</text>
<text x="20" y="128" class="sub note">如果发给 7001:MOVED 5712 127.0.0.1:7002</text>
<path d="M100,136 C100,166 200,176 246,176" class="arrow red dash"/>
<text x="20" y="312" class="sub">{user:1001}:cart 和 {user:1001}:orders 只按 {} 中的部分计算,都在槽 5712,可以在同一条命令或 Lua 脚本中使用</text>
<text x="20" y="330" class="sub">主节点宕机后,从节点被选为新的主节点;本机 cluster-node-timeout 为 5 秒时,这部分槽约 9 秒无法写入</text>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB