{"id":371990,"date":"2024-05-21T05:01:32","date_gmt":"2024-05-21T05:01:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=371990"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=371990","title":{"rendered":"<span>\u0410 \u0432 \u0447\u0435\u043c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438?<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e.<\/p>\n<p>\u0413\u043e\u0434 \u043d\u0430\u0437\u0430\u0434 \u043c\u0435\u043d\u044f \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u0432\u043b\u0435\u043a\u043b\u0430 \u0442\u0435\u043c\u0430 \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u042f \u043d\u0430\u0447\u0430\u043b \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043c\u0435\u043d\u044f \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0438\u0441\u043a\u043e\u043c. \u0420\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e, \u043d\u043e \u043e\u043d\u0438 \u0432\u0441\u0435 \u0440\u0430\u0437\u0431\u0440\u043e\u0441\u0430\u043d\u044b \u043f\u043e \u0441\u0435\u0442\u0438 \u0438 \u043c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u0432\u0440\u0435\u043c\u044f, \u0447\u0442\u043e\u0431\u044b \u0441\u043b\u043e\u0436\u0438\u0442\u044c \u0432\u0441\u0435 \u043a\u0443\u0441\u043e\u0447\u043a\u0438 \u043f\u0430\u0437\u043b\u0430. \u0417\u0434\u0435\u0441\u044c \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0441\u044c \u044d\u0442\u043e\u0442 \u043f\u0430\u0437\u043b \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u043e\u0435\u0434\u0438\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043f\u0443\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h2>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412\u0441\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u0434\u0435. \u041e\u0431\u044b\u0447\u043d\u043e \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438. \u042d\u0442\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u042f\u041f, \u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u044b:<\/p>\n<ul>\n<li>\n<p><code>fwrite<\/code> &#8212; C<\/p>\n<\/li>\n<li>\n<p><code>std::fstream.write<\/code> &#8212; C++<\/p>\n<\/li>\n<li>\n<p><code>FileStream.Write<\/code> &#8212; C#<\/p>\n<\/li>\n<li>\n<p><code>FileOutputStream.Write<\/code> &#8212; Java<\/p>\n<\/li>\n<li>\n<p><code>open().write<\/code> &#8212; Python<\/p>\n<\/li>\n<li>\n<p><code>os.WriteFile<\/code> &#8212; GO<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u0432\u0441\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u044f\u0437\u044b\u043a\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438: \u0437\u0430\u043f\u0438\u0441\u044c, \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0442.\u0434. \u0418\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c. \u041d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438 \u043f\u0440\u0438\u0432\u043d\u043e\u0441\u0438\u0442 \u0441\u0432\u043e\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u044d\u0442\u043e \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f.<\/p>\n<p>\u0421\u0443\u0434\u044f \u043f\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0432\u0441\u0435 \u042f\u041f, \u0438\u0437 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043b\u0438\u0431\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e:<\/p>\n<ul>\n<li>\n<p>C &#8212; <a href=\"https:\/\/en.cppreference.com\/w\/c\/io\/setvbuf\" rel=\"noopener noreferrer nofollow\">setvbuf<\/a><\/p>\n<\/li>\n<li>\n<p>C++ &#8212; <a href=\"https:\/\/cplusplus.com\/reference\/fstream\/filebuf\/\" rel=\"noopener noreferrer nofollow\">filebuf<\/a><\/p>\n<\/li>\n<li>\n<p>C# &#8212; <a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/main\/src\/libraries\/System.Private.CoreLib\/src\/System\/IO\/Strategies\/BufferedFileStreamStrategy.cs\" rel=\"noopener noreferrer nofollow\">BufferedFileStrategy<\/a><\/p>\n<\/li>\n<li>\n<p>Java &#8212; <a href=\"https:\/\/docs.oracle.com\/javase\/8\/docs\/api\/java\/nio\/file\/Files.html#newBufferedWriter-java.nio.file.Path-java.nio.charset.Charset-java.nio.file.OpenOption...-\" rel=\"noopener noreferrer nofollow\">Files.newBufferedReader<\/a><\/p>\n<\/li>\n<li>\n<p>Python &#8212; <a href=\"https:\/\/docs.python.org\/3\/library\/io.html#io.BufferedIOBase\" rel=\"noopener noreferrer nofollow\">io.BufferedIOBase<\/a><\/p>\n<\/li>\n<li>\n<p>GO &#8212; <a href=\"https:\/\/pkg.go.dev\/bufio#Reader\" rel=\"noopener noreferrer nofollow\">bufio.Reader<\/a><\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u041d\u0430\u0441\u0447\u0435\u0442 C# &#8212; \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <code>FileStream<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>FileStreamStrategy<\/code> \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<br \/> \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 <code>FileStream<\/code> \u0447\u0435\u0440\u0435\u0437 <code>File.Open<\/code>, <code>BufferedFileStrategy<\/code> \u043e\u0431\u0435\u0440\u0442\u044b\u0432\u0430\u0435\u0442 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 <code>OSFileStreamStrategy<\/code>.<\/p>\n<\/blockquote>\n<p>\u0412\u043e\u043e\u0431\u0449\u0435, \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0448\u0442\u0443\u043a\u0430 \u043d\u0435\u043f\u043b\u043e\u0445\u0430\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u041d\u043e \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u043d\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e, \u0442\u043e \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u0430. \u0422\u0443\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c 2 \u0441\u043b\u0443\u0447\u0430\u044f:<\/p>\n<ol>\n<li>\n<p>\u0411\u0443\u0444\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u0432\u0440\u0443\u0447\u043d\u0443\u044e (GO, Java).<\/p>\n<\/li>\n<li>\n<p>\u0411\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 (C, C++).<\/p>\n<\/li>\n<\/ol>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0431\u0443\u0444\u0435\u0440\u044b \u043d\u0430\u0434\u043e \u0441\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438, \u0442\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0432 \u043d\u043e\u0433\u0443:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u044d\u043a\u0441\u0442\u0440\u0435\u043d\u043d\u043e \u0437\u0430\u043a\u0440\u043e\u0435\u0442\u0441\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 SIGKILL \u043d\u0435\u043b\u044c\u0437\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c) \u0438 \u0431\u0443\u0444\u0435\u0440\u044b \u0443\u0440\u043e\u0432\u043d\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0441\u0431\u0440\u043e\u0441\u044f\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0424\u0430\u0439\u043b \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0433\u0434\u0435-\u0442\u043e \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u043f\u0440\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0438 \u0431\u0443\u0444\u0435\u0440\u044b \u0441\u0431\u0440\u043e\u0448\u0435\u043d\u044b \u043d\u0435 \u0431\u0443\u0434\u0443\u0442, \u0442.\u043a. \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0431\u0443\u0434\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b\u0445\u043e\u0434\u043e\u0432 \u0437\u0434\u0435\u0441\u044c 2:<\/p>\n<ul>\n<li>\n<p>\u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u0431\u0443\u0444\u0435\u0440\u044b \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0430\u043d\u0441\u0430 \u0437\u0430\u043f\u0438\u0441\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0435\u0441\u044c \u0431\u0430\u0442\u0447 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 <code>write<\/code> \u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0431\u0443\u0444\u0435\u0440.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0432\u043e\u043e\u0431\u0449\u0435 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 &#8212; \u043f\u0435\u0440\u0432\u044b\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u044f \u043f\u0440\u043e\u0432\u0435\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a. \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c 64\u041c\u0431 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b.<\/p>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b \u043d\u0430 \u0441\u0442\u0430\u0440\u043e\u043c \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0435 \u0441 HDD \u0438 \u043d\u043e\u0432\u043e\u043c \u0441 SSD M.2. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u041d\u043e\u0443\u0442\u0431\u0443\u043a<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u041d\u0435 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c, \u0441<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0411\u0443\u0444\u0435\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c, \u0441<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0421\u0442\u0430\u0440\u044b\u0439<\/p>\n<\/td>\n<td>\n<p align=\"left\">894.7<\/p>\n<\/td>\n<td>\n<p align=\"left\">109.6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041d\u043e\u0432\u044b\u0439<\/p>\n<\/td>\n<td>\n<p align=\"left\">8.932<\/p>\n<\/td>\n<td>\n<p align=\"left\">1.198<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435 \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u0435\u043d: \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u0432 8 \u0440\u0430\u0437. \u041a\u043e\u0434 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d <a href=\"https:\/\/github.com\/ashenBlade\/habr-posts\/blob\/file-write\/file-write\/src\/FileWrite.Benchmarks\/FileWriteBenchmarks.cs\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<\/div>\n<\/details>\n<h2>\u041e\u0421<\/h2>\n<p>\u042f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u0443\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b &#8212; \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u0443\u043c\u0430\u0442\u044c (\u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u043d\u0435 \u0442\u0430\u043a \u0447\u0430\u0441\u0442\u043e) \u043d\u0430 \u043a\u0430\u043a\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041d\u043e \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044f\u0437\u044b\u043a\u0430 \u0431\u0443\u0434\u0443\u0442 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f\/\u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u041e\u0421. \u042d\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043d\u043e \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f<\/p>\n<\/th>\n<th>\n<p align=\"left\">*nix<\/p>\n<\/th>\n<th>\n<p align=\"left\">Windows<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041e\u0442\u043a\u0440\u044b\u0442\u0438\u0435\/\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">open<\/p>\n<\/td>\n<td>\n<p align=\"left\">CreateFile<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0427\u0442\u0435\u043d\u0438\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">pread<\/p>\n<\/td>\n<td>\n<p align=\"left\">ReadFile<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0417\u0430\u043f\u0438\u0441\u044c<\/p>\n<\/td>\n<td>\n<p align=\"left\">pwrite<\/p>\n<\/td>\n<td>\n<p align=\"left\">WriteFile<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0417\u0430\u043a\u0440\u044b\u0442\u0438\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">close<\/p>\n<\/td>\n<td>\n<p align=\"left\">CloseFile<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<blockquote>\n<p>\u041f\u043e\u0434 *nix \u0438\u043c\u0435\u044e\u0442 Unix-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u041e\u0421 (Linux, FreeBSD, OSX). \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0443 \u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435, \u0445\u043e\u0442\u044c \u0438 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/blockquote>\n<p>\u041d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u041e\u0421 \u0442\u043e\u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f &#8212; <a href=\"https:\/\/en.wikipedia.org\/wiki\/Page_cache\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u043a\u044d\u0448<\/a>. \u0418 \u0432\u043e\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0435 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c \u0432 \u043d\u043e\u0433\u0443 \u0435\u0449\u0435 \u043f\u0440\u043e\u0449\u0435.<\/p>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u043e\u043c (\u0447\u0442\u0435\u043d\u0438\u0435\/\u0437\u0430\u043f\u0438\u0441\u044c) \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043d\u0435\u0433\u043e \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438, \u0434\u0430\u0436\u0435 \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e 1 \u0431\u0430\u0439\u0442 (\u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043b\u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c). \u041a\u043e\u0433\u0434\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0431\u044b\u043b\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0430, \u0442\u043e \u043e\u043d\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f &#171;\u0433\u0440\u044f\u0437\u043d\u043e\u0439&#187; \u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u0431\u0440\u043e\u0448\u0435\u043d\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a. \u041f\u0440\u0438\u0447\u0435\u043c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u043e\u043d\u0438 \u0438 \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u043a\u044d\u0448 &#8212; \u0431\u0443\u0444\u0435\u0440 \u0443\u0440\u043e\u0432\u043d\u044f \u041e\u0421. \u0422\u0430\u043a \u0433\u0434\u0435 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u043f\u043e\u0432\u0440\u0435\u0434\u0438\u0442\u044c? \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441:<\/p>\n<ol>\n<li>\n<p>\u041d\u0430\u043c \u043f\u0440\u0438\u0448\u0435\u043b \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435<\/p>\n<\/li>\n<li>\n<p>\u041c\u044b \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u043c\u0435\u044e\u0449\u0438\u0439\u0441\u044f \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0438\u043c\u0435\u043d\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c (\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0438\u043c\u0435\u043d\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 255 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432)<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u0447\u0442\u043e \u0438\u043c\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043e<\/p>\n<\/li>\n<\/ol>\n<p>\u0413\u0434\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430? \u041f\u043e\u0441\u043b\u0435 4 \u0448\u0430\u0433\u0430. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0431 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u0442\u0432\u0430. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0438\u043c\u0435\u0435\u043c \u0442\u0430\u043a\u0443\u044e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e:<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u0443\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u0438\u043c\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043e<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0441\u0442\u0430\u0440\u044b\u0435<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0441\u0442\u0430\u0440\u044b\u0435? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0438\u043c\u044f \u0445\u0440\u0430\u043d\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u0433\u0440\u044f\u0437\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0430 \u043d\u0435 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435, \u0438 \u043f\u0440\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u044b \u0435\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435 \u0443\u0441\u043f\u0435\u043b\u0438.<\/p>\n<p>\u0421\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u043a\u044d\u0448 \u043f\u043e\u043b\u0435\u0437\u0435\u043d, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0434 \u043e\u0434\u043d\u0438\u043c \u0443\u0447\u0430\u0441\u0442\u043a\u043e\u043c \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0447\u0442\u0435\u043d\u0438\u044f\/\u0437\u0430\u043f\u0438\u0441\u0438. \u041d\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c &#171;\u0437\u0430\u043a\u043e\u043c\u043c\u0438\u0447\u0435\u043d\u044b&#187; \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u043b\u0438 \u0441\u0431\u0440\u043e\u0448\u0435\u043d\u044b \u043d\u0430 \u0434\u0438\u0441\u043a. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439:<\/p>\n<ol>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0434\u043b\u044f \u0441\u0431\u0440\u043e\u0441\u0430 \u0431\u0443\u0444\u0435\u0440\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0441\u0440\u0430\u0437\u0443, \u0447\u0442\u043e \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u0430<\/p>\n<\/li>\n<\/ol>\n<h3>\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0434\u043b\u044f \u0441\u0431\u0440\u043e\u0441\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446<\/h3>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b.<\/p>\n<h4>Linux<\/h4>\n<p>\u0414\u043b\u044f Linux \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\n<p><code>fdatasync(fd)<\/code> &#8212; \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e <em>\u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438<\/em> \u0438 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0442.\u0435. \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u0431\u0440\u043e\u0441 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430;<\/p>\n<\/li>\n<li>\n<p><code>fsync(fd)<\/code> &#8212; \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0447\u0442\u043e \u0438 <code>fdatasync<\/code>, \u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u0442 <em>\u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u0430<\/em> (\u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0438 \u0434\u0440.);<\/p>\n<\/li>\n<li>\n<p><code>sync_file_range(fd, range)<\/code> &#8212; \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 <em>\u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0434\u0430\u043d\u043d\u044b\u0445<\/em> \u0444\u0430\u0439\u043b\u0430 \u0441\u0431\u0440\u043e\u0448\u0435\u043d \u043d\u0430 \u0434\u0438\u0441\u043a;<\/p>\n<\/li>\n<li>\n<p><code>sync()<\/code> &#8212; \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0442\u043e\u0436\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0438 \u0434\u0438\u0441\u043a\u043e\u0432, \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u043e <em>\u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432<\/em>, \u0430 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, <code>fdatasync<\/code> \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435, \u0431\u0435\u0437 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u0430\u043a <code>fsync<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<br \/> \u0412 etcd \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/etcd-io\/etcd\/blob\/6f55dfa26e1a359e47e1fb15af79951e97dbac39\/client\/pkg\/fileutil\/sync_linux.go#L32\" rel=\"noopener noreferrer nofollow\">\u044f\u0432\u043d\u043e\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435<\/a> \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 2 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438:<\/p>\n<pre><code class=\"go\">\/\/ Fsync is a wrapper around file.Sync(). Special handling is needed on darwin platform. func Fsync(f *os.File) error { return f.Sync() }  \/\/ Fdatasync is similar to fsync(), but does not flush modified metadata \/\/ unless that metadata is needed in order to allow a subsequent data retrieval \/\/ to be correctly handled. func Fdatasync(f *os.File) error { return syscall.Fdatasync(int(f.Fd())) } <\/code><\/pre>\n<blockquote>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u043e \u044d\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/habr.com\/ru\/companies\/ruvds\/articles\/524172\/\" rel=\"noopener noreferrer nofollow\">\u0423\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 API Linux<\/a>.<\/p>\n<\/blockquote>\n<h4>Windows<\/h4>\n<p>\u0414\u043b\u044f Windows \u044d\u0442\u043e:<\/p>\n<ul>\n<li>\n<p><code>_commit(fd)<\/code> &#8212; \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u0430 \u043f\u0440\u044f\u043c\u043e \u043d\u0430 \u0434\u0438\u0441\u043a. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u043c \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u043c<\/p>\n<\/li>\n<li>\n<p><code>FlushFileBuffers(hFile)<\/code> &#8212; \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0432\u0441\u0435\u0445 \u0431\u0443\u0444\u0435\u0440\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0445\u044d\u043d\u0434\u043b\u043e\u043c \u041e\u0421<\/p>\n<\/li>\n<li>\n<p><code>NtFlushBuffersFileEx(hFile, params)<\/code> &#8212; \u0441\u0431\u0440\u043e\u0441 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u043d\u0430 \u0434\u0438\u0441\u043a, \u043d\u043e \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0433\u0440\u0430\u043d\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u0437\u0430 \u0441\u0447\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0445\u044d\u043d\u0434\u043b\u043e\u043c \u041e\u0421<\/p>\n<\/li>\n<\/ul>\n<p>P.S. <code>NtFlushBuffersFileEx<\/code> <a href=\"https:\/\/github.com\/postgres\/postgres\/blob\/874d817baa160ca7e68bee6ccc9fc1848c56e750\/src\/port\/win32fdatasync.c#L40\" rel=\"noopener noreferrer nofollow\">\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 Postgres<\/a> \u043a\u0430\u043a \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u0434\u043b\u044f \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0433\u043e <code>fdatasync<\/code>, \u0430 \u0434\u043b\u044f <code>fsync<\/code> &#8212; <code>_commit<\/code><\/p>\n<pre><code class=\"cpp\">\/\/ https:\/\/github.com\/postgres\/postgres\/blob\/9acae56ce0b0812f3e940cf1f87e73e8d5784e78\/src\/include\/port\/win32_port.h#L85 \/* Windows doesn't have fsync() as such, use _commit() *\/ #define fsync(fd) _commit(fd)  \/\/ https:\/\/github.com\/postgres\/postgres\/blob\/874d817baa160ca7e68bee6ccc9fc1848c56e750\/src\/port\/win32fdatasync.c#L23 int fdatasync(int fd) {     \/\/ ... status = pg_NtFlushBuffersFileEx(handle,  FLUSH_FLAGS_FILE_DATA_SYNC_ONLY,  NULL,  0,  &amp;iosb);     \/\/ ... } <\/code><\/pre>\n<h4>macOS<\/h4>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c macOS. \u041e\u043d\u0430 \u0445\u043e\u0442\u044c \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f POSIX \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0439, \u0442.\u0435. \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>fsync<\/code>, \u043d\u043e \u0435\u0433\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0414\u043b\u044f \u043d\u0435\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>fcntl(F_FULLSYNC)<\/code>. \u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 <a href=\"https:\/\/developer.apple.com\/library\/archive\/documentation\/System\/Conceptual\/ManPages_iPhoneOS\/man2\/fsync.2.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>:<\/p>\n<blockquote>\n<p>For applications that require tighter guarantees about the integrity of their data, Mac OS X provides the F_FULLFSYNC fcntl.<\/p>\n<\/blockquote>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u0430 macOS \u043e\u0431 \u044d\u0442\u043e\u043c \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0438\u043d\u0430\u0447\u0435 <a href=\"https:\/\/habr.com\/ru\/news\/653527\/\" rel=\"noopener noreferrer nofollow\">\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0441\u043e\u043a\u0430<\/a>. \u0412 etcd \u044d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 <a href=\"https:\/\/github.com\/etcd-io\/etcd\/blob\/6f55dfa26e1a359e47e1fb15af79951e97dbac39\/client\/pkg\/fileutil\/sync_darwin.go#L36\" rel=\"noopener noreferrer nofollow\">\u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f<\/a>:<\/p>\n<pre><code class=\"go\">\/\/ Fsync on HFS\/OSX flushes the data on to the physical drive but the drive \/\/ may not write it to the persistent media for quite sometime and it may be \/\/ written in out-of-order sequence. Using F_FULLFSYNC ensures that the \/\/ physical drive's buffer will also get flushed to the media. func Fsync(f *os.File) error { _, err := unix.FcntlInt(f.Fd(), unix.F_FULLFSYNC, 0) return err }  \/\/ Fdatasync on darwin platform invokes fcntl(F_FULLFSYNC) for actual persistence \/\/ on physical drive media. func Fdatasync(f *os.File) error { return Fsync(f) } <\/code><\/pre>\n<h3>\u0413\u043e\u0432\u043e\u0440\u0438\u043c \u041e\u0421, \u0447\u0442\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u0430<\/h3>\n<p>\u0414\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c.<\/p>\n<p>\u0412 Linux \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <code>O_SYNC | O_DIRECT<\/code> \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>open<\/code>:<\/p>\n<ul>\n<li>\n<p><code>O_SYNC<\/code> &#8212; \u043b\u044e\u0431\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u0440\u0430\u0437\u0443 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0438\u0441\u043a (\u0435\u0441\u0442\u044c \u0435\u0449\u0435 <code>O_DSYNC<\/code> &#8212; \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u043d\u043d\u044b\u0445, \u0431\u0435\u0437 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445)<\/p>\n<\/li>\n<li>\n<p><code>O_DIRECT<\/code> &#8212; \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043e\u0431\u0445\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u0435\u0448\u0430, \u0442.\u0435. \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0435\u0433\u043e<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u0430 <code>O_SYNC<\/code>\/<code>O_DSYNC<\/code> \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e write \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f <code>fsync<\/code>\/<code>fdatasync<\/code>, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>fcntl<\/code> \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0444\u0430\u0439\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e <code>O_DIRECT<\/code> \u0444\u043b\u0430\u0433, \u043d\u043e \u043d\u0435 <code>O_SYNC<\/code>. \u042d\u0442\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 <code>fcntl<\/code>:<\/p>\n<blockquote>\n<p>&#8230; It is not possible to change the O_DSYNC and O_SYNC flags; see BUGS, below.<\/p>\n<\/blockquote>\n<p>\u0412 Windows \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438: \u0444\u043b\u0430\u0433\u0438 <code>FILE_FLAG_NO_BUFFERING<\/code> \u0438 <code>FILE_FLAG_WRITE_THROUGH<\/code> \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0444\u0430\u0439\u043b\u0430 <code>CreateFile<\/code>:<\/p>\n<ul>\n<li>\n<p><code>FILE_FLAG_NO_BUFFERING<\/code> &#8212; \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u041e\u0421 \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438<\/p>\n<\/li>\n<li>\n<p><code>FILE_FLAG_WRITE_THROUGH<\/code> &#8212; \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0434\u0438\u0441\u043a, \u0431\u0435\u0437 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/fileapi\/nf-fileapi-createfilea#caching-behavior\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u0434\u0430\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e \u043f\u0440\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u043e\u0431\u043e\u0438\u0445 \u0444\u043b\u0430\u0433\u043e\u0432:<\/p>\n<blockquote>\n<p>If FILE_FLAG_WRITE_THROUGH and FILE_FLAG_NO_BUFFERING are both specified, so that system caching is not in effect, then the data is immediately flushed to disk without going through the Windows system cache. The operating system also requests a write-through of the hard disk&#8217;s local hardware cache to persistent media.<\/p>\n<\/blockquote>\n<p>\u0410 \u0432 <a href=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/20210729-00\/?p=105494\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0445 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td colspan=\"2\" rowspan=\"2\">\n<p align=\"left\">\n<\/td>\n<td colspan=\"2\">\n<p align=\"left\">NO_BUFFERING<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041d\u0435\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\">\n<p align=\"left\">WRITE_THROUGH<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0435\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u043a\u044d\u0448 \u041e\u0421 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u041e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430 \u0434\u0438\u0441\u043a. \u0411\u0435\u0437 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0441\u0431\u0440\u043e\u0441\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u043a\u044d\u0448 \u041e\u0421 _\u043d\u0435_ \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u041d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430 \u0434\u0438\u0441\u043a. \u0411\u0435\u0437 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0441\u0431\u0440\u043e\u0441\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0412\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u043a\u044d\u0448 \u041e\u0421 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u041d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430 \u0434\u0438\u0441\u043a. \u0410\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0439 \u0441\u0431\u0440\u043e\u0441<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u043a\u044d\u0448 \u041e\u0421 _\u043d\u0435_ \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u041d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430 \u0434\u0438\u0441\u043a. \u0410\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0439 \u0441\u0431\u0440\u043e\u0441<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>&#171;Hardware flush&#187;, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0432 \u0441\u0442\u0430\u0442\u044c\u0435, \u044f \u043f\u0435\u0440\u0435\u0432\u0435\u043b \u043a\u0430\u043a &#171;\u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u044b\u0439 \u0441\u0431\u0440\u043e\u0441&#187;. \u041f\u043e \u0444\u0430\u043a\u0442\u0443, \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 &#171;\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043c\u0438\u043d\u0443\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043a\u044d\u0448 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u044f&#187;.<\/p>\n<p>\u0412 Postgres \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u0444\u043b\u0430\u0433\u043e\u0432:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">Windows<\/p>\n<\/th>\n<th>\n<p align=\"left\">Unix<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">FILE_FLAG_NO_BUFFERING<\/p>\n<\/td>\n<td>\n<p align=\"left\">O_DIRECT<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">FILE_FLAG_WRITE_THROUGH<\/p>\n<\/td>\n<td>\n<p align=\"left\">O_DSYNC<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<pre><code class=\"cpp\">\/\/ https:\/\/github.com\/postgres\/postgres\/blob\/30e144287a72529c9cd9fd6b07fe96eb8a1e270e\/src\/port\/open.c#L65 HANDLE pgwin32_open_handle(const char *fileName, int fileFlags, bool backup_semantics) {     \/\/ ... while ((h = CreateFile(fileName,                            \/\/ ...    ((fileFlags &amp; O_DIRECT) ? FILE_FLAG_NO_BUFFERING : 0) |    ((fileFlags &amp; O_DSYNC) ? FILE_FLAG_WRITE_THROUGH : 0),    NULL)) == INVALID_HANDLE_VALUE)     \/\/ ... } <\/code><\/pre>\n<h3>\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439<\/h3>\n<p>\u041d\u043e \u044d\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0432\u0441\u0435. \u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e 1) \u0444\u0430\u0439\u043b\u044b \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f, \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0438 2) \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 &#8212; \u0442\u043e\u0436\u0435 \u0444\u0430\u0439\u043b\u044b. \u0422\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u0435\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0441\u0431\u0440\u043e\u0448\u0435\u043d\u043e \u043d\u0430 \u0434\u0438\u0441\u043a \u0442\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0438 \u0444\u0430\u0439\u043b. \u0412 POSIX \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a \u0436\u0435, \u043a\u0430\u043a \u0438 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 &#8212; \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c <code>fsync(directory_fd)<\/code> \u043d\u0430 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438. \u042d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0437\u0430\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043e:<\/p>\n<blockquote>\n<p>Calling  fsync() does not necessarily ensure that the entry in the directory containing the file has also reached disk.<br \/> For that an explicit fsync() on a file descriptor for the directory is also needed.<\/p>\n<\/blockquote>\n<p>P.S. \u042f \u0438\u0441\u043a\u0430\u043b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0442\u043e\u043c, \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 <code>fsync<\/code> \u0434\u043b\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0447\u0435\u0440\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u0430 <code>O_SYNC<\/code> \u043f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438, \u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043d\u0430\u0448\u0435\u043b. \u0415\u0441\u043b\u0438 \u0437\u043d\u0430\u0435\u0442\u0435, \u0432\u043b\u0438\u044f\u0435\u0442 \u043b\u0438 \u044d\u0442\u043e\u0442 \u0444\u043b\u0430\u0433, \u0442\u043e \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p>\n<p>\u0427\u0442\u043e \u0436\u0435 \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f Windows, \u0442\u043e \u0442\u0430\u043c \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f: \u0445\u044d\u043d\u0434\u043b \u0434\u043b\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043c\u043e\u0436\u043d\u043e (\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u043e\u0433\u043e \u0436\u0435 <code>CreateFile<\/code>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440), \u043d\u043e \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <code>FlushFileBuffers<\/code> \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 <code>EACCESS<\/code> &#8212; <code>FlushFileBuffers<\/code> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u043b\u0438\u0431\u043e \u0442\u043e\u043c\u043e\u043c (\u0441\u0431\u0440\u043e\u0441 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u0441\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0442\u043e\u043c\u0430), \u043d\u043e \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043d\u0443\u0436\u043d\u044b \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0438.<\/p>\n<p>\u042d\u0442\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f. \u0412 Postgres <a href=\"https:\/\/github.com\/postgres\/postgres\/blob\/874d817baa160ca7e68bee6ccc9fc1848c56e750\/src\/backend\/storage\/file\/fd.c#L3797\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f<\/a>:<\/p>\n<pre><code class=\"cpp\">\/*  * fsync_fname_ext -- Try to fsync a file or directory  *  * If ignore_perm is true, ignore errors upon trying to open unreadable  * files. Logs other errors at a caller-specified level.  *  * Returns 0 if the operation succeeded, -1 otherwise.  *\/ int fsync_fname_ext(const char *fname, bool isdir, bool ignore_perm, int elevel) { returncode = pg_fsync(fd);  \/*  * Some OSes don't allow us to fsync directories at all, so we can ignore  * those errors. Anything else needs to be logged.  *\/ if (returncode != 0 &amp;&amp; !(isdir &amp;&amp; (errno == EBADF || errno == EINVAL))) { \/\/ ... return -1; }  return 0; } <\/code><\/pre>\n<h3>\u041e\u0448\u0438\u0431\u043a\u0438 fsync<\/h3>\n<p><code>fsync<\/code> <em>\u043c\u043e\u0436\u0435\u0442<\/em> \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u0438 \u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u042d\u0442\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435. \u0415\u0441\u043b\u0438 \u043e\u043d\u0430 \u0432\u0435\u0440\u043d\u0443\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0443, \u0442\u043e \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 &#8212; \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b. \u041f\u043e\u0447\u0435\u043c\u0443? \u041f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b <strong>\u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u044b \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0444\u0430\u0439\u043b \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0432 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438<\/strong>, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u043d \u043d\u0435 \u043f\u043e\u043b\u043e\u043c\u0430\u043d (\u043e\u0431 \u044d\u0442\u043e\u043c \u0434\u0430\u043b\u044c\u0448\u0435),<\/p>\n<ul>\n<li>\n<p>\u0424\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0430<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u0434\u044b\u0440\u0430 (\u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c)<\/p>\n<\/li>\n<li>\n<p>\u0413\u0440\u044f\u0437\u043d\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u0447\u0438\u0441\u0442\u044b\u043c\u0438 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u0431\u0440\u043e\u0448\u0435\u043d\u044b \u043d\u0435 \u0431\u0443\u0434\u0443\u0442<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0438 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0440\u0430\u0437\u043d\u044b\u0435, \u043d\u043e \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442.<\/p>\n<p>\u0414\u043b\u044f \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e\u0441\u0442\u0438 \u0441\u0442\u043e\u0438\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u043c\u0435\u0442\u043a\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0447\u0438\u0441\u0442\u044b\u043c\u0438 &#8212; \u044d\u0442\u043e \u0447\u0430\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 Linux, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u0412\u043e\u0442 <a href=\"https:\/\/wiki.postgresql.org\/wiki\/Fsync_Errors#Research_notes_and_OS_differences\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a> \u0435\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u041e\u0421 \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 <code>fsync<\/code> (\u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438):<\/p>\n<ul>\n<li>\n<p>Darwin\/macOS &#8212; \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f<\/p>\n<\/li>\n<li>\n<p>OpenBSD &#8212; \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f<\/p>\n<\/li>\n<li>\n<p>NetBSD &#8212; \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f<\/p>\n<\/li>\n<li>\n<p>FreeBSD &#8212; \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u0433\u0440\u044f\u0437\u043d\u044b\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>Linux (\u043f\u043e\u0441\u043b\u0435 4.16) &#8212; \u043f\u043e\u043c\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0447\u0438\u0441\u0442\u044b\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>Windows &#8212; \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e<\/p>\n<\/li>\n<\/ul>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u044d\u0442\u0438\u043c\u0438 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e \u043a \u043f\u043e\u0442\u0435\u0440\u044f\u043c \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 WAL \u0432 Postgres. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u0438, \u0447\u0442\u043e \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430 <code>fsync<\/code> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f:<\/p>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 <code>fsync()<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0441\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0442\u043e \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e <em>\u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e<\/em> <code>fsync<\/code> \u0431\u044b\u043b\u0438 \u0441\u0431\u0440\u043e\u0448\u0435\u043d\u044b \u043d\u0430 \u0434\u0438\u0441\u043a<\/p>\n<\/blockquote>\n<p>\u0422.\u0435. \u0435\u0441\u043b\u0438 \u043c\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u0432\u044b\u0437\u0432\u0430\u043b\u0438 <code>fsync<\/code> \u0438 \u043e\u043d \u0432\u0435\u0440\u043d\u0443\u043b \u043e\u0448\u0438\u0431\u043a\u0443, \u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u0432 \u043d\u0430\u0434\u0435\u0436\u0434\u0435, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043f\u0430\u0434\u0443\u0442 \u043d\u0430 \u0434\u0438\u0441\u043a. \u041d\u043e \u044d\u0442\u043e \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0412 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0435\u0441\u043b\u0438 <code>fsync<\/code> \u0432\u0435\u0440\u043d\u0443\u043b \u043e\u0448\u0438\u0431\u043a\u0443, \u0442\u043e \u0433\u0440\u044f\u0437\u043d\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u043e &#171;\u0437\u0430\u0431\u044b\u0442\u044b&#187;. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435 \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0442\u044c:<\/p>\n<blockquote>\n<p>\u0415\u0441\u043b\u0438 <code>fsync()<\/code> \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0441\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0442\u043e \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e <s>\u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e<\/s> <code>fsync<\/code> \u0431\u044b\u043b\u0438 \u0441\u0431\u0440\u043e\u0448\u0435\u043d\u044b \u043d\u0430 \u0434\u0438\u0441\u043a<\/p>\n<\/blockquote>\n<p>\u042d\u0442\u043e \u0431\u044b\u043b\u043e \u0437\u0430\u043c\u0435\u0447\u0435\u043d\u043e \u0432 2018 \u0433\u043e\u0434\u0443 \u0438 \u0432\u043e\u043f\u0440\u043e\u0441 \u043f\u043e\u0434\u043d\u044f\u043b\u0441\u044f \u0432 <a href=\"https:\/\/lwn.net\/Articles\/752093\/\" rel=\"noopener noreferrer nofollow\">\u0441\u043f\u0438\u0441\u043a\u0435 \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0438<\/a>. \u0411\u0430\u0433\u0443 \u0434\u0430\u0436\u0435 \u0434\u0430\u043b\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 <code>fsyncgate 2018<\/code> \u0438 \u043f\u043e\u0441\u0432\u044f\u0442\u0438\u043b\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043d\u0430 <a href=\"https:\/\/wiki.postgresql.org\/wiki\/Fsync_Errors\" rel=\"noopener noreferrer nofollow\">\u0432\u0438\u043a\u0438<\/a>. \u0421\u0430\u043c \u0431\u0430\u0433 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 12 (\u0438 \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445) \u0432 <a href=\"https:\/\/git.postgresql.org\/gitweb\/?p=postgresql.git;a=commit;h=9ccdd7f66e3324d2b6d3dec282cfa9ff084083f1\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u0435<\/a> \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c (\u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0443\u0440\u043e\u0432\u043d\u044f \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0438):<\/p>\n<pre><code class=\"cpp\">\/\/ https:\/\/github.com\/postgres\/postgres\/blob\/30e144287a72529c9cd9fd6b07fe96eb8a1e270e\/src\/backend\/storage\/file\/fd.c#L3936 int data_sync_elevel(int elevel) {     return data_sync_retry ? elevel : PANIC; }  \/\/ \u041b\u044e\u0431\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u044d\u0442\u0430 - https:\/\/github.com\/postgres\/postgres\/blob\/30e144287a72529c9cd9fd6b07fe96eb8a1e270e\/src\/backend\/access\/heap\/rewriteheap.c#L1132 void sample_function()  {     \/\/ \u041b\u044e\u0431\u043e\u0439 \u0432\u044b\u0437\u043e\u0432 fsync \u0432 \u043b\u043e\u0433\u0438\u043a\u0435      if (pg_fsync(fd) != 0)     \/\/ ereport(ERROR,        ereport(data_sync_elevel(ERROR),                 (errcode_for_file_access(),                  errmsg(\"could not fsync file \\\"%s\\\": %m\", path))); } <\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u0421\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u043a\u044d\u0448 \u0432 \u0411\u0414<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0438\u0441\u043a\u043e\u043c &#8212; \u0432\u0430\u0436\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u043e\u0433\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u0441\u0432\u043e\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u043c \u043a\u044d\u0448\u044d\u043c \u0438 \u043d\u0435 \u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u041e\u0421. \u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u044d\u0442\u043e\u043c\u0443:<\/p>\n<ul>\n<li>\n<p>\u0411\u043e\u043b\u0435\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 IO, \u0442.\u043a. \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430 \u0434\u0438\u0441\u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 <code>COMMIT<\/code><\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f (\u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e) \u0431\u043e\u043b\u0435\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u043c\u0435\u0440 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u0438\u0445 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c\u0441\u044f<\/p>\n<\/li>\n<li>\n<p>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0421\u0423\u0411\u0414:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u0421\u0423\u0411\u0414<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0413\u0434\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Postgres<\/p>\n<\/td>\n<td>\n<p align=\"left\"><a href=\"https:\/\/github.com\/postgres\/postgres\/blob\/d13ff82319ccaacb04d77b77a010ea7a1717564f\/src\/include\/storage\/bufmgr.h\" rel=\"noopener noreferrer nofollow\">bufmgr.h<\/a>, <a href=\"https:\/\/github.com\/postgres\/postgres\/blob\/d13ff82319ccaacb04d77b77a010ea7a1717564f\/src\/backend\/storage\/buffer\/bufmgr.c\" rel=\"noopener noreferrer nofollow\">bufmgr.c<\/a><\/p>\n<\/td>\n<td>\n<p align=\"left\"><a href=\"https:\/\/habr.com\/ru\/companies\/postgrespro\/articles\/458186\/\" rel=\"noopener noreferrer nofollow\">WAL \u0432 PostgreSQL: 1. \u0411\u0443\u0444\u0435\u0440\u043d\u044b\u0439 \u043a\u0435\u0448<\/a><\/p>\n<\/td>\n<td>\n<p align=\"left\">clock-sweep<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">SQL Server<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b<\/p>\n<\/td>\n<td>\n<p align=\"left\"><a href=\"https:\/\/habr.com\/ru\/articles\/233365\/\" rel=\"noopener noreferrer nofollow\">\u041e\u0431\u0437\u043e\u0440 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u044c\u044e \u0432 SQL Server<\/a><\/p>\n<\/td>\n<td>\n<p align=\"left\">LRU-2 (LRU-K)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">Oracle<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b<\/p>\n<\/td>\n<td>\n<p align=\"left\"><a href=\"https:\/\/www.appservgrid.com\/documentation111\/docs\/rdbms10g\/windows\/doc\/server.101\/b10743\/memory.htm#sthref1252\" rel=\"noopener noreferrer nofollow\">Oracle Memory Architecture<\/a><\/p>\n<\/td>\n<td>\n<p align=\"left\">LRU, Temperature-based<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">MySQL (InnoDB)<\/p>\n<\/td>\n<td>\n<p align=\"left\"><a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/824e2b4064053f7daf17d7f3f84b7a3ed92e5fb4\/storage\/innobase\/include\/buf0buf.h\" rel=\"noopener noreferrer nofollow\">buf0buf.h<\/a>, <a href=\"https:\/\/github.com\/mysql\/mysql-server\/blob\/824e2b4064053f7daf17d7f3f84b7a3ed92e5fb4\/storage\/innobase\/buf\/buf0buf.cc\" rel=\"noopener noreferrer nofollow\">buf0buf.cc<\/a><\/p>\n<\/td>\n<td>\n<p align=\"left\"><a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/innodb-buffer-pool.html\" rel=\"noopener noreferrer nofollow\">InnoDB Buffer Pool<\/a><\/p>\n<\/td>\n<td>\n<p align=\"left\">LRU<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0421\u0423\u0411\u0414, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u043e\u0433\u0438\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c &#171;\u0443\u043c\u043d\u043e\u043c&#187; \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0437\u0430\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446. \u041f\u0440\u0438\u043c\u0435\u0440\u044b:<\/p>\n<ul>\n<li>\n<p>ORACLE \u0438 SQL Server \u0438\u043c\u0435\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c flash \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0431\u0443\u0444\u0435\u0440\u043e\u0432, \u0432\u043c\u0435\u0441\u0442\u043e \u0441\u0431\u0440\u043e\u0441\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0434\u0438\u0441\u043a (\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>DB_FLASH_CACHE_FILE<\/code> \u0434\u043b\u044f Oracle \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 Buffer Pool \u0434\u043b\u044f SQL Server)<\/p>\n<\/li>\n<li>\n<p>Postgres \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 &#171;\u0440\u0430\u0437\u043e\u0433\u0440\u0435\u0432\u0430\u0442\u044c&#187; \u043a\u044d\u0448 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f <code>pg_prewarm<\/code><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/details>\n<p>\u042f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u044f\u0434\u0440\u0430 \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u0448\u0435\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e <code>fsync<\/code> <a href=\"https:\/\/github.com\/torvalds\/linux\/blob\/67be068d31d423b857ffd8c34dbcc093f8dfff76\/fs\/buffer.c#L769\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a><\/p>\n<h2>\u0424\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430<\/h2>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0435\u0447\u044c \u0438\u0434\u0435\u0442 \u043f\u0440\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b\u044b, \u043e\u0431\u044b\u0447\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f\u0442 &#171;\u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 \u0434\u0438\u0441\u043a&#187;. \u041e\u0442\u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e \u0432\u0435\u0440\u043d\u043e, \u043d\u043e \u043c\u0435\u0436\u0434\u0443 \u041e\u0421 \u0438 \u0434\u0438\u0441\u043a\u043e\u043c \u0435\u0441\u0442\u044c \u0432\u0430\u0436\u043d\u043e\u0435 \u0441\u0432\u044f\u0437\u0443\u044e\u0449\u0435\u0435 \u0437\u0432\u0435\u043d\u043e &#8212; \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430. \u041e\u043d\u0430 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0442\u043e, \u043a\u0430\u043a \u0438 \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c.<\/p>\n<p>\u0424\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Comparison_of_file_systems\" rel=\"noopener noreferrer nofollow\">\u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e<\/a>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0432\u044b\u0434\u0435\u043b\u044e \u043b\u0438\u0448\u044c \u0447\u0430\u0441\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>ext4, ext3, ext2<\/p>\n<\/li>\n<li>\n<p>btrfs<\/p>\n<\/li>\n<li>\n<p>xfs<\/p>\n<\/li>\n<li>\n<p>ntfs<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u0412\u044b\u0431\u0440\u0430\u043b \u044d\u0442\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u043e \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0445<\/p>\n<\/blockquote>\n<p>\u041a\u0430\u0436\u0434\u0430\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0441\u0432\u043e\u0438\u043c\u0438 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0430\u043c\u0438, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044f\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043b\u0438\u043d\u0430 \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u0430. \u041d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u0442\u0435, \u0447\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u044b \u0441 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<h3>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/h3>\n<p>\u0414\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b:<\/p>\n<ul>\n<li>\n<p>\u0416\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 (ext3, ext4, ntfs, xfs) &#8212; \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0432\u0435\u0434\u0435\u0442 \u043b\u043e\u0433 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 (WAL)<\/p>\n<\/li>\n<li>\n<p>Copy-on-write (btrfs, zfs) &#8212; \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\/\u0434\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u0430 \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0431\u043b\u043e\u043a, \u043a\u0443\u0434\u0430 \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f<\/p>\n<\/li>\n<li>\n<p>log structured &#8212; \u0441\u0430\u043c\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043b\u043e\u0433\u043e\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u043e \u043d\u0435 \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, ext2 &#8212; \u043d\u0435 \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u0430\u044f \u0438 \u043b\u044e\u0431\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0434\u0443\u0442 \u0441\u0440\u0430\u0437\u0443 \u0432 \u0444\u0430\u0439\u043b.<\/p>\n<p>\u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u0432\u043e\u0442 \u0442\u0430\u0431\u043b\u0435\u0442\u043a\u0430 \u043e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c &#8212; \u0432\u044b\u0431\u0438\u0440\u0430\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0441 \u0436\u0443\u0440\u043d\u0430\u043b\u043e\u043c (\u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u043e\u043c) \u0438 \u0440\u0430\u0434\u0443\u0439\u0441\u044f \u0436\u0438\u0437\u043d\u0438. \u041d\u043e \u043d\u0435\u0442.<br \/> \u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 <a href=\"https:\/\/research.cs.wisc.edu\/wind\/Publications\/sfa-dsn05.pdf\" rel=\"noopener noreferrer nofollow\">Model-Based Failure Analysis of Journaling File Systems<\/a> \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e, \u0447\u0442\u043e \u0434\u0430\u0436\u0435 \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u043e\u0433\u0443\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438. \u0411\u044b\u043b\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 3 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c (ext3, reiserfs \u0438 jfs) \u043f\u0440\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0431\u043b\u043e\u043a\u0430. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0438\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/20f\/254\/bd3\/20f254bd392115da262e4c20a6671ecd.png\" alt=\"\u041e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/20f\/254\/bd3\/20f254bd392115da262e4c20a6671ecd.png\"\/><\/p>\n<div><figcaption>\u041e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445<\/figcaption><\/div>\n<\/figure>\n<p>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u044d\u0442\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 (Data Block) \u0432 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 (DC, Data Corruption). \u0412\u044b\u0432\u043e\u0434: \u043d\u0430 \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0441\u0442\u043e\u0438\u0442.<\/p>\n<p>\u041f\u0440\u043e NTFS \u0442\u043e\u0436\u0435 \u043d\u0430\u0448\u0435\u043b <a href=\"https:\/\/pages.cs.wisc.edu\/~laksh\/research\/Bairavasundaram-ThesisWithFront.pdf\" rel=\"noopener noreferrer nofollow\">\u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435<\/a> (\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 163) &#8212; \u0434\u0430\u0436\u0435 \u0441 \u0443\u0447\u0435\u0442\u043e\u043c \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0430 \u0438 \u043d\u0435 \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0442\u044c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044e.<\/p>\n<p>\u0410 \u0447\u0442\u043e \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430\u043c\u0438 &#8212; copy-on-write \u0438 log structured?<\/p>\n<p>\u0412 <a href=\"https:\/\/elinux.org\/images\/b\/b6\/EMMC-SSD_File_System_Tuning_Methodology_v1.0.pdf\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u043c<\/a> \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 (\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 26 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435) \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0430\u0441\u044c btrfs \u043d\u0430 SSD \u0438 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u043f\u0438\u0442\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0440\u0438\u0448\u043b\u0430 \u0432 \u043d\u0435\u0433\u043e\u0434\u043d\u043e\u0441\u0442\u044c \u0438 \u043d\u0435 \u0441\u043c\u043e\u0433\u043b\u0430 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f, \u0445\u043e\u0442\u044f \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0439 ext4 \u043f\u0435\u0440\u0435\u0436\u0438\u043b 1406. \u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435: \u0441\u0442\u0430\u0442\u044c\u044f 2013 \u0433\u043e\u0434\u0430, \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u0435\u0439\u0447\u0430\u0441 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f, \u043d\u043e \u043d\u043e\u0432\u044b\u0445 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b.<\/p>\n<p>\u041f\u0440\u043e log structured \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u043d\u0430\u0439\u0442\u0438 \u043d\u0435 \u0441\u043c\u043e\u0433.<\/p>\n<h3>\u041f\u0440\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b<\/h3>\n<p>\u041e\u0431\u043e\u0431\u0449\u0430\u044f, \u0444\u0430\u0439\u043b \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 2 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 &#8212; \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u0431\u043b\u043e\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0444\u0430\u0439\u043b \u043d\u0430\u0434\u043e \u043f\u043e\u043d\u044f\u0442\u044c \u0447\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u043c? \u0415\u0441\u043b\u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435, \u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0438\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f, \u0432 \u0444\u0430\u0439\u043b\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043c\u0443\u0441\u043e\u0440:<\/p>\n<ol>\n<li>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0434\u043e\u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b<\/p>\n<\/li>\n<li>\n<p>\u0424\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 &#8212; \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0434\u043b\u0438\u043d\u0443 \u0444\u0430\u0439\u043b\u0430<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0442\u043a\u0430\u0437.<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d \u043c\u0443\u0441\u043e\u0440\u043e\u043c, \u0445\u043e\u0442\u044f \u043d\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430, \u043d\u0438 \u0434\u0438\u0441\u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0435 \u0432\u0438\u0434\u044f\u0442.<\/p>\n<p>\u0417\u0430\u0449\u0438\u0442\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u044b \u0432 \u0444\u0430\u0439\u043b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b \u043d\u0430\u043c \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438, \u0447\u0442\u043e \u0444\u0430\u0439\u043b \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0438 \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c, \u0447\u0442\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0434\u0443\u0442 \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u043d\u0435 \u043c\u0443\u0441\u043e\u0440. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442:<\/p>\n<ul>\n<li>\n<p>Postgres \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b WAL \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 magic number<\/p>\n<pre><code class=\"cpp\">\/*  * Each page of XLOG file has a header like this:  *\/ #define XLOG_PAGE_MAGIC 0xD114\/* can be used as WAL version indicator *\/  typedef struct XLogPageHeaderData {     uint16xlp_magic;\/* magic value for correctness checks *\/     \/\/ ... } XLogPageHeaderData; <\/code><\/pre>\n<\/li>\n<li>\n<p>Kafka <a href=\"https:\/\/github.com\/apache\/kafka\/blob\/9bc9fae9425e4dac64ef078cd3a4e7e6e09cc45a\/clients\/src\/main\/java\/org\/apache\/kafka\/common\/record\/FileLogInputStream.java#L63\" rel=\"noopener noreferrer nofollow\">\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 magic number<\/a> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u043e\u043c\u0435\u0440\u0430 \u0432\u0435\u0440\u0441\u0438\u0438<\/p>\n<pre><code class=\"java\">public class FileLogInputStream implements LogInputStream&lt;FileLogInputStream.FileChannelRecordBatch> {     @Override     public FileChannelRecordBatch nextBatch() throws IOException {         \/\/ ...                  byte magic = logHeaderBuffer.get(MAGIC_OFFSET);         final FileChannelRecordBatch batch;          if (magic &lt; RecordBatch.MAGIC_VALUE_V2)             batch = new LegacyFileChannelRecordBatch(offset, magic, fileRecords, position, size);         else             batch = new DefaultFileChannelRecordBatch(offset, magic, fileRecords, position, size);         return batch;     } } <\/code><\/pre>\n<\/li>\n<li>\n<p>\u0410 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0447\u0438\u0441\u043b\u043e\u043c, \u0430 \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u043a\u0430\u043a \u0432 SQLite, \u043f\u0440\u0438\u0447\u0435\u043c \u043a\u0430\u043a <a href=\"https:\/\/github.com\/sqlite\/sqlite\/blob\/f79b0bdcbfb46164cfd665d256f2862bf3f42a7c\/src\/btree.c#L3267\" rel=\"noopener noreferrer nofollow\">\u043e\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e\u0439<\/a>, \u0442\u0430\u043a \u0438 <a href=\"https:\/\/github.com\/sqlite\/sqlite\/blob\/f79b0bdcbfb46164cfd665d256f2862bf3f42a7c\/src\/pager.c#L1608\" rel=\"noopener noreferrer nofollow\">\u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439<\/a><\/p>\n<pre><code class=\"cpp\">\/\/ \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0436\u0443\u0440\u043d\u0430\u043b\u0430 \u043e\u0442\u043a\u0430\u0442\u0430 - \u043d\u0435\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u0430\u044f \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \/* ** Journal files begin with the following magic string.  The data ** was obtained from \/dev\/random.  It is used only as a sanity check. *\/ static const unsigned char aJournalMagic[] = {   0xd9, 0xd5, 0x05, 0xf9, 0x20, 0xa1, 0x63, 0xd7, };  static int readJournalHdr(   Pager *pPager,               \/* Pager object *\/   int isHot,   i64 journalSize,             \/* Size of the open journal file in bytes *\/   u32 *pNRec,                  \/* OUT: Value read from the nRec field *\/   u32 *pDbSize                 \/* OUT: Value of original database size field *\/ ){   int rc;                      \/* Return code *\/   unsigned char aMagic[8];     \/* A buffer to hold the magic header *\/   i64 iHdrOff;                 \/* Offset of journal header being read *\/    \/* Read in the first 8 bytes of the journal header. If they do not match   ** the  magic string found at the start of each journal header, return   ** SQLITE_DONE. If an IO error occurs, return an error code. Otherwise,   ** proceed.   *\/   if( isHot || iHdrOff!=pPager->journalHdr ){     rc = sqlite3OsRead(pPager->jfd, aMagic, sizeof(aMagic), iHdrOff);     if( rc ){       return rc;     }     if( memcmp(aMagic, aJournalMagic, sizeof(aMagic))!=0 ){       return SQLITE_DONE;     }   }      \/\/ ... }  \/\/ \u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0444\u0430\u0439\u043b\u0430 \u0411\u0414 - \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u043e\u0447\u0438\u0442\u0430\u0435\u043c\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 #ifndef SQLITE_FILE_HEADER \/* 123456789 123456 *\/ #  define SQLITE_FILE_HEADER \"SQLite format 3\" #endif  \/* ** The header string that appears at the beginning of every ** SQLite database. *\/ static const char zMagicHeader[] = SQLITE_FILE_HEADER;  static int lockBtree(BtShared *pBt){   \/\/ ...   if( nPage>0 ){     \/* EVIDENCE-OF: R-43737-39999 Every valid SQLite database file begins     ** with the following 16 bytes (in hex): 53 51 4c 69 74 65 20 66 6f 72 6d     ** 61 74 20 33 00. *\/     if( memcmp(page1, zMagicHeader, 16)!=0 ){       goto page1_init_failed;     }      \/\/ ...  page1_init_failed:   pBt->pPage1 = 0;   return rc; } <\/code><\/pre>\n<\/li>\n<\/ul>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u043d\u0430\u0447\u0430\u043b\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, BOM, JPEG, PNG.<\/p>\n<p>\u041d\u043e \u044d\u0442\u043e \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0430\u0449\u0435 \u043d\u0443\u0436\u043d\u0430 \u0434\u043b\u044f \u043f\u043e\u043c\u0435\u0442\u043a\u0438 \u0433\u0440\u0430\u043d\u0438\u0446 \u0434\u0430\u043d\u043d\u044b\u0445. \u0427\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u043c\u044b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0435\u0435 (\u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443), \u0430 \u043f\u043e\u0442\u043e\u043c \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u043e\u0442\u043a\u0430\u0437? \u0427\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u0430, \u0430 \u0434\u0440\u0443\u0433\u0430\u044f \u043d\u0435\u0442. \u041f\u0440\u0438\u0447\u0435\u043c \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0447\u0430\u0441\u0442\u044c \u0431\u044b\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e &#8212; \u0437\u0430\u043f\u0438\u0441\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0447\u0430\u0442\u044c \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b.<\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442 \u043f\u043e \u0432\u0441\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u044b\u043c \u0434\u0430\u043d\u043d\u044b\u043c. \u0421\u0430\u043c\u0443 \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0430\u043a \u0432 \u043d\u0430\u0447\u0430\u043b\u0435, \u0442\u0430\u043a \u0438 \u0432 \u043a\u043e\u043d\u0446\u0435. \u042f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u0443 \u0432 \u043a\u043e\u043d\u0446\u0435 &#8212; \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<ul>\n<li>\n<p>\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0442.\u0435. \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u043c\u0430\u0445\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b (\u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c 4 \u0431\u0430\u0439\u0442\u0430, \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c 4 \u041a\u0431 &#8212; \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443)<\/p>\n<\/li>\n<li>\n<p>\u041c\u0435\u043d\u044c\u0448\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0439 \u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0434\u0438\u0441\u043a\u0430<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430 \u043f\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043c\u0430\u0440\u043a\u0435\u0440\u043e\u043c (&#171;\u0434\u0430\u043b\u044c\u0448\u0435 \u0435\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435&#187;), \u0442\u043e \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0432 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u044f \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438. \u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430:<\/p>\n<ul>\n<li>\n<p>Postgres <a href=\"https:\/\/github.com\/postgres\/postgres\/blob\/5f79cb7629a4ce6321f509694ebf475a931608b6\/src\/include\/access\/xlogrecord.h#L49\" rel=\"noopener noreferrer nofollow\">\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 CRC32C<\/a> \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 WAL<\/p>\n<pre><code class=\"cpp\">typedef struct XLogRecord {     \/\/ ...     pg_crc32cxl_crc;\/* CRC for this record *\/ } XLogRecord; <\/code><\/pre>\n<\/li>\n<li>\n<p>etcd \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043a\u043e\u043b\u044c\u0437\u044f\u0449\u0443\u044e \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u0443 \u0434\u043b\u044f <a href=\"https:\/\/github.com\/etcd-io\/etcd\/blob\/8b9909e20de0aeacb3e63a0df992347b2f683703\/server\/storage\/wal\/walpb\/record.pb.go#L28\" rel=\"noopener noreferrer nofollow\">\u0437\u0430\u043f\u0438\u0441\u0435\u0439 WAL<\/a><\/p>\n<pre><code class=\"go\">type Record struct {   Crc                  uint32   `protobuf:\"varint,2,opt,name=crc\" json:\"crc\"` } <\/code><\/pre>\n<\/li>\n<li>\n<p>EventStore \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/github.com\/EventStore\/EventStore\/blob\/e18b459c0f44c76ff7a1146d023070f5423b759a\/src\/EventStore.Core\/TransactionLog\/Chunks\/ChunkFooter.cs#L21\" rel=\"noopener noreferrer nofollow\">MD5 \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u0443<\/a><\/p>\n<pre><code class=\"cpp\">public class ChunkFooter {     \/\/ ...     public readonly byte[] MD5Hash;     \/\/ ... } <\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>\u041c\u043e\u0434\u0435\u043b\u044c \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u0438<\/h3>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0438\u0434\u0442\u0438 \u0432\u043f\u0435\u0440\u0435\u0434, \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0415\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u043a\u0430\u043a \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438. \u0412 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430\u0445 \u044f \u043d\u0430\u0445\u043e\u0434\u0438\u043b \u0440\u0430\u0437\u043d\u044b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f, \u043d\u043e \u0441\u043a\u0430\u0436\u0435\u043c, \u0447\u0442\u043e \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438 &#8212; \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432\u0430\u043d\u0438\u044f store\/load \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0442.\u0435. \u0438\u0445 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442\u0441\u044f. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"cpp\">void function() {     \/\/ 1     a = 123;     b = 244;      \/\/ 2     int c = a;     b = 555;  } <\/code><\/pre>\n<p>\u0412\u043e\u043f\u0440\u043e\u0441\u044b \u0442\u0430\u043a\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>\u0412 1 \u0441\u043b\u0443\u0447\u0430\u0435, \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c <code>b<\/code> \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c <code>a<\/code>, \u0442.\u0435. \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a store\/store \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/p>\n<\/li>\n<li>\n<p>\u0412\u043e 2 \u0441\u043b\u0443\u0447\u0430\u0435, \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>b<\/code> \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 <code>a<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u0442\u0430\u043a\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0430\u043c\u044f\u0442\u0438. \u0414\u043b\u044f \u042f\u041f \u0438 \u0436\u0435\u043b\u0435\u0437\u0430 \u0435\u0441\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0441 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c \u0438\u0445 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0430\u043c\u044f\u0442\u0438:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/en.cppreference.com\/w\/cpp\/language\/memory_model\" rel=\"noopener noreferrer nofollow\">C++<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/main\/docs\/design\/specs\/Memory-model.md\" rel=\"noopener noreferrer nofollow\">C#<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.cs.umd.edu\/~pugh\/java\/memoryModel\/jsr133.pdf\" rel=\"noopener noreferrer nofollow\">Java<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/peps.python.org\/pep-0583\/\" rel=\"noopener noreferrer nofollow\">Python<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/go.dev\/ref\/mem\" rel=\"noopener noreferrer nofollow\">Go<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/doc.rust-lang.org\/nomicon\/atomics.html\" rel=\"noopener noreferrer nofollow\">Rust<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.amd.com\/content\/dam\/amd\/en\/documents\/processor-tech-docs\/programmer-references\/24592.pdf\" rel=\"noopener noreferrer nofollow\">AMD64<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u043e \u043e\u0441\u0442\u0430\u0432\u0438\u043c \u042f\u041f \u043d\u0430 \u043f\u043e\u0442\u043e\u043c. \u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0412 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 <a href=\"https:\/\/www.cs.utexas.edu\/~bornholt\/papers\/ferrite-asplos16.pdf\" rel=\"noopener noreferrer nofollow\">Specifying and Checking File System Crash-Consistency Models<\/a> \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u0431\u044b\u043b\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u043e Crash-Consistency Model &#8212; \u043c\u043e\u0434\u0435\u043b\u044c \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u0441\u0431\u043e\u044f\u0445. \u0414\u0430\u043b\u044c\u0448\u0435 \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u0438\u0435. \u0412 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 <a href=\"https:\/\/www.usenix.org\/system\/files\/conference\/osdi14\/osdi14-paper-pillai.pdf\" rel=\"noopener noreferrer nofollow\">All File Systems Are Not Created Equal<\/a> \u0432\u044b\u0434\u0435\u043b\u0438\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 &#171;\u0431\u0430\u0437\u043e\u0432\u044b\u0435&#187; \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044c \u0447\u0430\u043d\u043a\u0430 \u0444\u0430\u0439\u043b\u0430<\/p>\n<\/li>\n<li>\n<p>\u0414\u043e\u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u043c\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 All File Systems Are Not Created Equal \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0441 ext2, ext3, ext4, reiserfs, xfs \u0438 btrfs \u0431\u044b\u043b\u0430 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u044d\u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/3ef\/7be\/d5c\/3ef7bed5cdfcbc9db139b55582258bcd.png\" alt=\"Crash-Consistency \u043c\u043e\u0434\u0435\u043b\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/3ef\/7be\/d5c\/3ef7bed5cdfcbc9db139b55582258bcd.png\"\/><\/p>\n<div><figcaption>Crash-Consistency \u043c\u043e\u0434\u0435\u043b\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c<\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u0442\u0435\u0441\u0442\u044b, \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 <em>\u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u044b\u0435<\/em> \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u044f &#8212; \u0435\u0441\u043b\u0438 \u0431\u0430\u0433\u0430 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e, \u044d\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0435\u0433\u043e \u043d\u0435\u0442<\/p>\n<\/blockquote>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u0434\u0430\u043b\u044c\u0448\u0435 \u044f \u0431\u0443\u0434\u0443 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u043c\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438 \u0442\u0435, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0435\u0441\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u0431\u0443\u0444\u0435\u0440, \u043a\u0443\u0434\u0430 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c\u0441\u044f &#8212; COW, log-structured, soft updates, \u0436\u0443\u0440\u043d\u0430\u043b (\u0432\u0441\u0435\u0445 \u043f\u043e\u0434 \u043e\u0434\u043d\u0443 \u0433\u0440\u0435\u0431\u0435\u043d\u043a\u0443).<\/p>\n<h4>\u0410\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0441\u0442\u044c<\/h4>\n<p>\u041f\u0440\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 \u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0447\u0430\u0441\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u0442 \u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0445 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0434\u043e\u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0444\u0430\u0439\u043b \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u043b\u0438\u043d\u0443 \u0432 \u0435\u0433\u043e inode, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0431\u043b\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445. \u0410\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0441\u0442\u044c, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0441\u0442\u044c \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u0418\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u044b:<\/p>\n<ul>\n<li>\n<p>\u041d\u0438\u043a\u0430\u043a\u0430\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e \u0434\u043e\u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043b\u043e\u043a\u043e\u0432 (\u0440\u0430\u0437\u0432\u0435 \u0447\u0442\u043e \u043e\u0434\u0438\u043d)<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044c 1 \u0441\u0435\u043a\u0442\u043e\u0440\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0435\u0437\u0434\u0435 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u0430<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u043c\u0438 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0432\u043e\u043e\u0431\u0449\u0435 \u0431\u0435\u0437 \u0436\u0443\u0440\u043d\u0430\u043b\u0430 (\u0435\u0449\u0435 \u0438 ext2, \u043d\u043e \u0447\u0443\u0432\u0441\u0442\u0432\u0443\u044e, \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u0442\u0430\u043a \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f)<\/p>\n<\/li>\n<\/ul>\n<p>\u0427\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u043e\u0442\u043a\u0430\u0437 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0439? \u0421\u0430\u043c\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 &#8212; \u043d\u0430\u0440\u0443\u0448\u0438\u0442\u0441\u044f \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u0438 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c <code>fsck<\/code> (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u0432\u0441\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c). \u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0435\u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0441\u0431\u043e\u0439:<\/p>\n<ul>\n<li>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043c\u0443\u0441\u043e\u0440, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0434\u043e\u0437\u0430\u043f\u0438\u0441\u044c &#8212; \u0432\u044b\u0434\u0435\u043b\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u0431\u043b\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043b\u0438, \u043b\u0438\u0431\u043e \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0430\u0441\u044c \u0434\u043e \u043a\u043e\u043d\u0446\u0430<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 <a href=\"https:\/\/www.cs.utexas.edu\/~bornholt\/papers\/ferrite-asplos16.pdf\" rel=\"noopener noreferrer nofollow\">Specifying and Checking File System Crash-Consistency Models<\/a> \u0431\u044b\u043b\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043a\u0430\u0437\u0430. \u0411\u044b\u043b\u0430 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/ddd\/f82\/002\/dddf8200207ceadfe83d71652bcf0540.png\" alt=\"\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/ddd\/f82\/002\/dddf8200207ceadfe83d71652bcf0540.png\"\/><\/p>\n<div><figcaption>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438<\/figcaption><\/div>\n<\/figure>\n<p>\u0417\u0430\u043a\u0440\u0430\u0448\u0435\u043d\u043d\u044b\u0435 \u0442\u043e\u0447\u043a\u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442, \u0447\u0442\u043e \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0433\u043b\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u044e \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043a\u0430\u0437\u0430:<\/p>\n<ul>\n<li>\n<p><code>PA<\/code> (Prefix Append) &#8212; \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u043c \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438 &#8212; \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043c\u0443\u0441\u043e\u0440<\/p>\n<\/li>\n<li>\n<p><code>ARVR<\/code> (Atomic Replace Via Rename) &#8212; \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0447\u0435\u0440\u0435\u0437 \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0435 \u0432\u0441\u0435\u043c\u0438 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f &#8212; \u043f\u0440\u0438 \u0437\u0430\u043c\u0435\u043d\u0435 \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u043d\u043e\u0432\u044b\u0439, \u0432 \u0444\u0430\u0439\u043b\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<li>\n<p><code>ACVR<\/code> (Atomic Create Via Rename) &#8212; \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u043d\u0438\u043a\u0435\u043c \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f &#8212; \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u043d\u043e\u0432\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432\u0441\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0431\u044b\u0442\u044c \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0434\u043b\u0438\u043d\u044b<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 <code>ARVR<\/code> \u0438 <code>ACVR<\/code> &#8212; \u044d\u0442\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u0438\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 etcd \u043d\u043e\u0432\u044b\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u043b\u043e\u0433\u0430 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>ACVR<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>\u0412\u0430\u0436\u043d\u043e\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u0435 \u0432 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e ARVR\/ACVR<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u0437\u0443\u0447\u0438\u043b\u0438 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0434\u043b\u044f <code>ACVR<\/code>\/<code>ARVR<\/code> \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u044d\u0442\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b.<br \/> \u0414\u0430\u043b\u0435\u0435, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0431\u044b\u043b\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0442\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f \u0438 \u043d\u0430\u0434\u043e \u0431\u044b \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>fsync<\/code>.<br \/> \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e\u0435 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u0435, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u0430\u043c \u0442\u0435\u0441\u0442 (\u0435\u0433\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435):<\/p>\n<pre><code># Atomic Replace Via Rename (ARVR) initial:   g &lt;- creat(\"file\", 0600)   write(g, old) main:   f &lt;- creat(\"file.tmp\", 0600)   write(f, new)   rename(\"file.tmp\", \"file\") exists?:   content(\"file\") 6= old ^ content(\"file\") 6= new    # Atomic create via rename (ACVR) main:   f &lt;- creat(\"file.tmp\", 0600)   write(f, data)   rename(\"file.tmp\", \"file\") exists?:   content(\"file\") 6= \u2205 ^ content(\"file\") 6= data <\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u0441\u044f, \u0442\u043e \u043c\u0435\u0436\u0434\u0443 <code>write<\/code> \u0438 <code>rename<\/code> \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>fsync<\/code>. \u0427\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442?<\/p>\n<ol>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>write<\/code> \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<li>\n<p>\u0424\u0430\u0439\u043b \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f (\u0434\u043b\u044f ARVR)<\/p>\n<\/li>\n<li>\n<p>\u0424\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0440\u0435\u0448\u0430\u0435\u0442 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b (\u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439)<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0442\u043a\u0430\u0437<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435, \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>ARVR &#8212; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 \u043f\u0443\u0441\u0442\u043e\u0435, \u0442.\u043a. \u0431\u044b\u043b \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d \u043f\u0443\u0441\u0442\u043e\u0439 \u043d\u0430 \u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u0444\u0430\u0439\u043b<\/p>\n<\/li>\n<li>\n<p>ACVR &#8212; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 \u043f\u0443\u0441\u0442\u043e\u0435, \u0442.\u043a. \u0432 \u0444\u0430\u0439\u043b \u043d\u0435 \u0443\u0441\u043f\u0435\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u044b, \u0442\u043e \u043e\u043d\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a \u0441\u0435\u0431\u044f \u0432\u0435\u0441\u0442\u0438 \u0438 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 <code>fsync<\/code> \u043f\u0435\u0440\u0435\u0434 <code>rename<\/code> (\u043e\u0431 \u044d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0437\u0436\u0435).<\/p>\n<p>\u041d\u043e \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0434\u0435\u043b\u0430\u044e\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u044e\u0442 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0434\u0438\u0441\u043a \u043f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435\u043c:<\/p>\n<ul>\n<li>\n<p>ext4 &#8212; \u043e\u043f\u0446\u0438\u044f <a href=\"https:\/\/man7.org\/linux\/man-pages\/man5\/ext4.5.html\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <code>auto_da_alloc<\/code><\/a> \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u044d\u0442\u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u0432\u044b\u0437\u043e\u0432\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p>btrfs &#8212; \u043e\u043f\u0446\u0438\u044f <a href=\"https:\/\/btrfs.readthedocs.io\/en\/latest\/Administration.html\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <code>flushoncommit<\/code><\/a> \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0435 \u0433\u0440\u044f\u0437\u043d\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <code>rename<\/code> (\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u0437\u044f\u043b <a href=\"https:\/\/archive.kernel.org\/oldwiki\/btrfs.wiki.kernel.org\/index.php\/FAQ.html#What_are_the_crash_guarantees_of_overwrite-by-rename.3F#What_are_the_crash_guarantees_of_overwrite-by-rename.3F\" rel=\"noopener noreferrer nofollow\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a>, \u043d\u043e \u0432\u0438\u043a\u0438 \u0437\u0430\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u043e \u0443\u0436\u0435 \u043d\u0435 \u0442\u0430\u043a)<\/p>\n<\/li>\n<li>\n<p>xfs &#8212; \u0441\u0443\u0434\u044f \u043f\u043e <a href=\"https:\/\/www.spinics.net\/lists\/xfs\/msg36717.html\" rel=\"noopener noreferrer nofollow\">\u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0435 \u0437\u0430 2015 \u0433\u043e\u0434<\/a> \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e, \u043d\u043e \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u043e (<code>The sync-after-rename behavior was suggested and rejected for xfs<\/code>)<\/p>\n<\/li>\n<\/ul>\n<p>P.S. \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u0437\u044f\u043b <a href=\"https:\/\/unix.stackexchange.com\/a\/464383\" rel=\"noopener noreferrer nofollow\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a><\/p>\n<p>\u041d\u043e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0441\u0430\u043c <code>rename<\/code> \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u043c? \u041c\u044b, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0438 \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435, \u043d\u043e \u043a\u0430\u043a\u043e\u0439 \u0432 \u044d\u0442\u043e\u043c \u0441\u043c\u044b\u0441\u043b, \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u0441\u043b\u043e\u043c\u0430\u0435\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u0437\u043e\u0432\u0430 <code>rename<\/code>? \u0412 <a href=\"https:\/\/man7.org\/linux\/man-pages\/man2\/rename.2.html#DESCRIPTION\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<blockquote>\n<p>If newpath already exists, it will be atomically replaced, so that there is no point at which another process attempting to access newpath will find it missing.<\/p>\n<\/blockquote>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c, \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u0430. \u041d\u043e &#171;\u0430\u0442\u043e\u043c\u0430\u0440\u043d\u0430\u044f&#187; \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432, \u043d\u043e \u043d\u0435 \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438.<br \/> \u0414\u0430\u043b\u0435\u0435, \u043c\u044b \u0432\u0438\u0434\u0438\u043c:<\/p>\n<blockquote>\n<p>However, there will probably be a window in which both oldpath and newpath refer to the file being renamed.<\/p>\n<\/blockquote>\n<p>\u0418\u0437 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434, \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043a\u0430\u0437\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f, \u043a\u043e\u0433\u0434\u0430 \u043e\u0431\u0430 \u043f\u0443\u0442\u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043d\u0430 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0444\u0430\u0439\u043b. \u0418 \u0435\u0449\u0435:<\/p>\n<blockquote>\n<p>If newpath exists but the operation fails for some reason, rename() guarantees to leave an instance of newpath in place.<\/p>\n<\/blockquote>\n<p>\u042d\u0442\u043e \u0443\u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043c \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043e\u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 \u043f\u043e <code>newpath<\/code> (\u0434\u043b\u044f <code>ACVR<\/code>\/<code>ARVE<\/code> &#8212; \u0446\u0435\u043b\u0435\u0432\u043e\u0433\u043e) \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u044b\u043c. \u041f\u0440\u043e \u043e\u0442\u043a\u0430\u0437\u044b \u044f\u0432\u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f. \u0412 <a href=\"https:\/\/www.gnu.org\/software\/libc\/manual\/html_node\/Renaming-Files.html#Renaming-Files\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 GNU C<\/a> \u043d\u0430\u0448\u0435\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f:<\/p>\n<blockquote>\n<p>If there is a system crash during the operation, it is possible for both names to still exist; but newname will always be intact if it exists at all.<\/p>\n<\/blockquote>\n<p>\u0412\u043e\u0442 \u0442\u0443\u0442 \u0443\u0436\u0435 \u044f\u0432\u043d\u043e \u043f\u0440\u043e \u043e\u0442\u043a\u0430\u0437 &#8212; \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0444\u0430\u0439\u043b \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043d\u0435\u0438\u0437\u043c\u0435\u043d\u043d\u044b\u043c (\u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d) \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043a\u0430\u0437\u0430.<\/p>\n<p>\u042f \u0434\u0435\u043b\u0430\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0432\u043e\u0434: <code>rename<\/code> &#8212; \u0430\u0442\u043e\u043c\u0430\u0440\u0435\u043d, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434 \u043d\u0438\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <code>fsync<\/code>, \u0447\u0442\u043e\u0431\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0438 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0444\u0430\u0439\u043b \u043d\u0435 \u043f\u0443\u0441\u0442\u043e\u0439.<\/p>\n<\/div>\n<\/details>\n<h4>\u041f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432\u0430\u043d\u0438\u0435<\/h4>\n<p>\u041a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0432\u043e\u0434: \u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u0430\u044f, \u0442\u043e \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 <em>\u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432<\/em> \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f. \u042d\u0442\u043e\u0433\u043e \u043d\u0435\u0442 \u0432 ext2, ext3-writeback, ext4-writeback, reiserfs-nolog, reiserfs-writeback \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u044b.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432\u0430\u0436\u043d\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0430\u043a\u0442 \u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u043d\u0430\u0434 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u043c\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445. \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b, \u0430 \u043f\u043e\u0442\u043e\u043c \u0445\u043e\u0442\u0438\u043c \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c, \u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a, \u0447\u0442\u043e \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u0443\u0435\u043c \u0444\u0430\u0439\u043b, (\u0442.\u0435. \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0441\u0442\u0430\u0440\u043e\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043f\u043e\u0442\u0435\u0440\u044f\u0435\u043c) \u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043c \u043d\u0430\u0447\u043d\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u044c. \u041a \u043c\u043e\u0435\u043c\u0443 \u0443\u0434\u0438\u0432\u043b\u0435\u043d\u0438\u044e, \u043d\u0430 \u0442\u0430\u043a\u043e\u0435 \u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b \u043d\u0435 \u0432\u0441\u0435, \u0434\u0430\u0436\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043f\u043e\u0440\u044f\u0434\u043e\u043a (xfs \u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u043b \u0437\u0434\u0435\u0441\u044c \u0443\u0432\u0438\u0434\u0435\u0442\u044c).<\/p>\n<h4>\u0411\u0430\u0440\u044c\u0435\u0440 \u0437\u0430\u043f\u0438\u0441\u0438<\/h4>\n<p>\u0412 \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0430\u043c\u044f\u0442\u0438, \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u043d\u044f\u0442\u0438\u0435 \u043a\u0430\u043a \u0431\u0430\u0440\u044c\u0435\u0440 \u0437\u0430\u043f\u0438\u0441\u0438 &#8212; \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0435\u0439 store\/load \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u0414\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u043d \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c &#8212; \u044d\u0442\u043e <code>fsync()<\/code>. \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u0431\u0430\u0440\u044c\u0435\u0440 \u0438\u043c\u0435\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0443:<\/p>\n<blockquote>\n<p>\u0412\u0441\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u043e <code>fsync()<\/code> \u0441\u0431\u0440\u043e\u0448\u0435\u043d\u044b \u043d\u0430 \u0434\u0438\u0441\u043a<\/p>\n<\/blockquote>\n<p>\u041d\u043e \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0432 \u043a\u0430\u043a\u043e\u0439 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043e\u043d\u0438 \u0431\u044b\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b, \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b. \u0414\u043e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435. \u0412\u043e\u043e\u0431\u0449\u0435, <code>fsync()<\/code> &#8212; \u043d\u0435 \u0431\u0430\u0440\u044c\u0435\u0440 \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u0440\u043e\u0441\u0442\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u041f\u043e\u0434\u043e\u0431\u043d\u0430\u044f \u0442\u0435\u043c\u0430 \u0443\u0436\u0435 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u043b\u0430\u0441\u044c &#8212; \u0431\u044b\u043b\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>fbarrier()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c \u0431\u044b \u0438 \u044f\u0432\u043b\u044f\u043b\u0441\u044f, \u043d\u043e \u041b\u0438\u043d\u0443\u0441 \u0438\u0434\u0435\u044e <a href=\"https:\/\/lwn.net\/Articles\/326505\/\" rel=\"noopener noreferrer nofollow\">\u043e\u0442\u0432\u0435\u0440\u0433<\/a>, \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u0432, \u0447\u0442\u043e \u044d\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u043b\u0438\u0448\u043d\u044e\u044e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c.<\/p>\n<h3>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u0440\u043e\u0431\u043b\u0435\u043c<\/h3>\n<p>\u0412 \u0442\u043e\u043c \u0436\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 All File Systems Are Not Created Equal \u0431\u044b\u043b\u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0435\u0439, \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043a\u0430\u0437\u0430. \u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043d\u0438\u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 (\u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439) \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0434\u0438\u0441\u043a\u043e\u043c:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/88b\/629\/176\/88b6291765b934d6e89e4faba800ebe6.png\" alt=\"\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/88b\/629\/176\/88b6291765b934d6e89e4faba800ebe6.png\"\/><\/p>\n<div><figcaption>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/figcaption><\/div>\n<\/figure>\n<p>\u0410 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/bd2\/97f\/757\/bd297f7573c6dc807ecb3c4a5ce9c206.png\" alt=\"\u041d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/bd2\/97f\/757\/bd297f7573c6dc807ecb3c4a5ce9c206.png\"\/><\/p>\n<div><figcaption>\u041d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c<\/figcaption><\/div>\n<\/figure>\n<p>\u041a\u0430\u043a\u0438\u0435 \u0438\u0437 \u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u044b:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u0430 (\u0421\u0423\u0411\u0414 \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440), \u0447\u0430\u0441\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 <code>fsync<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u0430\u0440\u044c\u0435\u0440\u0430<\/p>\n<\/li>\n<li>\n<p>\u0427\u0435\u043c \u0445\u0443\u0436\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438 &#8212; \u0442\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0431\u0430\u0433\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c (\u0438 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0439 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438)<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u0436\u0434\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u044f\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0438 \u043f\u0440\u0438 \u0438\u0445 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u0442\u0440\u0430\u0434\u0430\u0442\u044c \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b <a href=\"https:\/\/sqlite.org\/atomiccommit.html#_hardware_assumptions\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f SQLite<\/a> \u0438 \u0441\u0430\u043c\u0438 \u0430\u0432\u0442\u043e\u0440\u044b \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438, \u0447\u0442\u043e ZooKeeper \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0444\u0430\u0439\u043b \u043b\u043e\u0433\u0430.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0414\u0440\u0443\u0433\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b<\/h3>\n<p>\u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u044b\u0448\u0435 \u0431\u044b\u043b\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b *nix \u043c\u0438\u0440\u0430, \u043d\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435, \u043e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c.<\/p>\n<h4>NTFS<\/h4>\n<p>NTFS &#8212; &#171;\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f&#187; \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u043b\u044f Windows. \u042f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439, \u043a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0435\u0435 \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438, \u043d\u043e, \u043e\u043f\u0438\u0440\u0430\u044f\u0441\u044c \u043d\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435, \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u044b:<\/p>\n<ol>\n<li>\n<p>\u0416\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 &#8212; \u0432 \u0444\u0430\u0439\u043b\u0430\u0445 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043c\u0443\u0441\u043e\u0440<\/p>\n<\/li>\n<li>\n<p>\u0418\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u043e\u043d\u043d\u044b\u0439 API, \u043d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c <a href=\"https:\/\/_https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/fileio\/deprecation-of-txf#abstract\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043a\u0430\u0442\u044c<\/a> \u0435\u043c\u0443 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b<\/p>\n<\/li>\n<\/ol>\n<h4>APFS<\/h4>\n<p>APFS (Apple File System) &#8212; \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0434\u043b\u044f Apple, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c HFS+.<br \/> \u0418\u0437 \u0441\u0442\u0430\u0442\u0435\u0439 \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ol>\n<li>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Copy On Write, \u043f\u0440\u0438\u0447\u0435\u043c \u043d\u043e\u0432\u0430\u044f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f <code>novel copy-on-write metadata scheme<\/code> (\u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u0440\u043e \u043d\u0435\u0435 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b)<\/p>\n<\/li>\n<li>\n<p>\u0418\u043c\u0435\u0435\u0442 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e <code>Atomic Safe-Save<\/code> \u0434\u043b\u044f \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0433\u043e <code>rename<\/code><\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u043d\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u0443\u043d\u043a\u0442 \u044f \u0432\u044b\u0434\u0435\u043b\u0438\u043b \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u044f \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u043d\u044f\u043b <a href=\"https:\/\/danluu.com\/filesystem-errors#error-detection\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a>, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u043f\u0438\u0440\u0430\u043b\u0441\u044f. \u0412 \u043d\u0435\u0439 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043e <code>apfs doesn\u2019t checksum data because \u201c[apfs] engineers contend that Apple devices basically don\u2019t return bogus data\u201d<\/code>, \u043d\u043e \u0435\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0441\u044b\u043b\u0430\u0435\u043c\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e, \u0442\u043e \u0442\u0430\u043c \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043e <code>APFS checksums its own metadata but not user data<\/code>. \u041d\u0435\u0434\u043e\u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432 \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0434\u0435\u0442 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 ZFS (\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f), \u0430 \u0432 \u0442\u043e\u0439, \u0447\u0442\u043e \u0438\u0437\u0443\u0447\u0430\u043b \u044f &#8212; \u043f\u0440\u043e \u043d\u0435\u0435 \u043d\u0438 \u0441\u043b\u043e\u0432\u0430.<\/p>\n<p>\u041a \u0441\u043b\u043e\u0432\u0443, \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u044b \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0430\u043b\u043e \u043a\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0431\u0435\u0437 \u044f\u0432\u043d\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, ext4 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 <code>data=ordered<\/code> \u0440\u0435\u0436\u0438\u043c\u0435, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u0430 \u043d\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 <code>data=journal<\/code>. XFS \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e <a href=\"https:\/\/wiki.archlinux.org\/title\/XFS#Checksumming\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445. \u0410 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438\u0445 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 NTFS.<\/p>\n<h3>\u041e\u0448\u0438\u0431\u043a\u0438 fsync<\/h3>\n<p>\u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0433\u043b\u0430\u0432\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u043e\u0442 \u043e\u0448\u0438\u0431\u043e\u043a <code>fsync<\/code> \u043d\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u043a\u0430\u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u041e\u0421 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438. \u041d\u043e \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e \u043f\u043e\u043c\u0435\u0442\u043a\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u044f \u0432\u0437\u044f\u043b \u0438\u0437 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f <a href=\"https:\/\/www.usenix.org\/system\/files\/atc20-rebello.pdf\" rel=\"noopener noreferrer nofollow\">Can Applications Recover from fsync Failures?<\/a> \u041e\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0441\u0430\u043c\u043e \u0437\u0430 \u0441\u0435\u0431\u044f &#8212; \u0432 \u043d\u0435\u043c \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0438 \u041e\u0421 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 <code>fsync<\/code>. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 <code>fsync<\/code>.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/e3f\/657\/78f\/e3f65778fd480514d07b275840ba27eb.png\" alt=\"\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 fsync\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/e3f\/657\/78f\/e3f65778fd480514d07b275840ba27eb.png\"\/><\/p>\n<div><figcaption>\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 fsync<\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p>ext4 data &#8212; \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 journal \u0440\u0435\u0436\u0438\u043c<\/p>\n<\/blockquote>\n<p>\u0418\u0437 \u044d\u0442\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u044b:<\/p>\n<ul>\n<li>\n<p>\u041e\u0448\u0438\u0431\u043a\u0438 <code>fsync<\/code> \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0441 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0431\u043b\u043e\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u0436\u0443\u0440\u043d\u0430\u043b\u0430, \u0442.\u043a. \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435. \u041d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c, \u0435\u0441\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0430 \u0432 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0439\u0434\u0435\u043d\u0430, \u0442\u043e xfs \u0438 btrfs \u0441\u0442\u0430\u043d\u0443\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 (\u043b\u0438\u0431\u043e \u0437\u0430\u043a\u0440\u043e\u0435\u0442\u0441\u044f (XFS), \u043b\u0438\u0431\u043e \u0441\u043c\u043e\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 read-only \u0440\u0435\u0436\u0438\u043c\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e), \u0430 ext4 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043b\u043e\u0433\u0438\u0440\u0443\u0435\u0442 \u044d\u0442\u043e \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0431\u043b\u043e\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445, \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445), \u043c\u043e\u0433\u0443\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 (\u0434\u043b\u0438\u043d\u0430), \u0442.\u0435. \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f, \u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0440\u044b\u043c\/\u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u0434\u044b\u0440\u0430 \u0438\u043b\u0438 \u043c\u0443\u0441\u043e\u0440<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f, \u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0438 \u0432 \u041e\u0421 \u043c\u043e\u0433\u0443\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044d\u0442\u043e btrfs &#8212; \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435 \u043c\u0435\u043d\u044f\u044e\u0442\u0441\u044f, \u043d\u043e \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0440\u044b\u0439 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0444\u0430\u0439\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0432 \u0444\u0430\u0439\u043b\u0435 \u0437\u0430 \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 (\u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438)<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u043e\u043c\u0435\u0447\u0430\u044e\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0447\u0438\u0441\u0442\u044b\u043c\u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043e\u043a, \u043d\u043e \u044d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0442\u0435\u0441\u0442\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u043d\u0430 Linux &#8212; \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f (\u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u044b\u043b\u0438 \u0432\u044b\u0448\u0435)<\/p>\n<\/li>\n<li>\n<p>\u041e\u0448\u0438\u0431\u043a\u0430 <code>fsync<\/code> \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u043b\u0430\u0441\u044c <em>\u0441\u0435\u0439\u0447\u0430\u0441<\/em> &#8212; ext4 \u0432 data \u0440\u0435\u0436\u0438\u043c\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0432\u044b\u0437\u043e\u0432\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430 \u0442\u0430\u043a\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f: <\/p>\n<ol>\n<li>\n<p>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<li>\n<p><code>fsync<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u043a\u043e\u0434<\/p>\n<\/li>\n<li>\n<p>\u041e\u0447\u0438\u0449\u0430\u0435\u043c \u0431\u0443\u0444\u0435\u0440 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u043f\u043e\u0440\u0446\u0438\u044e \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<li>\n<p><code>fsync<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043c\u044b \u0443\u0436\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 <em>\u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438<\/em>, \u0430 \u043f\u043e\u0432\u0442\u043e\u0440 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 <em>\u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0442\u0435, \u0447\u0442\u043e \u043f\u0440\u043e\u043f\u0430\u043b\u0438<\/em><\/p>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p>\u041d\u0435 \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 \u043f\u0435\u0440\u0435\u043c\u043e\u043d\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 read-only \u0440\u0435\u0436\u0438\u043c\u0435, \u0442.\u0435. \u0434\u0430\u0436\u0435 \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 <code>fsync<\/code> \u043c\u044b \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u043e\u043c \u0443\u0437\u043b\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0434\u043b\u044f \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0447\u0442\u0435\u043d\u0438\u0435 (\u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435 \u0443\u043f\u0430\u0441\u0442\u044c)<\/p>\n<\/li>\n<li>\n<p>ext4 \u0432 journal \u0440\u0435\u0436\u0438\u043c\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043d\u043e \u0441 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\/\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0434\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0432 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 (\u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0438 \u043f\u0440\u043e \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0441)<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b\u0432\u043e\u0434: \u0440\u0430\u0431\u043e\u0442\u0430\u044f \u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439, \u043c\u043e\u0436\u043d\u043e \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f &#8212; \u043b\u044e\u0431\u043e\u0439 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0438 \u0438\u0437 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u0437\u0443\u0447\u0430\u043b\u0438 \u0438 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 <code>fsync<\/code>. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0432 \u044d\u0442\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/34f\/971\/1bd\/34f9711bd92eb3cc72b181ca94bd7842.png\" alt=\"\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 fsync\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/34f\/971\/1bd\/34f9711bd92eb3cc72b181ca94bd7842.png\"\/><\/p>\n<div><figcaption>\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 fsync<\/figcaption><\/div>\n<\/figure>\n<blockquote>\n<p>OV (old value) &#8212; \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0430 \u043d\u0435 \u043d\u043e\u0432\u043e\u0433\u043e<br \/> FF (false failure) &#8212; \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0433\u043e\u0432\u043e\u0440\u0438\u043c, \u0447\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0430\u043b\u0438\u043b\u0430\u0441\u044c, \u043d\u043e \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043e<br \/> KC\/VC (key\/value corruption) &#8212; \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u044b (\u0442\u0435\u0441\u0442\u044b \u043d\u0430 key-value \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c)<br \/> KNF (key not found) &#8212; \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0433\u043e\u0432\u043e\u0440\u0438\u043c, \u0447\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b\u0430\u0441\u044c, \u043d\u043e \u043d\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 (\u043f\u0440\u043e\u043f\u0430\u043b\u043e)<\/p>\n<\/blockquote>\n<p>\u041c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u044b:<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0430 <code>fsync<\/code> \u043d\u0435 \u043f\u0440\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0440\u0430\u0437\u0443 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, ext4 journal \u0440\u0435\u0436\u0438\u043c), \u0442\u043e \u043e\u0448\u0438\u0431\u043e\u043a \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435<\/p>\n<\/li>\n<li>\n<p>COW \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, btrfs) \u043b\u0443\u0447\u0448\u0435 \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438 <code>fsync<\/code>, \u0447\u0435\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u043e\u0448\u0438\u0431\u043a\u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0438 \u043e\u0442\u043a\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0434\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f (<code>-<\/code>, <code>|<\/code> \u0432 \u044f\u0447\u0435\u0439\u043a\u0430\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u044b)<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u0446\u0435\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u041e\u0421, \u0430 \u043d\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0439 \u0432 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u043e\u0432 &#8212; Redis \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438 fsync \u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<br \/> \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u044d\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e Redis \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c In-Memory \u0411\u0414 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0444\u0438\u0447\u0430.<\/p>\n<\/blockquote>\n<h2>\u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435<\/h2>\n<p>\u0412\u043e\u0442 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u0442\u0430\u043f &#8212; \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u0435\u0439\u0447\u0430\u0441 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u0440\u043e:<\/p>\n<ul>\n<li>\n<p>\u0416\u0435\u0441\u0442\u043a\u0438\u0435 \u0434\u0438\u0441\u043a\u0438, HDD<\/p>\n<\/li>\n<li>\n<p>\u0422\u0432\u0435\u0440\u0434\u043e\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u0438, SSD<\/p>\n<\/li>\n<\/ul>\n<details class=\"spoiler\">\n<summary>\u041d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e HDD\/SSD<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041a\u0440\u043e\u043c\u0435 HDD \u0438 SSD \u0441\u0442\u043e\u0438\u043b\u043e \u0431\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0435\u0449\u0435:<\/p>\n<ul>\n<li>\n<p>\u041b\u0435\u043d\u0442\u043e\u0447\u043d\u044b\u0435 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u0438<\/p>\n<\/li>\n<li>\n<p>CD\/DVD\/Blu-ray \u0434\u0438\u0441\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>PCM, FRAM, MRAM<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e \u043d\u0438\u0445 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440 \u0432\u0435\u0441\u0442\u0438\u0441\u044c \u043d\u0435 \u0431\u0443\u0434\u0435\u0442, \u043d\u043e \u043d\u0435 \u0445\u043e\u0440\u043e\u0448\u043e \u0432\u043e\u0442 \u0442\u0430\u043a \u0438\u0445 \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c.<\/p>\n<p>\u041b\u0435\u043d\u0442\u043e\u0447\u043d\u044b\u0435 \u043d\u043e\u0441\u0438\u0442\u0435\u043b\u0438 &#8212; \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043b\u044f \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u0432\u0435\u0440\u0438\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/companies\/x-com\/articles\/667542\/\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>, \u0442\u043e \u043e\u043d\u0438:<\/p>\n<ol>\n<li>\n<p>\u0421\u0430\u043c\u044b\u0435 \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0435 &#8212; 15-30 \u043b\u0435\u0442<\/p>\n<\/li>\n<li>\n<p>\u0412\u043c\u0435\u0449\u0430\u044e\u0442 \u043c\u043d\u043e\u0433\u043e &#8212; 18 \u0422\u0431<\/p>\n<\/li>\n<li>\n<p>\u041c\u0430\u043b\u043e \u0441\u0442\u043e\u044f\u0442 &#8212; 1300 \u0440\/\u0422\u0431 (\u0437\u0430 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u0437\u044f\u043b <a href=\"https:\/\/ltoshop.ru\/lentochnyy_nositeli_kartridzhi\/lto_9_ultrium_1845tb\/lentochnyy_nositel_dannyh_hpe_lto_9_ultrium_1845tb_worm_q2079w.html\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0442 \u043a\u0430\u0440\u0442\u0440\u0438\u0434\u0436<\/a>))<\/p>\n<\/li>\n<\/ol>\n<p>CD\/DVD\/Blu-ray \u0434\u0438\u0441\u043a\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u0421\u0443\u0434\u044f \u043f\u043e <a href=\"https:\/\/www.anythingresearch.com\/industry\/Manufacturing-Reproducing-Magnetic-Optical-Media.htm\" rel=\"noopener noreferrer nofollow\">\u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u0440\u044b\u043d\u043a\u0430 \u0432 \u0421\u0428\u0410<\/a> \u0438\u0445 \u043e\u0431\u043e\u0440\u043e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u0421\u043a\u043e\u0440\u0435\u0435 \u043e\u043d\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 (\u0438\u0433\u0440\u044b, \u0444\u0438\u043b\u044c\u043c\u044b, \u043c\u0443\u0437\u044b\u043a\u0430), \u0447\u0435\u043c \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u044b\u0445 IO \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u043e\u0436\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043c.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0437\u0430 \u0431\u043e\u0440\u0442\u043e\u043c \u044f \u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0442\u0430\u043a\u0438\u0435 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u043a\u0430\u043a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Phase-change_memory\" rel=\"noopener noreferrer nofollow\">PCM<\/a> (Phase-change Memory), <a href=\"https:\/\/ru.wikipedia.org\/wiki\/FRAM\" rel=\"noopener noreferrer nofollow\">FRAM<\/a> (Ferroelectic RAM) \u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Magnetoresistive_RAM\" rel=\"noopener noreferrer nofollow\">MRAM<\/a> (Magnetoresistive RAM). \u0414\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u043d\u0438\u043c \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b.<\/p>\n<\/div>\n<\/details>\n<p>\u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u044b \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442, \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e \u043d\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435. \u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043e\u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\n<p>\u0418\u0437\u043d\u043e\u0441<\/p>\n<\/li>\n<li>\n<p>ECC<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/p>\n<\/li>\n<\/ul>\n<h3>\u0418\u0437\u043d\u043e\u0441<\/h3>\n<p>\u041a\u0430\u0436\u0434\u043e\u0435 \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0437\u043d\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u0415\u0441\u043b\u0438 \u0436\u0435\u043b\u0435\u0437\u043e (\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440, \u0432\u0438\u0434\u0435\u043e\u043a\u0430\u0440\u0442\u0430) \u0438\u0441\u043f\u043e\u0440\u0442\u0438\u0442\u0441\u044f, \u0442\u043e \u043c\u044b \u044d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u043c \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u043c. \u0412 \u043e\u0431\u0449\u0435\u043c, \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e \u043d\u0435 \u0441\u043b\u0443\u0447\u0438\u0442\u0441\u044f.<\/p>\n<p>\u041d\u043e \u0435\u0441\u043b\u0438 \u0443\u043c\u0440\u0435\u0442 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u044c, \u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. Blackbaze \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u043b\u0438 <a href=\"https:\/\/www.backblaze.com\/blog\/backblaze-drive-stats-for-2023\/\" rel=\"noopener noreferrer nofollow\">\u043e\u0442\u0447\u0435\u0442 \u0437\u0430 2023<\/a> \u0433\u043e\u0434 \u043f\u043e \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0435 \u043e\u0442\u043a\u0430\u0437\u043e\u0432 \u0441\u0432\u043e\u0438\u0445 \u0436\u0435\u0441\u0442\u043a\u0438\u0445 \u0434\u0438\u0441\u043a\u043e\u0432. \u0418\u0437 \u043d\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u044b:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/www.backblaze.com\/blog\/wp-content\/uploads\/2024\/02\/4-Lifetime-AFR.png\" rel=\"noopener noreferrer nofollow\">\u0421\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0436\u0438\u0437\u043d\u0438 HDD<\/a> \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u043c\u043d\u043e\u0433\u0438\u0445 \u0444\u0430\u043a\u0442\u043e\u0440\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f \u0438\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0434\u0438\u0441\u043a\u0430, \u043d\u043e \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u043f\u043e \u0431\u043e\u043b\u044c\u043d\u0438\u0446\u0435 &#8212; \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 65 \u043c\u0435\u0441\u044f\u0446\u0435\u0432 (5.5 \u043b\u0435\u0442)<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 2022 \u0433\u043e\u0434\u043e\u043c AFR (Annualized Failure Rate, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043e\u0442\u043a\u0430\u0437\u0430 \u0432 \u0433\u043e\u0434\u0443) \u0434\u0438\u0441\u043a\u043e\u0432 \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b\u0441\u044f<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u044b \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438. \u0415\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044f \u0437\u0430 2021 \u0433\u043e\u0434 <a href=\"https:\/\/www.backblaze.com\/blog\/how-long-do-disk-drives-last\/\" rel=\"noopener noreferrer nofollow\">How Long Do Disk Drives Last?<\/a>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u043b\u0438 \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0436\u0438\u0437\u043d\u0438 \u0434\u0438\u0441\u043a\u043e\u0432. \u0418\u0437 \u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u044b\u0432\u043e\u0434\u044b:<\/p>\n<ul>\n<li>\n<p>\u0421\u0440\u0435\u0434\u043d\u044f\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0436\u0438\u0437\u043d\u0438 \u0434\u0438\u0441\u043a\u0430 &#8212; 6 \u043b\u0435\u0442 \u0438 9 \u043c\u0435\u0441\u044f\u0446\u0435\u0432. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u043a\u0441\u0442\u0440\u0430\u043f\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430 6 \u043b\u0435\u0442 (\u0437\u0430 6 \u043b\u0435\u0442 \u0432\u044b\u0436\u0438\u0432\u0430\u043b\u043e 65% \u0434\u0438\u0441\u043a\u043e\u0432)<\/p>\n<\/li>\n<li>\n<p>\u0413\u0440\u0430\u0444\u0438\u043a AFR \u0436\u0435\u0441\u0442\u043a\u0438\u0445 \u0434\u0438\u0441\u043a\u043e\u0432 \u0438\u043c\u0435\u0435\u0442 \u0444\u043e\u0440\u043c\u0443 \u0432\u0430\u043d\u043d\u043e\u0439, \u0442\u043e \u0435\u0441\u0442\u044c AFR \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u043e\u0432 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0438 \u043a\u043e\u043d\u0446\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0436\u0438\u0437\u043d\u0438 (\u044d\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/en.wikipedia.org\/wiki\/Bathtub_curve\" rel=\"noopener noreferrer nofollow\">bathtub curve<\/a>, \u043d\u0435 \u0441\u043c\u043e\u0433 \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438)<\/p>\n<\/li>\n<\/ul>\n<p>\u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f SSD, \u0442\u043e \u0443 \u043d\u0438\u0445 \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c <a href=\"https:\/\/www.backblaze.com\/blog\/ssd-drive-stats-mid-2022-review\/\" rel=\"noopener noreferrer nofollow\">\u043e\u0442\u0447\u0435\u0442, \u043d\u043e \u0437\u0430 2022 \u0433\u043e\u0434<\/a>. \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0435\u043c\u0443, AFR \u0434\u043b\u044f SSD &#8212; 0.92% (\u043d\u0438\u0436\u0435 \u0447\u0435\u043c \u0443 HDD). \u041d\u043e \u0441\u0442\u043e\u0438\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0432 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u044e SSD \u0432\u0437\u044f\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 2018 \u0433\u043e\u0434\u0443, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043d\u0430\u0434\u043e \u0435\u0449\u0435 \u0441\u043e\u0431\u0440\u0430\u0442\u044c.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e \u0432\u043b\u0438\u044f\u043d\u0438\u0438 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0438\u0440\u0430 \u043d\u0430 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u0438:<\/p>\n<ul>\n<li>\n<p>\u0412 HDD \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u0432\u0438\u0436\u0443\u0449\u0438\u0445\u0441\u044f \u0434\u0435\u0442\u0430\u043b\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0432\u0435\u0440\u0436\u0435\u043d \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0432\u043e\u0437\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f\u043c. \u0417\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e &#8212; <a href=\"https:\/\/www.youtube.com\/watch?v=tDacjrSCeq4\" rel=\"noopener noreferrer nofollow\">Shouting in the Datacenter<\/a>. \u041d\u0430 \u044d\u0442\u043e\u043c \u0432\u0438\u0434\u0435\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e \u043a\u0430\u043a \u0441\u0438\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0430 \u043e\u0442\u0432\u0435\u0442\u0430 HDD, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430 \u043d\u0435\u0433\u043e \u043a\u0440\u0438\u0447\u0430\u0442. \u0410 \u0432 <a href=\"https:\/\/www.princeton.edu\/~pmittal\/publications\/acoustic-ashes18.pdf\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438<\/a> \u043f\u0440\u043e\u0432\u0435\u043b\u0438 \u0430\u043d\u0430\u043b\u0438\u0437 \u0432\u043b\u0438\u044f\u043d\u0438\u044f \u0448\u0443\u043c\u043e\u0432 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 HDD. \u0413\u0440\u0443\u0431\u043e \u0433\u043e\u0432\u043e\u0440\u044f, HDD \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0445 \u0448\u0443\u043c\u0430\u0445 (\u0443\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0435\u043c\u0443 ADoS, Acoustic Denial of Service). \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u043e\u0437\u0440\u043e\u0441\u043b\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0430 \u0432 \u043d\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0438 \u043e\u0442\u043a\u0430\u0437 \u0432\u0441\u0435\u0433\u043e \u0434\u0438\u0441\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0425\u043e\u0442\u044c \u0432 SSD \u0438 \u043d\u0435\u0442 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0434\u0432\u0438\u0436\u0443\u0449\u0438\u0445\u0441\u044f \u0434\u0435\u0442\u0430\u043b\u0435\u0439, \u043d\u043e \u0437\u0430\u0442\u043e \u0435\u0441\u0442\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438 \u0432\u043e\u0442 \u043a \u043d\u0435\u043c\u0443, \u0430 \u0442\u043e\u0447\u043d\u0435\u0435 \u043a \u0435\u0433\u043e \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e\u043c\u0443 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e \u043e\u043d \u0443\u044f\u0437\u0432\u0438\u043c. \u0412 <a href=\"https:\/\/arxiv.org\/pdf\/1805.00140.pdf\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438<\/a> \u043f\u0440\u043e\u0432\u0435\u043b\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f SSD \u043d\u0430 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b. \u0418, \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e, \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u044e \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438\u0445 \u043f\u043e\u0442\u0435\u0440\u0435, \u043b\u0438\u0431\u043e \u0432\u043e\u043e\u0431\u0449\u0435 <a href=\"https:\/\/www.usenix.org\/system\/files\/conference\/fast13\/fast13-final80.pdf\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c SSD<\/a> \u0432 \u043a\u0438\u0440\u043f\u0438\u0447.<\/p>\n<\/li>\n<\/ul>\n<h3>ECC<\/h3>\n<p>HDD \u0438 SSD \u0438\u043c\u0435\u044e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 ECC &#8212; Error Correction Code, \u041a\u043e\u0434\u044b \u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u041e\u0448\u0438\u0431\u043e\u043a:<\/p>\n<ul>\n<li>\n<p>HDD \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0441\u0435\u043a\u0442\u043e\u0440\u043e\u0432 \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e <a href=\"https:\/\/en.wikipedia.org\/wiki\/Advanced_Format\" rel=\"noopener noreferrer nofollow\">Advanced Format<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c ECC \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u0441\u0435\u043a\u0442\u043e\u0440\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u0430 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0441\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u041e\u0421 &#8212; \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043e\u043d\u0430 \u0435\u0441\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0435\u0437\u0434\u0435, \u043d\u043e \u0432 \u0441\u0442\u0430\u0440\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c.  \u0421\u0442\u043e\u0438\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0435\u0449\u0435 \u0438 \u0442\u043e, \u0447\u0442\u043e \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0437\u043d\u0430\u044e\u0442 <a href=\"https:\/\/wiki.archlinux.org\/title\/Advanced_Format#File_systems\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e Advanced Format \u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u0434 \u043d\u0435\u0433\u043e \u043f\u043e\u0434\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c\u0441\u044f<\/a>, \u043d\u043e \u044d\u0442\u043e \u0437\u0430 \u0440\u0430\u043c\u043a\u0430\u043c\u0438 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<\/li>\n<li>\n<p>SSD \u0442\u043e\u0436\u0435 \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f <a href=\"https:\/\/en.wikipedia.org\/wiki\/Flash_memory#NAND_flash\" rel=\"noopener noreferrer nofollow\">NAND<\/a> \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 (\u0432 &#171;\u0431\u044b\u0442\u0443&#187; &#8212; \u043e\u0431\u044b\u0447\u043d\u044b\u0435 SSD, USB \u0444\u043b\u0435\u0448\u043a\u0438, SD \u043a\u0430\u0440\u0442\u044b), \u043d\u043e \u0432 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Flash_memory#NOR_flash\" rel=\"noopener noreferrer nofollow\">NOR<\/a> \u043d\u0435 \u0442\u0430\u043a \u0447\u0430\u0441\u0442\u043e (\u0432 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445). \u041f\u0440\u0438\u0447\u0435\u043c, \u044d\u0442\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 &#8212; \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u044f, \u0430 \u043d\u0435 \u041e\u0421<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u043e \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 ECC \u0438 \u0435\u0441\u0442\u044c, \u0442\u043e \u043e\u043d \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438. \u0412 <a href=\"https:\/\/arxiv.org\/pdf\/2012.12373.pdf\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u043c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438<\/a> \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043b\u0438 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0435 \u0446\u0438\u043a\u043b\u044b HDD \u0438 SSD \u043f\u0443\u0442\u0435\u043c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u0445 \u043d\u0430 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043d\u0430\u0431\u043e\u0440\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u043b\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u043d\u0435\u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043c\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a (UE, Uncorrectable Error) \u0434\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043e\u0442\u043a\u0430\u0437\u0430 \u0434\u0438\u0441\u043a\u0430 &#8212; \u043e\u0448\u0438\u0431\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043c\u043e\u0433\u043b\u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c ECC<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/b9a\/d37\/68f\/b9ad3768f4ee3b813671a084a5ca48c1.png\" alt=\"\u0412\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u043d\u0435\u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043c\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0432 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u044f\u0445\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b9a\/d37\/68f\/b9ad3768f4ee3b813671a084a5ca48c1.png\"\/><\/p>\n<div><figcaption>\u0412\u043e\u0437\u043d\u0438\u043a\u043d\u043e\u0432\u0435\u043d\u0438\u0435 \u043d\u0435\u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043c\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0432 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u044f\u0445<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u044b\u0432\u043e\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<ul>\n<li>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u0443 SSD \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0436\u0438\u0437\u043d\u0438 \u0434\u0438\u0441\u043a\u0430, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0443 HDD &#8212; \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0434\u0438\u0441\u043a\u0430 (Head Flying Hours)<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0448\u0438\u0431\u043e\u043a HDD \u0440\u0435\u0437\u043a\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442 \u0437\u0430 2 \u0434\u043d\u044f \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043a\u0430\u0437\u043e\u043c<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043e\u0448\u0438\u0431\u043e\u043a \u043d\u0430 SSD \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u043d\u0430 HDD<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b\u0432\u043e\u0434: \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e (\u043d\u0430 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0438 \u0438 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u041e\u0421) \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u0438 \u0438\u043c\u0435\u044e\u0442 \u043a\u043e\u0434\u044b \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438 \u043e\u0448\u0438\u0431\u043e\u043a, \u043d\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043d\u0438\u0445 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442.<\/p>\n<p>P.S. \u043f\u0443\u043d\u043a\u0442 1 &#8212; \u0435\u0449\u0435 \u043e\u0434\u043d\u0430 \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u043e \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u044b<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u0430\u0445 \u0432 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u044f\u0445 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0434\u043b\u044f &#171;\u043e\u0431\u0449\u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f&#187;. \u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043a \u043d\u0438\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0435\u0442 (\u0440\u0430\u043d\u044c\u0448\u0435 \u0431\u044b\u043b\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 Read Long \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0441\u044b\u0440\u043e\u0433\u043e \u0441\u0435\u043a\u0442\u043e\u0440\u0430 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u043e\u0439, \u043d\u043e \u043e\u043d\u0430 <a href=\"https:\/\/serverfault.com\/questions\/417948\/is-there-way-to-read-sectors-from-sata-drive-without-ecc-correction\/418392#418392\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u043c\u0435\u0447\u0435\u043d\u0430 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0439<\/a> \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f).<\/p>\n<p>\u041f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u043d\u0435 \u043f\u043e\u043c\u043e\u0433 <a class=\"mention\" href=\"\/users\/ahabreader\">@ahabreader<\/a> \u0438 \u043f\u0440\u043e\u0446\u0438\u0442\u0438\u0440\u0443\u044e \u0435\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u043e \u043c\u0435\u0441\u0442\u0435 \u0447\u0435\u043a-\u0441\u0443\u043c\u043c \u0432\u043e \u0432\u0441\u0435\u043c \u044d\u0442\u043e\u043c \u0441\u0442\u0435\u043a\u0435<\/p>\n<blockquote>\n<p>\u0421\u0442\u0440\u0435\u043c\u044f\u0441\u044c \u043a \u00abend-to-end data integrity\u00bb \u043c\u044b \u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u043d\u0435 \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0438\u0436\u0435\u043b\u0435\u0436\u0430\u0449\u0438\u043c \u0443\u0440\u043e\u0432\u043d\u044f\u043c \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0447\u0435\u043a\u0441\u0443\u043c\u043c\u044b \u0434\u043b\u044f \u0432\u0441\u0435\u0433\u043e \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0424\u0421 (zfs, btrfs, ReFS) \u0438\u043b\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 RAID-\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 (\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 T10-DIF, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043c\u0435\u043b\u0441\u044f \u0432 \u0432\u0438\u0434\u0443 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0435 \u043f\u0440\u043e \u0441\u0435\u043a\u0442\u043e\u0440\u0430 \u043d\u0430 520 \u0431\u0430\u0439\u0442)<\/p>\n<\/blockquote>\n<\/div>\n<\/details>\n<h3>\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430<\/h3>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u043e\u0438\u0442 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c &#8212; \u044d\u0442\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u044f. \u042d\u0442\u043e\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0437\u043d\u0430\u0435\u0442 \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u043e\u0442 \u041e\u0421 \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u0412\u0430\u0436\u043d\u043e\u0439 \u0434\u0435\u0442\u0430\u043b\u044c\u044e \u0437\u0434\u0435\u0441\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0434\u0438\u0441\u043a\u043e\u0432\u044b\u0439 \u043a\u044d\u0448 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u044f &#8212; \u0442\u0443\u0434\u0430 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u043f\u0440\u043e <code>fsync<\/code> &#8212; \u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0442\u044c \u0441\u0431\u0440\u043e\u0441 \u0432\u0441\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0434\u0438\u0441\u043a, \u0442.\u0435. \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u043e\u0447\u043d\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435. \u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c man \u0434\u043b\u044f <code>fsync<\/code> \u0441\u0435\u0439\u0447\u0430\u0441, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c:<\/p>\n<blockquote>\n<p>The fsync() implementations in older kernels and lesser used filesystems do not know how to flush disk caches. In these cases disk caches need to be disabled using hdparm(8) or sdparm(8) to guarantee safe operation.<\/p>\n<\/blockquote>\n<p>\u0412 \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 \u044f\u0434\u0440\u0430 (\u0441\u0443\u0434\u044f \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0439 \u0440\u0430\u043d\u0435\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 2.2) <code>fsync<\/code> \u043d\u0435 \u0437\u043d\u0430\u043b \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u043a\u044d\u0448 \u0434\u0438\u0441\u043a\u0430, \u043a\u0430\u043a \u0438 \u043d\u0435 \u0437\u043d\u0430\u043b\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0434\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b. \u0415\u0441\u043b\u0438 \u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/lwn.net\/Articles\/457667\/\" rel=\"noopener noreferrer nofollow\">Ensuring data reaches disk<\/a>, \u0442\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 \u044f\u0434\u0440\u0430 2.6.35 ext3, ext4, xfs \u0438 btrfs \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0441 \u0444\u043b\u0430\u0433\u043e\u043c <code>barrier<\/code>, \u0447\u0442\u043e\u0431\u044b \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0430\u0440\u044c\u0435\u0440\u044b (\u0441\u0431\u0440\u043e\u0441 \u0434\u0438\u0441\u043a\u043e\u0432\u043e\u0433\u043e \u043a\u044d\u0448\u0430). \u041f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435, \u0432 man \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0434\u043b\u044f <a href=\"https:\/\/man.linuxexplore.com\/htmlman8\/mount.8.html\" rel=\"noopener noreferrer nofollow\">mount<\/a> \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438\u043c\u0435\u044e\u0442 \u0444\u043b\u0430\u0433 <code>barrier<\/code>.<\/p>\n<p>\u042f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430\u043b \u0432 <a href=\"https:\/\/github.com\/torvalds\/linux\/tree\/a4145ce1e7bc247fd6f2846e8699473448717b37\/fs\" rel=\"noopener noreferrer nofollow\">\u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 Linux<\/a> \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u0443\u043c\u0435\u044e\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c fsync, \u043d\u043e \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0432\u044b\u0432\u043e\u0434\u0443, \u0447\u0442\u043e \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 <code>fsync<\/code> \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0432 readonly \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/torvalds\/linux\/blob\/67be068d31d423b857ffd8c34dbcc093f8dfff76\/fs\/efs\/dir.c#L13\" rel=\"noopener noreferrer nofollow\">efs<\/a> \u0438 <a href=\"https:\/\/github.com\/torvalds\/linux\/blob\/67be068d31d423b857ffd8c34dbcc093f8dfff76\/fs\/isofs\/dir.c#L268\" rel=\"noopener noreferrer nofollow\">isofs<\/a> \u043d\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 <code>fsync<\/code>). \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u0432\u043e\u0435\u0439 \u043b\u043e\u0433\u0438\u043a\u0438 \u0441\u0431\u0440\u043e\u0441\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435 \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0440\u0443\u0435\u043c\u0430\u044f), \u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e <code>fsync<\/code> &#8212; \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0439 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432:<\/p>\n<pre><code class=\"cpp\">\/\/ https:\/\/github.com\/torvalds\/linux\/blob\/a4145ce1e7bc247fd6f2846e8699473448717b37\/block\/bdev.c#L203 \/*  * Write out and wait upon all the dirty data associated with a block  * device via its mapping.  Does not take the superblock lock.  *\/ int sync_blockdev(struct block_device *bdev) { if (!bdev) return 0; return filemap_write_and_wait(bdev->bd_inode->i_mapping); } EXPORT_SYMBOL(sync_blockdev);  \/\/ https:\/\/github.com\/torvalds\/linux\/blob\/a4145ce1e7bc247fd6f2846e8699473448717b37\/mm\/filemap.c#L779 \/**  * file_write_and_wait_range - write out &amp; wait on a file range  * @file:file pointing to address_space with pages  * @lstart:offset in bytes where the range starts  * @lend:offset in bytes where the range ends (inclusive)  *  * Write out and wait upon file offsets lstart->lend, inclusive.  *  * Note that @lend is inclusive (describes the last byte to be written) so  * that this function can be used to write to the very end-of-file (end = -1).  *  * After writing out and waiting on the data, we check and advance the  * f_wb_err cursor to the latest value, and return any errors detected there.  *  * Return: %0 on success, negative error code otherwise.  *\/ int file_write_and_wait_range(struct file *file, loff_t lstart, loff_t lend) { int err = 0, err2; struct address_space *mapping = file->f_mapping;  if (lend &lt; lstart) return 0;  if (mapping_needs_writeback(mapping)) { err = __filemap_fdatawrite_range(mapping, lstart, lend,  WB_SYNC_ALL); \/* See comment of filemap_write_and_wait() *\/ if (err != -EIO) __filemap_fdatawait_range(mapping, lstart, lend); } err2 = file_check_and_advance_wb_err(file); if (!err) err = err2; return err; } EXPORT_SYMBOL(file_write_and_wait_range);  \/\/ https:\/\/github.com\/torvalds\/linux\/blob\/a4145ce1e7bc247fd6f2846e8699473448717b37\/fs\/hfs\/inode.c#L661 static int hfs_file_fsync(struct file *filp, loff_t start, loff_t end,   int datasync) {     \/\/ ... file_write_and_wait_range(filp, start, end); \/\/ ... sync_blockdev(sb->s_bdev); \/\/ ... return ret; } <\/code><\/pre>\n<h3>\u0413\u0430\u0440\u0430\u043d\u0442\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438<\/h3>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a\u0438\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0430\u044e\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u041f\u043e\u0434 \u044d\u0442\u0438\u043c \u044f \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e 2 \u0432\u0435\u0449\u0438:<\/p>\n<ul>\n<li>\n<p>\u0410\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438<\/p>\n<\/li>\n<li>\n<p>PowerSafe OverWrite (PSOW)<\/p>\n<\/li>\n<\/ul>\n<h4>\u0410\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438<\/h4>\n<p>\u0427\u0442\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430 \u0434\u0438\u0441\u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0435 \u043f\u043e 1 \u0431\u0430\u0439\u0442\u0443 \u0437\u0430 \u0440\u0430\u0437, \u0430 \u0431\u043b\u043e\u043a\u0430\u043c\u0438.<\/p>\n<p>\u0414\u043b\u044f HDD \u0435\u0434\u0438\u043d\u0438\u0446\u0430 \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u0438 &#8212; \u0441\u0435\u043a\u0442\u043e\u0440, \u043d\u043e \u0443 SSD \u043e\u043d\u0438 \u0440\u0430\u0437\u043d\u044b\u0435: \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0438 \u0431\u043b\u043e\u043a \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u041d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u043d\u0430 \u0435\u0434\u0438\u043d\u0438\u0446\u0443 \u0437\u0430\u043f\u0438\u0441\u0438. \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u0432\u0435\u0442\u0443 <a href=\"https:\/\/stackoverflow.com\/a\/61832882\" rel=\"noopener noreferrer nofollow\">\u043d\u0430 StackOverflow<\/a> &#8212; \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e (likely) \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u0430, \u043d\u043e \u043f\u0440\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0438, \u0447\u0442\u043e:<\/p>\n<ul>\n<li>\n<p>\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u0438\u0441\u043a\u0430 \u0438\u043c\u0435\u0435\u0442 \u0437\u0430\u043f\u0430\u0441\u043d\u0443\u044e \u0431\u0430\u0442\u0430\u0440\u0435\u044e<\/p>\n<\/li>\n<li>\n<p>\u0412\u0435\u043d\u0434\u043e\u0440 SCSI \u0434\u0438\u0441\u043a\u0430 \u0434\u0430\u0435\u0442 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0441\u0442\u0438 \u0437\u0430\u043f\u0438\u0441\u0438<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f NVMe \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0417\u0432\u0443\u0447\u0438\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0443 \u044d\u0442\u043e \u0437\u0430 \u043e\u0442\u0432\u0435\u0442.<\/p>\n<h4>PowerSafe OverWrite (PSOW)<\/h4>\n<p><a href=\"https:\/\/www.sqlite.org\/psow.html\" rel=\"noopener noreferrer nofollow\">PowerSafe OverWrite<\/a> &#8212; \u044d\u0442\u043e \u0442\u0435\u0440\u043c\u0438\u043d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 SQLite \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u0438 \u0434\u0438\u0441\u043a\u043e\u0432 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e\u0433\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u0442\u0432\u0430. \u0417\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u043d\u043e \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c:<\/p>\n<blockquote>\n<p>When an application writes a range of bytes in a file, no bytes outside of that range will change, even if the write occurs just before a crash or power failure.<\/p>\n<\/blockquote>\n<p>\u041f\u0435\u0440\u0435\u0432\u043e\u0434:<\/p>\n<blockquote>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0442\u043a\u0430\u0437\u0430 \u0438\u043b\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0438\u0442\u0430\u043d\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0431\u0430\u0439\u0442\u043e\u0432 \u0432 \u0444\u0430\u0439\u043b, \u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u044d\u0442\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b.<\/p>\n<\/blockquote>\n<p>\u0412 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435, \u044d\u0442\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0431\u0430\u0442\u0430\u0440\u0435\u0438 \u0432 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u0435 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u0442, \u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0435 \u0441\u0435\u043a\u0442\u043e\u0440\u0430 \u0438 \u043e\u043d \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0430\u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u043c. \u0415\u0441\u043b\u0438 \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u043c\u044b \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u0435\u043a\u0442\u043e\u0440\u0430 \u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043d\u0435\u0433\u043e \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u0430, \u0442\u043e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 PSOW \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u043b\u044f \u043d\u0430\u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439.<\/p>\n<details class=\"spoiler\">\n<summary>\u0410\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0441\u0442\u044c \u0438 PSOW &#8212; \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0410\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0441\u0442\u044c \u0438 PowerSafe OverWrite &#8212; \u044d\u0442\u043e \u0440\u0430\u0437\u043d\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0438 \u043e\u0434\u043d\u043e \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u043d\u044b\u043c \u0441\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0440\u0443\u0433\u043e\u0433\u043e.<\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0442\u0430\u043a\u0443\u044e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e &#8212; \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u0444\u0430\u0439\u043b\u0430 \u0438 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043b\u043e\u0441\u044c \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u0442\u0432\u043e. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u0439, \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0437\u043d\u044b\u043c\u0438.<\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 3 \u0441\u0435\u043a\u0442\u043e\u0440\u0430, \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0445 0, \u0438 \u0445\u043e\u0442\u0438\u043c \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u043c\u0438, \u043f\u0440\u0438\u0447\u0435\u043c \u044d\u0442\u043e\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0437\u0430\u0442\u0440\u0430\u0433\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u0418\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<pre><code>              \u0410         \u0411         \u0412 \u0421\u0435\u043a\u0442\u043e\u0440\u044b: |000000000|000000000|000000000|         \u0417\u0430\u043f\u0438\u0441\u044c:       |------------------| <\/code><\/pre>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438:<\/p>\n<ol>\n<li>\n<p>Atomic + PSOW<\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0441\u0435\u043a\u0442\u043e\u0440 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043b\u0438\u0431\u043e \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043b\u0438\u0431\u043e \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (\u0431\u0438\u0442\u044b \u0431\u044b\u043b\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b).<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438:<\/p>\n<pre><code>\u0410: |000011111|000000000|000000000|         |------------------|  \u0411: |000000000|111111111|000000000|         |------------------|  \u0412: |000000000|000000000|111100000|         |------------------| <\/code><\/pre>\n<\/li>\n<li>\n<p>!Atomic + PSOW<\/p>\n<p>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0441\u0435\u043a\u0442\u043e\u0440 \u0410 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u0435\u043b \u0441\u0431\u043e\u0439. \u0422\u043e\u0433\u0434\u0430 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043b\u044e\u0431\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0442.\u0435. \u0431\u0443\u0434\u0443\u0442 \u0441\u043c\u0435\u0448\u0430\u043d\u044b \u0441\u0442\u0430\u0440\u044b\u0435 \u0438 \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u0431\u0438\u0442\u044b \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u043a\u0442\u043e\u0440\u0430 \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0442\u044b \u043d\u0435 \u0431\u0443\u0434\u0443\u0442.<\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0442\u0430\u043a\u0438\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438:<\/p>\n<pre><code>\u0410: |000011010|000000000|000000000|         |------------------|  \u0411: |000000000|110011010|000000000|         |------------------|  \u0412: |000000000|000000000|001000000|         |------------------| <\/code><\/pre>\n<p>\u0413\u043b\u0430\u0432\u043d\u043e\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u044d\u0442\u043e\u0433\u043e \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u043d\u0435 \u0431\u044b\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b.<\/p>\n<\/li>\n<li>\n<p>Atomic + !PSOW<\/p>\n<p>\u0414\u0435\u043b\u0430 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0441\u0435\u043a\u0442\u043e\u0440 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u0430, \u043d\u043e PSOW \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u043c. \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u0435\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 SQLite: \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0438 \u0443\u0447\u0430\u0441\u0442\u043a\u0430 \u0444\u0430\u0439\u043b\u0430 \u041e\u0421 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0432\u0435\u0441\u044c \u0441\u0435\u043a\u0442\u043e\u0440, \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0432 \u043d\u0435\u043c \u043d\u0443\u0436\u043d\u044b\u0435 \u0431\u0430\u0439\u0442\u044b, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u0434\u0438\u0441\u043a (Read Modify Write) \u0438 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u0442\u0432\u0430. \u0414\u0430\u043d\u043d\u044b\u0435 \u0431\u044b\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e, ECC \u043d\u0435 \u0431\u044b\u043b \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d \u0438 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0434\u0438\u0441\u043a \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u0435\u043a\u0442\u043e\u0440 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u0438 \u0437\u0430\u043d\u0443\u043b\u044f\u0435\u0442 \u0435\u0433\u043e. \u0425\u043e\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c \u0438 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u0430, \u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u043c\u0438 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 \u0431\u044b\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b. \u0412 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c (\u0435\u0434\u0438\u043d\u0438\u0446\u044b \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u0447\u0438\u0441\u0442\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b):<\/p>\n<pre><code>\u0410: |111111111|000000000|000000000|         |------------------|  \u0411: |000000000|111111111|000000000|         |------------------|  \u0412: |000000000|000000000|111111111|         |------------------| <\/code><\/pre>\n<\/li>\n<li>\n<p>!Atomic + !PSOW<\/p>\n<p>\u042d\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0438 \u0441\u0430\u043c\u044b\u0439 \u0441\u0442\u0440\u0430\u0448\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043c\u044b \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0439 \u043d\u0435 \u0434\u0430\u0435\u043c \u0438 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043b\u044e\u0431\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0438\u043d\u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0432\u0441\u0435\u0433\u043e \u0441\u0435\u043a\u0442\u043e\u0440\u0430. \u041a\u0430\u0440\u0442\u0438\u043d\u0430 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0445\u043e\u0436\u0430 \u043d\u0430 3 \u0441\u043b\u0443\u0447\u0430\u0439.<\/p>\n<\/li>\n<\/ol>\n<p>\u0412 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 <a href=\"https:\/\/github.com\/hashicorp\/raft-wal\" rel=\"noopener noreferrer nofollow\">hashicorp\/raft-wal<\/a> \u0438\u043c\u0435\u0435\u0442\u0441\u044f README, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0439 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430.<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0410\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0441\u0442\u044c<\/p>\n<\/th>\n<th>\n<p align=\"left\">PowerSafe OverWrite<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><a href=\"https:\/\/sqlite.org\/atomiccommit.html#_hardware_assumptions\" rel=\"noopener noreferrer nofollow\">SQLite<\/a><\/p>\n<\/td>\n<td>\n<p align=\"left\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"left\">+ (\u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 3.7.9)<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><a href=\"https:\/\/github.com\/hashicorp\/raft-wal\/tree\/main?tab=readme-ov-file#our-assumptions\" rel=\"noopener noreferrer nofollow\">Hashicorp<\/a><\/p>\n<\/td>\n<td>\n<p align=\"left\">&#8212;<\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><a href=\"https:\/\/github.com\/hashicorp\/raft-wal\/tree\/main?tab=readme-ov-file#user-content-etcd-wal\" rel=\"noopener noreferrer nofollow\">Etcd\/wal<\/a><\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><a href=\"https:\/\/github.com\/hashicorp\/raft-wal\/tree\/main?tab=readme-ov-file#user-content-lmdb\" rel=\"noopener noreferrer nofollow\">LMDB<\/a><\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<td>\n<p align=\"left\">&#8212;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\"><a href=\"https:\/\/github.com\/hashicorp\/raft-wal\/tree\/main?tab=readme-ov-file#user-content-rocksdb-wal\" rel=\"noopener noreferrer nofollow\">BoltDB<\/a><\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<td>\n<p align=\"left\">+<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/details>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0438 \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c, \u043d\u043e \u043c\u044b \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u043e\u0434\u0438\u043d \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0432\u0430\u0436\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 &#8212; \u0441\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<h2>\u0420\u0430\u043d\u0442\u0430\u0439\u043c<\/h2>\n<p>\u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u044b \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u043e\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0440\u0430\u0437\u0443 \u043a \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. \u041d\u043e \u043c\u0435\u0436\u0434\u0443 \u043d\u0438\u043c\u0438 \u043c\u043e\u0436\u0435\u0442 \u043b\u0435\u0436\u0430\u0442\u044c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u043b\u043e\u0439 &#8212; \u0440\u0430\u043d\u0442\u0430\u0439\u043c:<\/p>\n<ul>\n<li>\n<p>\u0421\u0440\u0435\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f &#8212; Node.js, .NET, JVM<\/p>\n<\/li>\n<li>\n<p>\u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440\u044b &#8212; Python, Ruby<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0432 C\/C++ \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u0432\u044b\u0437\u0432\u0430\u0442\u044c (\u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432) <code>fsync<\/code>, \u0442\u043e \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u0430\u0434\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430. \u0421\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u0440\u043e <code>fsync<\/code>, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c \u0434\u043b\u044f \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043d\u0438\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u0412 java \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <code>force(true)<\/code> \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e. \u0412 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e:<\/p>\n<blockquote>\n<p>Forces any updates to this channel&#8217;s file to be written to the storage device that contains it.<\/p>\n<\/blockquote>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e <code>fsync<\/code> \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043c\u044b \u043f\u043e\u043b\u0430\u0433\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0440\u0435\u0434\u0430 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 .NET &#8212; \u0443 \u043a\u043b\u0430\u0441\u0441\u0430 <code>FileStream<\/code> \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <code>Flush(bool flushToDisk)<\/code>. \u0415\u0441\u043b\u0438 \u0435\u043c\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>true<\/code>, \u0442\u043e \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430 \u0434\u0438\u0441\u043a:<\/p>\n<blockquote>\n<p>Use this overload when you want to ensure that all buffered data in intermediate file buffers is written to disk. When you call the Flush method, the operating system I\/O buffer is also flushed.<\/p>\n<\/blockquote>\n<p>\u041d\u043e \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u0440\u043e <code>fsync<\/code> \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043e. \u0414\u0430, \u044d\u0442\u043e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u0430\u044f \u0434\u0435\u0442\u0430\u043b\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438, \u043d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0442\u043e\u0447\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c. \u0427\u0442\u043e \u044f \u0438 \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c &#8212; \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u0430\u043a \u0441\u0435\u0431\u044f \u0432\u0435\u0434\u0435\u0442 \u0432\u044b\u0437\u043e\u0432 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0438\u0441\u043a\u0430\u043b \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 \u0438 \u043d\u0430\u0448\u0435\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0432\u044b\u0437\u043e\u0432\u043e\u0432:<\/p>\n<details class=\"spoiler\">\n<summary>\u0426\u0435\u043f\u043e\u0447\u043a\u0430 \u0432\u044b\u0437\u043e\u0432\u043e\u0432<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cs\">public class FileStream {     private readonly FileStreamStrategy _strategy;          \/\/ https:\/\/github.com\/dotnet\/runtime\/blob\/da781b3aab1bc30793812bced4a6b64d2df31a9f\/src\/libraries\/System.Private.CoreLib\/src\/System\/IO\/FileStream.cs#L389     public virtual void Flush(bool flushToDisk)     {         if (_strategy.IsClosed)         {             ThrowHelper.ThrowObjectDisposedException_FileClosed();         }          _strategy.Flush(flushToDisk);     } }  internal abstract class OSFileStreamStrategy : FileStreamStrategy {     \/\/ https:\/\/github.com\/dotnet\/runtime\/blob\/da781b3aab1bc30793812bced4a6b64d2df31a9f\/src\/libraries\/System.Private.CoreLib\/src\/System\/IO\/Strategies\/OSFileStreamStrategy.cs#L137     internal sealed override void Flush(bool flushToDisk)     {         if (flushToDisk &amp;&amp; CanWrite)         {             FileStreamHelpers.FlushToDisk(_fileHandle);         }     } }  internal static partial class FileStreamHelpers {     \/\/ https:\/\/github.com\/dotnet\/runtime\/blob\/da781b3aab1bc30793812bced4a6b64d2df31a9f\/src\/libraries\/System.Private.CoreLib\/src\/System\/IO\/Strategies\/FileStreamHelpers.Unix.cs#L40     internal static void FlushToDisk(SafeFileHandle handle)     {         if (Interop.Sys.FSync(handle) &lt; 0)         {             Interop.ErrorInfo errorInfo = Interop.Sys.GetLastErrorInfo();             switch (errorInfo.Error)             {                 case Interop.Error.EROFS:                 case Interop.Error.EINVAL:                 case Interop.Error.ENOTSUP:                     \/\/ Ignore failures for special files that don't support synchronization.                     \/\/ In such cases there's nothing to flush.                     break;                 default:                     throw Interop.GetExceptionForIoErrno(errorInfo, handle.Path);             }         }     } }  internal static partial class Interop {     internal static partial class Sys     {         \/\/ https:\/\/github.com\/dotnet\/runtime\/blob\/da781b3aab1bc30793812bced4a6b64d2df31a9f\/src\/libraries\/Common\/src\/Interop\/Unix\/System.Native\/Interop.FSync.cs#L11         [LibraryImport(Libraries.SystemNative, EntryPoint = \"SystemNative_FSync\", SetLastError = true)]         internal static partial int FSync(SafeFileHandle fd);     } }  \/\/ https:\/\/github.com\/dotnet\/runtime\/blob\/da781b3aab1bc30793812bced4a6b64d2df31a9f\/src\/native\/libs\/System.Native\/pal_io.c#L736 int32_t SystemNative_FSync(intptr_t fd) {     int fileDescriptor = ToFileDescriptor(fd);      int32_t result;     while ((result = #if defined(TARGET_OSX) &amp;&amp; HAVE_F_FULLFSYNC     fcntl(fileDescriptor, F_FULLFSYNC) #else     fsync(fileDescriptor) #endif     &lt; 0) &amp;&amp; errno == EINTR);     return result; } <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c, \u043f\u0440\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0438 <code>true<\/code>, \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u0432\u044b\u0437\u043e\u0432 <code>fsync<\/code>. \u0414\u0430\u043b\u044c\u0448\u0435 \u044f \u0437\u0430\u0445\u043e\u0442\u0435\u043b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u044d\u0442\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0438 \u043e\u0442\u0441\u043b\u0435\u0434\u0438\u043b \u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>strace<\/code>.<\/p>\n<pre><code class=\"cs\">using var file = new FileStream(\"sample.txt\", FileMode.OpenOrCreate); file.Write(\"hello, world\"u8); file.Flush(true); <\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0447\u0430\u0441\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u0430 <code>strace<\/code> \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0438 \u0434\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u044f \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code>openat(AT_FDCWD, \"\/path\/sample.txt\", O_RDWR|O_CREAT|O_CLOEXEC, 0666) = 19 lseek(19, 0, SEEK_CUR)                  = 0 pwrite64(19, \"hello, world\", 12, 0)     = 12 fsync(19)                               = 0 flock(19, LOCK_UN)                      = 0 close(19)                               = 0 <\/code><\/pre>\n<p>\u041f\u043e \u0448\u0430\u0433\u0430\u043c:<\/p>\n<ol>\n<li>\n<p><code>openat<\/code> &#8212; \u041e\u0442\u043a\u0440\u044b\u0442 \u0444\u0430\u0439\u043b \u0441 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u043c 19<\/p>\n<\/li>\n<li>\n<p><code>lseek<\/code> &#8212; \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0441\u043c\u0435\u0449\u0435\u043d \u0432 \u0441\u0430\u043c\u043e\u0435 \u043d\u0430\u0447\u0430\u043b\u0430<\/p>\n<\/li>\n<li>\n<p><code>pwrite64<\/code> &#8212; \u0417\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u043d\u0430\u0448\u0438 \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<li>\n<p><code>fsync(19)<\/code> &#8212; \u0412\u044b\u0437\u043e\u0432 <code>fsync<\/code> &#8212; \u0441\u0431\u0440\u043e\u0441 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0434\u0438\u0441\u043a<\/p>\n<\/li>\n<li>\n<p><code>close(19)<\/code> &#8212; \u0424\u0430\u0439\u043b \u0437\u0430\u043a\u0440\u044b\u0442<\/p>\n<\/li>\n<\/ol>\n<p>\u0412\u043e\u0442 \u0438 \u0445\u043e\u0440\u043e\u0448\u043e &#8212; <code>fsync<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f. \u041d\u043e \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0432\u0435\u0440\u0441\u0438\u044e .NET 8.0.1. \u041c\u043d\u0435 \u0441\u0442\u0430\u043b\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u043a\u0430\u043a \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445. \u042f \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b .NET 7 (7.0.11), \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b \u0441 \u0442\u0435\u043c\u0438 \u0436\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b <code>strace<\/code>:<\/p>\n<pre><code>openat(AT_FDCWD, \"\/path\/sample.txt\", O_RDWR|O_CREAT|O_CLOEXEC, 0666) = 19 lseek(19, 0, SEEK_CUR)                  = 0 pwrite64(19, \"hello, world\", 12, 0)     = 12 flock(19, LOCK_UN)                      = 0 close(19)                               = 0 <\/code><\/pre>\n<p>\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 \u043d\u0435\u0442 <code>fsync<\/code>! \u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0435\u0441\u043b\u0438 \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>Flush(true)<\/code> \u0435\u0449\u0435 \u0440\u0430\u0437, \u0442\u043e \u043e\u043d \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f:<\/p>\n<pre><code>openat(AT_FDCWD, \"\/path\/sample.txt\", O_RDWR|O_CREAT|O_CLOEXEC, 0666) = 19 lseek(19, 0, SEEK_CUR)                  = 0 pwrite64(19, \"hello, world\", 12, 0)     = 12 fsync(19)                               = 0 flock(19, LOCK_UN)                      = 0 close(19)                               = 0 <\/code><\/pre>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435, \u044f \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0432\u044b\u0432\u043e\u0434\u0443, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 <code>Flush(true)<\/code> \u043f\u043e \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 <code>fsync<\/code>.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u0445, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0441\u0430\u043c\u0438\u043c \u044f\u0437\u044b\u043a\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>fsync<\/code> \u043c\u043e\u0436\u0435\u0442 (\u0438 \u0434\u043e\u043b\u0436\u0435\u043d) \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u0445, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432. \u0422\u0443\u0442 \u044f \u043e\u043f\u044f\u0442\u044c \u043f\u043e\u0436\u0430\u043b\u0443\u044e\u0441\u044c \u043d\u0430 C# &#8212; \u043f\u043e\u043d\u044f\u0442\u0438\u044f \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043d\u0435\u0442 (\u043d\u0430\u0441\u043b\u0435\u0434\u0438\u0435 Windows). \u0410 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438 \u043d\u0435\u043b\u044c\u0437\u044f &#8212; \u0443 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Directory<\/code> \u043d\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u0430 <code>Open<\/code> \u0438\u043b\u0438 \u043a\u0430\u043a\u043e\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430\u043f\u043e\u0434\u043e\u0431\u0438\u0435 <code>Sync<\/code>, \u0430 \u0435\u0441\u043b\u0438 \u0432 <code>FileStream<\/code> \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u0443\u0442\u044c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u0434\u0430\u0436\u0435 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0435\u043c ReadOnly \u0440\u0435\u0436\u0438\u043c\u0430, \u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <code>UnauthorizedAccessException<\/code>. \u042d\u0442\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u0438\u0435 Windows.<\/p>\n<p>\u042f \u043d\u0430\u0448\u0435\u043b \u043e\u0431\u0445\u043e\u0434\u043d\u043e\u0439 \u043f\u0443\u0442\u044c: \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e P\/Invoke \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>open<\/code> \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u0430 \u043f\u043e\u0441\u043b\u0435 \u0438\u0437 \u043d\u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c <code>SafeFileHandle<\/code>. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u043d\u0435\u0442 \u0438 <code>fsync<\/code> \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c.<\/p>\n<pre><code class=\"cs\">var directory = Directory.CreateDirectory(\"sample-directory\"); const int directoryFlags = 65536; \/\/ O_DIRECTORY | O_RDONLY var handle = Open(directory.FullName, directoryFlags);  using var stream = new FileStream(new SafeFileHandle(handle, true), FileAccess.ReadWrite); stream.Flush(true);  [DllImport(\"libc\", EntryPoint = \"open\")] static extern nint Open(string path, int flags); <\/code><\/pre>\n<p>\u0418 \u0432\u043e\u0442 <code>strace<\/code><\/p>\n<pre><code>openat(AT_FDCWD, \"\/path\/sample-directory\", O_RDONLY|O_DIRECTORY) = 19 lseek(19, 0, SEEK_CUR)                  = 0 lseek(19, 0, SEEK_CUR)                  = 0 fsync(19)                               = 0 close(19)                               = 0 <\/code><\/pre>\n<h3>\u0418\u0442\u043e\u0433<\/h3>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435, \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0442\u043e, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u043b\u043e\u0439, \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u0438\u043c\u0435\u0435\u0442 \u0434\u0435\u0442\u0430\u043b\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c. \u0412\u0441\u0435 \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u044e \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043c\u0443\u0441\u043e\u0440\u0430, \u043f\u043e\u0442\u0435\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0445 \u0438\u0441\u0445\u043e\u0434\u043e\u0432. \u041d\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u0435 \u043d\u0438\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0439 \u0441\u0442\u0435\u043a \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438 \u044d\u0442\u0438 \u0441\u0430\u043c\u044b\u0435 \u0434\u0435\u0442\u0430\u043b\u0438.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/8f5\/7ea\/9b0\/8f57ea9b02c6589b254d992e5bb49009.png\" alt=\"\u0421\u0442\u0435\u043a \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/8f5\/7ea\/9b0\/8f57ea9b02c6589b254d992e5bb49009.png\"\/><\/p>\n<div><figcaption>\u0421\u0442\u0435\u043a \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438<\/figcaption><\/div>\n<\/figure>\n<h2>\u041f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0445 \u0441\u0431\u043e\u0435\u0432 \u0438 \u043e\u0448\u0438\u0431\u043e\u043a, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0441 \u043d\u0438\u043c\u0438 \u043c\u043e\u0436\u043d\u043e \u0431\u043e\u0440\u043e\u0442\u044c\u0441\u044f.<\/p>\n<h3>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<\/h3>\n<p>\u0416\u0438\u0437\u043d\u044c \u0444\u0430\u0439\u043b\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0435\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f. \u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c, \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u043d\u0435\u043b\u044c\u0437\u044f &#8212; \u0435\u0433\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438 \u043d\u0435 \u0431\u044b\u0442\u044c \u043a \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b, \u0442\u043e \u043f\u043e\u0441\u043b\u0435 <code>creat<\/code> \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c <code>fsync<\/code>:<\/p>\n<ol>\n<li>\n<p><code>creat(\"\/dir\/data\")<\/code> &#8212; \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/p>\n<\/li>\n<li>\n<p><code>fsync(\"\/dir\")<\/code> &#8212; \u0410\u043a\u0442\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0444\u0430\u0439\u043b\u0430<\/p>\n<\/li>\n<\/ol>\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e, \u0444\u0430\u0439\u043b \u043f\u0443\u0441\u0442. \u041d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0443\u0436\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d? \u041a\u0430\u043a \u043c\u044b \u0443\u0436\u0435 \u0432\u0438\u0434\u0435\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c &#171;\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b&#187;, &#171;\u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435&#187;, &#171;\u0437\u0430\u043a\u0440\u044b\u0442\u044c&#187; \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u043e\u0442\u043a\u0430\u0437\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u0443\u0441\u043e\u0440, \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u044b\u043c \u0438\u043b\u0438, \u0432\u043e\u043e\u0431\u0449\u0435, \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043f\u0430\u0442\u0442\u0435\u0440\u043d <code>Atomic Create Via Rename<\/code>. \u0418\u043c\u044f \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0441\u0430\u043c\u043e \u0437\u0430 \u0441\u0435\u0431\u044f &#8212; \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:<\/p>\n<ol>\n<li>\n<p><code>creat(\"\/dir\/data.tmp\")<\/code> &#8212; \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b<\/p>\n<\/li>\n<li>\n<p><code>write(\"\/dir\/data.tmp\", new_data)<\/code> &#8212; \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<li>\n<p><code>fsync(\"\/dir\/data.tmp\")<\/code> &#8212; \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a<\/p>\n<\/li>\n<li>\n<p><code>fsync(\"\/dir\")<\/code> &#8212; \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a (\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430)<\/p>\n<\/li>\n<li>\n<p><code>rename(\"\/dir\/data.tmp\", \"\/dir\/data\")<\/code> &#8212; \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u0439<\/p>\n<\/li>\n<li>\n<p><code>fsync(\"\/dir\")<\/code> &#8212; \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a (\u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435)<\/p>\n<\/li>\n<\/ol>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u043b\u043e\u0433\u0430 \u0432 etcd<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 &#8212; \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043b\u043e\u0433\u0430 \u0432 <a href=\"https:\/\/github.com\/etcd-io\/etcd\/blob\/4527093b166da6fb1d803649d7c0d7aef7d9b878\/server\/storage\/wal\/wal.go#L716\" rel=\"noopener noreferrer nofollow\">etcd<\/a>:<\/p>\n<pre><code class=\"go\">\/\/ cut closes current file written and creates a new one ready to append. \/\/ cut first creates a temp wal file and writes necessary headers into it. \/\/ Then cut atomically rename temp wal file to a wal file. func (w *WAL) cut() error { \/\/ \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 fpath := filepath.Join(w.dir, walName(w.seq()+1, w.enti+1))      \/\/ 1. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 newTail, err := w.fp.Open() if err != nil { return err }      \/\/ 2. \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \/\/ update writer and save the previous crc w.locks = append(w.locks, newTail) prevCrc := w.encoder.crc.Sum32() w.encoder, err = newFileEncoder(w.tail().File, prevCrc) if err != nil { return err } if err = w.saveCrc(prevCrc); err != nil { return err } if err = w.encoder.encode(&amp;walpb.Record{Type: MetadataType, Data: w.metadata}); err != nil { return err } if err = w.saveState(&amp;w.state); err != nil { return err }  \/\/ atomically move temp wal file to wal file          \/\/ 3-4. \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a if err = w.sync(); err != nil { return err }      \/\/ 5. \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 if err = os.Rename(newTail.Name(), fpath); err != nil { return err }  \/\/ 6. \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a if err = fileutil.Fsync(w.dirFile); err != nil { return err }  \/\/ reopen newTail with its new path so calls to Name() match the wal filename format newTail.Close() if newTail, err = fileutil.LockFile(fpath, os.O_WRONLY, fileutil.PrivateFileMode); err != nil { return err }  w.locks[len(w.locks)-1] = newTail prevCrc = w.encoder.crc.Sum32() w.encoder, err = newFileEncoder(w.tail().File, prevCrc) if err != nil { return err }  return nil } <\/code><\/pre>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438 \u044f \u043e\u0442\u043c\u0435\u0442\u0438\u043b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0448\u0430\u0433\u043e\u0432 \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u0438 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u0434\u0435. \u0428\u0430\u0433\u0438 &#8212; \u043e\u0434\u043d\u0438 \u0438 \u0442\u0435 \u0436\u0435 \u0438 \u0432 \u0442\u043e\u0439 \u0436\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u0422\u0430\u043a\u0436\u0435, \u0432 \u043a\u043e\u043d\u0446\u0435 \u0444\u0430\u0439\u043b \u0437\u0430\u043d\u043e\u0432\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430, \u0430 \u043d\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0435 (\u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u043e\u0437\u0434\u0430\u043b\u0438), \u0438 \u043d\u0430 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442.<\/p>\n<\/div>\n<\/details>\n<h3>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430<\/h3>\n<p>\u0424\u0430\u0439\u043b \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c. \u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u043d\u0435\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u0422\u0443\u0442 2 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430.<\/p>\n<h4>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<\/h4>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0430\u0442\u0442\u0435\u0440\u043d <code>Atomic Replace Via Rename<\/code> (\u0432 btrfs \u044d\u0442\u043e\u0442 \u0436\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u044f \u043d\u0430\u0448\u0435\u043b \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <code>overwrite-by-rename<\/code>). \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0442\u043e\u0442 \u0436\u0435, \u0447\u0442\u043e \u0438 \u0434\u043b\u044f <code>Atomic Create Via Rename<\/code>:<\/p>\n<ol>\n<li>\n<p><code>creat(\"\/dir\/data.tmp\")<\/code> &#8212; \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b<\/p>\n<\/li>\n<li>\n<p><code>write(\"\/dir\/data.tmp\", new_data)<\/code> &#8212; \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<li>\n<p><code>fsync(\"\/dir\/data.tmp\")<\/code> &#8212; \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a<\/p>\n<\/li>\n<li>\n<p><code>fsync(\"\/dir\")<\/code> &#8212; \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a (\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430)<\/p>\n<\/li>\n<li>\n<p><code>rename(\"\/dir\/data.tmp\", \"\/dir\/data\")<\/code> &#8212; \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u0439<\/p>\n<\/li>\n<li>\n<p><code>fsync(\"\/dir\")<\/code> &#8212; \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a (\u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435)<\/p>\n<\/li>\n<\/ol>\n<p>\u0420\u0430\u043d\u0435\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0442\u0430\u043a\u043e\u0439 \u0448\u0430\u0431\u043b\u043e\u043d \u0432 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u044e\u0442 \u0438 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044e\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0441\u0430\u043c\u0438, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u044b\u0437\u043e\u0432 <code>fsync<\/code> \u0434\u043b\u044f \u043d\u0438\u0445 \u043b\u0438\u0448\u043d\u0438\u0439. \u041d\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u044b \u043d\u0435 \u0437\u043d\u0430\u0435\u043c \u043d\u0430 \u043a\u0430\u043a\u043e\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u044d\u0442\u043e \u0432\u0441\u0435 \u0431\u0443\u0434\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043e\u043d\u0430 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0434\u0438\u0441\u043a \u0432 LevelDB<\/summary>\n<div class=\"spoiler__content\">\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432 LevelDB &#8212; \u0441\u0431\u0440\u043e\u0441 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0434\u0438\u0441\u043a \u0438\u0437 \u043f\u0430\u043c\u044f\u0442\u0438, Compaction (\u0432\u043e\u043e\u0431\u0449\u0435, \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a\u0430\u043a &#171;\u0443\u043f\u043b\u043e\u0442\u043d\u0435\u043d\u0438\u0435&#187;, \u043d\u043e \u043b\u043e\u0433\u0438\u043a\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f):<\/p>\n<pre><code class=\"cpp\">\/\/ https:\/\/github.com\/google\/leveldb\/blob\/068d5ee1a3ac40dabd00d211d5013af44be55bea\/db\/db_impl.cc#L549 void DBImpl::CompactMemTable() {   \/\/ ...    \/\/ Replace immutable memtable with the generated Table   if (s.ok()) {     edit.SetPrevLogNumber(0);     edit.SetLogNumber(logfile_number_);  \/\/ Earlier logs no longer needed     s = versions_->LogAndApply(&amp;edit, &amp;mutex_); \/\/ \u0412\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 LogAndApply \u0443 \u043a\u043b\u0430\u0441\u0441\u0430 VersionSet   }      \/\/ ... }  \/\/ https:\/\/github.com\/google\/leveldb\/blob\/068d5ee1a3ac40dabd00d211d5013af44be55bea\/db\/version_set.cc#L777 Status VersionSet::LogAndApply(VersionEdit* edit, port::Mutex* mu) {   \/\/ 1. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 - \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0440\u0430\u0432\u043a\u0438 \u043a \u0442\u0435\u043a\u0443\u0449\u0435\u043c\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e (\u043f\u043e\u043a\u0430 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438)   Version* v = new Version(this);   {     Builder builder(this, current_);     builder.Apply(edit);     builder.SaveTo(v);   }   Finalize(v);    \/\/ Initialize new descriptor log file if necessary by creating   \/\/ a temporary file that contains a snapshot of the current version.   std::string new_manifest_file;   Status s;   if (descriptor_log_ == nullptr) {      \/\/ 2. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b     new_manifest_file = DescriptorFileName(dbname_, manifest_file_number_);     s = env_->NewWritableFile(new_manifest_file, &amp;descriptor_file_);     if (s.ok()) {       \/\/ 3. \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u043d\u043e\u0432\u044b\u0439 \u0441\u043d\u0430\u043f\u0448\u043e\u0442 \u0411\u0414       descriptor_log_ = new log::Writer(descriptor_file_);       s = WriteSnapshot(descriptor_log_);     }   }    {     if (s.ok()) {       \/\/ 4. \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0434\u0438\u0441\u043a       s = descriptor_file_->Sync();     }      \/\/ If we just created a new descriptor file, install it by writing a     \/\/ new CURRENT file that points to it.     if (s.ok() &amp;&amp; !new_manifest_file.empty()) {       \/\/ 5. \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b       s = SetCurrentFile(env_, dbname_, manifest_file_number_);     }      mu->Lock();   }   return s; }  \/\/ https:\/\/github.com\/google\/leveldb\/blob\/068d5ee1a3ac40dabd00d211d5013af44be55bea\/util\/env_posix.cc#L334 class PosixWritableFile: public WritableFile { public:   Status Sync() override {     \/\/ \u041d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c fsync \u0434\u043b\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u0444\u0430\u0439\u043b \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 (\u0434\u043b\u044f \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u0430 - \u043d\u0430\u0448 \u0441\u043b\u0443\u0447\u0430\u0439)     Status status = SyncDirIfManifest();          status = FlushBuffer();     return SyncFd(fd_, filename_);   } private:   static Status SyncFd(int fd, const std::string&amp; fd_path) { #if HAVE_FULLFSYNC     \/\/ On macOS and iOS, fsync() doesn't guarantee durability past power     \/\/ failures. fcntl(F_FULLFSYNC) is required for that purpose. Some     \/\/ filesystems don't support fcntl(F_FULLFSYNC), and require a fallback to     \/\/ fsync().     if (::fcntl(fd, F_FULLFSYNC) == 0) {       return Status::OK();     } #endif  \/\/ HAVE_FULLFSYNC  #if HAVE_FDATASYNC     bool sync_success = ::fdatasync(fd) == 0; #else     bool sync_success = ::fsync(fd) == 0; #endif  \/\/ HAVE_FDATASYNC      if (sync_success) {       return Status::OK();     }     return PosixError(fd_path, errno);   } }  \/\/ https:\/\/github.com\/google\/leveldb\/blob\/068d5ee1a3ac40dabd00d211d5013af44be55bea\/db\/filename.cc#L123 Status SetCurrentFile(Env* env, const std::string&amp; dbname,                       uint64_t descriptor_number) {   \/\/ ...   if (s.ok()) {     \/\/ \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439\/\u0446\u0435\u043b\u0435\u0432\u043e\u0439     s = env->RenameFile(tmp, CurrentFileName(dbname));   }   return s; } <\/code><\/pre>\n<\/div>\n<\/details>\n<h4>\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430<\/h4>\n<p>\u041d\u043e \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u0444\u0430\u0439\u043b \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0438\/\u0438\u043b\u0438 \u043c\u0435\u0441\u0442\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u043c\u0430\u043b\u043e?<\/p>\n<p>\u0412\u0441\u043f\u043e\u043c\u043d\u0438\u043c \u0441 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u0438 &#8212; \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044c \u0444\u0430\u0439\u043b\u0430. \u041d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u044d\u0442\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u0441\u0442\u0430\u043b\u0430 \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0439. \u0414\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u044f \u0432\u0437\u044f\u043b \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/danluu.com\/file-consistency\/\" rel=\"noopener noreferrer nofollow\">Files Are Hard<\/a>. \u041f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u0444\u0430\u0439\u043b \u043c\u043e\u0436\u0435\u0442 \u0441\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043e\u0442\u043a\u0430\u0437 \u0438 \u0442\u043e\u0433\u0434\u0430, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u0435\u0441\u044c \u0444\u0430\u0439\u043b \u043f\u043e\u0432\u0440\u0435\u0434\u0438\u0442\u0441\u044f. \u0427\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438:<\/p>\n<ul>\n<li>\n<p>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0430\u0442\u0441\u044f<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0438\u0448\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<li>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043c\u0443\u0441\u043e\u0440<\/p>\n<\/li>\n<li>\n<p>\u0426\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0440\u0443\u0448\u0438\u0442\u0441\u044f (\u0434\u0430\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438)<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043b\u043e\u0433 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439:<\/p>\n<ul>\n<li>\n<p>undo (rollback) &#8212; \u043e\u0442\u043a\u0430\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439<\/p>\n<\/li>\n<li>\n<p>redo (write ahead log, wal) &#8212; \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u043b\u043e\u0433\u043e\u0432 \u0432 \u0431\u0430\u0437\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"http:\/\/www.cburch.com\/cs\/340\/reading\/log\/index.html\" rel=\"noopener noreferrer nofollow\">\u0442\u0443\u0442<\/a>. \u0422\u0435\u043f\u0435\u0440\u044c &#8212; \u043a\u0430\u043a \u0434\u0435\u043b\u0430\u0442\u044c \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0430 \u0444\u0430\u0439\u043b\u0430.<\/p>\n<h3>Undo \u043b\u043e\u0433<\/h3>\n<p>Undo \u043b\u043e\u0433 \u0445\u0440\u0430\u043d\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0434\u043b\u044f <em>\u043e\u0442\u043a\u0430\u0442\u0430<\/em> \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0438 \u0444\u0430\u0439\u043b\u0430, \u043e\u043d \u0445\u0440\u0430\u043d\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u0443\u0447\u0430\u0441\u0442\u043a\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u044b \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 (<code>new_data<\/code>) \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 10 \u0431\u0430\u0439\u0442\u0430 (<code>start<\/code>) \u0434\u043b\u0438\u043d\u043e\u0439 \u0432 15 \u0431\u0430\u0439\u0442\u043e\u0432 (<code>length<\/code>), \u0442\u043e \u0432 \u044d\u0442\u043e\u0442 \u043b\u043e\u0433 \u0431\u0443\u0434\u0443\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u044b \u0431\u0430\u0439\u0442\u044b \u0441 10 \u043f\u043e 24 \u0438\u0437 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e, \u0435\u0449\u0435 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 (<code>old_data<\/code>). \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:<\/p>\n<ol>\n<li>\n<p><code>creat(\"\/dir\/undo.log\")<\/code> &#8212; \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b undo \u043b\u043e\u0433\u0430<\/p>\n<\/li>\n<li>\n<p><code>write(\"\/dir\/undo.log\", \"[check_sum, start, length, old_data]\")<\/code> &#8212; \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c: <\/p>\n<ul>\n<li>\n<p><code>start<\/code> &#8212; \u043f\u043e\u0437\u0438\u0446\u0438\u044f, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c<\/p>\n<\/li>\n<li>\n<p><code>length<\/code> &#8212; \u0434\u043b\u0438\u043d\u0430 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u043a\u0430<\/p>\n<\/li>\n<li>\n<p><code>old_data<\/code> &#8212; \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c (\u043d\u0435 \u043d\u043e\u0432\u044b\u0435, \u0430 \u0441\u0442\u0430\u0440\u044b\u0435 \u0434\u043b\u044f \u043e\u0442\u043a\u0430\u0442\u0430)<\/p>\n<\/li>\n<li>\n<p><code>check_sum<\/code> &#8212; \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u0430, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f <code>start<\/code>, <code>length<\/code> \u0438 <code>old_data<\/code><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><code>fsync(\"\/dir\/undo.log\")<\/code> &#8212; \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a<\/p>\n<\/li>\n<li>\n<p><code>fsync(\"\/dir\")<\/code> &#8212; \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 (\u0442\u0435\u043f\u0435\u0440\u044c undo \u043b\u043e\u0433 \u0442\u043e\u0447\u043d\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435)<\/p>\n<\/li>\n<li>\n<p><code>write(\"\/dir\/data\", new_data)<\/code> &#8212; \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<li>\n<p><code>fsync(\"\/dir\/data\")<\/code> &#8212; \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a<\/p>\n<\/li>\n<li>\n<p><code>unlink(\"\/dir\/undo.log\")<\/code> &#8212; \u0423\u0434\u0430\u043b\u044f\u0435\u043c undo \u043b\u043e\u0433<\/p>\n<\/li>\n<li>\n<p><code>fsync(\"\/dir\")<\/code> &#8212; \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a (\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 undo \u043b\u043e\u0433\u0430)<\/p>\n<\/li>\n<\/ol>\n<p>\u0427\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0443\u0447\u043b\u0438:<\/p>\n<ul>\n<li>\n<p>\u041e\u0442\u043a\u0430\u0437 \u043f\u0440\u044f\u043c\u043e \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 undo \u043b\u043e\u0433\u0430 &#8212; \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0438\u0434\u0435\u0442 \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u0430, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u044d\u0442\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 &#8212; \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u0430 \u0434\u043b\u044f \u0432\u0441\u0435\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 undo \u043b\u043e\u0433\u0435 \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439, \u0435\u0441\u043b\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u044b (\u0435\u0441\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0435, \u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u0438\u043c <code>write<\/code> \u043d\u0435 \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c) \u0438\u043b\u0438 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0430 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043a\u0430\u0437 \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u0437\u0430\u043f\u0438\u0441\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0441\u0430\u043c \u0444\u0430\u0439\u043b &#8212; \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c <code>fsync<\/code> \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u0430 undo \u043b\u043e\u0433\u0430 \u0438 \u0435\u0433\u043e \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 (\u0444\u0430\u0439\u043b \u043b\u043e\u0433\u0430 \u0442\u043e\u0447\u043d\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435)<\/p>\n<\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441\u0430\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 undo \u043b\u043e\u0433\u0430 &#8212; \u0432 \u043a\u043e\u043d\u0446\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c <code>fsync<\/code> \u0434\u043b\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u0447\u0442\u043e\u0431\u044b undo \u043b\u043e\u0433 \u0431\u044b\u043b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0434\u0430\u043b\u0435\u043d<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0430\u043a \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0441\u0442\u0430\u043b\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e:<\/p>\n<ol>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 undo \u043b\u043e\u0433\u0430 <\/p>\n<ul>\n<li>\n<p>Undo \u043b\u043e\u0433 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442<\/p>\n<\/li>\n<li>\n<p>\u041e\u043d \u043d\u0435 \u043f\u0443\u0441\u0442<\/p>\n<\/li>\n<li>\n<p>\u0412\u0441\u0435 \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u044b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0435<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 undo \u043b\u043e\u0433 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d: <\/p>\n<ol>\n<li>\n<p>\u041e\u0442\u043a\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 (\u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0438\u0437 undo \u043b\u043e\u0433\u0430)<\/p>\n<\/li>\n<li>\n<p>\u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0438\u0441\u043a (\u0444\u0430\u0439\u043b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438)<\/p>\n<\/li>\n<li>\n<p>\u0423\u0434\u0430\u043b\u044f\u0435\u043c undo \u043b\u043e\u0433<\/p>\n<\/li>\n<li>\n<p>\u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0438\u0441\u043a (\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f)<\/p>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>\u0414\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0441\u0431\u043e\u0439, \u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043d\u0430\u0440\u0443\u0448\u0438\u0442\u044c \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445, \u0442.\u043a. \u043e\u0442\u043a\u0430\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0438\u0434\u0435\u043c\u043f\u043e\u0442\u0435\u043d\u0442\u0435\u043d (\u0441\u0442\u043e\u0438\u0442 \u0435\u0449\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c PSOW \u0438 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0441\u0442\u044c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430, \u0441\u043c. \u0432\u044b\u0448\u0435).<\/p>\n<p>\u041d\u043e \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0431\u043e\u043b\u0435\u0435 \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0447\u0435\u043c \u0442\u0430 \u0436\u0435 \u0437\u0430\u043f\u0438\u0441\u044c, \u0442.\u043a. \u043d\u0430\u0434\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438, \u043d\u043e \u0438, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u043c\u0435\u0442\u0438\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0447\u0438\u0441\u0442\u044b\u043c\u0438 \u0434\u043b\u044f \u043e\u0447\u0438\u0449\u0435\u043d\u0438\u044f \u043c\u0435\u0441\u0442\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435. \u0412 SQLite \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0436\u0443\u0440\u043d\u0430\u043b (undo \u043b\u043e\u0433) \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c 2 \u043e\u043f\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p>\u041e\u0431\u0440\u0435\u0437\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0434\u043e 0 &#8212; <code>PRAGMA journal_mode=TRUNCATE<\/code><\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043d\u0443\u043b\u044f\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0436\u0443\u0440\u043d\u0430\u043b\u0430 &#8212; <code>PRAGMA journal_mode=PERSIST<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0412 <a href=\"https:\/\/devdoc.net\/database\/sqlite-3.0.7.2\/atomiccommit.html#section_7_6\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u044d\u0442\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e.<\/p>\n<details class=\"spoiler\">\n<summary>Undo \u043b\u043e\u0433 \u0432 SQLite<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0420\u0430\u0437 \u0443\u0436 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440 \u0437\u0430\u0448\u0435\u043b \u043e SQLite, \u0442\u043e \u0438 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0435\u0433\u043e. \u0421\u0430\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u043c\u0438\u0442\u0430 \u043e\u043f\u0438\u0441\u0430\u043d \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 <a href=\"https:\/\/devdoc.net\/database\/sqlite-3.0.7.2\/atomiccommit.html\" rel=\"noopener noreferrer nofollow\">Atomic Commit In SQLite<\/a>. \u0412 \u043a\u043e\u0434\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">\/\/ https:\/\/github.com\/sqlite\/sqlite\/blob\/5007833f5f82d33c95f44c65fc46221de1c5950f\/src\/btree.c#L4388 int sqlite3BtreeCommit(Btree *p){   int rc;   \/\/ \u041f\u0435\u0440\u0432\u0430\u044f \u0444\u0430\u0437\u0430 - \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0436\u0443\u0440\u043d\u0430\u043b\u0430 \u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b \u0411\u0414   rc = sqlite3BtreeCommitPhaseOne(p, 0);   if( rc==SQLITE_OK ){     \/\/ \u0412\u0442\u043e\u0440\u0430\u044f \u0444\u0430\u0437\u0430 - \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435\/\u043e\u0431\u0440\u0435\u0437\u0430\u043d\u0438\u0435\/\u0437\u0430\u043d\u0443\u043b\u0435\u043d\u0438\u0435 \u0436\u0443\u0440\u043d\u0430\u043b\u0430     rc = sqlite3BtreeCommitPhaseTwo(p, 0);   }   return rc; }  \/\/ https:\/\/github.com\/sqlite\/sqlite\/blob\/5007833f5f82d33c95f44c65fc46221de1c5950f\/src\/btree.c#L4267 int sqlite3BtreeCommitPhaseOne(Btree *p, const char *zSuperJrnl){   int rc = SQLITE_OK;   if( p->inTrans==TRANS_WRITE ){     rc = sqlite3PagerCommitPhaseOne(pBt->pPager, zSuperJrnl, 0);   }   return rc; }  \/\/ https:\/\/github.com\/sqlite\/sqlite\/blob\/5007833f5f82d33c95f44c65fc46221de1c5950f\/src\/pager.c#L6437 int sqlite3PagerCommitPhaseOne(   Pager *pPager,                  \/* Pager object *\/   const char *zSuper,            \/* If not NULL, the super-journal name *\/   int noSync                      \/* True to omit the xSync on the db file *\/ ){   int rc = SQLITE_OK;             \/* Return code *\/    if( 0==pagerFlushOnCommit(pPager, 1) ){     \/\/ ...   }else{     if( pagerUseWal(pPager) ){       \/\/ ...     }else{       \/\/ 1. \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0442\u0438\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432 \u0436\u0443\u0440\u043d\u0430\u043b       rc = pager_incr_changecounter(pPager, 0);       \/\/ 2. \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0436\u0443\u0440\u043d\u0430\u043b \u043d\u0430 \u0434\u0438\u0441\u043a       rc = syncJournal(pPager, 0);       if( rc!=SQLITE_OK ) goto commit_phase_one_exit;        \/\/ 3. \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432 \u0441\u0430\u043c \u0444\u0430\u0439\u043b \u0411\u0414       pList = sqlite3PcacheDirtyList(pPager->pPCache);       if( \/* ... *\/ ){         rc = pager_write_pagelist(pPager, pList);       }       if( rc!=SQLITE_OK ) goto commit_phase_one_exit;        \/\/ 3. \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u0430 \u0411\u0414 \u043d\u0430 \u0434\u0438\u0441\u043a       if( \/* ... *\/ ){         rc = sqlite3PagerSync(pPager, zSuper);       }     }   }  commit_phase_one_exit:   return rc; }  \/\/ https:\/\/github.com\/sqlite\/sqlite\/blob\/5007833f5f82d33c95f44c65fc46221de1c5950f\/src\/pager.c#L4259 static int syncJournal(Pager *pPager, int newHdr){   int rc;                         \/* Return code *\/    if( \/* ... *\/ ){     if( \/* ... *\/ ){       if( \/* ... *\/ ){         \/\/ \u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446 = 0, \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439         if( rc==SQLITE_OK &amp;&amp; 0==memcmp(aMagic, aJournalMagic, 8) ){           static const u8 zerobyte = 0;           rc = sqlite3OsWrite(pPager->jfd, &amp;zerobyte, 1, iNextHdrOffset);         }          if( \/* ... *\/ ){           \/\/ \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435           rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags);           if( rc!=SQLITE_OK ) return rc;         }                  \/\/ \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u0430\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a         rc = sqlite3OsWrite(             pPager->jfd, zHeader, sizeof(zHeader), pPager->journalHdr         );         if( rc!=SQLITE_OK ) return rc;       }       if( \/* ... *\/ ){         \/\/ \u0415\u0449\u0435 \u0440\u0430\u0437 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a         rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags|           (pPager->syncFlags==SQLITE_SYNC_FULL?SQLITE_SYNC_DATAONLY:0)         );         if( rc!=SQLITE_OK ) return rc;       }     }else{       pPager->journalHdr = pPager->journalOff;     }   }      return SQLITE_OK; }  \/\/ https:\/\/github.com\/sqlite\/sqlite\/blob\/5007833f5f82d33c95f44c65fc46221de1c5950f\/src\/pager.c#L6372 int sqlite3PagerSync(Pager *pPager, const char *zSuper){   int rc = SQLITE_OK;   if( \/* ... *\/ ){     \/\/ fsync     rc = sqlite3OsSync(pPager->fd, pPager->syncFlags);   }   return rc; }  \/\/ https:\/\/github.com\/sqlite\/sqlite\/blob\/5007833f5f82d33c95f44c65fc46221de1c5950f\/src\/btree.c#L4356 int sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){   if( p->inTrans==TRANS_WRITE ){     int rc;     rc = sqlite3PagerCommitPhaseTwo(p->pBt->pPager);     if( rc!=SQLITE_OK &amp;&amp; bCleanup==0 ){       sqlite3BtreeLeave(p);       return rc;     }   }      return SQLITE_OK; }  \/\/ https:\/\/github.com\/sqlite\/sqlite\/blob\/5007833f5f82d33c95f44c65fc46221de1c5950f\/src\/pager.c#L6674 int sqlite3PagerCommitPhaseTwo(Pager *pPager){   int rc = SQLITE_OK;                  \/* Return code *\/   rc = pager_end_transaction(pPager, pPager->setSuper, 1);   return pager_error(pPager, rc); }  \/\/ https:\/\/github.com\/sqlite\/sqlite\/blob\/5007833f5f82d33c95f44c65fc46221de1c5950f\/src\/pager.c#L2033 static int pager_end_transaction(Pager *pPager, int hasSuper, int bCommit){   int rc = SQLITE_OK;   int rc2 = SQLITE_OK;         if( isOpen(pPager->jfd) ){     if( sqlite3JournalIsInMemory(pPager->jfd) ){       \/\/ ...     }else if( pPager->journalMode==PAGER_JOURNALMODE_TRUNCATE ){       \/\/ PRAGMA journal_mode=TRUNCATE       \/\/ \u041e\u0431\u0440\u0435\u0437\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0434\u043e 0       if( pPager->journalOff==0 ){         rc = SQLITE_OK;       }else{         rc = sqlite3OsTruncate(pPager->jfd, 0);         if( rc==SQLITE_OK &amp;&amp; pPager->fullSync ){           rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags);         }       }       pPager->journalOff = 0;     }else if( pPager->journalMode==PAGER_JOURNALMODE_PERSIST){       \/\/ PRAGMA journal_mode=PERSIST       \/\/ \u0417\u0430\u043d\u0443\u043b\u044f\u0435\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0436\u0443\u0440\u043d\u0430\u043b\u0430       rc = zeroJournalHdr(pPager, hasSuper||pPager->tempFile);       pPager->journalOff = 0;     }else{       \/\/ PRAGMA journal_mode=DELETE       \/\/ \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0444\u0430\u0439\u043b \u0436\u0443\u0440\u043d\u0430\u043b\u0430       int bDelete = !pPager->tempFile;       sqlite3OsClose(pPager->jfd);       if( bDelete ){         rc = sqlite3OsDelete(pPager->pVfs, pPager->zJournal, pPager->extraSync);       }     }   }   \/\/ ...   return (rc==SQLITE_OK?rc2:rc); }  \/\/ \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f sqlite3OsDelete \u0434\u043b\u044f Unix \u0441\u0438\u0441\u0442\u0435\u043c  \/\/ https:\/\/github.com\/sqlite\/sqlite\/blob\/5007833f5f82d33c95f44c65fc46221de1c5950f\/src\/os_unix.c#L6533 static int unixDelete(   sqlite3_vfs *NotUsed,     \/* VFS containing this as the xDelete method *\/   const char *zPath,        \/* Name of file to be deleted *\/   int dirSync               \/* If true, fsync() directory after deleting file *\/ ){   int rc = SQLITE_OK;      \/\/ \u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0444\u0430\u0439\u043b - unlink   if( osUnlink(zPath)==(-1) ){     rc = unixLogError(SQLITE_IOERR_DELETE, \"unlink\", zPath);     return rc;   }      \/\/ \u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438   if( (dirSync &amp; 1)!=0 ){     int fd;     rc = osOpenDirectory(zPath, &amp;fd);     if( rc==SQLITE_OK ){       \/\/ \u0423\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0439 \"fsync\"       if( full_fsync(fd,0,0) ){         rc = unixLogError(SQLITE_IOERR_DIR_FSYNC, \"fsync\", zPath);       }     }else{       rc = SQLITE_OK;     }   }   return rc; }  \/\/ \u0423\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f fsync, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0438 \u0431\u0430\u0433\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \/\/ https:\/\/github.com\/sqlite\/sqlite\/blob\/5007833f5f82d33c95f44c65fc46221de1c5950f\/src\/os_unix.c#L3638 static int full_fsync(int fd, int fullSync, int dataOnly){   int rc;    \/* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a   ** no-op.  But go ahead and call fstat() to validate the file   ** descriptor as we need a method to provoke a failure during   ** coverage testing.   *\/ #ifdef SQLITE_NO_SYNC   {     struct stat buf;     rc = osFstat(fd, &amp;buf);   } #elif HAVE_FULLFSYNC   if( fullSync ){     rc = osFcntl(fd, F_FULLFSYNC, 0);   }else{     rc = 1;   }   \/* If the FULLFSYNC failed, fall back to attempting an fsync().   ** It shouldn't be possible for fullfsync to fail on the local   ** file system (on OSX), so failure indicates that FULLFSYNC   ** isn't supported for this file system. So, attempt an fsync   ** and (for now) ignore the overhead of a superfluous fcntl call.   ** It'd be better to detect fullfsync support once and avoid   ** the fcntl call every time sync is called.   *\/   if( rc ) rc = fsync(fd);  #elif defined(__APPLE__)   \/* fdatasync() on HFS+ doesn't yet flush the file size if it changed correctly   ** so currently we default to the macro that redefines fdatasync to fsync   *\/   rc = fsync(fd); #else   rc = fdatasync(fd); #if OS_VXWORKS   if( rc==-1 &amp;&amp; errno==ENOTSUP ){     rc = fsync(fd);   } #endif \/* OS_VXWORKS *\/ #endif \/* ifdef SQLITE_NO_SYNC elif HAVE_FULLFSYNC *\/    if( OS_VXWORKS &amp;&amp; rc!= -1 ){     rc = 0;   }   return rc; } <\/code><\/pre>\n<\/div>\n<\/details>\n<h3>Redo \u043b\u043e\u0433<\/h3>\n<p>Redo \u043b\u043e\u0433 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0439 \u0441\u0445\u0435\u043c\u0435. \u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u044d\u0442\u043e\u0442 \u043b\u043e\u0433 \u043d\u0435 \u0441\u0442\u0430\u0440\u044b\u0435, \u0430 \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/p>\n<ol>\n<li>\n<p><code>creat(\"\/dir\/redo.log\")<\/code> &#8212; \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b redo \u043b\u043e\u0433\u0430<\/p>\n<\/li>\n<li>\n<p><code>write(\"\/dir\/redo.log\", \"[check_sum, start, length, new_data]\")<\/code> &#8212; \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435: <\/p>\n<ul>\n<li>\n<p><code>start<\/code> &#8212; \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0432 \u0444\u0430\u0439\u043b\u0435, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c<\/p>\n<\/li>\n<li>\n<p><code>length<\/code> &#8212; \u0434\u043b\u0438\u043d\u0430 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0443\u0447\u0430\u0441\u0442\u043a\u0430<\/p>\n<\/li>\n<li>\n<p><code>new_data<\/code> &#8212; \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0445\u043e\u0442\u0438\u043c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c<\/p>\n<\/li>\n<li>\n<p><code>check_sum<\/code> &#8212; \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u0430, \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u0430\u044f \u0434\u043b\u044f <code>start<\/code>, <code>length<\/code> \u0438 <code>new_data<\/code><\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><code>fsync(\"\/dir\/redo.log\")<\/code> &#8212; \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a<\/p>\n<\/li>\n<li>\n<p><code>fsync(\"\/dir\")<\/code> &#8212; \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 (\u0442\u0435\u043f\u0435\u0440\u044c redo \u043b\u043e\u0433 \u0442\u043e\u0447\u043d\u043e \u043d\u0430 \u0434\u0438\u0441\u043a\u0435)<\/p>\n<\/li>\n<li>\n<p><code>write(\"\/dir\/data\", new_data)<\/code> &#8212; \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/p>\n<\/li>\n<li>\n<p><code>fsync(\"\/dir\/data\")<\/code> &#8212; \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a<\/p>\n<\/li>\n<li>\n<p><code>unlink(\"\/dir\/redo.log\")<\/code> &#8212; \u0423\u0434\u0430\u043b\u044f\u0435\u043c redo \u043b\u043e\u0433<\/p>\n<\/li>\n<li>\n<p><code>fsync(\"\/dir\")<\/code> &#8212; \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 \u0434\u0438\u0441\u043a (\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 redo \u043b\u043e\u0433\u0430)<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c redo \u043b\u043e\u0433\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0442\u043e, \u0447\u0442\u043e \u043e\u0442\u0432\u0435\u0442 \u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u044b \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043b\u043e\u0433\u0435 (\u0448\u0430\u0433 4), \u0442.\u043a. \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043b\u0438\u0431\u043e \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u044b \u0441\u0435\u0439\u0447\u0430\u0441, \u043b\u0438\u0431\u043e \u043f\u0440\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438.<\/p>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 &#8212; \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u0442\u0440\u0430\u0442\u043d\u0430\u044f. \u0414\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0442\u043e\u043c \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0440\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438. \u041d\u043e \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u043c\u0438\u0442\u0438\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043b\u0438\u0448\u043d\u0438\u0439 \u0440\u0430\u0437 \u0438\u0445 \u043d\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c (\u043f\u0443\u0441\u0442\u0430\u044f \u0442\u0440\u0430\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432). \u0417\u0430\u043a\u043e\u043c\u043c\u0438\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0435\u0446 \u043b\u043e\u0433\u0430 (\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u0436\u0434\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043b\u043e\u0433\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043b\u0438\u0431\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0435\u0439, \u043b\u0438\u0431\u043e \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u043c). \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0437\u0430\u043f\u0438\u0441\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u043b\u0430\u0433 \u043a\u043e\u043c\u043c\u0438\u0442\u0430 \u0438 \u0437\u0430\u043d\u0443\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u0437\u0430\u043d\u0443\u043b\u044f\u0442\u044c \u0432\u0435\u0441\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a, \u043a\u0430\u043a \u0431\u044b \u0433\u043e\u0432\u043e\u0440\u044f, \u0447\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 (\u043a\u0430\u043a \u0432 SQLite \u043f\u0440\u0438 <code>PRAGMA journal_mode=PERSIST<\/code>). \u0412\u043e\u0442 \u043c\u044b \u0438 \u043f\u0440\u0438\u0448\u043b\u0438 \u043a WAL &#8212; Write Ahead Log.<\/p>\n<details class=\"spoiler\">\n<summary>WAL \u0432 Postgres<\/summary>\n<div class=\"spoiler__content\">\n<p>Redo \u043b\u043e\u0433 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0431\u0430\u0437\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043d \u0435\u0441\u0442\u044c \u0432 <a href=\"https:\/\/docs.oracle.com\/en\/database\/oracle\/oracle-database\/19\/admin\/managing-the-redo-log.html\" rel=\"noopener noreferrer nofollow\">Oracle<\/a>, <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/innodb-redo-log.html\" rel=\"noopener noreferrer nofollow\">MySQL<\/a>, <a href=\"https:\/\/www.postgresql.org\/docs\/current\/runtime-config-wal.html\" rel=\"noopener noreferrer nofollow\">Postgres<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/www.sqlite.org\/wal.html\" rel=\"noopener noreferrer nofollow\">SQLite<\/a>. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 WAL \u0432 Postgres.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d \u043d\u0430 2 \u0447\u0430\u0441\u0442\u0438:<\/p>\n<ol>\n<li>\n<p>\u0412\u044b\u0437\u043e\u0432 <code>COMMIT<\/code> &#8212; \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 WAL<\/p>\n<\/li>\n<li>\n<p>\u0421\u0431\u0440\u043e\u0441 \u0433\u0440\u044f\u0437\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u043d\u0430 \u0434\u0438\u0441\u043a (\u0432\u044b\u0442\u0435\u0441\u043d\u0435\u043d\u0438\u0435) &#8212; \u0441\u0431\u0440\u043e\u0441 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b \u0411\u0414<\/p>\n<\/li>\n<\/ol>\n<p>\u0423\u0436\u0435 \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e WAL: \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c (\u0432 redo \u043b\u043e\u0433), \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043e\u0442\u0432\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0433\u0440\u044f\u0437\u043d\u044b\u043c\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438. \u0421\u0430\u043c\u0430 \u0433\u0440\u044f\u0437\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u0431\u0440\u043e\u0448\u0435\u043d\u0430 \u0432 \u0444\u0430\u0439\u043b \u0411\u0414 \u043f\u043e\u0442\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0435\u0440\u0430 \u0438\u043b\u0438 \u043f\u0440\u0438 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u043e\u044f.<\/p>\n<pre><code class=\"cpp\">\/\/ 1. \u0412\u044b\u0437\u043e\u0432 COMMIT  \/\/ https:\/\/github.com\/postgres\/postgres\/blob\/cc6e64afda530576d83e331365d36c758495a7cd\/src\/backend\/access\/transam\/xact.c#L2158 static void CommitTransaction(void) {        \/\/ ... RecordTransactionCommit();     \/\/ ... }  \/\/ https:\/\/github.com\/postgres\/postgres\/blob\/97d85be365443eb4bf84373a7468624762382059\/src\/backend\/access\/transam\/xact.c#L1284 static TransactionId RecordTransactionCommit(void) {     \/\/ ...     XactLogCommitRecord(GetCurrentTransactionStopTimestamp(),                         nchildren, children, nrels, rels,                         ndroppedstats, droppedstats,                         nmsgs, invalMessages,                         RelcacheInitFileInval,                         MyXactFlags,                         InvalidTransactionId, NULL \/* plain commit *\/ );     \/\/ ... }  \/\/ https:\/\/github.com\/postgres\/postgres\/blob\/eeefd4280f6e5167d70efabb89586b7d38922d95\/src\/backend\/access\/transam\/xact.c#L5736 XLogRecPtr XactLogCommitRecord(TimestampTz commit_time, int nsubxacts, TransactionId *subxacts, int nrels, RelFileLocator *rels, int ndroppedstats, xl_xact_stats_item *droppedstats, int nmsgs, SharedInvalidationMessage *msgs, bool relcacheInval, int xactflags, TransactionId twophase_xid, const char *twophase_gid) {     \/\/ ... return XLogInsert(RM_XACT_ID, info); }  XLogRecPtr XLogInsertRecord(XLogRecData *rdata,  XLogRecPtr fpw_lsn,  uint8 flags,  int num_fpi,  bool topxid_included) {     \/\/ ...     XLogFlush(EndPos);     \/\/ ... }  \/\/ https:\/\/github.com\/postgres\/postgres\/blob\/dbfc44716596073b99e093a04e29e774a518f520\/src\/backend\/access\/transam\/xlog.c#L2728 void XLogFlush(XLogRecPtr record) { \/\/ ... XLogWrite(WriteRqst, insertTLI, false);     \/\/ ... }  \/\/ https:\/\/github.com\/postgres\/postgres\/blob\/dbfc44716596073b99e093a04e29e774a518f520\/src\/backend\/access\/transam\/xlog.c#L2273 static void XLogWrite(XLogwrtRqst WriteRqst, TimeLineID tli, bool flexible) { while (\/* \u0415\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 *\/) {     \/\/ 1. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u043b\u043e\u0433\u0430, \u043b\u0438\u0431\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0439     if (\/* \u0420\u0430\u0437\u043c\u0435\u0440 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u0435\u0432\u044b\u0448\u0435\u043d *\/) { openLogFile = XLogFileInit(openLogSegNo, tli); } if (openLogFile &lt; 0) { openLogFile = XLogFileOpen(openLogSegNo, tli); }          \/\/ 2. \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446 WAL \u043b\u043e\u0433\u0430         do         {             written = pg_pwrite(openLogFile, from, nleft, startoffset);         } while (\/* \u0415\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 *\/);                  \/\/ 3. \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a (fsync)         if (finishing_seg)         {             issue_xlog_fsync(openLogFile, openLogSegNo, tli);         }     } }  \/\/ https:\/\/github.com\/postgres\/postgres\/blob\/dbfc44716596073b99e093a04e29e774a518f520\/src\/backend\/access\/transam\/xlog.c#L8516 void issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli) {     \/\/ \u0412\u044b\u0437\u043e\u0432 fsync \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 switch (wal_sync_method) { case WAL_SYNC_METHOD_FSYNC:     pg_fsync_no_writethrough(fd); break; case WAL_SYNC_METHOD_FSYNC_WRITETHROUGH:     pg_fsync_writethrough(fd); break; case WAL_SYNC_METHOD_FDATASYNC:     pg_fdatasync(fd);     break; \/\/ ... } }  \/\/ 2. \u0421\u0431\u0440\u043e\u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u043d\u0430 \u0434\u0438\u0441\u043a, \u0432 \u0444\u0430\u0439\u043b \u0411\u0414  \/\/ https:\/\/github.com\/postgres\/postgres\/blob\/97d85be365443eb4bf84373a7468624762382059\/src\/backend\/storage\/buffer\/bufmgr.c#L3437 static void FlushBuffer(BufferDesc *buf, SMgrRelation reln, IOObject io_object, IOContext io_context) {     \/\/ 3. \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0431\u0443\u0444\u0435\u0440 \u0432 WAL (\u0435\u0441\u043b\u0438 \u0435\u0449\u0435 \u043d\u0435\u0442) if (buf_state &amp; BM_PERMANENT) XLogFlush(recptr);          \/\/ \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0438\u0441\u043a, \u0432 \u0444\u0430\u0439\u043b \u0411\u0414 (\u043f\u0438\u0448\u0435\u043c \u0438 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438 \u0434\u0430\u043b\u044c\u0448\u0435)     smgrwrite(reln,   BufTagGetForkNum(&amp;buf->tag),   buf->tag.blockNum,   bufToWrite,   false); }  \/\/ https:\/\/github.com\/postgres\/postgres\/blob\/eeefd4280f6e5167d70efabb89586b7d38922d95\/src\/include\/storage\/smgr.h#L121 static inline void smgrwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,   const void *buffer, bool skipFsync) { smgrwritev(reln, forknum, blocknum, &amp;buffer, 1, skipFsync); }  \/\/ https:\/\/github.com\/postgres\/postgres\/blob\/eeefd4280f6e5167d70efabb89586b7d38922d95\/src\/backend\/storage\/smgr\/smgr.c#L631 void smgrwritev(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,    const void **buffers, BlockNumber nblocks, bool skipFsync) { smgrsw[reln->smgr_which].smgr_writev(reln, forknum, blocknum,  buffers, nblocks, skipFsync); }  \/\/ https:\/\/github.com\/postgres\/postgres\/blob\/eeefd4280f6e5167d70efabb89586b7d38922d95\/src\/backend\/storage\/smgr\/md.c#L928 void mdwritev(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,  const void **buffers, BlockNumber nblocks, bool skipFsync) {     \/\/ 5. \u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0444\u0430\u0439\u043b \u0411\u0414 while (\/* \u0415\u0441\u0442\u044c \u0435\u0449\u0435 \u0431\u043b\u043e\u043a\u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 *\/) {         FileWriteV(v->mdfd_vfd, iov, iovcnt, seekpos,                    WAIT_EVENT_DATA_FILE_WRITE); }  \/\/ 6. \u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0434\u0438\u0441\u043a (\u0444\u0430\u0439\u043b \u0411\u0414)     register_dirty_segment(reln, forknum, v); }   \/\/ https:\/\/github.com\/postgres\/postgres\/blob\/6b41ef03306f50602f68593d562cd73d5e39a9b9\/src\/backend\/storage\/file\/fd.c#L2192 ssize_t FileWriteV(File file, const struct iovec *iov, int iovcnt, off_t offset,    uint32 wait_event_info) { returnCode = pg_pwritev(vfdP->fd, iov, iovcnt, offset); }  \/\/ https:\/\/github.com\/postgres\/postgres\/blob\/eeefd4280f6e5167d70efabb89586b7d38922d95\/src\/backend\/storage\/smgr\/md.c#L1353 static void register_dirty_segment(SMgrRelation reln, ForkNumber forknum, MdfdVec *seg) { if (\/* \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c fsync \u0437\u0430\u043f\u0440\u043e\u0441 \u0434\u043b\u044f \u0447\u0435\u043a\u043f\u043e\u0438\u043d\u0442\u0435\u0440\u0430 *\/) { FileSync(seg->mdfd_vfd, WAIT_EVENT_DATA_FILE_SYNC); } }  \/\/ https:\/\/github.com\/postgres\/postgres\/blob\/c20d90a41ca869f9c6dd4058ad1c7f5c9ee9d912\/src\/backend\/storage\/file\/fd.c#L2297 int FileSync(File file, uint32 wait_event_info) { pg_fsync(VfdCache[file].fd); } <\/code><\/pre>\n<\/div>\n<\/details>\n<h3>\u0421\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043b\u043e\u0433 + \u0441\u043d\u0430\u043f\u0448\u043e\u0442<\/h3>\n<p>\u0420\u0430\u0437 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043f\u0440\u043e WAL, \u0442\u043e \u0441\u0442\u043e\u0438\u0442 \u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043b\u043e\u0433. <a href=\"https:\/\/martinfowler.com\/articles\/patterns-of-distributed-systems\/segmented-log.html\" rel=\"noopener noreferrer nofollow\">\u0421\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043b\u043e\u0433<\/a> &#8212; \u044d\u0442\u043e \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0435\u0434\u0438\u043d\u043e\u0433\u043e &#171;\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e&#187; \u043b\u043e\u0433\u0430 \u0432 \u0432\u0438\u0434\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 &#171;\u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445&#187; \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u0420\u0430\u043d\u044c\u0448\u0435 &#8212; \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0436\u0438\u0440\u043d\u044b\u0439 \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u043b \u0432 \u0441\u0435\u0431\u0435 \u0432\u0441\u0435<\/p>\n<\/li>\n<li>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c &#8212; \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 (\u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0432 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u043e\u043c) \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u043e \u0441\u0430\u043c \u043f\u043e \u0441\u0435\u0431\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043b\u043e\u0433 \u0438\u043c\u0435\u0435\u0442 \u043d\u0435 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432, \u0432 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0438 \u0441 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u043e\u043c. \u0412\u043e\u0442 \u0442\u0443\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0441\u043d\u0430\u043f\u0448\u043e\u0442 &#8212; \u0441\u043b\u0435\u043f\u043e\u043a \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438\u0437 \u043b\u043e\u0433\u0430. \u0412\u043e\u0442 \u044d\u0442\u0430 \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0438\u0437 <a href=\"https:\/\/raft.github.io\/raft.pdf\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u0440\u043e Raft<\/a> \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u043b\u043e\u0433\u043e\u043c \u0438 \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u043e\u043c:<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/251\/2f1\/731\/2512f1731783bb7a8a1a33c15f2a007b.png\" alt=\"\u0412\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u044c WAL \u0438 \u0421\u043d\u0430\u043f\u0448\u043e\u0442\u0430 \u0432 Raft\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/251\/2f1\/731\/2512f1731783bb7a8a1a33c15f2a007b.png\"\/><\/p>\n<div><figcaption>\u0412\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u044c WAL \u0438 \u0421\u043d\u0430\u043f\u0448\u043e\u0442\u0430 \u0432 Raft<\/figcaption><\/div>\n<\/figure>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c 2 &#171;\u0444\u0430\u0439\u043b\u0430&#187;, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0421\u043d\u0430\u043f\u0448\u043e\u0442 &#8212; \u0444\u0430\u0439\u043b \u0441 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043a\u043e\u043c\u0430\u043d\u0434, \u0438<\/p>\n<\/li>\n<li>\n<p>\u0421\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043b\u043e\u0433 &#8212; \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 (\u0444\u0430\u0439\u043b\u043e\u0432), \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043a \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u0443<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u0430\u043a: &#171;\u0421\u043d\u0430\u043f\u0448\u043e\u0442&#187; + \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438\u0437 &#171;\u0421\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043b\u043e\u0433&#187;.<\/p>\n<p>\u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u0430\u0433\u0438\u044f &#8212; \u0441 \u043a\u0430\u0436\u0434\u044b\u043c \u0442\u0438\u043f\u043e\u043c \u0444\u0430\u0439\u043b\u043e\u0432 \u043c\u044b \u0443\u043c\u0435\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e:<\/p>\n<ul>\n<li>\n<p>\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u0430 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c <code>Atomic Create Via Rename<\/code> \u0438\u043b\u0438 <code>Atomic Replace Via Rename<\/code><\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f &#8212; \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0435\u0435 \u0432 \u043d\u0430\u0448 \u043b\u043e\u0433 (\u0437\u0430\u043f\u0438\u0441\u044c \u0432 redo \u043b\u043e\u0433 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u0430\u0441\u044c)<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0445 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u043b\u043e\u0433\u0430 &#8212; \u0447\u0435\u0440\u0435\u0437 <code>Atomic Create Via Rename<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u043d\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043b\u043e\u0433, \u0430 <em>\u043c\u043e\u043d\u043e\u043b\u043e\u0433<\/em> (\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b \u0441\u0430\u043c), \u0442\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u043c\u0435\u0441\u0442\u0430 (\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0438\u043b\u0438 \u0438\u0445 \u0441\u0436\u0430\u0442\u0438\u0435) \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0442.\u043a. \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0438\u0437 \u043b\u043e\u0433\u0430 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e <code>ARVR<\/code>. \u041f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0435 \u043b\u043e\u0433\u0430, \u044d\u0442\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u043d\u043e, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c\/\u0441\u0436\u0430\u0442\u044c \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u043e\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b.<\/p>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b:<\/p>\n<ul>\n<li>\n<p>Postgres: WAL \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 <a href=\"https:\/\/habr.com\/ru\/companies\/otus\/articles\/717684\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p>Apache Kafka: \u041a\u0430\u0436\u0434\u0430\u044f \u043f\u0430\u0440\u0442\u0438\u0446\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 <a href=\"https:\/\/kafka.apache.org\/documentation\/#log\" rel=\"noopener noreferrer nofollow\">\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p>etcd: \u0414\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u0438\u0442 \u0432 <a href=\"https:\/\/pkg.go.dev\/github.com\/etcd-io\/etcd\/snap\" rel=\"noopener noreferrer nofollow\">\u0441\u043d\u0430\u043f\u0448\u043e\u0442\u0435<\/a> \u0438 <a href=\"https:\/\/pkg.go.dev\/go.etcd.io\/etcd\/wal\" rel=\"noopener noreferrer nofollow\">\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c WAL<\/a><\/p>\n<\/li>\n<li>\n<p>log-cabin: \u0414\u0430\u043d\u043d\u044b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 <a href=\"https:\/\/github.com\/logcabin\/logcabin\/blob\/master\/Storage\/SnapshotFile.cc\" rel=\"noopener noreferrer nofollow\">\u0441\u043d\u0430\u043f\u0448\u043e\u0442\u0435<\/a> \u0438 <a href=\"https:\/\/github.com\/logcabin\/logcabin\/blob\/master\/Storage\/SegmentedLog.cc\" rel=\"noopener noreferrer nofollow\">\u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c WAL<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432:<\/p>\n<ul>\n<li>\n<p>\u041e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f: \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0432 WAL \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043d\u0430\u043f\u0448\u043e\u0442\u0430 (\u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0432\u044b\u0448\u0435)<\/p>\n<\/li>\n<li>\n<p>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f: \u0437\u0430\u043f\u0438\u0441\u044c \u0432 WAL \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043a\u043e\u043d\u0435\u0446 \u0444\u0430\u0439\u043b\u0430 &#8212; \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 (\u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435) \u0432\u0440\u0435\u043c\u044f \u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0433\u043e\u043b\u043e\u0432\u043a\u0438<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u0435\u0435: \u043f\u043e\u0442\u043e\u043a\u043e\u0432\u0430\u044f \u0440\u0435\u043f\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f (\u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432 WAL \u0438\u0434\u0443\u0442 \u0441\u0442\u0440\u043e\u0433\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e) \u0438\u043b\u0438, \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u043c\u043e\u0436\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0435\u0441\u044c \u0441\u043d\u0430\u043f\u0448\u043e\u0442 \u0441\u0440\u0430\u0437\u0443<\/p>\n<\/li>\n<li>\n<p>\u0421\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u0435\u0442: \u0432\u043c\u0435\u0441\u0442\u043e \u0447\u0442\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u043e \u043b\u043e\u0433\u0430, \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0441\u043d\u0430\u043f\u0448\u043e\u0442 \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a\u0436\u0435, \u043f\u043e\u0432\u0435\u0440\u0445 WAL \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438, \u043a\u0430\u043a \u0432 Postgres.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412\u0441\u0435 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c \u0441\u043e \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/danluu.com\/file-consistency\/\" rel=\"noopener noreferrer nofollow\">Files Are Hard<\/a>. \u0422\u043e\u0433\u0434\u0430 \u044f \u043f\u043e\u043d\u044f\u043b \u0437\u0430\u0447\u0435\u043c \u043d\u0443\u0436\u043d\u044b \u0447\u0435\u043a-\u0441\u0443\u043c\u043c\u044b, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430\u0434\u043e \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c (<code>fsync<\/code>) \u0438, \u0432\u043e\u043e\u0431\u0449\u0435, \u0447\u0442\u043e \u0444\u0430\u0439\u043b\u044b \u043d\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u044b. \u041f\u043e\u0441\u043b\u0435, \u044f \u0440\u0435\u0448\u0438\u043b \u043a\u043e\u043f\u043d\u0443\u0442\u044c \u043f\u043e\u0433\u043b\u0443\u0431\u0436\u0435 \u0438 \u043f\u043e\u043d\u044f\u043b \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0433\u043b\u0443\u0431\u043e\u043a\u0430 \u044d\u0442\u0430 \u043a\u0440\u043e\u043b\u0438\u0447\u044c\u044f \u043d\u043e\u0440\u0430. \u041f\u0438\u0441\u0430\u0442\u044c \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b \u0441 \u0442\u0440\u0443\u0434\u043e\u043c, \u0442.\u043a. \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0438\u0441\u043a\u0430\u0442\u044c \u0435\u0449\u0435 \u043a\u0430\u043a\u0438\u0445-\u043d\u0438\u0431\u0443\u0434\u044c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439, \u043d\u0430\u0439\u0442\u0438 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 \u0444\u0430\u043a\u0442\u044b \u0438 \u0442.\u0434.<\/p>\n<p>\u0413\u043b\u0430\u0432\u043d\u044b\u0439 \u0432\u044b\u0432\u043e\u0434 \u0438\u0437 \u0432\u0441\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 &#8212; <strong>\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u043d\u0430\u0434\u043e \u0443\u043c\u0435\u0442\u044c<\/strong>. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0442\u0435\u0440\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u0438\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b\/\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u043a\u043e \u0432\u043e\u0437\u0440\u0430\u0441\u0442\u0430\u044e\u0442.<\/p>\n<p>\u042f \u043f\u0440\u043e\u0448\u0435\u043b\u0441\u044f \u043f\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0441\u043b\u043e\u044f\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0437\u0430\u043f\u0438\u0441\u0438, \u043d\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0435\u043c\u044b \u043d\u0435 \u043f\u043e\u043a\u0440\u044b\u0442\u044b:<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445<\/p>\n<\/li>\n<li>\n<p>\u0423\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c<\/p>\n<\/li>\n<li>\n<p>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435\u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445\/\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c (NFS, OverlayFS)<\/p>\n<\/li>\n<li>\n<p>\u041a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0441\u0442\u044c (\u0442\u043e\u0447\u043d\u0435\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u043a\u0430\u043a\u0438\u0445 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445 &#8212; \u041e\u0421, \u0440\u0430\u043d\u0442\u0430\u0439\u043c, \u0436\u0435\u043b\u0435\u0437\u043e)<\/p>\n<\/li>\n<li>\n<p>\u0411\u0430\u0433\u0438 \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0445 (\u043e\u043d\u0438 \u0435\u0441\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/bugs.archlinux.org\/task\/63733\" rel=\"noopener noreferrer nofollow\">\u0431\u0430\u0433 btrfs 4.2 \u0438 4.3 \u0432\u0435\u0440\u0441\u0438\u0438<\/a>, <a href=\"https:\/\/bugzilla.redhat.com\/show_bug.cgi?id=2208553\" rel=\"noopener noreferrer nofollow\">\u0431\u0430\u0433 \u044f\u0434\u0440\u0430 6.3.3 \u043f\u0440\u0438\u0432\u043e\u0434\u044f\u0449\u0438\u0439 \u043a \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u044e \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 XFS (\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d \u0432 \u043c\u0430\u0435 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0433\u043e\u0434\u0430)<\/a> \u0438\u043b\u0438 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0439 \u043c\u043d\u043e\u0439)<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u0432 (Cygwin, WSL) \u0438\u043b\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d (VMWare, VirtualBox)<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0435\u0437\u043d\u0430. \u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043f\u0440\u0438\u043b\u0430\u0433\u0430\u044e:<\/p>\n<p>\u0424\u0430\u0439\u043b\u043e\u0432\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/danluu.com\/file-consistency\/\" rel=\"noopener noreferrer nofollow\">Files Are Hard<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/danluu.com\/filesystem-errors\/\" rel=\"noopener noreferrer nofollow\">Filesystem Error Handling<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.usenix.org\/system\/files\/conference\/osdi14\/osdi14-paper-pillai.pdf\" rel=\"noopener noreferrer nofollow\">All File Systems Are Not Created Equal: On the Complexity of Crafting Crash-Consistent Applications<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.usenix.org\/system\/files\/atc20-rebello.pdf\" rel=\"noopener noreferrer nofollow\">Can Applications Recover from fsync Failures?<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/lwn.net\/Articles\/457667\/\" rel=\"noopener noreferrer nofollow\">Ensuring data reaches disk<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.cs.utexas.edu\/~bornholt\/papers\/ferrite-asplos16.pdf\" rel=\"noopener noreferrer nofollow\">Specifying and Checking File System Crash-Consistency Models<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/research.cs.wisc.edu\/wind\/Publications\/sfa-dsn05.pdf\" rel=\"noopener noreferrer nofollow\">Model-Based Failure Analysis of Journaling File Systems<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.usenix.org\/legacy\/event\/fast08\/tech\/full_papers\/gunawi\/gunawi.pdf\" rel=\"noopener noreferrer nofollow\">EIO: Error Handling is Occasionally Correct<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u0438:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/gudok.xyz\/sspar\/\" rel=\"noopener noreferrer nofollow\">Storage subsystem performance: analysis and recipes<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/arxiv.org\/pdf\/2012.12373.pdf\" rel=\"noopener noreferrer nofollow\">The Life and Death of SSDs and HDDs: Similarities, Differences, and Prediction Models<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/arxiv.org\/pdf\/1901.03401.pdf\" rel=\"noopener noreferrer nofollow\">Large Scale Studies of Memory, Storage, and Network Failures in a Modern Data Center<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/arxiv.org\/pdf\/1805.00140.pdf\" rel=\"noopener noreferrer nofollow\">Investigating Power Outage Effects on Reliability of Solid-State Drives<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/www.backblaze.com\/blog\/backblaze-drive-stats-for-2023\/\" rel=\"noopener noreferrer nofollow\">Backblaze Drive Stats for 2023<\/a><\/p>\n<\/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\/articles\/803347\/\"> https:\/\/habr.com\/ru\/articles\/803347\/<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e.<\/p>\n<p>\u0413\u043e\u0434 \u043d\u0430\u0437\u0430\u0434 \u043c\u0435\u043d\u044f \u0441\u0438\u043b\u044c\u043d\u043e \u0443\u0432\u043b\u0435\u043a\u043b\u0430 \u0442\u0435\u043c\u0430 \u043e\u0442\u043a\u0430\u0437\u043e\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u042f \u043d\u0430\u0447\u0430\u043b \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0430\u0441\u043f\u0435\u043a\u0442\u044b \u0435\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043c\u0435\u043d\u044f \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0438\u0441\u043a\u043e\u043c. \u0420\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u043c\u043d\u043e\u0433\u043e, \u043d\u043e \u043e\u043d\u0438 \u0432\u0441\u0435 \u0440\u0430\u0437\u0431\u0440\u043e\u0441\u0430\u043d\u044b \u043f\u043e \u0441\u0435\u0442\u0438 \u0438 \u043c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u0432\u0440\u0435\u043c\u044f, \u0447\u0442\u043e\u0431\u044b \u0441\u043b\u043e\u0436\u0438\u0442\u044c \u0432\u0441\u0435 \u043a\u0443\u0441\u043e\u0447\u043a\u0438 \u043f\u0430\u0437\u043b\u0430. \u0417\u0434\u0435\u0441\u044c \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0441\u044c \u044d\u0442\u043e\u0442 \u043f\u0430\u0437\u043b \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u043e\u0435\u0434\u0438\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u043d\u0430\u043d\u0438\u044f.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043f\u0443\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f.<\/p>\n<h2>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412\u0441\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043e\u0434\u0435. \u041e\u0431\u044b\u0447\u043d\u043e \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438. \u042d\u0442\u043e \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u042f\u041f, \u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u044b:<\/p>\n<ul>\n<li>\n<p><code>fwrite<\/code> &#8212; C<\/p>\n<\/li>\n<li>\n<p><code>std::fstream.write<\/code> &#8212; C++<\/p>\n<\/li>\n<li>\n<p><code>FileStream.Write<\/code> &#8212; C#<\/p>\n<\/li>\n<li>\n<p><code>FileOutputStream.Write<\/code> &#8212; Java<\/p>\n<\/li>\n<li>\n<p><code>open().write<\/code> &#8212; Python<\/p>\n<\/li>\n<li>\n<p><code>os.WriteFile<\/code> &#8212; GO<\/p>\n<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u0432\u0441\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0435 \u044f\u0437\u044b\u043a\u0430\u043c\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438: \u0437\u0430\u043f\u0438\u0441\u044c, \u0447\u0442\u0435\u043d\u0438\u0435 \u0438 \u0442.\u0434. \u0418\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u043e\u0442 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c. \u041d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438 \u043f\u0440\u0438\u0432\u043d\u043e\u0441\u0438\u0442 \u0441\u0432\u043e\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u044d\u0442\u043e \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f.<\/p>\n<p>\u0421\u0443\u0434\u044f \u043f\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0432\u0441\u0435 \u042f\u041f, \u0438\u0437 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043b\u0438\u0431\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e:<\/p>\n<ul>\n<li>\n<p>C &#8212; <a href=\"https:\/\/en.cppreference.com\/w\/c\/io\/setvbuf\" rel=\"noopener noreferrer nofollow\">setvbuf<\/a><\/p>\n<\/li>\n<li>\n<p>C++ &#8212; <a href=\"https:\/\/cplusplus.com\/reference\/fstream\/filebuf\/\" rel=\"noopener noreferrer nofollow\">filebuf<\/a><\/p>\n<\/li>\n<li>\n<p>C# &#8212; <a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/main\/src\/libraries\/System.Private.CoreLib\/src\/System\/IO\/Strategies\/BufferedFileStreamStrategy.cs\" rel=\"noopener noreferrer nofollow\">BufferedFileStrategy<\/a><\/p>\n<\/li>\n<li>\n<p>Java &#8212; <a href=\"https:\/\/docs.oracle.com\/javase\/8\/docs\/api\/java\/nio\/file\/Files.html#newBufferedWriter-java.nio.file.Path-java.nio.charset.Charset-java.nio.file.OpenOption...-\" rel=\"noopener noreferrer nofollow\">Files.newBufferedReader<\/a><\/p>\n<\/li>\n<li>\n<p>Python &#8212; <a href=\"https:\/\/docs.python.org\/3\/library\/io.html#io.BufferedIOBase\" rel=\"noopener noreferrer nofollow\">io.BufferedIOBase<\/a><\/p>\n<\/li>\n<li>\n<p>GO &#8212; <a href=\"https:\/\/pkg.go.dev\/bufio#Reader\" rel=\"noopener noreferrer nofollow\">bufio.Reader<\/a><\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u041d\u0430\u0441\u0447\u0435\u0442 C# &#8212; \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <code>FileStream<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>FileStreamStrategy<\/code> \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b.<br \/> \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 <code>FileStream<\/code> \u0447\u0435\u0440\u0435\u0437 <code>File.Open<\/code>, <code>BufferedFileStrategy<\/code> \u043e\u0431\u0435\u0440\u0442\u044b\u0432\u0430\u0435\u0442 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 <code>OSFileStreamStrategy<\/code>.<\/p>\n<\/blockquote>\n<p>\u0412\u043e\u043e\u0431\u0449\u0435, \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0448\u0442\u0443\u043a\u0430 \u043d\u0435\u043f\u043b\u043e\u0445\u0430\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u041d\u043e \u0435\u0441\u043b\u0438 \u043d\u0435 \u0437\u043d\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e, \u0442\u043e \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u0430. \u0422\u0443\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c 2 \u0441\u043b\u0443\u0447\u0430\u044f:<\/p>\n<ol>\n<li>\n<p>\u0411\u0443\u0444\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0441\u043e\u0437\u0434\u0430\u043d \u0432\u0440\u0443\u0447\u043d\u0443\u044e (GO, Java).<\/p>\n<\/li>\n<li>\n<p>\u0411\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430 (C, C++).<\/p>\n<\/li>\n<\/ol>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0442\u043e\u0447\u043d\u043e \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u0431\u0443\u0444\u0435\u0440\u044b \u043d\u0430\u0434\u043e \u0441\u0431\u0440\u043e\u0441\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438, \u0442\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0432 \u043d\u043e\u0433\u0443:<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u044d\u043a\u0441\u0442\u0440\u0435\u043d\u043d\u043e \u0437\u0430\u043a\u0440\u043e\u0435\u0442\u0441\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 SIGKILL \u043d\u0435\u043b\u044c\u0437\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c) \u0438 \u0431\u0443\u0444\u0435\u0440\u044b \u0443\u0440\u043e\u0432\u043d\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0441\u0431\u0440\u043e\u0441\u044f\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p>\u0424\u0430\u0439\u043b \u043f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0433\u0434\u0435-\u0442\u043e \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u043f\u0440\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0438 \u0431\u0443\u0444\u0435\u0440\u044b \u0441\u0431\u0440\u043e\u0448\u0435\u043d\u044b \u043d\u0435 \u0431\u0443\u0434\u0443\u0442, \u0442.\u043a. \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0431\u0443\u0434\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412\u044b\u0445\u043e\u0434\u043e\u0432 \u0437\u0434\u0435\u0441\u044c 2:<\/p>\n<ul>\n<li>\n<p>\u0421\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u0431\u0443\u0444\u0435\u0440\u044b \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0435\u0430\u043d\u0441\u0430 \u0437\u0430\u043f\u0438\u0441\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0435\u0441\u044c \u0431\u0430\u0442\u0447 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0447\u0435\u0440\u0435\u0437 <code>write<\/code> \u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u0431\u0443\u0444\u0435\u0440.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0432\u043e\u043e\u0431\u0449\u0435 \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e.<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0432\u043b\u0435\u043a\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 &#8212; \u043f\u0435\u0440\u0432\u044b\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u044b\u0441\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0414\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u044f \u043f\u0440\u043e\u0432\u0435\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a. \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c 64\u041c\u0431 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b.<\/p>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b \u043d\u0430 \u0441\u0442\u0430\u0440\u043e\u043c \u043d\u043e\u0443\u0442\u0431\u0443\u043a\u0435 \u0441 HDD \u0438 \u043d\u043e\u0432\u043e\u043c \u0441 SSD M.2. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u041d\u043e\u0443\u0442\u0431\u0443\u043a<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u041d\u0435 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c, \u0441<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u0411\u0443\u0444\u0435\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c, \u0441<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0421\u0442\u0430\u0440\u044b\u0439<\/p>\n<\/td>\n<td>\n<p align=\"left\">894.7<\/p>\n<\/td>\n<td>\n<p align=\"left\">109.6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041d\u043e\u0432\u044b\u0439<\/p>\n<\/td>\n<td>\n<p align=\"left\">8.932<\/p>\n<\/td>\n<td>\n<p align=\"left\">1.198<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0435 \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u0435\u043d: \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u0432 8 \u0440\u0430\u0437. \u041a\u043e\u0434 \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d <a href=\"https:\/\/github.com\/ashenBlade\/habr-posts\/blob\/file-write\/file-write\/src\/FileWrite.Benchmarks\/FileWriteBenchmarks.cs\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<\/div>\n<\/details>\n<h2>\u041e\u0421<\/h2>\n<p>\u042f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u0443\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b &#8212; \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u0443\u043c\u0430\u0442\u044c (\u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u043d\u0435 \u0442\u0430\u043a \u0447\u0430\u0441\u0442\u043e) \u043d\u0430 \u043a\u0430\u043a\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041d\u043e \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044f\u0437\u044b\u043a\u0430 \u0431\u0443\u0434\u0443\u0442 \u0442\u0440\u0430\u043d\u0441\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f\/\u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u041e\u0421. \u042d\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b, \u043d\u043e \u0432 \u043e\u0431\u0449\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th>\n<p align=\"left\">\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u044f<\/p>\n<\/th>\n<th>\n<p align=\"left\">*nix<\/p>\n<\/th>\n<th>\n<p align=\"left\">Windows<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041e\u0442\u043a\u0440\u044b\u0442\u0438\u0435\/\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">open<\/p>\n<\/td>\n<td>\n<p align=\"left\">CreateFile<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0427\u0442\u0435\u043d\u0438\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">pread<\/p>\n<\/td>\n<td>\n<p align=\"left\">ReadFile<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0417\u0430\u043f\u0438\u0441\u044c<\/p>\n<\/td>\n<td>\n<p align=\"left\">pwrite<\/p>\n<\/td>\n<td>\n<p align=\"left\">WriteFile<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0417\u0430\u043a\u0440\u044b\u0442\u0438\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\">close<\/p>\n<\/td>\n<td>\n<p align=\"left\">CloseFile<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<blockquote>\n<p>\u041f\u043e\u0434 *nix \u0438\u043c\u0435\u044e\u0442 Unix-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u041e\u0421 (Linux, FreeBSD, OSX). \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0443 \u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435, \u0445\u043e\u0442\u044c \u0438 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f.<\/p>\n<\/blockquote>\n<p>\u041d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u041e\u0421 \u0442\u043e\u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f &#8212; <a href=\"https:\/\/en.wikipedia.org\/wiki\/Page_cache\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u043a\u044d\u0448<\/a>. \u0418 \u0432\u043e\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0435 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c \u0432 \u043d\u043e\u0433\u0443 \u0435\u0449\u0435 \u043f\u0440\u043e\u0449\u0435.<\/p>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0444\u0430\u0439\u043b\u043e\u043c (\u0447\u0442\u0435\u043d\u0438\u0435\/\u0437\u0430\u043f\u0438\u0441\u044c) \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u043d\u0435\u0433\u043e \u0447\u0438\u0442\u0430\u044e\u0442\u0441\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438, \u0434\u0430\u0436\u0435 \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0440\u043e\u0448\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e 1 \u0431\u0430\u0439\u0442 (\u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043b\u0438 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c). \u041a\u043e\u0433\u0434\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0431\u044b\u043b\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0430, \u0442\u043e \u043e\u043d\u0430 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f &#171;\u0433\u0440\u044f\u0437\u043d\u043e\u0439&#187; \u0438 \u0431\u0443\u0434\u0435\u0442 \u0441\u0431\u0440\u043e\u0448\u0435\u043d\u0430 \u043d\u0430 \u0434\u0438\u0441\u043a. \u041f\u0440\u0438\u0447\u0435\u043c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446, \u043e\u043d\u0438 \u0438 \u0441\u043e\u0437\u0434\u0430\u044e\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u043a\u044d\u0448 &#8212; \u0431\u0443\u0444\u0435\u0440 \u0443\u0440\u043e\u0432\u043d\u044f \u041e\u0421. \u0422\u0430\u043a \u0433\u0434\u0435 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043c \u043f\u043e\u0432\u0440\u0435\u0434\u0438\u0442\u044c? \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441:<\/p>\n<ol>\n<li>\n<p>\u041d\u0430\u043c \u043f\u0440\u0438\u0448\u0435\u043b \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435<\/p>\n<\/li>\n<li>\n<p>\u041c\u044b \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u043c\u0435\u044e\u0449\u0438\u0439\u0441\u044f \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0438\u043c\u0435\u043d\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c (\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u0438\u043c\u0435\u043d\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 255 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432)<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e, \u0447\u0442\u043e \u0438\u043c\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043e<\/p>\n<\/li>\n<\/ol>\n<p>\u0413\u0434\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430? \u041f\u043e\u0441\u043b\u0435 4 \u0448\u0430\u0433\u0430. \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0431 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u0442\u0432\u0430. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0438\u043c\u0435\u0435\u043c \u0442\u0430\u043a\u0443\u044e \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e:<\/p>\n<ul>\n<li>\n<p>\u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u0443\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u0438\u043c\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043e<\/p>\n<\/li>\n<li>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0441\u0442\u0430\u0440\u044b\u0435<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u0441\u0442\u0430\u0440\u044b\u0435? \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u0438\u043c\u044f \u0445\u0440\u0430\u043d\u0438\u043b\u043e\u0441\u044c \u043d\u0430 \u0433\u0440\u044f\u0437\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0430 \u043d\u0435 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435, \u0438 \u043f\u0440\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043c\u044b \u0435\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435 \u0443\u0441\u043f\u0435\u043b\u0438.<\/p>\n<p>\u0421\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u043a\u044d\u0448 \u043f\u043e\u043b\u0435\u0437\u0435\u043d, \u043a\u043e\u0433\u0434\u0430 \u043d\u0430\u0434 \u043e\u0434\u043d\u0438\u043c \u0443\u0447\u0430\u0441\u0442\u043a\u043e\u043c \u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0447\u0442\u0435\u043d\u0438\u044f\/\u0437\u0430\u043f\u0438\u0441\u0438. \u041d\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c &#171;\u0437\u0430\u043a\u043e\u043c\u043c\u0438\u0447\u0435\u043d\u044b&#187; \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0431\u044b\u043b\u0438 \u0441\u0431\u0440\u043e\u0448\u0435\u043d\u044b \u043d\u0430 \u0434\u0438\u0441\u043a. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0439:<\/p>\n<ol>\n<li>\n<p>\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0434\u043b\u044f \u0441\u0431\u0440\u043e\u0441\u0430 \u0431\u0443\u0444\u0435\u0440\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0441\u0440\u0430\u0437\u0443, \u0447\u0442\u043e \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u0430<\/p>\n<\/li>\n<\/ol>\n<h3>\u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0434\u043b\u044f \u0441\u0431\u0440\u043e\u0441\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446<\/h3>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b.<\/p>\n<h4>Linux<\/h4>\n<p>\u0414\u043b\u044f Linux \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c:<\/p>\n<ul>\n<li>\n<p><code>fdatasync(fd)<\/code> &#8212; \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e <em>\u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438<\/em> \u0438 \u043d\u0430 \u0434\u0438\u0441\u043a\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u0442.\u0435. \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0441\u0431\u0440\u043e\u0441 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0440 \u0444\u0430\u0439\u043b\u0430;<\/p>\n<\/li>\n<li>\n<p><code>fsync(fd)<\/code> &#8212; \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0447\u0442\u043e \u0438 <code>fdatasync<\/code>, \u043d\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u0442 <em>\u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u0430<\/em> (\u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430, \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0438 \u0434\u0440.);<\/p>\n<\/li>\n<li>\n<p><code>sync_file_range(fd, range)<\/code> &#8212; \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 <em>\u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0434\u0430\u043d\u043d\u044b\u0445<\/em> \u0444\u0430\u0439\u043b\u0430 \u0441\u0431\u0440\u043e\u0448\u0435\u043d \u043d\u0430 \u0434\u0438\u0441\u043a;<\/p>\n<\/li>\n<li>\n<p><code>sync()<\/code> &#8212; \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0442\u043e\u0436\u0435 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0431\u0443\u0444\u0435\u0440\u043e\u0432 \u0438 \u0434\u0438\u0441\u043a\u043e\u0432, \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u044d\u0442\u043e <em>\u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432<\/em>, \u0430 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u0441\u043a\u0430\u0437\u0430\u043d\u043e, <code>fdatasync<\/code> \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435, \u0431\u0435\u0437 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u043a\u0430\u043a <code>fsync<\/code>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<br \/> \u0412 etcd \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/etcd-io\/etcd\/blob\/6f55dfa26e1a359e47e1fb15af79951e97dbac39\/client\/pkg\/fileutil\/sync_linux.go#L32\" rel=\"noopener noreferrer nofollow\">\u044f\u0432\u043d\u043e\u0435 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435<\/a> \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 2 \u0432\u044b\u0437\u043e\u0432\u0430\u043c\u0438:<\/p>\n<pre><code class=\"go\">\/\/ Fsync is a wrapper around file.Sync(). Special handling is needed on darwin platform. func Fsync(f *os.File) error { return f.Sync() }  \/\/ Fdatasync is similar to fsync(), but does not flush modified metadata \/\/ unless that metadata is needed in order to allow a subsequent data retrieval \/\/ to be correctly handled. func Fdatasync(f *os.File) error { return syscall.Fdatasync(int(f.Fd())) } <\/code><\/pre>\n<blockquote>\n<p>\u0411\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u043e \u044d\u0442\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"https:\/\/habr.com\/ru\/companies\/ruvds\/articles\/524172\/\" rel=\"noopener noreferrer nofollow\">\u0423\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0435 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0435 API Linux<\/a>.<\/p>\n<\/blockquote>\n<h4>Windows<\/h4>\n<p>\u0414\u043b\u044f Windows \u044d\u0442\u043e:<\/p>\n<ul>\n<li>\n<p><code>_commit(fd)<\/code> &#8212; \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u0430 \u043f\u0440\u044f\u043c\u043e \u043d\u0430 \u0434\u0438\u0441\u043a. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u043c \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u043c<\/p>\n<\/li>\n<li>\n<p><code>FlushFileBuffers(hFile)<\/code> &#8212; \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0432\u0441\u0435\u0445 \u0431\u0443\u0444\u0435\u0440\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u0430\u0439\u043b. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0445\u044d\u043d\u0434\u043b\u043e\u043c \u041e\u0421<\/p>\n<\/li>\n<li>\n<p><code>NtFlushBuffersFileEx(hFile, params)<\/code> &#8212; \u0441\u0431\u0440\u043e\u0441 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u043d\u0430 \u0434\u0438\u0441\u043a, \u043d\u043e \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0433\u0440\u0430\u043d\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c \u0437\u0430 \u0441\u0447\u0435\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0445\u044d\u043d\u0434\u043b\u043e\u043c \u041e\u0421<\/p>\n<\/li>\n<\/ul>\n<p>P.S. <code>NtFlushBuffersFileEx<\/code> <a href=\"https:\/\/github.com\/postgres\/postgres\/blob\/874d817baa160ca7e68bee6ccc9fc1848c56e750\/src\/port\/win32fdatasync.c#L40\" rel=\"noopener noreferrer nofollow\">\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 Postgres<\/a> \u043a\u0430\u043a \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u0434\u043b\u044f \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u0433\u043e <code>fdatasync<\/code>, \u0430 \u0434\u043b\u044f <code>fsync<\/code> &#8212; <code>_commit<\/code><\/p>\n<pre><code class=\"cpp\">\/\/ https:\/\/github.com\/postgres\/postgres\/blob\/9acae56ce0b0812f3e940cf1f87e73e8d5784e78\/src\/include\/port\/win32_port.h#L85 \/* Windows doesn't have fsync() as such, use _commit() *\/ #define fsync(fd) _commit(fd)  \/\/ https:\/\/github.com\/postgres\/postgres\/blob\/874d817baa160ca7e68bee6ccc9fc1848c56e750\/src\/port\/win32fdatasync.c#L23 int fdatasync(int fd) {     \/\/ ... status = pg_NtFlushBuffersFileEx(handle,  FLUSH_FLAGS_FILE_DATA_SYNC_ONLY,  NULL,  0,  &amp;iosb);     \/\/ ... } <\/code><\/pre>\n<h4>macOS<\/h4>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c macOS. \u041e\u043d\u0430 \u0445\u043e\u0442\u044c \u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f POSIX \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0439, \u0442.\u0435. \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>fsync<\/code>, \u043d\u043e \u0435\u0433\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u0414\u043b\u044f \u043d\u0435\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <code>fcntl(F_FULLSYNC)<\/code>. \u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 <a href=\"https:\/\/developer.apple.com\/library\/archive\/documentation\/System\/Conceptual\/ManPages_iPhoneOS\/man2\/fsync.2.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>:<\/p>\n<blockquote>\n<p>For applications that require tighter guarantees about the integrity of their data, Mac OS X provides the F_FULLFSYNC fcntl.<\/p>\n<\/blockquote>\n<p>\u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043d\u0430 macOS \u043e\u0431 \u044d\u0442\u043e\u043c \u0441\u0442\u043e\u0438\u0442 \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0438\u043d\u0430\u0447\u0435 <a href=\"https:\/\/habr.com\/ru\/news\/653527\/\" rel=\"noopener noreferrer nofollow\">\u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u044b\u0441\u043e\u043a\u0430<\/a>. \u0412 etcd \u044d\u0442\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 <a href=\"https:\/\/github.com\/etcd-io\/etcd\/blob\/6f55dfa26e1a359e47e1fb15af79951e97dbac39\/client\/pkg\/fileutil\/sync_darwin.go#L36\" rel=\"noopener noreferrer nofollow\">\u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f<\/a>:<\/p>\n<pre><code class=\"go\">\/\/ Fsync on HFS\/OSX flushes the data on to the physical drive but the drive \/\/ may not write it to the persistent media for quite sometime and it may be \/\/ written in out-of-order sequence. Using F_FULLFSYNC ensures that the \/\/ physical drive's buffer will also get flushed to the media. func Fsync(f *os.File) error { _, err := unix.FcntlInt(f.Fd(), unix.F_FULLFSYNC, 0) return err }  \/\/ Fdatasync on darwin platform invokes fcntl(F_FULLFSYNC) for actual persistence \/\/ on physical drive media. func Fdatasync(f *os.File) error { return Fsync(f) } <\/code><\/pre>\n<h3>\u0413\u043e\u0432\u043e\u0440\u0438\u043c \u041e\u0421, \u0447\u0442\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u0430<\/h3>\n<p>\u0414\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c.<\/p>\n<p>\u0412 Linux \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <code>O_SYNC | O_DIRECT<\/code> \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>open<\/code>:<\/p>\n<ul>\n<li>\n<p><code>O_SYNC<\/code> &#8212; \u043b\u044e\u0431\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u0440\u0430\u0437\u0443 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0438\u0441\u043a (\u0435\u0441\u0442\u044c \u0435\u0449\u0435 <code>O_DSYNC<\/code> &#8212; \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0430\u043d\u043d\u044b\u0445, \u0431\u0435\u0437 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445)<\/p>\n<\/li>\n<li>\n<p><code>O_DIRECT<\/code> &#8212; \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043e\u0431\u0445\u043e\u0434 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u043e\u0433\u043e \u043a\u0435\u0448\u0430, \u0442.\u0435. \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0435\u0433\u043e<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u043b\u0430\u0433\u0430 <code>O_SYNC<\/code>\/<code>O_DSYNC<\/code> \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e write \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f <code>fsync<\/code>\/<code>fdatasync<\/code>, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>fcntl<\/code> \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0444\u0430\u0439\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e <code>O_DIRECT<\/code> \u0444\u043b\u0430\u0433, \u043d\u043e \u043d\u0435 <code>O_SYNC<\/code>. \u042d\u0442\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 <code>fcntl<\/code>:<\/p>\n<blockquote>\n<p>&#8230; It is not possible to change the O_DSYNC and O_SYNC flags; see BUGS, below.<\/p>\n<\/blockquote>\n<p>\u0412 Windows \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u0430\u043d\u0430\u043b\u043e\u0433\u0438: \u0444\u043b\u0430\u0433\u0438 <code>FILE_FLAG_NO_BUFFERING<\/code> \u0438 <code>FILE_FLAG_WRITE_THROUGH<\/code> \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0444\u0430\u0439\u043b\u0430 <code>CreateFile<\/code>:<\/p>\n<ul>\n<li>\n<p><code>FILE_FLAG_NO_BUFFERING<\/code> &#8212; \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0431\u0443\u0444\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u041e\u0421 \u043f\u0440\u0438 \u0437\u0430\u043f\u0438\u0441\u0438<\/p>\n<\/li>\n<li>\n<p><code>FILE_FLAG_WRITE_THROUGH<\/code> &#8212; \u0432\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0434\u0438\u0441\u043a, \u0431\u0435\u0437 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 <a href=\"https:\/\/learn.microsoft.com\/en-us\/windows\/win32\/api\/fileapi\/nf-fileapi-createfilea#caching-behavior\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u0434\u0430\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e \u043f\u0440\u0438 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u0438 \u043e\u0431\u043e\u0438\u0445 \u0444\u043b\u0430\u0433\u043e\u0432:<\/p>\n<blockquote>\n<p>If FILE_FLAG_WRITE_THROUGH and FILE_FLAG_NO_BUFFERING are both specified, so that system caching is not in effect, then the data is immediately flushed to disk without going through the Windows system cache. The operating system also requests a write-through of the hard disk&#8217;s local hardware cache to persistent media.<\/p>\n<\/blockquote>\n<p>\u0410 \u0432 <a href=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/20210729-00\/?p=105494\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0445 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td colspan=\"2\" rowspan=\"2\">\n<p align=\"left\">\n<\/td>\n<td colspan=\"2\">\n<p align=\"left\">NO_BUFFERING<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u041d\u0435\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0412\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td rowspan=\"2\">\n<p align=\"left\">WRITE_THROUGH<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041d\u0435\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u043a\u044d\u0448 \u041e\u0421 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u041e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430 \u0434\u0438\u0441\u043a. \u0411\u0435\u0437 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0441\u0431\u0440\u043e\u0441\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439 \u043a\u044d\u0448 \u041e\u0421 _\u043d\u0435_ \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u041d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043d\u0430 \u0434\u0438\u0441\u043a. \u0411\u0435\u0437 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0441\u0431\u0440\u043e\u0441\u0430<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p align=\"left\">\u0412\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0442\u0440\u0430\u043d\u0438\u0447\u043d\u044b\u0439<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-371990","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/371990","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=371990"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/371990\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=371990"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=371990"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=371990"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}