diff --git a/doc/user/configuration-reference.xml b/doc/user/configuration-reference.xml index 9a24ca6d97fb1c84b85c1c97a498a6fed23cf714..9f60c14417348af43856e9414e3d78e56478df70 100644 --- a/doc/user/configuration-reference.xml +++ b/doc/user/configuration-reference.xml @@ -259,7 +259,7 @@ lsn:4 tm:1301572313.691 t:65534 127.0.0.1:52728 UPDATE_FIELDS n:0flags:00000000 </row> <row> - <entry>work_dir</entry> + <entry xml:id="work_dir" xreflabel="work_dir">work_dir</entry> <entry>string</entry> <entry>""</entry> <entry>no</entry> diff --git a/doc/user/persistence-architecture.xml b/doc/user/persistence-architecture.xml index 5db4d1f3f01479205453f933206641a225746878..d9f51dd494146bf8f3d6bee15bb89c727ea4edc5 100644 --- a/doc/user/persistence-architecture.xml +++ b/doc/user/persistence-architecture.xml @@ -69,6 +69,44 @@ provided SELECTs are run in their own connections, is unaffected by disk load. </para> +<para> +WAL writer ensures data consistency and synchronization +between requesting fibers, WAL writer and disk by +employing one the following modes of operation (designated by +<emphasis>wal_mode</emphasis> and +<emphasis>wal_fsync_delay</emphasis> configuration keys): +<orderedlist> + <listitem><para><emphasis>write</emphasis>: fibers wait for their + data to be written to the log (no fsync(2));</para></listitem> + <listitem><para><emphasis>fsync</emphasis>: fibers wait for their + data, fsync(2) follows each write(2);</para></listitem> + <listitem><para><emphasis>fsync_delay</emphasis>: fibers wait for their + data, fsync every N=<emphasis>wal_fsync_delay</emphasis> + seconds (N=0.0 means no fsync(2) - equivalent to + <emphasis>wal_mode = "write"</emphasis>);</para></listitem> +</orderedlist> +</para> + +<!-- +<para> +WAL writer ensures data consistency and synchronization +between requesting fibers, WAL writer and disk by +employing one the following modes of operation (designated by +<emphasis>wal_mode</emphasis> and +<emphasis>wal_fsync_delay</emphasis> configuration keys): +<orderedlist> + <listitem><emphasis>write</emphasis>: fibers wait for their + data to be written to the log (no fsync(2));</listitem> + <listitem><emphasis>fsync</emphasis>: fibers wait for their + data, fsync(2) follows each write(2);</listitem> + <listitem><emphasis>fsync_delay</emphasis>: fibers wait for their + data, fsync every N=<emphasis>wal_fsync_delay</emphasis> + seconds (N=0.0 means no fsync(2) - equivalent to + <emphasis>wal_mode = "write"</emphasis>);</listitem> +</orderedlist> +</para> +--> + </section> <!-- vim: tw=66 syntax=docbk diff --git a/doc/user/stored-programs.xml b/doc/user/stored-programs.xml index fe877939cd0e94864c1b65ae1c87f5d191208e0a..fd580c25c1c14255240cc97d3f679a1d33af410f 100644 --- a/doc/user/stored-programs.xml +++ b/doc/user/stored-programs.xml @@ -20,7 +20,7 @@ </para> </blockquote> <para> - Procedures can be invoked both from the administrative + Procedures can be invoked from the administrative console and using the binary protocol, for example: <programlisting><computeroutput>localhost> lua function f1() return 'hello' end --- @@ -57,6 +57,43 @@ localhost> lua "hello".." world" ... </computeroutput></programlisting> </para> + <para> + Lua procedures could also be called at the time of initialization + using a dedicated <emphasis>init.lua</emphasis> script, + located in <olink targetptr="work_dir" />. + + An example of such a script is given below: + <programlisting> + <![CDATA[ +-- Importing expirationd module +dofile("expirationd.lua") + +function is_expired(args, tuple) + if tuple == nil then + return true + end + + if #tuple <= args.field_no then + return true + end + + field = tuple[args.field_no] + if field == nil or #field ~= 4 then + return true + end + + local current_time = os.time() + local tuple_ts = box.unpack("i", field) + return current_time >= tuple_ts + args.ttl +end + +-- Run task +expirationd.run_task("exprd space 0", 0, is_expired, nil, + { field_no = 1, ttl = 30 * 60 }) +]]> + </programlisting> + </para> + <para> There is a single global instance of Lua interpreter, which is shared across all connections. Anything prefixed with