<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>http://wiki.eijux.com/index.php?action=history&amp;feed=atom&amp;title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97</id>
	<title>逻辑日志与物理日志 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.eijux.com/index.php?action=history&amp;feed=atom&amp;title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97"/>
	<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;action=history"/>
	<updated>2026-04-25T03:58:11Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.38.2</generator>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2802&amp;oldid=prev</id>
		<title>Eijux：​/* 数据引擎层的 redo log/undo log */</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2802&amp;oldid=prev"/>
		<updated>2021-04-27T14:00:02Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;数据引擎层的 redo log/undo log&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2021年4月27日 (二) 22:00的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l186&quot;&gt;第186行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第186行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==== 数据引擎层的 '''redo log/undo log''' ====&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==== 数据引擎层的 '''redo log/undo log''' ====&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;MySQL 的 InnoDB 存储引擎使用 '''redo log''' 以及 '''undo log'''，它们属于'''“Physiological Logging”'''&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;，虽然很多人认为其属于物理日志。【！！！】&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;MySQL 的 InnoDB 存储引擎使用 '''redo log''' 以及 '''undo log'''，它们属于'''“Physiological Logging”'''&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;，虽然很多人认为其属于物理日志。【？？？undo log 不是逻辑日志吗？？？】&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2801&amp;oldid=prev</id>
		<title>Eijux：​/* 数据引擎层的 redo log/undo log */</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2801&amp;oldid=prev"/>
		<updated>2021-04-27T13:57:44Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;数据引擎层的 redo log/undo log&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2021年4月27日 (二) 21:57的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l189&quot;&gt;第189行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第189行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;MySQL InnoDB 的 redo log &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;可以分为三种类型：&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;MySQL InnoDB 的 redo log &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;可以分为三种类型：【？？？】&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 作用于 &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Page，【？？？】&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 作用于 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Page，&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 作用于 &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Space，【？？？】&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 作用于 &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Space，&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 以及提供额外信息的 Logic &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;类型。【？？？】&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 以及提供额外信息的 Logic &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;类型。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;以“作用于Page”的 redo log 的格式为例：&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;以“作用于Page”的 redo log 的格式为例：&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;: [[File:“作用于Page”的 redo log 的格式.png|&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;400px&lt;/del&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;: [[File:“作用于Page”的 redo log 的格式.png|&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;700px&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;可见，MySQL 的 redo log 属于“Physiological &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Logging”：&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;可见，MySQL 的 redo log 属于“Physiological &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Logging”：【！！！】&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;物理上，其使用 Page Number &lt;/del&gt;+ &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Record Offset 来指定具体作用于哪一个 &lt;/del&gt;page 上的一条记录。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;物理：使用“Page Number”&lt;/ins&gt;+&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;“Record Offset”来指定具体作用于哪一个 &lt;/ins&gt;page 上的一条记录。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;逻辑上，使用 Field Number（Field编号）来说明更新操作作用于哪些字段；&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;逻辑：使用“Field Number”（Field编号）来说明更新操作作用于哪些字段；&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Redis【？？？】 ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== Redis【？？？】 ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2800&amp;oldid=prev</id>
		<title>Eijux：​/* server 层的 bin log */</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2800&amp;oldid=prev"/>
		<updated>2021-04-27T13:53:38Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;server 层的 bin log&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2021年4月27日 (二) 21:53的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l176&quot;&gt;第176行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第176行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;无论是 SQL 更新语句还是行上具体某个修改，都是逻辑日志，因为都没有涉及在具体哪一个 page 上进行修改。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;无论是 SQL 更新语句还是行上具体某个修改，都是逻辑日志，因为都没有涉及在具体哪一个 page 上进行修改。&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;'''&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2799&amp;oldid=prev</id>
		<title>Eijux：​/* server 层的 bin log */</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2799&amp;oldid=prev"/>
		<updated>2021-04-27T13:53:06Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;server 层的 bin log&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2021年4月27日 (二) 21:53的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l174&quot;&gt;第174行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第174行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** 数据量相比基于语句的 binlog 要大很多，在备份与恢复上性能较差；&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** 数据量相比基于语句的 binlog 要大很多，在备份与恢复上性能较差；&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** 丢失了原有 SQL 更新语句，不利于复盘；&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** 丢失了原有 SQL 更新语句，不利于复盘；&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#** &lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2798&amp;oldid=prev</id>
		<title>Eijux：​/* server 层的 bin log */</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2798&amp;oldid=prev"/>
		<updated>2021-04-27T13:52:55Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;server 层的 bin log&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2021年4月27日 (二) 21:52的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l162&quot;&gt;第162行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第162行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** 数据更少，即使一个更新操作会影响非常多的行。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** 数据更少，即使一个更新操作会影响非常多的行。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** 包括任何更新语句，因此可以用于数据库维护人员维护数据库；&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#** 包括任何更新语句，因此可以用于数据库维护人员维护数据库；&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* 缺点：并非所有 SQL &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;语句的执行效果都支持基于语句的复制。例如调动一个函数 &lt;/del&gt;now() 来获取系统时间，在不同的机器、时间上重放日志将得到不同的结果；&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* 缺点：并非所有 SQL &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;语句的执行效果都支持基于语句的复制。&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#*: 例如调动一个函数 &lt;/ins&gt;now() 来获取系统时间，在不同的机器、时间上重放日志将得到不同的结果；&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# '''基于行'''的日志记录（Row-based logging）：主要记录了对单个行的修改，其在 MySQL 5.1.5 后引入；&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# '''基于行'''的日志记录（Row-based logging）：主要记录了对单个行的修改，其在 MySQL 5.1.5 后引入；&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* 优点：&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#* 优点：&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2797&amp;oldid=prev</id>
		<title>Eijux：​/* “Physiological Logging”日志的存储内容 */</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2797&amp;oldid=prev"/>
		<updated>2021-04-27T13:51:36Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;“Physiological Logging”日志的存储内容&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2021年4月27日 (二) 21:51的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l79&quot;&gt;第79行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第79行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;“Physiological &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Logging”的特点是：&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;“Physiological &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Logging”的特点是：【以物理日志方式定位，以逻辑日志方式更新】&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 与物理日志相同：'''更新操作相对于 page 进行，每一条日志仅仅涉及一个 page 的修改'''；&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 与物理日志相同：'''更新操作相对于 page 进行，每一条日志仅仅涉及一个 page 的修改'''；&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 与逻辑日志相同：'''日志内容为更新语句（update query）本身'''，而不是状态机某些字段更新前后的状态。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 与逻辑日志相同：'''日志内容为更新语句（update query）本身'''，而不是状态机某些字段更新前后的状态。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2796&amp;oldid=prev</id>
		<title>Eijux：​/* 物理日志与逻辑日志的存储内容 */</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2796&amp;oldid=prev"/>
		<updated>2021-04-27T13:49:30Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;物理日志与逻辑日志的存储内容&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2021年4月27日 (二) 21:49的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l10&quot;&gt;第10行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第10行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 物理日志与逻辑日志的存储内容 ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== 物理日志与逻辑日志的存储内容 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;物理日志与逻辑日志在存储内容上有很大的区别，存储内容是区分它们的最重要手段：&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;物理日志与逻辑日志在存储内容上有很大的区别，存储内容是区分它们的最重要手段：&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 物理日志：存储数据库中特定记录的变更，通常是 page oriented（面向页面），即描述具体某一个 page &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;的修改内容；&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# 物理日志：存储数据库中特定记录的变更，通常是 page oriented（面向页面），即描述具体某一个 page &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;的修改'''内容'''；&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: 如：一条更新请求对应的初始值（original value）以及更新值（after value）&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: 如：一条更新请求对应的初始值（original value）以及更新值（after value）&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;逻辑日志：存储事务中的一个操作；&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;# &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;逻辑日志：存储事务中的一个'''操作'''；&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: 如：事务中的 UPDATE、DELETE 以及 INSERT 操作。&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#: 如：事务中的 UPDATE、DELETE 以及 INSERT 操作。&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
	<entry>
		<id>http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2795&amp;oldid=prev</id>
		<title>Eijux：​建立内容为“category:MySQLcategory:Redis  == 关于 == 日志主要分为： # '''逻辑日志''' （Logic log）； # '''物理日志''' （Physical log）；  * 转…”的新页面</title>
		<link rel="alternate" type="text/html" href="http://wiki.eijux.com/index.php?title=%E9%80%BB%E8%BE%91%E6%97%A5%E5%BF%97%E4%B8%8E%E7%89%A9%E7%90%86%E6%97%A5%E5%BF%97&amp;diff=2795&amp;oldid=prev"/>
		<updated>2021-04-27T13:48:42Z</updated>

		<summary type="html">&lt;p&gt;建立内容为“&lt;a href=&quot;/%E5%88%86%E7%B1%BB:MySQL&quot; title=&quot;分类:MySQL&quot;&gt;category:MySQL&lt;/a&gt;&lt;a href=&quot;/%E5%88%86%E7%B1%BB:Redis&quot; title=&quot;分类:Redis&quot;&gt;category:Redis&lt;/a&gt;  == 关于 == 日志主要分为： # &amp;#039;&amp;#039;&amp;#039;逻辑日志&amp;#039;&amp;#039;&amp;#039; （Logic log）； # &amp;#039;&amp;#039;&amp;#039;物理日志&amp;#039;&amp;#039;&amp;#039; （Physical log）；  * 转…”的新页面&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[category:MySQL]][[category:Redis]]&lt;br /&gt;
&lt;br /&gt;
== 关于 ==&lt;br /&gt;
日志主要分为：&lt;br /&gt;
# '''逻辑日志''' （Logic log）；&lt;br /&gt;
# '''物理日志''' （Physical log）；&lt;br /&gt;
&lt;br /&gt;
* 转自：“[https://spongecaptain.cool/post/database/logicalandphicallog/#reference 逻辑日志与物理日志]”&lt;br /&gt;
&lt;br /&gt;
== 物理日志与逻辑日志的存储内容 ==&lt;br /&gt;
物理日志与逻辑日志在存储内容上有很大的区别，存储内容是区分它们的最重要手段：&lt;br /&gt;
# 物理日志：存储数据库中特定记录的变更，通常是 page oriented（面向页面），即描述具体某一个 page 的修改内容；&lt;br /&gt;
#: 如：一条更新请求对应的初始值（original value）以及更新值（after value）&lt;br /&gt;
# 逻辑日志：存储事务中的一个操作；&lt;br /&gt;
#: 如：事务中的 UPDATE、DELETE 以及 INSERT 操作。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
由以下示例可以看出：如果利用'''物理日志进行宕机后的数据恢复，那么需要确保 page 不能够改变'''，但利用'''逻辑日志并不在乎底层 page 是否改变'''。&lt;br /&gt;
&lt;br /&gt;
=== “Physical log”的存储内容 ===&lt;br /&gt;
下图是一种典型的“物理日志”：&lt;br /&gt;
: [[File:物理日志.png|800px]]&lt;br /&gt;
我们可以看到，更新操作作用于 Page42，将字段 “Kemera” 修改为 “camera”。更新操作对应的日志为：&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;mysql&amp;quot;  highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;quot;Page 42:image at 367,2; before:'ke';after:'ca'&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
其中：&lt;br /&gt;
: Page 42 用于说明更新操作作用的 page；&lt;br /&gt;
: 367：用于说明更新操作相对于 page 的 offset；&lt;br /&gt;
: 2：用于说明更新操作的作用长度，即 length，2 代表仅仅修改了两个字符；&lt;br /&gt;
: before:‘Ke’：这里表示 undo information，也可以称为 undo log；&lt;br /&gt;
: after:‘ca’：这里表示 redo log information，也可以称为 redo log；&lt;br /&gt;
&lt;br /&gt;
当然，一条物理日志可以有多个字段的修改，下面是一个抽象版本：&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;mysql&amp;quot;  highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
（Page ID，Record Offset,length，(Filed 1, Value 1) … (Filed i, Value i) … )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
注意：&lt;br /&gt;
* 物理日志实际上以字节编码落盘，而不是字符编码，因此通常肉眼不可见；&lt;br /&gt;
* image 的含义通常指代镜像，但这里不是说对 page 做整个镜像，而是对更改或增量（change/delta）操作做镜像，before image 代表写操作作用之前的字段副本，after image 代表写操作作用之后的字段副本；&lt;br /&gt;
* 可见，physical log 中的一条记录对应于状态机（state mechine）上某一个 page 上的某些字段做了什么改动的落盘。&lt;br /&gt;
&lt;br /&gt;
=== “Logic log”的存储内容 ===&lt;br /&gt;
逻辑日志又被称为“high-level logging”，这是相对于物理日志而言的。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
下图是一种典型的“逻辑日志”：&lt;br /&gt;
: [[File:逻辑日志.png|800px]]&lt;br /&gt;
在上图中，有一张 CameraLingo 表，我们试图纠正 itermID 为 0 的拼写错误，即将 “Kemera” 修改为 “Cemera”。逻辑日志的格式如下：&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;mysql&amp;quot;  highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
CameraLingo:update(0,'Kermera'=&amp;gt;'camera')&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
逻辑日志被称为“high level”的原因是其更抽象，其不需要指明更新操作具体作用于哪一块 page，因此也对底层少了一些限制。逻辑日志与一条 SQL 语句非常类似，事实上确实如此，逻辑日志的本质就是对更新语句（update query）本身的落盘。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
注意：&lt;br /&gt;
*  “high level”的数据结构抽象不仅仅局限于 table，例如 key-value 也是一个典型的“high level”数据结构。&lt;br /&gt;
* 得益于“high level”的抽象，一个逻辑日志可以对应多条物理日志，下面举一个例子：&lt;br /&gt;
*: &amp;lt;syntaxhighlight lang=&amp;quot;mysql&amp;quot;  highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
CameraLingo:capitaLetter(term)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
*: 上述逻辑日志的语义是对 CameraLingo 表中所有 term 字段对应的属性首字母大写，如果表足够大，此次逻辑日志涉及多个 page 上的修改，因而需要多个物理日志。&lt;br /&gt;
&lt;br /&gt;
=== “Physiological Logging”日志的存储内容 ===&lt;br /&gt;
除了物理日志以及逻辑日志，还有一种日志被称为“Physiological Logging”，其试图同时获得物理日志与逻辑日志的优势。&lt;br /&gt;
&lt;br /&gt;
下图是一种典型的“物理逻辑日志”：&lt;br /&gt;
: [[File:物理逻辑日志.png|800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“Physiological Logging”的格式也可以如下表示：&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;mysql&amp;quot;  highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
（Page ID，Record Offset，(Filed 1, Value 1) … (Filed i, Value i) … )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
其中，Page ID、Record Offset 的设计源于物理日志。(Field1,Value1) 的设计来源于逻辑日志。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
“Physiological Logging”的特点是：&lt;br /&gt;
# 与物理日志相同：'''更新操作相对于 page 进行，每一条日志仅仅涉及一个 page 的修改'''；&lt;br /&gt;
# 与逻辑日志相同：'''日志内容为更新语句（update query）本身'''，而不是状态机某些字段更新前后的状态。&lt;br /&gt;
&lt;br /&gt;
== 物理日志与逻辑日志的比较 ==&lt;br /&gt;
=== 事务并发控制 ===&lt;br /&gt;
我们需要使用事务并发控制的原因基于以下事实（以 MySQL 为语境解释）：&lt;br /&gt;
# 事务由 SQL 语句构成，每一个 SQL 语句可分解为多个不可分隔的读/写操作；&lt;br /&gt;
# 事务的执行实际上是一连串不可分割读写操作的执行；&lt;br /&gt;
# 事务调度器负责调度不可分割读写操作的执行顺序，它们可能来自于不同事务；&lt;br /&gt;
# 事务并发控制的一个目标就是实现'''并行化事务'''；&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# '''物理日志本身就是存储就是基于不可分隔的更新操作，因此其存储先后顺序就代表了执行器的调度顺序'''。而且由于很容易判断两个 page 是否是同一个 page，如果不是，完全可以安全并行地并行执行。&lt;br /&gt;
# '''逻辑日志很难实现一致的事务并发控制'''。由于逻辑日志难以携带并发执行顺序的信息，当同时有多个事务产生更新操作时，数据库内部会将这些操作调度为串行化序列执行，需要机制来保障每次回放操作的执行顺序与调度产生的顺序一致。&lt;br /&gt;
* 为了实现宕机前后事务并发控制的一致性，数据库选择使用 Physical Logging 作为其 Redo Log。&lt;br /&gt;
&lt;br /&gt;
=== 幂等性 ===&lt;br /&gt;
幂等性在日志上的语义是：无论日志回放多少次，最终得到的结果保持一致。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# 物理日志能够保证幂等性：因为其本质是对状态机某一个字段在更新前后状态的记录，无论执行多少次，最终得到的状态总是相同的。下面是一个例子：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;mysql&amp;quot;  highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;quot;Page 42:image at 367,2; before:'ke';after:'ca'&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
# 逻辑日志并不能够提供幂等性的语义，因为某一个更新操作本身不具备幂等性。例如：&lt;br /&gt;
#: &amp;lt;syntaxhighlight lang=&amp;quot;mysql&amp;quot;  highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
CameraLingo:update(0,age=&amp;gt;age+1)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
#* 而且逻辑日志可能包含了某些不确定函数。&lt;br /&gt;
#* 当然，如果更新操作本身是幂等的，逻辑日志也可以是幂等的，例如：&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;mysql&amp;quot;  highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
CameraLingo:capitaLetter(term)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 数据量大小 ===&lt;br /&gt;
日志数据量大小是特别重要的特性，其对以下过程都有影响：&lt;br /&gt;
* 磁盘 I/O 吞吐量；&lt;br /&gt;
* 落盘文件大小；&lt;br /&gt;
* 网络带宽；&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
来自客户端的一条更新语句可能会对应多个 page 上的更新，因此逻辑日志与物理日志在日志数量上有巨大的区别。&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;mysql&amp;quot;  highlight=&amp;quot;&amp;quot;&amp;gt;&lt;br /&gt;
#查询语句&lt;br /&gt;
CameraLingo:capitaLetter(term)&lt;br /&gt;
&lt;br /&gt;
#物理日志&lt;br /&gt;
&amp;quot;Page 42:image at 3,1; before:'k';after:'K'&amp;quot;&lt;br /&gt;
&amp;quot;Page 42:image at 22,1; before:'a';after:'A'&amp;quot;&lt;br /&gt;
....&lt;br /&gt;
&amp;quot;Page 42:image at 442,1; before:'b';after:'B'&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#逻辑日志&lt;br /&gt;
CameraLingo:capitaLetter(term)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
可以看出：'''逻辑日志在数据量上优势明显'''。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
分布式系统中，会通过 primary 副本向 secondary 副本发送日志的方式来进行分布式事务的维护，因此使用物理日志进行传播就不合适。例如，'''MySQL 就选择逻辑日志进行维护分布式事务'''。&lt;br /&gt;
&lt;br /&gt;
=== 日志重放效率 ===&lt;br /&gt;
逻辑日志比物理日志在重放时有着更低的效率，这主要有两个方面的原因：&lt;br /&gt;
# 额外的解释步骤：逻辑日志需要额外地解释更新语句、额外查找实际 page 位置；&lt;br /&gt;
# 物理日志可以并发进行：当系统判断两个物理日志作用于不同的 page 时，就可以进行完全的并行处理，而逻辑日志通常只能串行执行。&lt;br /&gt;
&lt;br /&gt;
=== 磁盘/内存式日志系统的 trade-off【？？？】 ===&lt;br /&gt;
基于磁盘的存储系统与基于内存的存储系统对逻辑日志以及物理日志有着不同的 trade-off（权衡），如下面两张图所示：&lt;br /&gt;
: [[File:“基于磁盘的存储系统”的日志 IO 效率与 replay 效率.png|none|thumb|600px|“基于磁盘的存储系统”的日志 IO 效率与 replay 效率]]&lt;br /&gt;
: [[File:“基于内存的存储系统”的日志 IO 效率与 replay 效率.png|none|thumb|600px|“基于内存的存储系统”的日志 IO 效率与 replay 效率]]&lt;br /&gt;
&lt;br /&gt;
== 工业实践与典型案例 ==&lt;br /&gt;
=== MySQL ===&lt;br /&gt;
----&lt;br /&gt;
MysQL 对存储引擎层以及 sever 提供了不同的日志方案。以 InnoDB 存储引擎为例。&lt;br /&gt;
&lt;br /&gt;
==== server 层的 bin log ====&lt;br /&gt;
MySQL 的 server 层使用 binlog，其属于'''逻辑日志'''。bin log 分为两种类型：&lt;br /&gt;
# '''基于语句'''的日志记录（Statement-based logging）：主要记录了该 MySQL 执行语句（包括 inserts, updates, deletes）；&lt;br /&gt;
#* 优点：&lt;br /&gt;
#** 技术成熟；&lt;br /&gt;
#** 数据更少，即使一个更新操作会影响非常多的行。&lt;br /&gt;
#** 包括任何更新语句，因此可以用于数据库维护人员维护数据库；&lt;br /&gt;
#* 缺点：并非所有 SQL 语句的执行效果都支持基于语句的复制。例如调动一个函数 now() 来获取系统时间，在不同的机器、时间上重放日志将得到不同的结果；&lt;br /&gt;
# '''基于行'''的日志记录（Row-based logging）：主要记录了对单个行的修改，其在 MySQL 5.1.5 后引入；&lt;br /&gt;
#* 优点：&lt;br /&gt;
#** 所有更改都可以复制，包括上面提到的 now() 函数；&lt;br /&gt;
#** 以下类型的语句所需行锁更少，可以实现更好的并发性：&lt;br /&gt;
#*** INSERT ... SELECT&lt;br /&gt;
#*** INSERT statements with AUTO_INCREMENT&lt;br /&gt;
#*** UPDATE or DELETE statements with WHERE clauses that do not use keys or do not change most of the examined rows.&lt;br /&gt;
#* 缺点：&lt;br /&gt;
#** 数据量相比基于语句的 binlog 要大很多，在备份与恢复上性能较差；&lt;br /&gt;
#** 丢失了原有 SQL 更新语句，不利于复盘；&lt;br /&gt;
#** &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
无论是 SQL 更新语句还是行上具体某个修改，都是逻辑日志，因为都没有涉及在具体哪一个 page 上进行修改。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
为此，MySQL 提供了三个模式进行配置：&lt;br /&gt;
# '''Statement'''：基于语句的 binlog 日志记录（statement-based replication-SBR）；&lt;br /&gt;
# '''Row'''：基于行的 binlog 日志记录（row-based replication-RBR）；&lt;br /&gt;
# '''Mixed'''：混合模式，通常基于语句，有必要的情况下基于行实现（mixed-based replication-MBR）；&lt;br /&gt;
* MySQL 从 5.1.8 开始提供 Mixed 模式。5.7.7 之前的版本默认是 Statement 模式，之后默认使用 Row 模式。但是在 8.0 以上版本已经默认使用 Mixed 模式了。&lt;br /&gt;
&lt;br /&gt;
==== 数据引擎层的 '''redo log/undo log''' ====&lt;br /&gt;
MySQL 的 InnoDB 存储引擎使用 '''redo log''' 以及 '''undo log'''，它们属于'''“Physiological Logging”'''，虽然很多人认为其属于物理日志。【！！！】&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
MySQL InnoDB 的 redo log 可以分为三种类型：&lt;br /&gt;
# 作用于 Page，【？？？】&lt;br /&gt;
# 作用于 Space，【？？？】&lt;br /&gt;
# 以及提供额外信息的 Logic 类型。【？？？】&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
以“作用于Page”的 redo log 的格式为例：&lt;br /&gt;
: [[File:“作用于Page”的 redo log 的格式.png|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
可见，MySQL 的 redo log 属于“Physiological Logging”：&lt;br /&gt;
# 物理上，其使用 Page Number + Record Offset 来指定具体作用于哪一个 page 上的一条记录。&lt;br /&gt;
# 逻辑上，使用 Field Number（Field编号）来说明更新操作作用于哪些字段；&lt;br /&gt;
&lt;br /&gt;
=== Redis【？？？】 ===&lt;br /&gt;
----&lt;br /&gt;
Redis 是一个内存型 key-value NoSQL 数据库的典型代表。&lt;br /&gt;
&lt;br /&gt;
Redis 基于 '''AOF'''（'''Append Only File'''）提供持久化机制。&lt;br /&gt;
&lt;br /&gt;
AOF 中的每一条日志代表 Redis 节点接收到的一条写操作，其格式为 Redis 命令格式，因此 '''AOF 属于逻辑日志'''。&lt;br /&gt;
&lt;br /&gt;
Redis 基于内存快照（RDB）+ check point + AOF 的方式实现持久化。【？】&lt;br /&gt;
&lt;br /&gt;
=== Kafka【？？？】 ===&lt;br /&gt;
----&lt;br /&gt;
在关系型数据库看来，日志不是数据本身，例如'''对于 MySQL 的 InnoDB 存储引擎来说，数据本身是存储于磁盘上的 B+Tree 树'''，日志是用于确保单机事务以及分布式事务的一种手段。换言之，关系型数据库提供的读/查询 API 不是直接读日志，而是直接读 B+Tree。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
但是'''对于 Kakfa 而言，日志本身就是数据本身'''。因此就没有必要将这类数据库分为逻辑日志与物理日志。Kakfa 的日志一方面服务于单机事务与分布式事务，另一方面服务于消息的读/写 API。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Kakfa “消息”包括如下重要字段：&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! 字段 !! 含义 &lt;br /&gt;
|-&lt;br /&gt;
| offset || 偏移量&lt;br /&gt;
|-&lt;br /&gt;
| magic || 魔数，区分版本&lt;br /&gt;
|-&lt;br /&gt;
| crc332 || 校验码&lt;br /&gt;
|-&lt;br /&gt;
| attributes || 表示压缩类型		&lt;br /&gt;
|-&lt;br /&gt;
| key length || key 的长度		&lt;br /&gt;
|-&lt;br /&gt;
| key || key&lt;br /&gt;
|-&lt;br /&gt;
| value length || value 长度&lt;br /&gt;
|-&lt;br /&gt;
| value || value&lt;br /&gt;
|-&lt;br /&gt;
| timestamp || 时间戳&lt;br /&gt;
|}&lt;br /&gt;
可见，Kafka 在“message-logging”中的一条消息并不是用于描述更新，其就是数据本身。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
总之，'''当日志本身就是数据而不是描述更新操作时，不需要将日志区分为逻辑日志与物理日志'''。&lt;/div&gt;</summary>
		<author><name>Eijux</name></author>
	</entry>
</feed>