diff --git a/doc/sphinx/dev_guide/building_documentation.rst b/doc/sphinx/dev_guide/building_documentation.rst index bfc9394649eabd04459010406cdac582c910ac6b..c7a42b41346350aa413c35a7c6599cadb4634eeb 100644 --- a/doc/sphinx/dev_guide/building_documentation.rst +++ b/doc/sphinx/dev_guide/building_documentation.rst @@ -1,12 +1,13 @@ .. _building-documentation: ------------------------------------------------------------------------------- - Building Documentation +Building documentation ------------------------------------------------------------------------------- -After building and testing your local instance of Tarantool, you can build a local version of this documentation and contribute to it. +After building and testing your local instance of Tarantool, you can build a +local version of this documentation and contribute to it. -Documentation is based on the Python-based Sphinx generator. So, make sure to +Documentation is based on the Python-based Sphinx generator. So, make sure install all Python modules indicated in the :ref:`building-from-source` section of this documentation. The procedure below implies that you already took those steps and successfully tested your instance of Tarantool. @@ -18,36 +19,55 @@ procedure is similar for other supported platforms): .. code-block:: bash - cd ~/tarantool - cmake -DENABLE_DOC=TRUE - make -C doc + cd ~/tarantool cmake -DENABLE_DOC=TRUE make -C doc Documentation is created and stored at ``doc/www/output``. -2. Set up a web-server. +2. Set up a web-server. -Note that if your Tarantool Database runs on a Virtual machine, you need to make sure that your host and client machines operate in the same network, i.e., to configure port forwarding. If you use Oracle VM VirtualBox, follow the guidelines below: +Note that if your Tarantool Database runs on a Virtual machine, you need to make +sure that your host and client machines operate in the same network, i.e., to +configure port forwarding. If you use Oracle VM VirtualBox, follow the +guidelines below: + +* To create a network, navigate to **Network > Advanced > Port Forwarding** in + your VirtualBox instance menu. + +* Enable the **Cable connected** checkbox. -* To create a network, navigate to **Network > Advanced > Port Forwarding** in your VirtualBox instance menu. -* Enable the **Cable connected** checkbox. * Click the **Port Forwarding** button. -* Set Host and Guest Ports to ``8000``, Host IP to ``127.0.0.1`` and Guest IP to ``10.0.2.15``. Make sure to check the IP of your VB instance, it must be 10.0.2.15 (``ifconfig`` command) -* Save your settings -If all the prerequisites are met, run the following command to set up a web-server (the example below is based on Ubuntu, but the procedure is similar for other supported platforms). Make sure to run it from the documentation output folder, as specified below: +* Set Host and Guest Ports to ``8000``, Host IP to ``127.0.0.1`` and Guest +IP to ``10.0.2.15``. Make sure to check the IP of your VB instance, it must +be 10.0.2.15 (``ifconfig`` command) + +* Save your settings. + +If all the prerequisites are met, run the following command to set up a +web-server (the example below is based on Ubuntu, but the procedure is similar +for other supported OS's). Make sure to run it from the documentation output +folder, as specified below: .. code-block:: bash cd ~/tarantool/doc/www/output python -m SimpleHTTPServer 8000 -3. Open your browser and enter ``127.0.0.1:8000`` into the address box. If your local documentation build is valid, the HTML version will be displayed in the browser. +3. Open your browser and enter ``127.0.0.1:8000`` into the address box. If your +local documentation build is valid, the HTML version will be displayed in the +browser. + +To contribute to documentation, use the ``.rst`` format for drafting and submit +your updates as "Pull Requests" via GitHub. -To contribute to documentation, use the ``.rst`` format for drafting and submit your updates as "Pull Requests" via GitHub. +To comply with the writing and formatting style, use guidelines provided in the +documentation, common sense and existing documents. -To comply with the writing and formatting style, use guidelines provided in the documentation, common sense and existing documents. +Note that if you suggest creating a new documentation section (i.e., a whole new +page), it has to be saved to the relevant section at GitHub. -Note that if you suggest creating a new documentation section (i.e., a whole new page), it has to be saved to the relevant section at GitHub. +* Root folder for documentation source files is located at + https://github.com/tarantool/tarantool/tree/1.6/doc/sphinx. -* Root folder for documentation source files is located at https://github.com/tarantool/tarantool/tree/1.6/doc/sphinx. -* Source files for the developers' guide are located at https://github.com/tarantool/tarantool/tree/1.6/doc/sphinx/dev_guide. +* Source files for the developers' guide are located at + https://github.com/tarantool/tarantool/tree/1.6/doc/sphinx/dev_guide. diff --git a/doc/sphinx/dev_guide/documentation_guidelines.rst b/doc/sphinx/dev_guide/documentation_guidelines.rst new file mode 100644 index 0000000000000000000000000000000000000000..dabd5275769969402ef3b51800d3f19c31ad4ea0 --- /dev/null +++ b/doc/sphinx/dev_guide/documentation_guidelines.rst @@ -0,0 +1,134 @@ +------------------------------------------------------------------------------- + Documentation guidelines +------------------------------------------------------------------------------- + +These guidelines are updated on the on-demand basis, covering only those issues +that cause pains to the existing writers. At this point, we do not aim to come +up with an exhaustive Documentation Style Guide for the Tarantool project. + +=========================================================== + Markup issues +=========================================================== + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Wrapping text +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The limit is 80 characters per line for plain text, and no limit for any other +constructions when wrapping affects ReST readability and/or HTML output. Also, +it makes no sense to wrap text into lines shorter than 80 characters unless you +have a good reason to do so. + +The 80-character limit comes from the ISO/ANSI 80x24 screen resolution, and it's +unlikely that readers/writers will use 80-character consoles. Yet it's still a +standard for many coding guidelines (including Tarantool). As for writers, the +benefit is that an 80-character page guide allows keeping the text window rather +narrow most of the time, leaving more space for other applications in a +wide-screen environment. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Making comments +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Sometimes we may need to leave comments in a ReST file. To make sphinx ignore +some text during processing, use the following per-line notation with ".. //" as +the comment marker: + +.. // your comment here + +`The notation example is excluded from HTML output, so please see the source in +ReST.` + +The starting symbols ".. //" do not interfere with the other ReST markup, and +they are easy to find both visually and using grep. There are no symbols to +escape in grep search, just go ahead with something like this: + + .. code-block:: console + + grep ".. //" doc/sphinx/dev_guide/*.rst + +These comments don't work properly in nested documentation, though (e.g. if you +leave a comment in module -> object -> method, sphinx ignores the comment and +all nested content that follows in the method description). + +=========================================================== + Language and style issues +=========================================================== + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + US vs British spelling +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +We use English US spelling. + +=========================================================== + Examples and templates +=========================================================== + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Module and function +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Here is an example of documenting a module (``my_fiber``) and a function +(``my_fiber.create``). + +.. module:: my_fiber + +.. function:: create(function [, function-arguments]) + + Create and start a ``my_fiber`` object. The object is created and begins to + run immediately. + + :param function: the function to be associated with the ``my_fiber`` object + :param function-arguments: what will be passed to function + + :return: created ``my_fiber`` object + :rtype: userdata + + **Example:** + + .. code-block:: tarantoolsession + + tarantool> my_fiber = require('my_fiber') + --- + ... + tarantool> function function_name() + > my_fiber.sleep(1000) + > end + --- + ... + tarantool> my_fiber_object = my_fiber.create(function_name) + --- + ... + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Module, class and method +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Here is an example of documenting a module (``my_box.index``), a class +(``my_index_object``) and a function (``my_index_object.rename``). + +.. module:: my_box.index + +.. class:: my_index_object + + .. method:: rename(index-name) + + Rename an index. + + :param index_object: an object reference + :param index_name: a new name for the index (type = string) + + :return: nil + + Possible errors: index_object does not exist. + + **Example:** + + .. code-block:: tarantoolsession + + tarantool> box.space.space55.index.primary:rename('secondary') + --- + ... + + Complexity Factors: Index size, Index type, Number of tuples accessed. diff --git a/doc/sphinx/dev_guide/index.rst b/doc/sphinx/dev_guide/index.rst index 96f8e17eac81ef3fd8ad7a5147e33141e8c6a9a3..0479768e961e691600d3aef6ed24d80d572711e8 100644 --- a/doc/sphinx/dev_guide/index.rst +++ b/doc/sphinx/dev_guide/index.rst @@ -9,6 +9,7 @@ building_from_source building_documentation developer_guidelines + documentation_guidelines box_protocol c_style_guide python_style_guide diff --git a/doc/www/content/newsite/index.yml b/doc/www/content/newsite/index.yml index 30c3e253d0ebd046d64b79e8b4330c03a6634031..22ddc3d1f314a9773b1116fc71a665f19f1e3e05 100644 --- a/doc/www/content/newsite/index.yml +++ b/doc/www/content/newsite/index.yml @@ -60,34 +60,4 @@ blocks : content: > Terms of commercial 24x7 support are available upon request, please send an inquiry to support@tarantool.org - example: - format: rst - content: | - .. code-block:: lua - :linenos: none - - #!/usr/bin/env tarantool - - box.cfg{} - hosts = box.space.hosts - if not hosts then - hosts = box.schema.create_space('hosts') - hosts:create_index('primary', - {parts = {1, 'STR'}}) - end - - local function handler(self) - local host = self.peer.host - local response = { - host = host; - counter = hosts:inc(host); - } - return self:render{ json = response } - end - - httpd = require('http.server') - server = httpd.new('127.0.0.1', 8080) - server:route({ path = '/' }, handler) - server:start() - video: '<iframe src="//www.youtube.com/embed/R9UHoZDFLWg" frameborder="0" allowfullscreen></iframe>' ... diff --git a/doc/www/theme/static/design.css b/doc/www/theme/static/design.css index b9851df3414e09039e8df4e2c742fab30a239196..b36e9378e06c41ea30cd008f2059ea4a841645dd 100644 --- a/doc/www/theme/static/design.css +++ b/doc/www/theme/static/design.css @@ -545,6 +545,7 @@ h1, h2, h3, h4, h5 { .i-wallarm { width:130px; height:63px; + margin-bottom: 36px; } .i-wallarm:after, .i-wallarm:before { diff --git a/doc/www/theme/templates/index.html b/doc/www/theme/templates/index.html index a9048c28af822dd5367469955db25666de536562..8daed9e7188622748a5d5b5cfb5dca34ee7e55ec 100644 --- a/doc/www/theme/templates/index.html +++ b/doc/www/theme/templates/index.html @@ -9,10 +9,15 @@ {% block content %} <section class="b-gray_block b-mainhead"> <div class="b-block-wrapper"> - <a href="https://github.com/tarantool/tarantool/" class="b-follow">Follow on</a> - <h1 class="b-Tarantool_title" >{{ page.blocks.header[0] }}</h1> + <!-- <a href="https://github.com/tarantool/tarantool/" class="b-follow">Follow on</a> --> + <div class="header-logo"></div> <h2 class="b-Tarantool_title-note">{{ page.blocks.header[1] }}</h2> <p class="b-Tarantool_title-text">{{ page.blocks.header[2] }}</p> + <div class="buttons-header"> + <a href="http://tarantool.org/download.html" class="b-button-red-download">DOWNLOAD</a> + <a href="https://github.com/tarantool/tarantool/" + class="b-button-white">FOLLOW ON GITHUB</a> + </div> </div> </section> @@ -82,56 +87,6 @@ </div> </section> -<section class="b-gray_block b-example"> - <div class="b-block-wrapper"> - <h2 class="b-section-title">Example</h2> - <div class="b-cols p-example"> - <div class="b-cols-item"> - <div class="b-example-code"> - {{ page.blocks.example }} - </div> - </div> - <div class="b-cols-item-empty"> </div> - <div class="b-cols-item"> - <div class="b-example-player"> - {{ page.blocks.video }} - </div> - </div> - </div> - </div> -</section> - -<section class="b-block b-benchmark"> - <div class="b-block-wrapper"> - <h2 class="b-section-title">Our benchmarks (YCSB)</h2> - <div class="b-block-wrapper_bench"> - <div class="b-benchmark-catalog"> - <ul class="b-switcher"> - <li class="b-switcher-item"><a href="#" class="b-switcher-item-url p-active">A</a></li> - <li class="b-switcher-item"><a href="#" class="b-switcher-item-url">B</a></li> - <li class="b-switcher-item"><a href="#" class="b-switcher-item-url">C</a></li> - <li class="b-switcher-item"><a href="#" class="b-switcher-item-url">D</a></li> - <li class="b-switcher-item"><a href="#" class="b-switcher-item-url">E</a></li> - <li class="b-switcher-item"><a href="#" class="b-switcher-item-url">F</a></li> - </ul> - </div> - <div class="b-benchmark-type"> - <ul class="b-switcher"> - <li class="b-switcher-item"> - <a href="#" class="b-switcher-item-url p-active">Throughput</a> - </li> - <li class="b-switcher-item"> - <a href="#" class="b-switcher-item-url">Latency</a> - </li> - </ul> - </div> - <h3 class="b-benchmark-type-title">Workload A</h3> - </div> - <div class="b-benchmark-grapf"><div id="b-benchmark-grapf-image"></div></div> - <div class="b-benchmark-more"> <a href="/benchmark.html">Learn more</a></div> - </div> -</section> - <section class="b-gray_block b-customers"> <div class="b-block-wrapper"> <h2 class="b-section-title">Our users</h2> @@ -162,6 +117,7 @@ </div> </div> </section> + {% endblock content %} {# vim: syntax=htmldjango ts=2 sts=2 sw=2 expandtab #} diff --git a/src/box/box.cc b/src/box/box.cc index 37c69a7038d2a53e3119ccc655c7c7d8c3cf8bea..e79b7f5d828a7b1caa9c7fec4f45cf21a3e1841d 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -112,6 +112,15 @@ box_check_writable(void) tnt_raise(LoggedError, ER_READONLY); } +static void +box_check_slab_alloc_minimal(ssize_t slab_alloc_minimal) +{ + + if (slab_alloc_minimal < 8 || slab_alloc_minimal > 1048280) + tnt_raise(ClientError, ER_CFG, "slab_alloc_minimal", + "specified value is out of bounds"); +} + void process_rw(struct request *request, struct tuple **result) { @@ -297,6 +306,7 @@ box_check_config() box_check_readahead(cfg_geti("readahead")); box_check_rows_per_wal(cfg_geti64("rows_per_wal")); box_check_wal_mode(cfg_gets("wal_mode")); + box_check_slab_alloc_minimal(cfg_geti64("slab_alloc_minimal")); } /* diff --git a/src/lib/small b/src/lib/small index 18b54084402cdd1e999e9998fa60471fad7aad50..3e7495f5231bc0526221bedc4d8672fd1cd21406 160000 --- a/src/lib/small +++ b/src/lib/small @@ -1 +1 @@ -Subproject commit 18b54084402cdd1e999e9998fa60471fad7aad50 +Subproject commit 3e7495f5231bc0526221bedc4d8672fd1cd21406 diff --git a/test/box-tap/cfg.result b/test/box-tap/cfg.result index db080630d80d919013cbd3a63f74536f12466ff0..3b5da32a597e6db5bb046603ad55b91abdaf153e 100644 --- a/test/box-tap/cfg.result +++ b/test/box-tap/cfg.result @@ -1,6 +1,11 @@ TAP version 13 -1..41 +1..46 ok - box is not started +ok - invalid slab_alloc_minimal +ok - invalid slab_alloc_minimal +ok - invalid slab_alloc_minimal +ok - invalid slab_alloc_minimal +ok - invalid slab_alloc_minimal ok - invalid replication_source ok - invalid wal_mode ok - invalid rows_per_wal diff --git a/test/box-tap/cfg.test.lua b/test/box-tap/cfg.test.lua index 6b1b19a0839e433239a6ccfd5ee4980d43cf98ba..ac4198f996b8f3352a796d3a7b43e14866ae6df0 100755 --- a/test/box-tap/cfg.test.lua +++ b/test/box-tap/cfg.test.lua @@ -4,7 +4,7 @@ local tap = require('tap') local test = tap.test('cfg') local socket = require('socket') local fio = require('fio') -test:plan(41) +test:plan(46) -------------------------------------------------------------------------------- -- Invalid values @@ -17,6 +17,11 @@ local function invalid(name, val) test:ok(not status and result:match('Incorrect'), 'invalid '..name) end +invalid('slab_alloc_minimal', 7) +invalid('slab_alloc_minimal', 0) +invalid('slab_alloc_minimal', -1) +invalid('slab_alloc_minimal', 1048281) +invalid('slab_alloc_minimal', 1000000000) invalid('replication_source', '//guest@localhost:3301') invalid('wal_mode', 'invalid') invalid('rows_per_wal', -1)