Skip to content
Snippets Groups Projects
Commit 15fcc7c0 authored by pcherenkov's avatar pcherenkov
Browse files

Merge branch 'wal-doc' into doc-edit-1

parents b0ac629f ea32bf31
No related merge requests found
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<title>Data persistence</title> <title>Data persistence</title>
<para> <para>
To maintain data persistence, Tarantool writes each data change To maintain data persistence, Tarantool writes each data change
request (INSERT, UPDATE, DELETE) into a write ahead log. WAL request (INSERT, UPDATE, DELETE) into a write-ahead log. WAL
files have extension <filename>.xlog</filename> and are stored in <olink files have extension <filename>.xlog</filename> and are stored in <olink
targetptr="wal_dir"/>. A new WAL file is created for every <olink targetptr="wal_dir"/>. A new WAL file is created for every <olink
targetptr="rows_per_wal"/> records. Each INSERT, UPDATE or DELETE targetptr="rows_per_wal"/> records. Each INSERT, UPDATE or DELETE
...@@ -23,36 +23,35 @@ each WAL record contains a checksum and a UNIX time stamp. ...@@ -23,36 +23,35 @@ each WAL record contains a checksum and a UNIX time stamp.
</para> </para>
<para> <para>
Tarantool proceeds requests atomically: a change is either Tarantool processes requests atomically: a change is either
accepted and recorded in the WAL, or is rejected wholesale. accepted and recorded in the WAL, or discarded completely.
Let's clarify how this happens, using REPLACE command as an Let's clarify how this happens, using REPLACE command as an
example: example:
<orderedlist> <orderedlist>
<listitem><para> <listitem><para>
The server tries to locate an old tuple identified by The server attempts to locate the original tuple by
the same primary key. If found, the tuple is remembered for primary key. If found, a reference to the tuple is retained
later. for later use.
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
The new tuple is <emphasis>validated</emphasis>. If it The new tuple is then <emphasis>validated</emphasis>. If it
violates any of the unique key constraints, misses violates a unique-key constraint, misses
any of indexed fields, or an indexed field type does not an indexed field, or an index-field type does not
match index type, the change is aborted. match the type of the index, the change is aborted.
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
The new tuple is marked 'invisible' and is added to The new tuple is marked 'invisible' and is added to
the primary and secondary indexes. the primary and secondary indexes.
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
A message is sent to a separate <quote>wal_writer</quote> A message is sent to <quote>wal_writer</quote>, running in a
thread requesting that the change is recorded in the WAL. separate thread, requesting that the change be recorded in the WAL.
The fiber associate with the current connection is scheduled The fiber associated with the current connection is suspended
off CPU until an acknowledgment is received from the WAL until an acknowledgment from the WAL writer.
writer.
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
Upon success, 'invisible' flag is cleared Upon success, the 'invisible' flag is cleared
and the old tuple is deleted. A response is sent to the and the original tuple is deleted. A response is sent to the
client. Upon failure, the new tuple is removed and <olink client. Upon failure, the new tuple is removed and <olink
targetptr="ER_WAL_IO"/> error is sent to the client. targetptr="ER_WAL_IO"/> error is sent to the client.
</para></listitem> </para></listitem>
...@@ -60,13 +59,12 @@ example: ...@@ -60,13 +59,12 @@ example:
</para> </para>
<para> <para>
Communication between master and WAL writer threads is asynchronous. The master and the WAL writer threads communicate using asynchronous (yet reliable)
It is implemented using an asynchronous FIFO queue. messaging; the master theread, not being blocked on
Asynchronous but reliable message passing between the master WAL tasks, continues to handle requests quickly
and WAL writer threads allows Tarantool to continue handling even at hight volumes of disk I/O. For instance, SELECT performance,
requests regardless of disk throughput. SELECT performance, provided SELECTs are run in their own connections, remains
provided SELECTs are run in their own connections, is unaffected unaffected by disk load.
by disk load.
</para> </para>
<para> <para>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment