{"id":342898,"date":"2022-12-20T03:00:22","date_gmt":"2022-12-20T03:00:22","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=342898"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2022-12-20T03:00:22","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=342898","title":{"rendered":"<span>\u041e\u0442 Isolation \u043a Consistency \u2014 \u0434\u043e\u0440\u043e\u0433\u0430 \u0434\u043b\u0438\u043d\u043e\u0439 \u0432 30 \u043b\u0435\u0442<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0423\u0447\u0430\u0441\u0442\u0432\u0443\u044e \u0432 \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0421\u0423\u0411\u0414 \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 (\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0432\u0435\u0440\u0445 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 kv-\u0434\u0432\u0438\u0436\u043a\u043e\u0432, \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044f \u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u043e \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/career.habr.com\/vacancies\/1000110099\" rel=\"nofollow noopener noreferrer\">\u0437\u0434\u0435\u0441\u044c<\/a>). \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043d\u0435\u043c\u043d\u043e\u0433\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432 \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0438, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0430 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0440\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u043e\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u043f\u043e \u0442\u0435\u043c\u0430\u043c Isolation \u0438 Consistency (\u0443\u0442\u043e\u0447\u043d\u044e, \u0447\u0442\u043e \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u0432\u0438\u0434\u0443 \u043d\u0435 \u0442\u0430 <code>Consistency<\/code>, \u0447\u0442\u043e \u0432 <code>ACID<\/code>). \u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043d\u044e\u0430\u043d\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438 \u0438\u0437\u043b\u0430\u0433\u0430\u044e \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u0437\u0438\u0441\u043d\u043e:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0422\u0435\u0440\u043c\u0438\u043d Phantom Read \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u0440\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430<\/li>\n<li>\u0421\u043c\u044b\u0441\u043b \u043f\u043e\u043d\u044f\u0442\u0438\u0439 Lost Update, Write Skew \u0438 Read Skew \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0439 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d \u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u0435\u043d<\/li>\n<li>\u0414\u0432\u0438\u0436\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 Serializable, \u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0441\u0442\u0438 \u0441\u0435\u0431\u044f \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u0440\u0438\u0447\u0443\u0434\u043b\u0438\u0432\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <strong>\u0432\u0441\u0435\u0433\u0434\u0430<\/strong> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u043b\u044f read-only \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u2014 \u0438 \u0435\u043c\u0443 \u0437\u0430 \u044d\u0442\u043e \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 &#171;\u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442&#187;<\/li>\n<li>Strong consistency \u0432 Cosmos DB \u2014 \u043f\u0440\u0435\u0434\u0435\u043b \u043c\u0435\u0447\u0442\u0430\u043d\u0438\u0439? (\u0441\u043f\u043e\u0439\u043b\u0435\u0440: \u043d\u0435\u0442)<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041d\u0443, \u0438 \u0435\u0449\u0451 \u043a\u043e\u0435-\u0447\u0442\u043e \u043f\u043e \u043c\u0435\u043b\u043e\u0447\u0438. \u0412 \u043a\u043e\u043d\u0446\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u0435\u043d\u0435\u0446 \u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u0443\u043c\u0430:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ka\/lr\/of\/kalrofk2w-2so1fv5a7dwikt6xs.png\" data-src=\"https:\/\/habrastorage.org\/webt\/ka\/lr\/of\/kalrofk2w-2so1fv5a7dwikt6xs.png\"\/><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h1 id=\"soderzhanie\">\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h1>\n<p>  <\/p>\n<ul>\n<li><a href=\"#sql-92\">SQL-92<\/a><\/li>\n<li><a href=\"#sql-92-1\">SQL-92?<\/a><br \/> \n<ul>\n<li><a href=\"#p0-dirty-write\">P0 (Dirty Write)<\/a><\/li>\n<li><a href=\"#p1-dirty-read\">P1 (Dirty Read)<\/a><\/li>\n<li><a href=\"#p2-fuzzy-or-non-repeatable-read\">P2 (Fuzzy or Non-Repeatable Read))<\/a><\/li>\n<li><a href=\"#p3-phantom\">P3 (Phantom)<\/a><\/li>\n<li><a href=\"#p4-lost-update\">P4 (Lost Update)<\/a><\/li>\n<li><a href=\"#p4c-cursor-lost-update\">P4C (Cursor Lost Update)<\/a><\/li>\n<li><a href=\"#a5a-read-skew\">A5A (Read Skew)<\/a><\/li>\n<li><a href=\"#a5b-write-skew\">A5B (Write Skew)<\/a><\/li>\n<li><a href=\"#a5b-write-skew\">A5B (Write Skew)<\/a><\/li>\n<li><a href=\"#snapshot-isolation\">\u0423\u0440\u043e\u0432\u0435\u043d\u044c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 Snapshot<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#d-abadi-introduction-to-transaction-isolation-levels\">D. Abadi: Introduction to Transaction Isolation Levels<\/a><\/li>\n<li><a href=\"#d-abadi-correctness-anomalies-under-serializable-isolation\">D. Abadi: Correctness Anomalies Under Serializable Isolation<\/a><\/li>\n<li><a href=\"#consistency-levels-in-azure-cosmos-db\">Consistency levels in Azure Cosmos DB<\/a><\/li>\n<li><a href=\"#jepsenio-consistency-models\">jepsen.io: Consistency Models<\/a><\/li>\n<li><a href=\"#conclusion\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/a><\/li>\n<li><a href=\"#references\">\u0421\u0441\u044b\u043b\u043a\u0438<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n<h1 id=\"sql-92\">SQL-92<\/h1>\n<p>  <\/p>\n<p>\u0422\u0440\u0438\u0434\u0446\u0430\u0442\u044c \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 <a href=\"https:\/\/www.contrib.andrew.cmu.edu\/~shadow\/sql\/sql1992.txt\" rel=\"nofollow noopener noreferrer\">ISO\/IEC 9075:1992, Database Language SQL- July 30, 1992<\/a> (\u0434\u0430\u043b\u0435\u0435 SQL-92). \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0442\u0430\u043c \u0435\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e, \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  <\/p>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u0442\u0440\u0438 \u0444\u0435\u043d\u043e\u043c\u0435\u043d\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">    1) P1 (\"Dirty read\"): SQL-transaction T1 modifies a row. SQL-     transaction T2 then reads that row before T1 performs a COMMIT.     If T1 then performs a ROLLBACK, T2 will have read a row that was     never committed and that may thus be considered to have never     existed.      2) P2 (\"Non-repeatable read\"): SQL-transaction T1 reads a row. SQL-     transaction T2 then modifies or deletes that row and performs     a COMMIT. If T1 then attempts to reread the row, it may receive     the modified value or discover that the row has been deleted.      3) P3 (\"Phantom\"): SQL-transaction T1 reads the set of rows N     that satisfy some &lt;search condition>. SQL-transaction T2 then     executes SQL-statements that generate one or more rows that     satisfy the &lt;search condition> used by SQL-transaction T1. If     SQL-transaction T1 then repeats the initial read with the same     &lt;search condition>, it obtains a different collection of rows.<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043a\u0430 \u043d\u0438\u0447\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e <code>Phantom Read<\/code>, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043d\u0430\u0434\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e <code>Phantom<\/code>.<\/p>\n<p>  <\/p>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 SERIALIZABLE:<\/p>\n<p>  <\/p>\n<blockquote><p>The execution of concurrent SQL-transactions at isolation level SERIALIZABLE is guaranteed to be serializable. A serializable execution is defined to be an execution of the operations of concur rently executing SQL-transactions that produces the same effect as some serial execution of those same SQL-transactions. A serial execution is one in which each SQL-transaction executes to completion before the next SQL-transaction begins.<\/p><\/blockquote>\n<p>\u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, SERIALIZABLE \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e \u044d\u0444\u0444\u0435\u043a\u0442 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d \u0438\u0445 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e. \u041a\u0430\u043a \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0434\u0430\u043b\u0435\u0435, \u0441\u0442\u0440\u043e\u0433\u043e\u0435 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u043c\u0443 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0438\u043c\u0435\u0435\u0442 \u0432\u0435\u0441\u044c\u043c\u0430 \u0442\u044f\u0436\u0451\u043b\u044b\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 (\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u0438\u0445).<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u0437\u0438\u0441: <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">    Significant new features are:     ...     15)Support for transaction consistency levels,      <\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u043d \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0434\u0430\u043b\u0435\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u0440\u043e <code>transaction consistency levels<\/code>, \u043f\u043e \u0432\u0441\u0435\u0439 \u0432\u0438\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0430\u0432\u0442\u043e\u0440\u044b \u0438\u043c\u0435\u043b\u0438 \u0432\u0432\u0438\u0434\u0443 &#171;SQL-transaction isolation levels&#187;. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043e\u0442\u043c\u0435\u0442\u0438\u043c \u0441\u043c\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u0439 \u0421onsistency \u0438 Isolation.<\/p>\n<p>  <\/p>\n<p>\u0418\u0434\u0451\u043c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>  <\/p>\n<h1 id=\"sql-92-1\">SQL-92?<\/h1>\n<p>  <\/p>\n<p><a href=\"https:\/\/arxiv.org\/ftp\/cs\/papers\/0701\/0701157.pdf\" rel=\"nofollow noopener noreferrer\">A Critique of ANSI SQL Isolation Levels, Jun 1995, Microsoft Research<\/a> \u2014 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 Microsoft, Sybase \u0438 UMass (University of Massachusetts Amherst), \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0432 1995 \u0433\u043e\u0434\u0443. \u0412 \u043d\u0435\u0439 \u0430\u0432\u0442\u043e\u0440\u044b \u043a\u0440\u0438\u0442\u0438\u043a\u0443\u044e\u0442 ANSI X3.135-1992 (<a href=\"https:\/\/www.ibm.com\/docs\/en\/informix-servers\/14.10?topic=overview-compliance-industry-standards\" rel=\"nofollow noopener noreferrer\">\u043e\u043d \u0436\u0435 ISO 9075:1992<\/a>) \u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043f\u043e\u0447\u0442\u0435\u043d\u043d\u044b\u0439 \u0432\u043e\u0437\u0440\u0430\u0441\u0442, \u0440\u0430\u0431\u043e\u0442\u0430 \u043a\u043b\u044e\u0447\u0435\u0432\u0430\u044f, \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0451 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0438 \u043f\u0435\u0440\u0435\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/501294\/\">\u0442\u0443\u0442<\/a>).<\/p>\n<p>  <\/p>\n<p>\u0410\u0432\u0442\u043e\u0440\u044b \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e\u0442 \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u0443\u044e \u043d\u043e\u0442\u0430\u0446\u0438\u044e:<\/p>\n<p>  <\/p>\n<blockquote><p>Histories consisting of reads, writes, commits, and aborts can be written in a shorthand notation: \u201cw1[x]\u201d means a write by transaction 1 on data item x (which is how a data item is \u201cmodified\u2019), and \u201cr2[x]\u201d represents a read of x by transaction 2. Transaction 1 reading and writing a set of records satisfying predicate P is denoted by r1[P] and w1[P] respectively. Transaction 1\u2019s commit and abort (ROLLBACK) are written \u201cc1\u201d and \u201ca1\u201d, respectively.<\/p><\/blockquote>\n<p>\u042d\u0442\u0430 \u043d\u043e\u0442\u0430\u0446\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0430\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u0430\u0445, \u0438 \u044f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0441 \u043d\u0435\u0439, \u0430 \u043d\u0435 \u0441 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430\u043c\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u0410\u0432\u0442\u043e\u0440\u044b \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0440\u0430\u043d\u0435\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u0444\u0435\u043d\u043e\u043c\u0435\u043d\u044b &#171;\u0444\u0435\u043d\u043e\u043c\u0435\u043d\u0430\u043c\u0438&#187;, \u0434\u0430\u0432\u0430\u044f \u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 &#171;\u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438&#187;, \u0438 \u0434\u0430\u044e\u0442 \u0442\u0430\u043a\u0443\u044e \u0444\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0432 \u0441\u0432\u043e\u0435\u0439 \u043d\u043e\u0442\u0430\u0446\u0438\u0438:<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>Anomaly<\/th>\n<th>History<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>A1 (Dirty Read)<\/td>\n<td><code>w1[x]...r2[x]...(a1 and c2 in either order)<\/code><\/td>\n<\/tr>\n<tr>\n<td>A2 (Fuzzy or Non-Repeatable Read)<\/td>\n<td><code>r1[x]...w2[x]...c2...r1[x]...c1<\/code><\/td>\n<\/tr>\n<tr>\n<td>A3 (Phantom)<\/td>\n<td><code>r1[P]...w2[y in P]...c2...r1[P]...c1<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<p>\u041f\u043e\u0434 \u0444\u0435\u043d\u043e\u043c\u0435\u043d\u0430\u043c\u0438 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e\u0442\u0441\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0431\u043e\u043b\u0435\u0435 \u043e\u0431\u0449\u0435\u0433\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 <strong>\u043c\u043e\u0433\u0443\u0442<\/strong> \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u044f\u043c, \u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f &#171;\u043d\u0430 \u043a\u043e\u0440\u043d\u044e&#187; \u0434\u0432\u0438\u0436\u043a\u0430\u043c\u0438 \u0411\u0414. \u0420\u0430\u0431\u043e\u0442\u0430 (\u043f\u0435\u0440\u0435)\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0448\u0435\u0441\u0442\u044c \u0444\u0435\u043d\u043e\u043c\u0435\u043d\u043e\u0432 \u0438 \u0432\u0432\u043e\u0434\u0438\u0442 \u0434\u0432\u0435 \u043d\u043e\u0432\u044b\u0445 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>P0 (Dirty Write)<\/li>\n<li>P1 (Dirty Read)<\/li>\n<li>P2 (Fuzzy or Non-Repeatable Read)<\/li>\n<li>P3 (Phantom)<\/li>\n<li>P4 (Lost Update)<\/li>\n<li>P4C (Cursor Lost Update)<\/li>\n<li>A5A (Read Skew)<\/li>\n<li>A5B (Write Skew)<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u0447\u0443\u0435\u0442 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 \u0432 \u0441\u0442\u0430\u0442\u044c\u044e \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0438\u0441\u043a\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438, \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f\u043c\u0438. \u0427\u0447\u0442\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0442\u044c \u0438\u0433\u0440\u0430\u0442\u044c \u0432 &#171;\u0438\u0441\u043f\u043e\u0440\u0447\u0435\u043d\u043d\u044b\u0439 \u0442\u0435\u043b\u0435\u0444\u043e\u043d&#187;, \u043a\u0440\u0430\u0442\u043a\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0432\u0441\u0451 \u043e\u0431\u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435.<\/p>\n<p>  <\/p>\n<h2 id=\"p0-dirty-write\">P0 (Dirty Write)<\/h2>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u0444\u0435\u043d\u043e\u043c\u0435\u043d \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 SQL-92, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">w1[x]...w2[x]...((c1 or a1) and (c2 or a2) in any order)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422.\u0435. \u043d\u0435\u043b\u044c\u0437\u044f \u043c\u0435\u043d\u044f\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u043a\u0442\u043e-\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u0435\u043d\u044f\u0435\u0442. \u0422\u0430\u043a\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f (\u0444\u0435\u043d\u043e\u043c\u0435\u043d) \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">w1[x=1]...w2[x=2]...w2[y=2]...c2...w1[y=1]...c1<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>\u041d\u0430 \u0431\u0430\u0437\u0443 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 x == y<\/li>\n<li>\u041f\u0435\u0440\u0432\u0430\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0432 x \u0438 y \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>1<\/code>, \u0432\u0442\u043e\u0440\u0430\u044f \u2014 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>2<\/code><\/li>\n<li>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 x == 2, y == 1, \u0447\u0442\u043e \u043d\u0435\u0445\u043e\u0440\u043e\u0448\u043e<\/li>\n<li>\u0410\u0432\u0442\u043e\u0440\u044b \u0441\u0447\u0438\u0442\u0430\u044e\u0442, \u0447\u0442\u043e \u043b\u044e\u0431\u043e\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 \u0438\u0437 SQL-92 \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0442\u044c Dirty Write<\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"p1-dirty-read\">P1 (Dirty Read)<\/h2>\n<p>  <\/p>\n<p>\u0424\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">A1: w1[x]...r2[x]...(a1 and c2 in either order)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422.\u0435. \u043f\u0435\u0440\u0432\u0430\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u043f\u0438\u0448\u0435\u0442 \u0432 <code>x<\/code> \u0438 \u0434\u0430\u043b\u0435\u0435 \u043d\u0435\u043f\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u0430 \u043e\u0442\u043a\u0430\u0442\u0438\u0442\u044c\u0441\u044f, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0432\u0442\u043e\u0440\u0443\u044e \u0441 \u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0447\u0442\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u0438\u0442\u0438\u043a\u0438 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e\u0442, \u0447\u0442\u043e \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0430\u0434\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0448\u0438\u0440\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">P1: w1[x]...r2[x]...(c1 or a1)<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0435\u043b\u044c\u0437\u044f \u0447\u0438\u0442\u0430\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u043a\u0442\u043e-\u0442\u043e \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0438\u0448\u0435\u0442, \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0441\u0442\u0438 \u043f\u0438\u0448\u0443\u0449\u0435\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438. \u041f\u043e\u0447\u0435\u043c\u0443 \u0442\u0430\u043a? \u041f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c 40 \u043c\u0435\u0436\u0434\u0443 \u0441\u0447\u0435\u0442\u0430\u043c\u0438, \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u043e \u043f\u043e 50, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0447\u0438\u0442\u0430\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u043d\u0430 \u0441\u0447\u0435\u0442\u0430\u0445:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">H1: r1[x=50]...w1[x=10]...r2[x=10]...r2[y=50]...c2...r1[y=50]...w1[y=90]...c1<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>T2 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u043b\u0430\u043d\u0441 60<\/li>\n<li>\u0418\u0441\u0442\u043e\u0440\u0438\u044e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u0442.\u0435. \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u0430\u0451\u0442 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/li>\n<li>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0444\u0435\u043d\u043e\u043c\u0435\u043d\u043e\u0432 \u0438\u0437 SQL-92<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f?<\/p>\n<p>  <\/p>\n<ul>\n<li>A1 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u0442\u043a\u0430\u0442\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u2014 \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442<\/li>\n<li>A2 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0434\u0432\u043e\u0439\u043d\u043e\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u2014 \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442<\/li>\n<li>A3 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0434 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c \u2014 \u0432 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0427.\u0422.\u0414. (\u043d\u0443, \u0438\u043b\u0438 Q.E.D. \u2014 \u043a\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u0438\u043b\u0435\u0435).<\/p>\n<p>  <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c, \u2014 &#171;\u0440\u0435\u0437\u0430\u0442\u044c, \u043d\u0435 \u0434\u043e\u0436\u0438\u0434\u0430\u044f\u0441\u044c \u043f\u0435\u0440\u0438\u0442\u043e\u043d\u0438\u0442\u0430&#187;. \u0417\u0430\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u0432 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c\u043e\u0439 \u0440\u0430\u043d\u0435\u0435 <a href=\"https:\/\/habr.com\/ru\/company\/otus\/blog\/501294\/\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 Dirty Read \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u044f, \u0430 \u043d\u0435 \u0444\u0435\u043d\u043e\u043c\u0435\u043d.<\/p>\n<p>  <\/p>\n<h2 id=\"p2-fuzzy-or-non-repeatable-read\">P2 (Fuzzy or Non-Repeatable Read)<\/h2>\n<p>  <\/p>\n<p>\u0424\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">A2: r1[x]...w2[x]...c2...r1[x]...c1<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422.\u0435. \u043f\u0435\u0440\u0432\u0430\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0447\u0438\u0442\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0432\u0442\u043e\u0440\u0430\u044f \u0435\u0433\u043e &#171;\u043f\u043e\u0440\u0442\u0438\u0442&#187; \u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f, \u0437\u0430\u0442\u0435\u043c \u043f\u0435\u0440\u0432\u0430\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442 \u0447\u0442\u0435\u043d\u0438\u0435, \u043f\u043e\u043b\u0443\u0447\u0430\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0447\u0442\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u0438\u0442\u0438\u043a\u0438 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e\u0442, \u0447\u0442\u043e \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0430\u0434\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0448\u0438\u0440\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">P2: r1[x]...w2[x]...(c1 or a1)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422.\u0435. \u043d\u0435\u043b\u044c\u0437\u044f \u043c\u0435\u043d\u044f\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u043a\u0442\u043e-\u0442\u043e \u0447\u0438\u0442\u0430\u0435\u0442. \u0412\u0442\u043e\u0440\u0430\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u043f\u0435\u0440\u0432\u043e\u0439, Non-Repeatable Read \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u0432 \u0447\u0435\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430?! \u041e\u043f\u044f\u0442\u044c \u0441 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u043e\u043c \u0434\u0435\u043d\u0435\u0433:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">H2: r1[x=50]...r2[x=50]...w2[x=10]...r2[y=50]...w2[y=90]...c2...r1[y=90]...c1<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>T1 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u043b\u0430\u043d\u0441 140<\/li>\n<li>\u0418\u0441\u0442\u043e\u0440\u0438\u044e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c<\/li>\n<li>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0444\u0435\u043d\u043e\u043c\u0435\u043d\u043e\u0432 \u0438\u0437 SQL-92<\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"p3-phantom\">P3 (Phantom)<\/h2>\n<p>  <\/p>\n<p>\u0422\u043e, \u0447\u0442\u043e \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442 Phantom Read. \u0424\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u0437 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">A3: r1[P]...w2[y in P]...c2...r1[P]...c1<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422.\u0435. \u0447\u0438\u0442\u0430\u0435\u043c \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e P, \u0437\u0430\u0442\u0435\u043c \u0435\u0433\u043e &#171;\u043f\u043e\u0440\u0442\u0438\u043c&#187; \u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0447\u0438\u0442\u0430\u0435\u043c &#171;\u043f\u043e\u0440\u0447\u0435\u043d\u043d\u043e\u0435&#187;. &#171;\u041f\u043e\u043f\u043e\u0440\u0442\u0438\u0442\u044c&#187; \u043c\u043e\u0436\u043d\u043e \u043a\u0430\u043a \u0432\u0441\u0442\u0430\u0432\u043a\u043e\u0439 \u043d\u043e\u0432\u043e\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0447\u0435\u0433\u043e \u043e\u043d \u043f\u043e\u043f\u043e\u043b\u043d\u0438\u0442 \u0441\u043e\u0431\u043e\u0439 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e, \u0442\u0430\u043a \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e, \u0442\u0430\u043a \u0447\u0442\u043e \u043e\u043d &#171;\u043f\u0435\u0440\u0435\u0439\u0434\u0435\u0442&#187; \u0432 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e.<\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u0438\u0442\u0438\u043a\u0438 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e\u0442, \u0447\u0442\u043e \u043d\u0430 \u0432\u043e\u043f\u0440\u043e\u0441 \u043d\u0430\u0434\u043e \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0448\u0438\u0440\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">P3: r1[P]...w2[y in P]...(c1 or a1)<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0442\u0430 \u0436\u0435, \u0447\u0442\u043e \u0438 \u0434\u043b\u044f P2<\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"p4-lost-update\">P4 (Lost Update)<\/h2>\n<p>  <\/p>\n<p>\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">P4: r1[x=1]...w2[x=10]...w1[x=1+1]...c1<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 \u04221 &#171;\u043f\u0435\u0440\u0435\u0442\u0438\u0440\u0430\u0435\u0442&#187; \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 T2 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0412 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u0441\u043c\u044b\u0441\u043b\u0430 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0444\u0435\u043d\u043e\u043c\u0435\u043d P0 (Dirty Write, <code>w2[x=10]...w1[x=1+1]<\/code>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043f\u043e \u0437\u0430\u043c\u044b\u0441\u043b\u0443 \u0430\u0432\u0442\u043e\u0440\u043e\u0432, \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043b\u044e\u0431\u044b\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438<\/li>\n<li>\u041c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a: <code>r1[x=1]...w2[x=10]...c2...w1[x=1+1]...c1<\/code><\/li>\n<li>\u0422\u0435\u043f\u0435\u0440\u044c \u0432\u043d\u0443\u0442\u0440\u0438 P2: <code>r1[x=1]...w2[x=10]<\/code><\/li>\n<li>\u041d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0439 \u043d\u044e\u0430\u043d\u0441 \u2014 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 Snapshot \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442 P4, \u043d\u043e \u043d\u0435 P2 (\u0441\u043c. \u0434\u0430\u043b\u0435\u0435)<\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"p4c-cursor-lost-update\">P4C (Cursor Lost Update)<\/h2>\n<p>  <\/p>\n<p>\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">rc1[x=1]...w2[x=10]...w1[x=1+1]...c1<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u043e\u0434 rc \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043a\u0443\u0440\u0441\u043e\u0440, \u0441\u043c\u044b\u0441\u043b \u0444\u0435\u043d\u043e\u043c\u0435\u043d\u0430 \u2014 \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u043c\u0435\u043d\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u0443\u0440\u0441\u043e\u0440<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u0443\u0440\u043e\u0432\u043d\u0435\u043c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 Cursor Stability<\/li>\n<li>\u042f \u0431\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u043b \u043a\u0430\u043a: <code>rc1[x=1]...w2[x=10]...c2...w1[x=1+1]...c1<\/code><br \/> \n<ul>\n<li>\u0418\u043d\u0430\u0447\u0435 \u043e\u043f\u044f\u0442\u044c \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0441\u0442\u043e P0<\/li>\n<\/ul>\n<\/li>\n<li>\u041c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u043d\u0435 \u043f\u043e\u0434 \u043a\u0443\u0440\u0441\u043e\u0440\u043e\u043c: <code>rc1[x]...rc1[y]...w2[x]...c2...w1[y]...c1<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"a5a-read-skew\">A5A (Read Skew)<\/h2>\n<p>  <\/p>\n<p>\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">r1[x]...w2[x]...w2[y]...c2...r1[y]...(c1 or a1)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043e\u0434\u043d\u043e \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0447\u0442\u0435\u043d\u0438\u044f &#171;\u043f\u043e\u0440\u0442\u0438\u0442&#187; \u0434\u0440\u0443\u0433\u0430\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439, \u0447\u0442\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f &#171;\u043a\u0440\u0438\u0432\u043e\u0435&#187;, \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u2014 \u043d\u0435\u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439, \u043e\u043f\u044f\u0442\u044c \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c 40 \u043c\u0435\u0436\u0434\u0443 \u0441\u0447\u0435\u0442\u0430\u043c\u0438 \u0441 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0441\u0442\u0430\u0442\u043a\u043e\u043c \u0432 50:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">H2: [x=50, y=50]...r1[x=50]...w2[x=10]...w2[y=90]...c2...r1[y=90]...(c1 or a1)<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>T1 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0430\u043d\u043e\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u043b\u0430\u043d\u0441 140 <\/li>\n<li>\u0412\u043d\u0443\u0442\u0440\u0438 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f P2: <code>(r1[x]...w2[x])<\/code><\/li>\n<li>\u0423\u0440\u043e\u0432\u0435\u043d\u044c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 A5A, \u043d\u043e \u043d\u0435 P2 \u2014 Snapshot (\u0441\u043c. \u0434\u0430\u043b\u0435\u0435)<\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"a5b-write-skew\">A5B (Write Skew)<\/h2>\n<p>  <\/p>\n<p>\u0412 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442, \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">r1[x]...r2[y]...w1[y]...w2[x]...(c1 and c2 occur)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u043c\u0435\u0435\u043c \u0434\u0432\u0430 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, T1 \u043f\u0438\u0448\u0435\u0442 \u0432\u0442\u043e\u0440\u043e\u0435, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0435\u0440\u0432\u043e\u0433\u043e. \u041e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f T2 \u0434\u0435\u043b\u0430\u0435\u0442 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0431\u0430\u0437\u0435 \u043d\u0435\u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0434\u0435\u043d\u044c\u0433\u0430\u043c\u0438 \u0442\u0443\u0442 \u0443\u0436\u0435 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442, \u043f\u0443\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 <code>x*2 &lt;= y<\/code>, x=3, y=4, \u0438\u0441\u0442\u043e\u0440\u0438\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">[x=3, y=4]...r1[x=3]...r2[y=4]...w1[y=6]...w2[x=2]...c1...c2...[x=2, y=6]<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li>\u0412 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f P2: <code>r1[x=3]...w2[x=2]<\/code><\/li>\n<li>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 A5B, \u043d\u043e \u043d\u0435 P2<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0435\u0449\u0451 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 Snapshot; \u0438 \u0441 \u044d\u0442\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u2014 \u0432\u0441\u0451.<\/p>\n<p>  <\/p>\n<h2 id=\"snapshot-isolation\">Snapshot Isolation<\/h2>\n<p>  <\/p>\n<p>\u0423\u0440\u043e\u0432\u0435\u043d\u044c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 Snapshot \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c\u0438 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f\u043c\u0438:<\/p>\n<p>  <\/p>\n<ul>\n<li>Updates by other transactions active after the transaction StartTimestamp are invisible to the transaction<\/li>\n<li>A transaction running in Snapshot Isolation is never blocked attempting a read <\/li>\n<li>The transaction&#8217;s writes (updates, inserts, and deletes) will also be reflected in this snapshot<\/li>\n<li>The transaction successfully commits only if no other transaction T2 with a Commit-Timestamp in T1\u2019s execution interval [StartTimestamp, Commit-Timestamp] wrote data that T1 also wrote<br \/> \n<ul>\n<li>Firstcommitter-wins prevents lost updates (phenomenon P4)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041d\u0443 \u0442.\u0435. \u0447\u0438\u0442\u0430\u0435\u043c \u0432\u0441\u0435\u0433\u0434\u0430 \u0442\u043e, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u0441 \u043a\u0435\u043c-\u0442\u043e \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442 \u043f\u043e \u0437\u0430\u043f\u0438\u0441\u0438, \u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u043e\u0442\u043a\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f. <\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043e\u0431\u0441\u0442\u043e\u044f\u0442 \u0434\u0435\u043b\u0430 \u0441 A2\/P2 (Non-Repeatable Read):<\/p>\n<p>  <\/p>\n<p>A2: <code>r1[x]...w2[x]...c2...r1[x]...c1<\/code><\/p>\n<p>  <\/p>\n<ul>\n<li>\u0415\u0441\u043b\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u0433\u043e, \u0442\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f<\/li>\n<li>\u041c\u043e\u0436\u043d\u043e \u0441\u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u0432\u0435\u0440\u0441\u0438\u0439: <code>r1[x1]...w2[x2]...c2...r1[x2]...c1<\/code> \u2014 \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u0438, \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f<\/li>\n<\/ul>\n<p>  <\/p>\n<p>P2: <code>r1[x]...w2[x]...(c1 or a1)<\/code><\/p>\n<p>  <\/p>\n<ul>\n<li>\u0422\u0430\u043a\u0438\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 Snapshot \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043e\u0431\u0441\u0442\u043e\u044f\u0442 \u0434\u0435\u043b\u0430 \u0441 A3\/P3, \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f A3:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">A3: r1[P1]...w2[y in P2]...c2...r1[P2]...c1<\/code><\/pre>\n<p>  <\/p>\n<p>\u043d\u043e \u043d\u0435 P3:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">P3: r1[P1]...w2[y in P2]...(c1 or a1)<\/code><\/pre>\n<p>  <\/p>\n<p>A5A (Read Skew) \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0444\u043e\u0440\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u043a\u0435:<\/p>\n<p>  <\/p>\n<ul>\n<li><code>r1[x1]...w2[x2]...w2[y2]...c2...r1[y2]...(c1 or a1)<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0432\u044b\u0448\u0435\u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e Table 4, \u043f\u043e\u0445\u043e\u0436\u0435, \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u0448\u0438\u0431\u043a\u0443:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ep\/xy\/ip\/epxyipcaif9bpfnyfyz9nyfemdy.png\" data-src=\"https:\/\/habrastorage.org\/webt\/ep\/xy\/ip\/epxyipcaif9bpfnyfyz9nyfemdy.png\"\/><\/p>\n<p>  <\/p>\n<ul>\n<li>\u041e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 P2 \u0438 Shapshot \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c &#171;Sometimes Possible&#187;, \u0442.\u0435. A2 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0430 \u0432\u043e\u0442 P2 \u2014 \u0432\u043f\u043e\u043b\u043d\u0435<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u0430\u0431\u043b\u0438\u0447\u043a\u0443 \u044f \u0431\u044b \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u043b \u0432 \u0442\u0430\u043a\u043e\u043c \u0432\u0438\u0434\u0435:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/3z\/dh\/cw\/3zdhcwunt9vzz1ofkancvggxet0.png\" data-src=\"https:\/\/habrastorage.org\/webt\/3z\/dh\/cw\/3zdhcwunt9vzz1ofkancvggxet0.png\"\/><\/p>\n<p>  <\/p>\n<ul>\n<li>\u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0444\u0435\u043d\u043e\u043c\u0435\u043d\u044b \u0442\u0430\u043a, \u043a\u0430\u043a \u043e\u043d\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0432 SQL-92, \u0442\u043e Lost Update \u0438 Read Skew \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438, \u0442.\u043a. \u043e\u043d\u0438 \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u044b (\u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435) A2<\/li>\n<li>\u0415\u0441\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0444\u0435\u043d\u043e\u043c\u0435\u043d\u044b \u0442\u0430\u043a, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442 &#171;\u043a\u0440\u0438\u0442\u0438\u043a\u0438&#187;, \u0442\u043e \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 Read Skew (\u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d Lost Update) \u0438 Write Skew (\u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d Fuzzy Read)<\/li>\n<li>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Sometimes Possible \u0434\u043b\u044f Cursor Stability \u2014 \u043d\u0435 \u043e\u0441\u0438\u043b\u0438\u043b<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0418\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>  <\/p>\n<h1 id=\"d-abadi-introduction-to-transaction-isolation-levels\">D. Abadi: Introduction to Transaction Isolation Levels<\/h1>\n<p>  <\/p>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 [<a href=\"http:\/\/dbmsmusings.blogspot.com\/2019\/05\/introduction-to-transaction-isolation.html\" rel=\"nofollow noopener noreferrer\">ABAISO<\/a>] \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440\u0430 D. Abadi \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:<\/p>\n<p>  <\/p>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043b\u0438\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440\u0430:<\/p>\n<p>  <\/p>\n<blockquote><p>He is best-known for the development of the storage and query execution engines of the C-Store (column-oriented database) prototype, which was commercialized by Vertica and eventually acquired by Hewlett-Packard in 2011, for his HadoopDB research on fault tolerant scalable analytical database systems which was commercialized by Hadapt and acquired by Teradata in 2014, and deterministic, scalable, transactional, distributed systems such as Calvin which is currently being commercialized by Fauna<\/p><\/blockquote>\n<p>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0442\u0435\u043c, \u0447\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0438\u0437 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u044b \u043d\u0435 \u0443\u0437\u043d\u0430\u0435\u043c, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0441\u0442\u0430\u0442\u044c\u044f \u0434\u0430\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f 2019 \u0433\u043e\u0434\u043e\u043c:<\/p>\n<p>  <\/p>\n<blockquote><p>There are many, many problems with how the SQL standard defines these isolation levels. Most of these problems were already pointed out in 1995, but inexplicably, revision after revision of the SQL standard have been released since that point without fixing these problems.<\/p><\/blockquote>\n<p>\u041d\u0435 \u0437\u0440\u044f, \u0432\u044b\u0445\u043e\u0434\u0438\u0442, \u0442\u0430\u043a \u0432\u0434\u0443\u043c\u0447\u0438\u0432\u043e \u0447\u0438\u0442\u0430\u043b\u0438 \u043a\u0440\u0438\u0442\u0438\u043a\u0443 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430 \u2014 \u044d\u0442\u043e \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e \u0438 \u0432 \u043d\u044b\u043d\u0435\u0448\u043d\u0435\u043c \u0442\u044b\u0441\u044f\u0447\u0435\u043b\u0435\u0442\u0438\u0438. \u0415\u0441\u0442\u044c, \u043f\u0440\u0430\u0432\u0434\u0430, \u043d\u044e\u0430\u043d\u0441 \u2014 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u0442\u0430\u043a\u0438 \u0438\u0441\u043f\u043e\u0440\u0442\u0438\u043b\u0441\u044f \u0438 Phantom \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0441\u044f \u0432 Phantom Read.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">Phantom \u0438\u043b\u0438 Phantom Read?<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0436\u0435 \u041f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0442\u0435\u0440\u043c\u0438\u043d Phantom Read? \u0412 SQL-92 \u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u0442 Phantom, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u0432 \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0437\u0434\u043d\u0438\u0445 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430\u0445 \u044d\u0442\u043e\u0442 \u0442\u0435\u0440\u043c\u0438\u043d \u0437\u0430\u043c\u0435\u043d\u0438\u043b\u0438 \u043d\u0430 Phantom Read? <\/p>\n<p>  <\/p>\n<p><a href=\"http:\/\/web.cecs.pdx.edu\/~len\/sql1999.pdf\" rel=\"nofollow noopener noreferrer\">ISO\/IEC 9075-2:1999<\/a>:<\/p>\n<p>  <\/p>\n<blockquote><p>3) P3 (\u2018\u2018Phantom\u2019\u2019): SQL-transaction T1 reads the set of rows N that satisfy some &lt;search condition>. SQL-transaction T2 then executes SQL-statements that generate one or more rows that satisfy the &lt;search condition> used by SQL-transaction T1. If SQL-transaction T1 then repeats the initial read with the same &lt;search condition>, it obtains a different collection of rows.<\/p><\/blockquote>\n<p><a href=\"http:\/\/www.wiscorp.com\/sql20nn.zip\" rel=\"nofollow noopener noreferrer\">SQL:2011 or ISO\/IEC 9075:2011<\/a>:<\/p>\n<p>  <\/p>\n<blockquote><p>3) P3 (\u201cPhantom\u201d): SQL-transaction T1 reads the set of rows N that satisfy some &lt;search condition>. SQL-transaction T2 then executes SQL-statements that generate one or more rows that satisfy the &lt;search condition> used by SQL-transaction T1. If SQL-transaction T1 then repeats the initial read with the same &lt;search condition>, it obtains a different collection of rows.<\/p><\/blockquote>\n<p><a href=\"http:\/\/www.sai.msu.su\/~megera\/postgres\/files\/sql-2016-json.txt\" rel=\"nofollow noopener noreferrer\">SQL:2016 or ISO\/IEC 9075-2:2016<\/a>:<\/p>\n<p>  <\/p>\n<blockquote><p>3) P3 (&#171;Phantom&#187;): SQL-transaction T1 reads the set of rows N that satisfy some &lt;search condition>. SQL- transaction T2 then executes SQL-statements that generate one or more rows that satisfy the &lt;search condition> used by SQL-transaction T1. If SQL-transaction T1 then repeats the initial read with the same &lt;search condition>, it obtains a different collection of rows.<\/p><\/blockquote>\n<p>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442 SQL:2019 \u0432\u044b\u043f\u0443\u0449\u0435\u043d June 2019, \u044d\u0442\u043e \u043f\u043e\u0437\u0436\u0435, \u0447\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430 \u041f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440\u0430, \u0442\u0430\u043a \u0447\u0442\u043e&#8230;<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u041d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u044f Perfect Isolation:<\/p>\n<p>  <\/p>\n<blockquote><p>The key point for our purposes is that we are defining \u201cperfect isolation\u201d as the ability of a system to run transactions in parallel, but in a way that is equivalent to as if they were running one after the other. In the SQL standard, this <strong>perfect isolation<\/strong> level is called <strong>serializability<\/strong>.<\/p><\/blockquote>\n<p>  <\/p>\n<h1 id=\"d-abadi-correctness-anomalies-under-serializable-isolation\">D. Abadi: Correctness Anomalies Under Serializable Isolation<\/h1>\n<p>  <\/p>\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 [<a href=\"https:\/\/dbmsmusings.blogspot.com\/2019\/06\/correctness-anomalies-under.html\" rel=\"nofollow noopener noreferrer\">ABACASER<\/a>] \u041f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442, \u0447\u0442\u043e \u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 Serializable \u2014 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043f\u0440\u0435\u0434\u0435\u043b \u043c\u0435\u0447\u0442\u0430\u043d\u0438\u0439, \u0432\u0441\u0451 \u043d\u0435 \u0442\u0430\u043a, \u043a\u0430\u043a \u0432 \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u043e\u0431\u0440\u044b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0430 \u043c\u0435\u0439\u043d\u0444\u0440\u0435\u0439\u043c\u043e\u0432, \u043c\u043e\u043d\u043e\u043b\u0438\u0442\u043e\u0432 \u0438 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<blockquote><p>In the good old days of having a \u201cdatabase server\u201d which is running on a single physical machine, serializable isolation was indeed sufficient, and database vendors never attempted to sell database software with stronger correctness guarantees than SERIALIZABLE. However, <strong>as distributed and replicated database systems have started<\/strong> to proliferate in the last few decades, <strong>anomalies and bugs have started to appear<\/strong> in applications even when running over a database system that guarantees serializable isolation. As a consequence, database system vendors <strong>started to release systems with stronger correctness guarantees than serializable isolation<\/strong>, which promise a lack of vulnerability to these newer anomalies. In this post, we will discuss several well known <strong>bugs and anomalies in serializable distributed database systems<\/strong>, and modern correctness guarantees that ensure avoidance of these anomalies.<\/p><\/blockquote>\n<p>\u0414\u043b\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b\u0438 One Copy Serializability (1SR), \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 [<a href=\"https:\/\/eprints.soton.ac.uk\/262096\/1\/reft.pdf\" rel=\"nofollow noopener noreferrer\">YB<\/a>] \u043e\u043d \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<blockquote><p>The <strong>One Copy Serializability<\/strong> [7] is the highest correctness criterion for replica control protocols\u2026 In order to achieve this correctness criterion, it is required that interleaved execution of transactions on replicas be equivalent to serial execution of those transactions on one copy of a database.<\/p><\/blockquote>\n<p>\u041d\u0443 \u0442.\u0435. \u043e\u043f\u044f\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e, \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f\u043c \u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445. \u0412\u0441\u0451 \u043b\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u044f\u0435\u0442 1SR? \u041d\u0435\u0442, \u043d\u0435 \u0432\u0441\u0451., \u041f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u0442\u0440\u0438 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0438, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0430\u043a\u0443\u044e \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u044e:<\/p>\n<p>  <\/p>\n<blockquote><p>The next few sections describe some forms of <strong>time-travel anomalies<\/strong> that occur in distributed and\/or replicated systems, and the types of application bugs that they may cause.<\/p><\/blockquote>\n<p><strong>1. Immortal Write (\u0411\u0435\u0441\u0441\u043c\u0435\u0440\u0442\u043d\u0430\u044f \u0417\u0430\u043f\u0438\u0441\u044c)<\/strong><\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u0451 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u043c\u043e\u0435 \u0438\u043c\u044f, Daniel => Danny => Danger:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438: <code>w1[x=Daniel]...c1...w2[x=Danny]...c2...w3[x=Danger]...c3<\/code><\/li>\n<li>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0432 \u0436\u0443\u0440\u043d\u0430\u043b\u0435 1SR-\u0441\u0438\u0441\u0442\u0435\u043c\u044b: <code>w1[x=Daniel]...w3[x=Danger]...w2[x=Danny]<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0430\u043d\u0430\u0445\u0440\u043e\u043d\u0438\u0437\u043c (time-travel anomaly) \u2014 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 Danger \u0431\u044b\u043b\u043e \u043f\u043e\u0441\u043b\u0430\u043d\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c, \u043d\u043e \u0434\u0432\u0438\u0436\u043e\u043a \u0411\u0414 \u0432 \u0441\u0438\u043b\u0443 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u0438\u043b w3 \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0435 \u043c\u0435\u0441\u0442\u043e. \u041f\u0440\u0438\u0447\u0438\u043d\u043e\u0439 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0440\u0430\u0441\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0447\u0430\u0441\u043e\u0432 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0438\u043b\u0438 \u0436\u0435 \u043d\u0435\u043a\u0438\u0435 &#171;\u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f&#187; \u0434\u0432\u0438\u0436\u043a\u0430 \u0411\u0414 \u043f\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439. \u041e\u0442 \u0442\u0430\u043a\u043e\u0439 &#171;\u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438&#187; \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f Serializability \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u043d\u0430\u0440\u0443\u0448\u0430\u044e\u0442\u0441\u044f, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u0432\u0438\u0436\u043e\u043a \u0432 \u0441\u0432\u043e\u0435\u043c \u043f\u0440\u0430\u0432\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>  <\/p>\n<p><strong>2. Stale Read (\u041d\u0435\u0441\u0432\u0435\u0436\u0435\u0435 \u0427\u0442\u0435\u043d\u0438\u0435)<\/strong><\/p>\n<p>  <\/p>\n<p>\u041f\u0438\u0448\u0435\u043c \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e 50, \u0437\u0430\u0442\u0435\u043c 0, \u043f\u043e\u0442\u043e\u043c \u0447\u0438\u0442\u0430\u0435\u043c, \u043e\u0436\u0438\u0434\u0430\u044f 0:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438: <code>w1[x=50]...\u04411...w2[x=0]...c2...r3...c3<\/code><\/li>\n<li>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0432 \u0436\u0443\u0440\u043d\u0430\u043b\u0435 1SR-\u0441\u0438\u0441\u0442\u0435\u043c\u044b: <code>w1[x=50]...r3[x=50]...w2[x=0]<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041a\u043b\u0430\u0441\u0442\u0435\u0440 \u0411\u0414 \u043e\u043f\u044f\u0442\u044c &#171;\u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u0438\u043b&#187; \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c 50.<\/p>\n<p>  <\/p>\n<p><strong>3. Causal Reverse (\u041e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u041f\u0440\u0438\u0447\u0438\u043d\u043d\u043e\u0441\u0442\u044c, &#171;\u0440\u0435\u0432\u0435\u0440\u0441 \u043a\u043e\u0437\u043b\u0430&#187;)<\/strong><\/p>\n<p>  <\/p>\n<p>\u0421\u0438\u0442\u0443\u0430\u0446\u0438\u044f: \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0438\u043c\u0435\u0435\u0442 1.000.000 \u043d\u0430 \u0441\u0447\u0435\u0442\u0443 <code>x<\/code> \u0438 0 \u043d\u0430 \u0441\u0447\u0435\u0442\u0443 <code>y<\/code>. \u0427\u0438\u0442\u0430\u0435\u043c \u043e\u0441\u0442\u0430\u0442\u043a\u0438, \u0441\u043d\u0438\u043c\u0430\u0435\u043c \u0432 \u0431\u0430\u043d\u043a\u043e\u043c\u0430\u0442\u0435 1.000.000 \u0441\u043e \u0441\u0447\u0435\u0442\u0430 <code>x<\/code> \u0438 \u0437\u0430\u0442\u0435\u043c \u043a\u043b\u0430\u0434\u0435\u043c \u043c\u0438\u043b\u043b\u0438\u043e\u043d \u043d\u0430 \u0441\u0447\u0435\u0442 <code>y<\/code>.<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438: <code>r1[x, y]...w2[x=0]...c2...w3[y=1.000.000]...c3...\u04411<\/code><\/li>\n<li>\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u0432 \u0436\u0443\u0440\u043d\u0430\u043b\u0435 1SR-\u0441\u0438\u0441\u0442\u0435\u043c\u044b: <code>w3[y=1.000.000]...r1[x=1.000.000, y=1.000.000]...w2[x=0]<\/code><\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0411\u0414 \u043e\u043f\u044f\u0442\u044c \u043f\u043e\u0432\u0435\u043b\u0430 \u0441\u0435\u0431\u044f \u0434\u0435\u0440\u0437\u043a\u043e \u0438 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u0438\u043b\u0430 r1 \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0435 \u043c\u0435\u0441\u0442\u043e, \u0442\u0430\u043a \u0447\u0442\u043e r1 &#171;\u0432\u044b\u0447\u0438\u0442\u0430\u043b\u0430&#187; \u043f\u043e \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0443 \u0441 \u043e\u0431\u043e\u0438\u0445 \u0441\u0447\u0435\u0442\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0423\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0442\u0430\u043a\u0430\u044f \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u0432 CockroachDB (aka CRDB) \u0438\u0437-\u0437\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b (STRONG PARTITION SERIALIZABLE) \u0438 \u043d\u0435\u0440\u0435\u0448\u0430\u0435\u043c\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u0447\u0430\u0441\u043e\u0432: &#171;this enables a read (<strong>in CockroachDB\u2019s case, this read has to be sent to the system before the two write transactions<\/strong>) to potentially see the write of the later transaction, but not the earlier one&#187;.<\/p>\n<p>  <\/p>\n<p>\u0421 \u043d\u0435\u0433\u043e\u0434\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u0442\u0432\u0435\u0440\u0433\u043d\u0435\u043c CockroachDB? \u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043d\u0435 \u0441\u0442\u043e\u0438\u0442, \u0440\u0430\u0431\u043e\u0442\u0430\u044f \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u0431\u044b\u0432\u0430\u0442\u044c \u0432 \u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u043e\u043c \u043d\u0435\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043e \u0442\u0435\u0445 \u0443\u0436\u0430\u0441\u0430\u0445, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u044f\u0442 \u043f\u043e\u0434 &#171;\u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u043a\u0430\u043f\u043e\u0442\u043e\u043c&#187;.<\/p>\n<p>  <\/p>\n<p>\u0413\u0430\u0440\u0430\u043d\u0442\u0438\u0438 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u043e\u0439 \u043e\u0442 &#171;\u0443\u0436\u0430\u0441\u043e\u0432&#187; \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u041f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442 Strict Serializability (\u0442.\u0435. \u0421\u0442\u0440\u043e\u0433\u043e-\u0421\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u0430\u044f \u0418\u0437\u043e\u043b\u044f\u0446\u0438\u044f, \u0434\u0430) \u0438 \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0443\u043f\u0435\u043d\u044c\u043a\u0438 \u043d\u0430 \u043f\u0443\u0442\u0438 \u043a \u0438\u0434\u0435\u0430\u043b\u0443:<\/p>\n<p>  <\/p>\n<ul>\n<li><strong>Strong Session Serializable<\/strong>: \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 Strict Serializability \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0441\u0435\u0441\u0441\u0438\u0438, \u0438\u043d\u0430\u0447\u0435 1SR<br \/> \n<ul>\n<li>\u041e\u0447\u0435\u0432\u0438\u0434\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u044d\u0442\u043e \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044f &#171;sticky session&#187;, \u0442.\u0435. \u0432\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0435\u0439 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438 \u0442\u043e\u043c\u0443 \u0436\u0435 \u0443\u0437\u043b\u0443<\/li>\n<\/ul>\n<\/li>\n<li><strong>Strong Write Serializable<\/strong>: \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 Strict Serializability \u0434\u043b\u044f \u043f\u0438\u0448\u0443\u0449\u0438\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439, read-only \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f \u0443\u0440\u043e\u0432\u043d\u0435\u043c 1SR<br \/> \n<ul>\n<li>\u041e\u0447\u0435\u0432\u0438\u0434\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u2014 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0442\u0435\u0440 \u0441 \u043e\u0434\u043d\u043e\u0439 master-\u0440\u0435\u043f\u043b\u0438\u043a\u043e\u0439, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c read-only \u0440\u0435\u043f\u043b\u0438\u043a<\/li>\n<\/ul>\n<\/li>\n<li><strong>Strong Partition Serializable<\/strong>: c\u0438\u0441\u0442\u0435\u043c\u0430 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 Strict Serializability \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u0432<br \/> \n<ul>\n<li>\u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434, \u043a \u0441\u043b\u043e\u0432\u0443, \u043f\u0440\u0438\u043d\u044f\u0442 \u0432 CocroachDB \u0438 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u0435<\/li>\n<li>\u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c shard \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 partition, \u043d\u043e \u0443 \u043d\u0430\u0441, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u043d\u0435 \u0442\u0430\u043a, \u0438 partition \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e shard<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u041f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0443:<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>System Guarantee<\/th>\n<th>Dirty read<\/th>\n<th>Non-repeatable read<\/th>\n<th>Phantom Read<\/th>\n<th>Write Skew<\/th>\n<th>Immortal write<\/th>\n<th>Stale read<\/th>\n<th>Causal reverse<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>READ UNCOMMITTED<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<\/tr>\n<tr>\n<td>READ COMMITTED<\/td>\n<td>&#8212;<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<\/tr>\n<tr>\n<td>REPEATABLE READ<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<\/tr>\n<tr>\n<td>SNAPSHOT ISOLATION<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<\/tr>\n<tr>\n<td>SERIALIZABLE \/ ONE COPY SERIALIZABLE \/ STRONG SESSION SERIALIZABLE<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<td>Possible<\/td>\n<\/tr>\n<tr>\n<td>STRONG WRITE SERIALIZABLE<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>Possible<\/td>\n<td>&#8212;<\/td>\n<\/tr>\n<tr>\n<td>STRONG PARTITION SERIALIZABLE<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>Possible<\/td>\n<\/tr>\n<tr>\n<td>STRICT SERIALIZABLE<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<td>&#8212;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<p>\u0418\u0434\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<p>  <\/p>\n<h1 id=\"consistency-levels-in-azure-cosmos-db\">Consistency levels in Azure Cosmos DB<\/h1>\n<p>  <\/p>\n<p>\u201c\u0421\u0443\u0445\u0430 \u0442\u0435\u043e\u0440\u0438\u044f, \u043c\u043e\u0439 \u0434\u0440\u0443\u0433, \u043d\u043e \u0434\u0440\u0435\u0432\u043e \u0436\u0438\u0437\u043d\u0438 \u0437\u0435\u043b\u0435\u043d\u0435\u0435\u0442\u201d. \u0421\u0438\u043b\u044c\u043d\u044b\u0435 \u0434\u0443\u0445\u043e\u043c \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c [<a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/cosmos-db\/consistency-levels\" rel=\"nofollow noopener noreferrer\">COSMOS<\/a>], Microsoft, Consistency levels in Azure Cosmos DB, 2022, \u0437\u0434\u0435\u0441\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0443\u0441\u044c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435\u043c Consistency levels, \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0445 \u0432 \u044d\u0442\u043e\u0439 \u0421\u0423\u0411\u0414:<\/p>\n<p>  <\/p>\n<ul>\n<li>Strong (\u0421\u0438\u043b\u044c\u043d\u0430\u044f)<\/li>\n<li>Bounded staleness ([ba\u028and\u026ad \u02c8ste\u026aln\u0259s], \u0417\u0430\u043f\u0430\u0437\u0434\u044b\u0432\u0430\u043d\u0438\u0435, \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0430\u043d\u0438\u0435, \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u0430\u044f \u043d\u0435\u0441\u0432\u0435\u0436\u0435\u0441\u0442\u044c)<br \/> \n<ul>\n<li>\u0422.\u0435. \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u0441\u0432\u0435\u0436\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u0438\u0445 \u0437\u0430\u043f\u0430\u0437\u0434\u044b\u0432\u0430\u043d\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u043f\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438\/\u0438\u043b\u0438 \u043f\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/li>\n<\/ul>\n<\/li>\n<li>Session (\u0421\u0435\u0430\u043d\u0441, \u0421\u0435\u0441\u0441\u0438\u043e\u043d\u043d\u0430\u044f)<\/li>\n<li>Consistent prefix ([k\u0259n\u02c8s\u026ast\u0259nt \u02c8pri\u02d0f\u026aks], \u0421\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0435\u0444\u0438\u043a\u0441)<br \/> \n<ul>\n<li>This guarantee says that if a sequence of writes happens in a certain order, then anyone reading those writes will see them appear in the same order [<a href=\"https:\/\/ebrary.net\/64710\/computer_science\/consistent_prefix_reads\" rel=\"nofollow noopener noreferrer\">CLEPP<\/a>] (\u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0441\u043e\u0431\u043b\u044e\u0434\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u0447\u0438\u0442\u0430\u0435\u043c \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u043c \u0437\u0430\u043f\u0430\u0437\u0434\u044b\u0432\u0430\u043d\u0438\u0435\u043c)<\/li>\n<\/ul>\n<\/li>\n<li>Eventual (\u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f, \u0421\u0432\u0435\u0442\u043b\u043e\u0435 \u0431\u0443\u0434\u0443\u0449\u0435\u0435)<br \/> \n<ul>\n<li>\u041a\u043e\u0433\u0434\u0430-\u0442\u043e \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0414\u043b\u044f Strong \u0434\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/694\/665\/fff\/694665fffbf3c7d2b1679f3a93623c90.gif\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/694\/665\/fff\/694665fffbf3c7d2b1679f3a93623c90.gif\"\/><\/p>\n<p>  <\/p>\n<p>\u0422.\u0435. \u043f\u0438\u0448\u0435\u043c \u0432 \u043e\u0434\u043d\u0443 \u0437\u043e\u043d\u0443, \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0447\u0438\u0442\u0430\u0435\u043c \u0431\u0435\u0437 \u0432\u0441\u044f\u043a\u0438\u0445 time-travel \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439.<\/p>\n<p>  <\/p>\n<p>\u0412\u0440\u043e\u0434\u0435 \u043a\u0430\u043a Strong \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430 Strict Serializable \u0443 \u041f\u0440\u043e\u0444\u0435\u0441\u0441\u043e\u0440\u0430 \u0438 c Cosmos DB \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e, \u0442\u0430\u043a? \u041d\u0435\u0442, \u043d\u0435 \u0442\u0430\u043a&#8230;<\/p>\n<p>  <\/p>\n<h1 id=\"jepsenio-consistency-models\">jepsen.io: Consistency Models<\/h1>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e <a href=\"https:\/\/youtu.be\/gjq5xsLeyJQ?t=4\" rel=\"nofollow noopener noreferrer\">\u0432\u0441\u0451 \u043e\u0447\u0435\u043d\u044c \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043e?<\/a>. \u0427\u0442\u043e\u0431\u044b &#171;\u0432\u0441\u0451&#187; \u0440\u0430\u0441\u043f\u0443\u0442\u0430\u0442\u044c, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0430\u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0433\u0440\u0430\u0444, \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0432\u0435\u0440\u0448\u0438\u043d\u0430 \u0438\u043c\u0435\u0435\u0442 \u043d\u0443\u043b\u0435\u0432\u0443\u044e \u0441\u0442\u0435\u043f\u0435\u043d\u044c \u0438\u0441\u0445\u043e\u0434\u0430 (\u043a\u0430\u043a \u0431\u044b \u0434\u0435\u0440\u0435\u0432\u043e, \u043d\u043e \u0441 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0442 \u043b\u0438\u0441\u0442\u044c\u0435\u0432 \u043a \u043a\u043e\u0440\u043d\u044e):<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/jepsen.io\/consistency\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/5n\/_a\/e3\/5n_ae3iu83oyeoorvnrlng5bg68.png\" data-src=\"https:\/\/habrastorage.org\/webt\/5n\/_a\/e3\/5n_ae3iu83oyeoorvnrlng5bg68.png\"\/><\/a><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0430 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 \u0433\u0440\u0443\u043f\u043f\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0435\u0431\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<blockquote><p>Jepsen is an effort to improve the safety of distributed databases, queues, consensus systems, etc. We maintain an open source software library for systems testing, as well as blog posts and conference talks exploring particular systems\u2019 failure modes<\/p><\/blockquote>\n<p>\u0418\u0437 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u0439 [<a href=\"https:\/\/jepsen.io\/analyses\/scylla-4.2-rc3\" rel=\"nofollow noopener noreferrer\">2020-12-23<\/a>]:<\/p>\n<p>  <\/p>\n<blockquote><p>Together with the ScyllaDB team, we found seven problems in Scylla, including lightweight transaction (LWT) split-brain in healthy clusters due to a.) incomplete row hashcodes and b.) multiple problems with membership changes. We also identified incomplete or inaccurate documentation, including claims that non-LWT operations were isolated and atomic, and undocumented rules about what kinds of membership operations were legal. Scylla has corrected almost all of these errors via patches and documentation; remaining cases of split-brain appear limited to concurrent membership changes.<\/p><\/blockquote>\n<p>\u041d\u0443 \u0442.\u0435. \u0440\u0435\u0431\u044f\u0442\u0430, \u043f\u043e\u0445\u043e\u0436\u0435, \u0441\u0432\u043e\u0451 \u0434\u0435\u043b\u043e \u0437\u043d\u0430\u044e\u0442.<\/p>\n<p>  <\/p>\n<p>\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e &#171;\u043a\u043b\u0438\u043a\u043d\u0443\u0442\u044c&#187; \u043f\u043e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435, \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435 \u0438 \u0434\u0430\u043b\u0435\u0435 \u043f\u043e\u043f\u0443\u0442\u0435\u0448\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u0443\u0437\u043b\u0430\u043c \u0433\u0440\u0430\u0444\u0430 \u2014 \u043e\u0442\u043a\u0440\u043e\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u043e\u0435 \u2014 \u0437\u0434\u0435\u0441\u044c \u0436\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0443\u0441\u044c \u043a\u0440\u0430\u0442\u043a\u0438\u043c\u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u041b\u0435\u0432\u0430\u044f \u0432\u0435\u0442\u0432\u044c \u0434\u0435\u0440\u0435\u0432\u0430 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 <strong>\u0430\u043d\u043e\u043c\u0430\u043b\u0438\u044f\u043c \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439<\/strong>, \u0430 \u043f\u0440\u0430\u0432\u0430\u044f \u2014 <strong>\u0430\u043d\u043e\u043c\u0430\u043b\u0438\u044f\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/strong>. \u0411\u0443\u0434\u044c \u043c\u043e\u044f \u0432\u043e\u043b\u044f, \u044f \u0431\u044b \u0434\u0430\u043b \u0442\u0430\u043a\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<blockquote><p><strong>Isolation<\/strong> \u2014 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439<\/p>\n<p>  <strong>Consistency<\/strong> \u2014 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/p><\/blockquote>\n<p>\u0415\u0449\u0451 \u0440\u0430\u0437 \u0437\u0430\u043c\u0435\u0447\u0443, \u0447\u0442\u043e Consistency \u0442\u0443\u0442 \u043d\u0435 \u0442\u0430, \u0447\u0442\u043e \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u0432\u0438\u0434\u0443 \u0432 \u0430\u0431\u0431\u0440\u0435\u0432\u0438\u0430\u0442\u0443\u0440\u0435 ACID.<\/p>\n<p>  <\/p>\n<p>\u041f\u043e \u043b\u0435\u0432\u043e\u0439 \u0432\u0435\u0442\u0432\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li>\n<blockquote><p>Note that read uncommitted <strong>does not impose any real-time constraints<\/strong>. If process A completes write <code>w<\/code>, then process B begins a read <code>r<\/code>, <code>r<\/code> is not necessarily guaranteed to observe <code>w<\/code>&#8230;In fact, a process can fail to observe its own prior writes, if those writes occurred in different transactions  <\/p>\n<ul>\n<li>\u0422.\u0435. \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u0430\u0436\u0435 \u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0438\u0445 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f\u0445<\/li>\n<\/ul>\n<p>  <\/p><\/blockquote>\n<p>  <\/li>\n<li>\n<blockquote><p>Like <strong>serializability<\/strong>, read uncommitted allows pathological orderings. For instance, a read uncommmitted database <strong>can always return the empty state for any reads<\/strong>, by appearing to execute those reads at time 0. It can also discard write-only transactions by reordering them to execute at the very end of the history, after any reads. Operations like increments can also be discarded, assuming the result of the increment is never observed. Luckily, most implementations don\u2019t seem to take advantage of these optimization opportunities  <\/p>\n<ul>\n<li>\u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438, read-only \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0434\u0430\u0436\u0435 \u0434\u043b\u044f \u0443\u0440\u043e\u0432\u043d\u044f \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 Serializable \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0443\u0441\u0442\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0430 write-only \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043e\u0442\u0431\u0440\u043e\u0448\u0435\u043d\u044b. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0421\u0423\u0411\u0414 \u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438<\/li>\n<\/ul>\n<p>  <\/p><\/blockquote>\n<p>  <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412\u043e\u043e\u0440\u0443\u0436\u0438\u0432\u0448\u0438\u0441\u044c \u043d\u043e\u0432\u044b\u043c\u0438 \u0437\u043d\u0430\u043d\u0438\u044f\u043c\u0438, \u043c\u043e\u0436\u043d\u043e \u043f\u043e-\u043d\u043e\u0432\u043e\u043c\u0443 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438\u0438 Cosmos DB. \u0423\u0440\u043e\u0432\u0435\u043d\u044c \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u0438 Strong, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u043e\u0442\u043a\u0438 \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0442\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 (\u043d\u043e \u0438 \u043d\u0435 \u043c\u0435\u043d\u0435\u0435) \u0447\u0435\u043c Linearizable \u2014 \u0442.\u0435. \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0435\u0439 \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0430\u043d\u043e\u043c\u0430\u043b\u0438\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u041d\u043e \u043c\u044b \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0435\u0449\u0451 \u0438 \u0434\u0440\u0443\u0433\u0430\u044f \u0432\u0435\u0442\u0432\u044c \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0439. \u0421 \u043d\u0435\u0439 \u0447\u0442\u043e?<\/p>\n<p>  <\/p>\n<blockquote><p>The database engine in Azure Cosmos DB supports full ACID (Atomicity, Consistency, Isolation, Durability) compliant transactions with snapshot isolation. <\/p>\n<p>  <a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/cosmos-db\/nosql\/database-transactions-optimistic-concurrency\" rel=\"nofollow noopener noreferrer\">https:\/\/learn.microsoft.com\/en-us\/azure\/cosmos-db\/nosql\/database-transactions-optimistic-concurrency<\/a><\/p><\/blockquote>\n<p>Snapshot isolation \u2014 \u0430\u0433\u0430, \u0432\u043e\u0437\u043c\u043e\u0436\u0435\u043d Write Skew. \u041a\u0442\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d, \u0442\u043e\u0442 \u0432\u043e\u043e\u0440\u0443\u0436\u0435\u043d.<\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f, DynamoDB \u043e\u0442 Amazon <a href=\"https:\/\/docs.aws.amazon.com\/amazondynamodb\/latest\/developerguide\/transaction-apis.html\" rel=\"nofollow noopener noreferrer\">\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442<\/a> SERIALIZABLE\/READ-COMMITTED \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438, \u0430 <a href=\"https:\/\/docs.aws.amazon.com\/amazondynamodb\/latest\/developerguide\/HowItWorks.ReadConsistency.html\" rel=\"nofollow noopener noreferrer\">\u0442\u0430\u043a\u0436\u0435<\/a> Strongly Consistent Reads\/Eventually Consistent Reads \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u0438. <code>Strongly Consistent Reads<\/code> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 <code>Strict Serializable<\/code> \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u0445 jepsen.io.<\/p>\n<p>  <a name=\"conclusion\"><\/a>  <\/p>\n<h1 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h1>\n<p>  <\/p>\n<ul>\n<li>\u041a\u0430\u043a \u0441\u0442\u0440\u0430\u0448\u043d\u043e \u0438 \u0442\u0440\u0443\u0434\u043d\u043e \u0436\u0438\u0442\u044c!<\/li>\n<li>\u0414\u043b\u044f \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0421\u0423\u0411\u0414 \u0442\u0440\u0435\u0431\u0443\u0439\u0442\u0435 <del>\u0434\u043e\u043b\u0438\u0432\u0430 \u043f\u0438\u0432\u0430 \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u0441\u0442\u043e\u044f \u043f\u0435\u043d\u044b<\/del> \u0447\u0435\u0442\u043a\u0438\u0445 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0439 \u043f\u043e Isolation \u0438 Consistency<\/li>\n<li>\u041a\u0430\u043f\u0438\u0442\u0430\u043d \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e\u0441\u0442\u044c \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442, \u0447\u0442\u043e \u0447\u0435\u043c \u0432\u044b\u0448\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438, \u0442\u0435\u043c \u043d\u0438\u0436\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/li>\n<\/ul>\n<p>  <a name=\"references\"><\/a>  <\/p>\n<h1 id=\"ssylki\">\u0421\u0441\u044b\u043b\u043a\u0438:<\/h1>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/www.contrib.andrew.cmu.edu\/~shadow\/sql\/sql1992.txt\" rel=\"nofollow noopener noreferrer\">[SQL-92]<\/a>: ISO\/IEC 9075:1992, Database Language SQL- July 30, 1992<\/li>\n<li>[<a href=\"http:\/\/dbmsmusings.blogspot.com\/2019\/05\/introduction-to-transaction-isolation.html\" rel=\"nofollow noopener noreferrer\">ABAISO<\/a>]: D. Abadi, Introduction to Transaction Isolation Levels, blogspot.com, May 2019<\/li>\n<li>[<a href=\"https:\/\/dbmsmusings.blogspot.com\/2019\/06\/correctness-anomalies-under.html\" rel=\"nofollow noopener noreferrer\">ABACASER<\/a>]: D. Abadi, Correctness Anomalies Under Serializable Isolation, blogspot.com, June 2019<\/li>\n<li>[<a href=\"https:\/\/ebrary.net\/64710\/computer_science\/consistent_prefix_reads\" rel=\"nofollow noopener noreferrer\">CLEPP<\/a>]: Martin Kleppmann, Designing Data-Intensive Applications<\/li>\n<li>[<a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/cosmos-db\/consistency-levels\" rel=\"nofollow noopener noreferrer\">COSMOS<\/a>], Microsoft, Consistency levels in Azure Cosmos DB, 2022, microsoft.com<\/li>\n<li>[<a href=\"https:\/\/eprints.soton.ac.uk\/262096\/1\/reft.pdf\" rel=\"nofollow noopener noreferrer\">YB<\/a>], D. Yadav, M. Butler, Rigorous Design of Fault-Tolerant Transactions for Replicated Database Systems using Event B, School of Electronics and Computer Science University of Southampton<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/705332\/\"> https:\/\/habr.com\/ru\/post\/705332\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0423\u0447\u0430\u0441\u0442\u0432\u0443\u044e \u0432 \u0441\u0442\u0430\u0440\u0442\u0430\u043f\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0421\u0423\u0411\u0414 \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u0438\u043f\u0430 (\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0432\u0435\u0440\u0445 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 kv-\u0434\u0432\u0438\u0436\u043a\u043e\u0432, \u043a\u0430\u0440\u0434\u0438\u043d\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u044f \u0438\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043f\u0440\u043e \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/career.habr.com\/vacancies\/1000110099\" rel=\"nofollow noopener noreferrer\">\u0437\u0434\u0435\u0441\u044c<\/a>). \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043d\u0435\u043c\u043d\u043e\u0433\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432 \u0438\u043d\u0434\u0443\u0441\u0442\u0440\u0438\u0438, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0430 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0440\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0435\u0440\u0432\u043e\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u043f\u043e \u0442\u0435\u043c\u0430\u043c Isolation \u0438 Consistency (\u0443\u0442\u043e\u0447\u043d\u044e, \u0447\u0442\u043e \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432\u0432\u0438\u0434\u0443 \u043d\u0435 \u0442\u0430 <code>Consistency<\/code>, \u0447\u0442\u043e \u0432 <code>ACID<\/code>). \u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u043d\u044e\u0430\u043d\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438 \u0438\u0437\u043b\u0430\u0433\u0430\u044e \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u0437\u0438\u0441\u043d\u043e:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0422\u0435\u0440\u043c\u0438\u043d Phantom Read \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u043c \u0438\u0441\u043f\u043e\u0440\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0430<\/li>\n<li>\u0421\u043c\u044b\u0441\u043b \u043f\u043e\u043d\u044f\u0442\u0438\u0439 Lost Update, Write Skew \u0438 Read Skew \u0434\u043b\u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0443\u0440\u043e\u0432\u043d\u0435\u0439 \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0439 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u0435\u043d \u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u0435\u043d<\/li>\n<li>\u0414\u0432\u0438\u0436\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0438\u0437\u043e\u043b\u044f\u0446\u0438\u0438 Serializable, \u0432 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c \u043c\u0438\u0440\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0441\u0442\u0438 \u0441\u0435\u0431\u044f \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u0440\u0438\u0447\u0443\u0434\u043b\u0438\u0432\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <strong>\u0432\u0441\u0435\u0433\u0434\u0430<\/strong> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u043b\u044f read-only \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u2014 \u0438 \u0435\u043c\u0443 \u0437\u0430 \u044d\u0442\u043e \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0443 &#171;\u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442&#187;<\/li>\n<li>Strong consistency \u0432 Cosmos DB \u2014 \u043f\u0440\u0435\u0434\u0435\u043b \u043c\u0435\u0447\u0442\u0430\u043d\u0438\u0439? (\u0441\u043f\u043e\u0439\u043b\u0435\u0440: \u043d\u0435\u0442)<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041d\u0443, \u0438 \u0435\u0449\u0451 \u043a\u043e\u0435-\u0447\u0442\u043e \u043f\u043e \u043c\u0435\u043b\u043e\u0447\u0438. \u0412 \u043a\u043e\u043d\u0446\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u0435\u043d\u0435\u0446 \u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u0443\u043c\u0430:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ka\/lr\/of\/kalrofk2w-2so1fv5a7dwikt6xs.png\" data-src=\"https:\/\/habrastorage.org\/webt\/ka\/lr\/of\/kalrofk2w-2so1fv5a7dwikt6xs.png\"\/><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-342898","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/342898","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=342898"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/342898\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=342898"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=342898"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=342898"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}