diff --git a/doc/user/configuration-reference.xml b/doc/user/configuration-reference.xml index 162eb784224272441e18abe7c1bd54df92559595..5a39f48fa1255fdbcbf04c93867626947aa98a3e 100644 --- a/doc/user/configuration-reference.xml +++ b/doc/user/configuration-reference.xml @@ -364,11 +364,15 @@ tarantool: primary pri: 3301 adm: 3313</programlisting> <entry>0</entry> <entry>yes</entry> <entry> - Period to make new database snapshot. - Daemon is disabled by - <code>snapshot_period=0</code> value. - Use <code>snapshot_period=3600</code> to make - snapshot for each hour. + The interval between actions by the snapshot daemon, in seconds. + The snapshot daemon is a fiber which is constantly running. + If snapshot_period is set to a value greater than zero, + then the snapshot daemon + will call <olink targetptr="box.snapshot"/> every snapshot_period seconds, creating + a new snapshot file each time. + For example, <code>box.cfg{snapshot_period=3600}</code> + will cause the snapshot daemon to create a new database + snapshot once per hour. </entry> </row> @@ -379,15 +383,15 @@ tarantool: primary pri: 3301 adm: 3313</programlisting> <entry>yes</entry> <entry> <para> - The daemon creates new snapshot and then it - removes old snapshots (and their xlogs) using the - option. + The maximum number of snapshots that the snapshot daemon maintains. + For example, <code>box.cfg{snapshot_period=3600, snapshot_count=10}</code> + will cause the snapshot daemon + to create a new snapshot each hour until it has created + ten snapshots. After that, it will remove the oldest + snapshot (and any associated write-ahead-log files) after creating + a new one. If snapshot_count equals zero, then the snapshot + daemon does not remove old snapshots. </para> - - <para> - Daemon is disabled by - <code>snapshot_count=0</code> value. - </para> </entry> </row> </tbody> @@ -417,7 +421,7 @@ tarantool: primary pri: 3301 adm: 3313</programlisting> <entry>boolean</entry> <entry>true</entry> <entry>no</entry> - <entry>If there is an error reading the snapshot file (at + <entry>If there is an error while reading the snapshot file (at server start), abort.</entry> </row> @@ -426,7 +430,7 @@ tarantool: primary pri: 3301 adm: 3313</programlisting> <entry>boolean</entry> <entry>false</entry> <entry>no</entry> - <entry>If there is an error reading a write-ahead + <entry>If there is an error while reading a write-ahead log file (at server start), abort.</entry> </row> @@ -511,11 +515,17 @@ tarantool: primary pri: 3301 adm: 3313</programlisting> <entry>If replication_source is not an empty string, the server is considered to be a Tarantool replica. The replica server will try to connect to the master - which replication_source specifies with format ip:port. - For example, if replication_source = "1.2.3.4:55555" then - the replica server tries to connect to 1.2.3.4 port 55555. - A replica server does not accept updates - on <olink targetptr="primary_port">listen</olink>. This parameter is + which replication_source specifies with a URI. + The string format is similar to the + <link + xlink:href="http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax">generic syntax for a URI schema</link> + So it may be a user name and password and ip:port address such as 'guest:password@127.0.0.1:3301', + or just ip:port address such as '127.0.0.1:3301', + or just port such as '3301'. + The default user name is 'guest'. + A replica server does not accept data-change requests + on the <olink targetptr="primary_port">listen</olink> port. + The replication_source parameter is dynamic, that is, to enter master mode, simply set replication_source to an empty string and issue "box.cfg{replication_source=new-value}".</entry> diff --git a/doc/user/databases.xml b/doc/user/databases.xml index 57d031b544a35c7c63906bb4f41ebcf4613ac137..cc92af0d232b553a19d9eb3f08959a40246e098d 100644 --- a/doc/user/databases.xml +++ b/doc/user/databases.xml @@ -638,7 +638,7 @@ tarantool> <userinput>box.space.space55.index.primary:rename('secondary')</useri <varlistentry> <term> <emphasis role="lua" xml:id="box.update"> - box.space.<replaceable>space-name</replaceable>:update{<replaceable>key, format, {field_no, value}...</replaceable>) + box.space.<replaceable>space-name</replaceable>:update({<replaceable>key {, operator, field_no, value}...</replaceable>}) </emphasis> </term> <listitem> @@ -647,46 +647,37 @@ tarantool> <userinput>box.space.space55.index.primary:rename('secondary')</useri </para> <para> The <code>update</code> function supports operations on fields — - assignment, arithmetic operations (the field must be numeric), - cutting and pasting fragments of a field, — as well as - operations on a tuple: push and pop of a field at the tail of - a tuple, deletion and insertion of a field. Multiple - operations can be combined into a single update, and in this - case they are performed atomically. Each operation expects - field number as its first argument. When a sequence of changes - is present, field identifier in each operation is assumed to - be relative to the most recent state of the tuple, i.e. as if + assignment, arithmetic (if the field is unsigned numeric), + cutting and pasting fragments of a field, + deletng or inserting a field. Multiple + operations can be combined in a single update request, and in this + case they are performed atomically and sequentially. Each operation requires + specification of a field number. When multiple operations + are present, the field number for each operation is assumed to + be relative to the most recent state of the tuple, that is, as if all previous operations in a multi-operation update have - already been applied. In other words, it's always safe to + already been applied. In other words, it is always safe to merge multiple <code>update</code> invocations into a single invocation, with no change in semantics. </para> <para> Parameters: <code>space-name</code>, <code>key</code> = primary-key field values, must be passed as a Lua table if key is multi-part, - <code>format</code> = a sequence of - pairs of characters, where the first character in each pair - is the operation specifier, and the second character in - each pair is the operation argument. - The <code>{field_no, value}</code> arguments are the - field numbers of affected fields and applicable values. + <code>{operator, field_no, value}</code> = a group of arguments + for each operation, indicating what the operation is, what field + the operation will apply to, and what value will be applied. For some operations the field number can be -1, meaning the last field in the tuple. - There must be a pair of {field_no, value} arguments - for each character pair in the format argument. - The format and {field_no, value} arguments are passed to - <code>pickle.pack()</code> and the result is sent - to <code>box.process()</code>. - Possible operation specifiers are: <quote>+</quote> + Possible operators are: <quote>+</quote> for addition, <quote>-</quote> for subtraction, <quote>&</quote> for bitwise AND, <quote>|</quote> for bitwise OR, <quote>^</quote> for bitwise exclusive OR (XOR), <quote>:</quote> - for string splice, <quote>!</quote> for insertion. - Possible operation arguments are: <quote>p</quote>. - Thus in the instruction <code>s:update{44,, {{'+p,1,55},{=p',3,'x'}})</code> + for string splice, <quote>!</quote> for insert, + <quote>#</quote> for delete. + Thus in the instruction <code>s:update{44,, {{'+,1,55},{=',3,'x'}})</code> the primary-key value is 44, - the formats are '+p' and '=p' + the operators are '+' and '=' meaning "add a value to a field and then assign a value to a field", the first affected field is field 1 and the value which will be added to it is 55, the second affected field @@ -764,11 +755,11 @@ box.space.tester:update({999}, {{'=', 2, 'XYZ'}}) #In the following update ... # The third argument is ':', that is, this is the example of splice. # The fourth argument is 2 because the change will occur in field[2]. -# The fifth argument is 1 because deletion will begin with the second byte. +# The fifth argument is 2 because deletion will begin with the second byte. # The sixth argument is 1 because the number of bytes to delete is 1. # The seventh argument is '!!' because '!!' is to be added at this position. # Therefore, after the following update, field[1] = 999, field[2] = 'X!!Z'. -box.space.tester:update({999}, {{':', 2, 1, 1, '!!'}}) +box.space.tester:update({999}, {{':', 2, 2, 1, '!!'}}) </programlisting> </para> @@ -2096,6 +2087,46 @@ tarantool> <userinput>tmp = ''; for k, v in t:pairs() do tmp = tmp .. v end</ tarantool> <userinput>tmp</userinput> --- - Fld#1Fld#2Fld#3Fld#4Fld#5 +...</programlisting> + </listitem> + </varlistentry> + + <varlistentry> + <term> + <emphasis role="lua"><replaceable>tuple-value</replaceable>:update(<replaceable>{{format, field_no, value}...}</replaceable>)</emphasis> + </term> + <listitem> + <para> + Update a tuple. + </para> + <para> + This function updates a tuple which is not in a space. + Compare the function + <code>box.space.<replaceable>space-name</replaceable>:update{<replaceable>key, format, {field_no, value}...</replaceable>)</code>, + which updates a tuple in a space. + </para> + <para> + Parameters: briefly: + <code>format</code> indicates the type of update operation such as '=' for 'assign new value', + <code>field_no</code> indicates the field number to change such as 2 for field number 2, + <code>value</code> indicates the string which operates on the field such as 'B' for a new assignable value = 'B'. + For details: see the description for <code>format</code>, <code>field_no</code>, and <code>value</code> + in the section <olink targetptr="box.update"><code>box.space.<replaceable>space-name</replaceable>:update{<replaceable>key, format, {field_no, value}...</replaceable>)</code></olink>. + </para> + <para> + Returns: (type = tuple) the new tuple. + </para> + <para> + In the following example, a tuple named t is created + and then its second field is updated to equal 'B'. + </para> + <bridgehead renderas="sect4">Example</bridgehead> +<programlisting>tarantool> <userinput>t = box.tuple.new({'Fld#1','Fld#2','Fld#3','Fld#4','Fld#5'})</userinput> +--- +... +tarantool> <userinput>t:update({{'=',2,'B'}})</userinput> +--- +- ['Fld#1', 'B', 'Fld#3', 'Fld#4', 'Fld#5'] ...</programlisting> </listitem> </varlistentry> diff --git a/doc/user/replication.xml b/doc/user/replication.xml index c2856b36e5874370e625a3534334f78b97963d6d..668a80bd6a1b800db0fe88d7a206c24af18c13d5 100644 --- a/doc/user/replication.xml +++ b/doc/user/replication.xml @@ -68,8 +68,8 @@ identifier which is unique within the cluster, known as the To prepare the master for connections from the replica, it's only necessary to include "listen" in the initial <code>box.cfg</code> request, for example <code>box.cfg{listen=3301}</code>. - A master with enabled "listen" uri can accept connections - from as many replicas as necessary on that uri. Each replica + A master with enabled "listen" URI can accept connections + from as many replicas as necessary on that URI. Each replica has its own replication state. </para> </section> @@ -120,7 +120,7 @@ identifier which is unique within the cluster, known as the <para> However, once a master failure is detected, the recovery is simple: declare that the replica is now the new master, - by saying <code>box.cfg{... listen=uri}</code>. + by saying <code>box.cfg{... listen=URI}</code>. Then, if there are updates on the old master that were not propagated before the old master went down, they would have to be re-applied manually. diff --git a/doc/user/stored-procedures.xml b/doc/user/stored-procedures.xml index 0aa7573a2dc6f05db9a127b0c7ffe4828e13707d..75f38d7bd02a37ff7a412f358714c67a1a3dae1b 100644 --- a/doc/user/stored-procedures.xml +++ b/doc/user/stored-procedures.xml @@ -288,7 +288,8 @@ administration with the built-in packages. <link xlink:href="https://en.wikipedia.org/wiki/Sha-2">SHA-2</link>) as well as a checksum function - (<link xlink:href="https://en.wikipedia.org/wiki/Cyclic_redundancy_check">CRC32</link>). + (<link xlink:href="https://en.wikipedia.org/wiki/Cyclic_redundancy_check">CRC32</link>) + and two functions for <link xlink:href="https://en.wikipedia.org/wiki/Base64">base64</link>. The functions in <code>digest</code> are: <informaltable> <tgroup cols="2" align="left" colsep="1" rowsep="0"> @@ -314,6 +315,8 @@ administration with the built-in packages. <row><entry><code>digest.md4_hex(<replaceable>string</replaceable>)</code></entry><entry> Returns hexadecimal of a digest calculated with md4.</entry></row> <row><entry><code>digest.md5(<replaceable>string</replaceable>)</code></entry><entry> Returns 256-bit digest made with MD5.</entry></row> <row><entry><code>digest.md5_hex(<replaceable>string</replaceable>)</code></entry><entry> Returns hexadecimal of a digest calculated with md5.</entry></row> + <row><entry><code>digest.base64_encode(<replaceable>string</replaceable>)</code></entry><entry> Returns base64 encoding from a regular string.</entry></row> + <row><entry><code>digest.base64_decode(<replaceable>string</replaceable>)</code></entry><entry> Returns a regular string from a base64 encoding.</entry></row> </tbody> </tgroup> </informaltable> @@ -2503,9 +2506,9 @@ end <listitem> <para> Listen on host:port. The primary way of listening for incoming - requests is via the host and port, or uri, specified in + requests is via the host and port, or URI, specified in <code>box.cfg{listen=...}</code>. The alternative way of - listening is via the host and port, or uri, specified in + listening is via the host and port, or URI, specified in <code>console.listen(...)</code>. This alternative way is called "administrative" or simply "admin port". </para>