Update 数据库系统原理.md
调整配图的配色和画法:换成更浅的蓝、青、紫和暖灰,去掉阴影,方框加同色细描边,箭头改为实心。
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 91 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
@@ -4,14 +4,14 @@
|
||||
.title { fill: #777; }
|
||||
.sub { fill: #888; }
|
||||
.note { fill: #C38F8A; }
|
||||
.flow { stroke: #666; stroke-width: 1.3; fill: none; marker-end: url(#arrow); }
|
||||
.flow { stroke: #555; stroke-width: 1.1; fill: none; marker-end: url(#arrow); }
|
||||
.wait { stroke-dasharray: 4 3; }
|
||||
.box { fill: #9BC4CB; }
|
||||
.box { fill: #9CCBC6; }
|
||||
.shadow { fill: #B8B8B8; }
|
||||
</style>
|
||||
<defs>
|
||||
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">
|
||||
<path d="M1,1 L9,5 L1,9" fill="none" stroke="#666" stroke-width="1.6"/>
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#555"/>
|
||||
</marker>
|
||||
</defs>
|
||||
<rect width="100%" height="100%" fill="#F5F5F5"/>
|
||||
@@ -20,52 +20,39 @@
|
||||
<text x="223" y="74" font-size="11">T1</text>
|
||||
<text x="340" y="74" font-size="11">T2</text>
|
||||
<!-- T1:加 X 锁修改后回滚 -->
|
||||
<circle cx="224.5" cy="105.5" r="18" class="shadow"/>
|
||||
<circle cx="223" cy="104" r="18" fill="#61646B"/>
|
||||
<line x1="223" y1="122" x2="223" y2="143.5" class="flow"/>
|
||||
<polygon points="185.5,146 260.5,146 263.5,149 263.5,169 188.5,169 185.5,166" class="shadow"/>
|
||||
<polygon points="184,144.5 259,144.5 262,147.5 262,167.5 187,167.5 184,164.5" class="box"/>
|
||||
<text x="223" y="160" font-size="11">lock-x A</text>
|
||||
<line x1="223" y1="167.5" x2="223" y2="177.5" class="flow"/>
|
||||
<polygon points="185.5,180 260.5,180 263.5,183 263.5,203 188.5,203 185.5,200" class="shadow"/>
|
||||
<polygon points="184,178.5 259,178.5 262,181.5 262,201.5 187,201.5 184,198.5" class="box"/>
|
||||
<text x="223" y="194" font-size="11">read A=10</text>
|
||||
<line x1="223" y1="201.5" x2="223" y2="213.5" class="flow"/>
|
||||
<polygon points="185.5,216 260.5,216 263.5,219 263.5,239 188.5,239 185.5,236" class="shadow"/>
|
||||
<polygon points="184,214.5 259,214.5 262,217.5 262,237.5 187,237.5 184,234.5" class="box"/>
|
||||
<text x="223" y="230" font-size="11">write A=20</text>
|
||||
<line x1="223" y1="237.5" x2="223" y2="249.5" class="flow"/>
|
||||
<polygon points="185.5,252 260.5,252 263.5,255 263.5,275 188.5,275 185.5,272" class="shadow"/>
|
||||
<polygon points="184,250.5 259,250.5 262,253.5 262,273.5 187,273.5 184,270.5" class="box"/>
|
||||
<text x="223" y="266" font-size="11">rollback</text>
|
||||
<line x1="223" y1="273.5" x2="223" y2="284.5" class="flow"/>
|
||||
<polygon points="185.5,287 260.5,287 263.5,290 263.5,310 188.5,310 185.5,307" class="shadow"/>
|
||||
<polygon points="184,285.5 259,285.5 262,288.5 262,308.5 187,308.5 184,305.5" class="box"/>
|
||||
<text x="223" y="301" font-size="11">unlock-x A</text>
|
||||
<line x1="223" y1="308.5" x2="223" y2="413" class="flow"/>
|
||||
<circle cx="224.5" cy="434.5" r="18" class="shadow"/>
|
||||
<circle cx="223" cy="433" r="18" fill="#61646B"/>
|
||||
<!-- T2:加 S 锁读取,等待 T1 释放 X 锁 -->
|
||||
<circle cx="341.5" cy="105.5" r="18" class="shadow"/>
|
||||
<circle cx="340" cy="104" r="18" fill="#61646B"/>
|
||||
<line x1="340" y1="122" x2="340" y2="177.5" class="flow"/>
|
||||
<polygon points="302.5,180 377.5,180 380.5,183 380.5,203 305.5,203 302.5,200" class="shadow"/>
|
||||
<polygon points="301,178.5 376,178.5 379,181.5 379,201.5 304,201.5 301,198.5" class="box"/>
|
||||
<text x="340" y="194" font-size="11">lock-s A</text>
|
||||
<line x1="340" y1="201.5" x2="340" y2="310.5" class="flow wait"/>
|
||||
<text x="364" y="259" font-size="10" class="note">wait</text>
|
||||
<polygon points="302.5,313 377.5,313 380.5,316 380.5,336 305.5,336 302.5,333" class="shadow"/>
|
||||
<polygon points="301,311.5 376,311.5 379,314.5 379,334.5 304,334.5 301,331.5" class="box"/>
|
||||
<text x="340" y="327" font-size="11">obtain</text>
|
||||
<line x1="340" y1="334.5" x2="340" y2="343.5" class="flow"/>
|
||||
<polygon points="302.5,346 377.5,346 380.5,349 380.5,369 305.5,369 302.5,366" class="shadow"/>
|
||||
<polygon points="301,344.5 376,344.5 379,347.5 379,367.5 304,367.5 301,364.5" class="box"/>
|
||||
<text x="340" y="360" font-size="11">read A=10</text>
|
||||
<line x1="340" y1="367.5" x2="340" y2="376.5" class="flow"/>
|
||||
<polygon points="302.5,379 377.5,379 380.5,382 380.5,402 305.5,402 302.5,399" class="shadow"/>
|
||||
<polygon points="301,377.5 376,377.5 379,380.5 379,400.5 304,400.5 301,397.5" class="box"/>
|
||||
<text x="340" y="393" font-size="11">unlock-s A</text>
|
||||
<line x1="340" y1="400.5" x2="340" y2="413" class="flow"/>
|
||||
<circle cx="341.5" cy="434.5" r="18" class="shadow"/>
|
||||
<circle cx="340" cy="433" r="18" fill="#61646B"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 3.3 KiB |
@@ -1,45 +1,45 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="620" height="230" viewBox="0 0 620 230">
|
||||
<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; }
|
||||
text { font-family: "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif; fill: #3F3F3F; font-size: 12px; }
|
||||
.title { font-weight: bold; font-size: 15px; fill: #333; 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; }
|
||||
.sub { font-size: 11px; fill: #6E6E6E; }
|
||||
.mono { font-family: Menlo, Consolas, monospace; }
|
||||
.arrow { stroke: #666; stroke-width: 1.3; fill: none; marker-end: url(#a); }
|
||||
.arrow { stroke: #555; stroke-width: 1.1; 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; }
|
||||
.line { stroke: #555; stroke-width: 1.1; 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"/>
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#555"/>
|
||||
</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"/>
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#C0605A"/>
|
||||
</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"/>
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#6A9F68"/>
|
||||
</marker>
|
||||
</defs>
|
||||
<rect width="100%" height="100%" fill="#FFFFFF"/>
|
||||
|
||||
<text x="310" y="28" class="title">Next-Key Locks</text>
|
||||
<rect x="40" y="106" width="110" height="28" fill="#D8ECF5"/>
|
||||
<rect x="40" y="106" width="110" height="28" fill="#DCEEFC" stroke="#9CC4E2"/>
|
||||
<text x="95" y="160" class="c mono">(-∞, 10]</text>
|
||||
<rect x="150" y="106" width="105" height="28" fill="#C9E6EC"/>
|
||||
<rect x="150" y="106" width="105" height="28" fill="#D8F0EE" stroke="#9CCBC6"/>
|
||||
<text x="202.5" y="160" class="c mono">(10, 11]</text>
|
||||
<rect x="255" y="106" width="105" height="28" fill="#D8ECF5"/>
|
||||
<rect x="255" y="106" width="105" height="28" fill="#DCEEFC" stroke="#9CC4E2"/>
|
||||
<text x="307.5" y="160" class="c mono">(11, 13]</text>
|
||||
<rect x="360" y="106" width="105" height="28" fill="#C9E6EC"/>
|
||||
<rect x="360" y="106" width="105" height="28" fill="#D8F0EE" stroke="#9CCBC6"/>
|
||||
<text x="412.5" y="160" class="c mono">(13, 20]</text>
|
||||
<rect x="465" y="106" width="115" height="28" fill="#D8ECF5"/>
|
||||
<rect x="465" y="106" width="115" height="28" fill="#DCEEFC" stroke="#9CC4E2"/>
|
||||
<text x="522.5" y="160" class="c mono">(20, +∞)</text>
|
||||
<line x1="30" y1="120" x2="590" y2="120" class="line"/>
|
||||
<circle cx="150" cy="120" r="6" fill="#61646B"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
@@ -6,13 +6,13 @@
|
||||
.label { fill: #C38F8A; }
|
||||
.ok { fill: #6A9F68; }
|
||||
.no { fill: #C0605A; }
|
||||
.box { fill: #9BC4CB; }
|
||||
.box { fill: #9CCBC6; }
|
||||
.shadow { fill: #B8B8B8; }
|
||||
.guide { stroke: #999; stroke-width: 1; stroke-dasharray: 3 3; }
|
||||
</style>
|
||||
<defs>
|
||||
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto">
|
||||
<path d="M1,1 L9,5 L1,9" fill="none" stroke="#666" stroke-width="1.6"/>
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#555"/>
|
||||
</marker>
|
||||
</defs>
|
||||
<rect width="100%" height="100%" fill="#F5F5F5"/>
|
||||
@@ -22,13 +22,10 @@
|
||||
<!-- 创建 ReadView 时未提交的事务列表 -->
|
||||
<text x="262" y="80" class="label">TRX_IDs(创建 ReadView 时未提交的事务)</text>
|
||||
<rect x="140" y="88" width="244" height="50" rx="9" fill="#C1D8BF" stroke="#666" stroke-dasharray="3 2"/>
|
||||
<rect x="151.5" y="99.5" width="66" height="27" rx="3" class="shadow"/>
|
||||
<rect x="150" y="98" width="66" height="27" rx="3" class="box"/>
|
||||
<text x="183" y="115.5">TRX_ID_1</text>
|
||||
<rect x="230.5" y="99.5" width="66" height="27" rx="3" class="shadow"/>
|
||||
<rect x="229" y="98" width="66" height="27" rx="3" class="box"/>
|
||||
<text x="262" y="115.5">TRX_ID_2</text>
|
||||
<rect x="309.5" y="99.5" width="66" height="27" rx="3" class="shadow"/>
|
||||
<rect x="308" y="98" width="66" height="27" rx="3" class="box"/>
|
||||
<text x="341" y="115.5">TRX_ID_3</text>
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.7 KiB |