diff --git a/doc/user/configuration-reference.xml b/doc/user/configuration-reference.xml index b08091f1b2e77d9a99fbada2f57388f2350368a2..da1e8a376aba09b0a000d1f2e048acd7ac80d583 100644 --- a/doc/user/configuration-reference.xml +++ b/doc/user/configuration-reference.xml @@ -546,9 +546,9 @@ tarantool: primary pri: 3301 adm: 3313</programlisting> <entry>integer</entry> <entry>5</entry> <entry><emphasis role="strong">yes</emphasis></entry> - <entry>How verbose the logging is. There are 5 log - verbosity classes: 1 -- ERROR, 2 -- CRITICAL, 3 -- - WARNING, 4 -- INFO, 5 -- DEBUG. By setting log_level, + <entry>How verbose the logging is. There are six log + verbosity classes: 1 -- SYSERROR, 2 -- ERROR, 3 -- CRITICAL, 4 -- + WARNING, 5 -- INFO, 6 -- DEBUG. By setting log_level, one can enable logging of all classes below or equal to the given level. Tarantool prints its logs to the standard error stream by default, but this can be @@ -593,7 +593,7 @@ tarantool: primary pri: 3301 adm: 3313</programlisting> <entry><emphasis role="strong">yes</emphasis></entry> <entry>If processing a request takes longer than the given value (in seconds), warn about it in the log. - Has effect only if log_level is less than or equal to 3 + Has effect only if log_level is less than or equal to 4 (WARNING).</entry> </row> diff --git a/doc/user/databases.xml b/doc/user/databases.xml index ffc46ed98ced78b6877881110e8235b3430f3d23..7e2da3418446831172a5c99cc6f8d2a0c0b3e81f 100644 --- a/doc/user/databases.xml +++ b/doc/user/databases.xml @@ -369,6 +369,9 @@ tarantool> <userinput>s:create_index('primary', {unique = true, parts = {1, 'NUM <para> Possible errors: If a tuple with the same primary key already exists, returns ER_TUPLE_FOUND. </para> + <para> + Example: <code>box.space.tester:insert{5000,'tuple number five thousand'}</code>. + </para> </listitem> </varlistentry> @@ -380,14 +383,17 @@ tarantool> <userinput>s:create_index('primary', {unique = true, parts = {1, 'NUM </term> <listitem> <para> - Search for a tuple in the given space. + Search for a tuple or a set of tuples in the given space. </para> <para> Parameters: (type = tuple, as a Lua table) <code>field-value(s)</code>— = values to be matched against the index key, which may be multi-part. </para> <para> - Returns: (type = tuple set, as a Lua table) the selected tuple. + Returns: (type = tuple set, as a Lua table) the tuples whose primary-key fields + are equal to the passed field-values. If the number of passed field-values is + less than the number of fields in the primary key, then only the passed field-values are + compared, so <code>select{1,2}</code> will match a tuple whose primary key is {1,2,3}. </para> <para> Complexity Factors: Index size, Index type. @@ -396,28 +402,50 @@ tarantool> <userinput>s:create_index('primary', {unique = true, parts = {1, 'NUM Possible Errors: No such space; wrong type. <bridgehead renderas="sect4">Example</bridgehead> <programlisting> -tarantool> <userinput>box.space.tester:insert{101, 'test#1', 'my first tuple'}</userinput> +tarantool> <userinput>s = box.schema.create_space('tmp', {temporary=true})</userinput> --- -- [101, 'test#1', 'my first tuple'] ... -tarantool> <userinput>box.space.tester:select{101}</userinput> +tarantool> <userinput> s:create_index('primary',{parts = {1,'NUM', 2, 'STR'}})</userinput> --- -- - [101, 'test#1', 'my first tuple'] ... -tarantool> <userinput>box.space.tester:insert{105, 'test#2', 'first_name', 'last_name'}</userinput> +tarantool> <userinput> s:insert{1,'A'}</userinput> --- -- [105, 'test#2', 'first_name', 'last_name'] +- [1, 'A'] ... -tarantool> <userinput>table_of_tuples = box.space.tester:select{105}</userinput> +tarantool> <userinput> s:insert{1,'B'}</userinput> --- +- [1, 'B'] ... -tarantool> <userinput>table_of_tuples[1]</userinput> +tarantool> <userinput> s:insert{1,'C'}</userinput> --- -- [105, 'test#2', 'first_name', 'last_name'] +- [1, 'C'] ... -</programlisting> - For examples of complex <code>select</code>s, which can return multiple tuples - via secondary indexes, see the later section <olink targetptr="box.index.iterator">box.space.space-name.index.index-name]:select</olink>. +tarantool> <userinput> s:insert{2,'D'}</userinput> +--- +- [2, 'D'] +... +tarantool> <userinput> s:select{1,'B'} -- must equal both primary-key fields</userinput> +--- +- - [1, 'B'] +... + +tarantool> <userinput> s:select{1} -- must equal only one primary-key field</userinput> +--- +- - [1, 'A'] + - [1, 'B'] + - [1, 'C'] +... +tarantool> <userinput> s:select{} -- must equal 0 fields, so returns all tuples</userinput> +--- +- - [1, 'A'] + - [1, 'B'] + - [1, 'C'] + - [2, 'D'] +...</programlisting> + For examples of complex <code>select</code>s, where one can specify which + index to search and what condition to use (for example "greater than" + instead of "equal to") and how many tuples to return, see the later section + <link linkend="box.index.iterator.select">box.space.space-name[.index.index-name]:select</link>. </para> </listitem> </varlistentry> @@ -453,6 +481,9 @@ tarantool> <userinput>table_of_tuples[1]</userinput> <code>box.space.tester:select{1}[1]</code>, and may serve as a convenient shorthand. </para> + <para> + Example: <code>box.space.tester:get{1}</code>. + </para> </listitem> </varlistentry> @@ -631,6 +662,9 @@ tarantool> <userinput>box.space.space55.index.primary:rename('secondary')</useri <para> Complexity Factors: Index size, Index type, Number of indexes accessed, WAL settings. </para> + <para> + Example: <code>box.space.tester:replace{5000,'New value'}</code>. + </para> </listitem> </varlistentry> @@ -1442,8 +1476,8 @@ console.delimiter('')! <varlistentry> <term> - <emphasis role="lua" xml:id="box.index.iterator" xreflabel="box.index.select(type, ...)"> - box.space.<replaceable>space-name</replaceable>[.index.<replaceable>index-name</replaceable>]:select({<replaceable>{fields}, {parameters}]</replaceable>)</emphasis> + <emphasis role="lua" xml:id="box.index.iterator.select" xreflabel="box.index.select(type, ...)"> + box.space.<replaceable>space-name</replaceable>[.index.<replaceable>index-name</replaceable>]:select({<replaceable>[field-value [, field-value ...]]</replaceable>}, {<replaceable>[option [, option ...]]</replaceable>})</emphasis> </term> <listitem> <para> @@ -1452,6 +1486,12 @@ console.delimiter('')! specify the iterator type, and the limit (that is, the maximum number of tuples to return) and the offset (that is, which tuple to start with in the list). </para> + <para> + Parameters: <code>field-value(s)</code> = values to be matched against the index key. + <code>option(s)</code> = any or all of <code>iterator=<replaceable>iterator-type</replaceable></code>, + <code>limit=<replaceable>maximum-number-of-tuples</replaceable></code>, + <code>offset=<replaceable>start-tuple-number</replaceable></code>. + </para> <para> Returns: (type = tuple set, as a Lua table) the tuple or tuples that match the field values. </para> @@ -1469,7 +1509,7 @@ box.space.tester:create_index('secondary', {type = 'tree', unique = false, parts box.space.tester:insert{1,'X','Row with field[2]=X'} box.space.tester:insert{2,'Y','Row with field[2]=Y'} box.space.tester:insert{3,'Z','Row with field[2]=Z'} -box.space.tester.index.secondary:select({'X'}, {iterator = 'GT'}) +box.space.tester.index.secondary:select({'X'}, {iterator = 'GT', limit = 1000}) </programlisting> The result will be a table of tuples and will look like this: <programlisting> diff --git a/doc/user/iterator-types.xml b/doc/user/iterator-types.xml index efb50c86a364555ede0a602469d59968ac9e09e6..4ea57bb2812c0adaee4c7bb46edb81674d4bda18 100644 --- a/doc/user/iterator-types.xml +++ b/doc/user/iterator-types.xml @@ -26,7 +26,7 @@ <tbody> <row> - <entry>box.index.ALL</entry> + <entry>box.index.ALL or 'ALL'</entry> <entry>none</entry> <entry>yes</entry> <entry>yes</entry> @@ -41,7 +41,7 @@ </row> <row> - <entry>box.index.EQ</entry> + <entry>box.index.EQ or 'EQ'</entry> <entry>key</entry> <entry>yes</entry> <entry>yes</entry> @@ -73,7 +73,7 @@ </row> <row> - <entry>box.index.GT</entry> + <entry>box.index.GT or 'GT'</entry> <entry>key</entry> <entry>yes (*)</entry> <entry>yes </entry> @@ -115,7 +115,7 @@ <tbody> <row> - <entry>box.index.REQ</entry> + <entry>box.index.REQ or 'REQ'</entry> <entry>key or key part</entry> <entry> Reverse equality iterator. Is equivalent to @@ -126,7 +126,7 @@ </row> <row> - <entry>box.index.GE</entry> + <entry>box.index.GE or 'GE'</entry> <entry>key or key part</entry> <entry> Iterate over all tuples for which the corresponding @@ -139,7 +139,7 @@ </entry> </row> <row> - <entry>box.index.LT</entry> + <entry>box.index.LT or 'LT'</entry> <entry>key or key part</entry> <entry> Similar to <code>box.index.GT</code>, @@ -152,7 +152,7 @@ </row> <row> - <entry>box.index.LE</entry> + <entry>box.index.LE or 'LE'</entry> <entry>key or key part</entry> <entry> Similar to <code>box.index.GE</code>, but diff --git a/doc/user/lua-and-packages.xml b/doc/user/lua-and-packages.xml index 3cdee6a4ef5e84e95a97f8e84c3ffcaaedeb1e05..bbd18b4bcf0a175ebfa59914aceda3623a2c1986 100644 --- a/doc/user/lua-and-packages.xml +++ b/doc/user/lua-and-packages.xml @@ -35,13 +35,15 @@ from <link xlink:href=" http://luarocks.org/">LuaRocks</link> -- the "downloadab </para> <para> -The included language processor is LuaJIT. +The included language processor is <link xlink:href="http://luajit.org/">LuaJIT</link>. Major "built-in" components are: fibers, -MsgPack, digest, JSON, YAML, IPC, and box. +<link xlink:href="http://msgpack.org">MsgPack</link>, +digest, JSON, <link xlink:href="http://en.wikipedia.org/wiki/Yaml">YAML</link>, +<link xlink:href="http://en.wikipedia.org/wiki/Inter-process_communication">IPC</link> , and box. </para> <para> -<link xlink:href="http://luajit.org/">LUAJIT</link> = a processor for the entire Lua language. +LUAJIT is a processor for the entire Lua language. This differs from the original Lua interpreter from <link xlink:href="http://www.puc-rio.br/index.html">PontifÃcia Universidade Católica do Rio de Janeiro</link> ("RIO-PUC" <link xlink:href="http://www.lua.org/">Lua</link>) @@ -70,21 +72,21 @@ provided one takes advantage of it where <link xlink:href="http://wiki.luajit.or </para> <para> -FIBERS = like Lua coroutines, but as <link xlink:href="http://members.chello.nl/~w.couwenberg/fibers.htm">one fiber developer</link> +FIBERS are like Lua coroutines, but as <link xlink:href="http://members.chello.nl/~w.couwenberg/fibers.htm">one fiber developer</link> put it: "The main difference between a coroutine and a fiber is that a running fiber can be suspended anywhere in a call chain, regardless of its C and Lua call stack nesting levels." </para> <para> -<link xlink:href="http://msgpack.org">MSGPACK</link> = a relatively new way to serialize data. +MSGPACK is a relatively new way to serialize data. The point of MsgPack is that it can handle Lua types and C types, with structures and nesting, without the overhead of an SGML-style markup language. </para> <para> -DIGEST = a cryptography package for CRC32, SHA, and MDA. +DIGEST is a cryptography package for CRC32, SHA, and MDA. Nothing new here -- except that Tarantool has made them into a package, so that one doesn't have to get each one of these things individually from the <link xlink:href="http://lua-users.org/wiki/CryptographyStuff">many that are available</link>. @@ -93,7 +95,7 @@ API, the routines should run faster on LuaJIT. </para> <para> -JSON = a serialization format which has +JSON is a serialization format which has become popular in the web world. The package within Tarantool is derived from <link xlink:href="http://www.kyne.com.au/~mark/software/lua-cjson-manual.html">CJSON</link> which, according to <link xlink:href="http://lua-users.org/wiki/JsonModules">a survey</link>, @@ -102,18 +104,18 @@ edge cases come up. </para> <para> -<link xlink:href="http://en.wikipedia.org/wiki/Yaml">YAML</link> -- short for "YAML Ain't a Markup Language". YAML is a +YAML is short for "YAML Ain't a Markup Language". YAML is a way to show data in human-readable form, without losing underlying information about typing, arrays, and structures. </para> <para> -<link xlink:href="http://en.wikipedia.org/wiki/Inter-process_communication">IPC</link> -- Inter-Process Communication. +IPC is Inter-Process Communication. this is useful for implementations of task queues and long polling. </para> <para> -BOX -- the NoSQL DBMS that was developed by Tarantool +BOX is the NoSQL DBMS that was developed by Tarantool and its community. Box's architecture and routines will be the subject of the next chapter. </para> diff --git a/doc/user/stored-procedures.xml b/doc/user/stored-procedures.xml index 7e8ed1d596bdbf057c3f143df65df3670a78df9a..0fd3637ba1cae99d0c017d06e2e558a0b10e6e80 100644 --- a/doc/user/stored-procedures.xml +++ b/doc/user/stored-procedures.xml @@ -1885,7 +1885,7 @@ end <listitem> <para> Accept a new client connection and create a new connected socket. - It is good practice to set the socket's blocking mode explicitly affer accepting. + It is good practice to set the socket's blocking mode explicitly after accepting. </para> <para> Returns: new socket if success, null if error. diff --git a/doc/user/triggers.xml b/doc/user/triggers.xml index 26d2f3d1b60957f51a4cd240d9d00bcdef96fa85..2e6ecbd770e0df5307d298937f484679106ddd84 100644 --- a/doc/user/triggers.xml +++ b/doc/user/triggers.xml @@ -16,8 +16,8 @@ which are executed when a new connection is created or dropped. Triggers must be set up when the server starts. - This is most commonly done in <olink - targetptr="init.lua">the initialization script</olink>. + This is most commonly done in an initialization script + written in Lua. The performance overhead of triggers, as long as they are not defined, is minimal: merely a pointer dereference and check. If a