Skip to content

Commit

Permalink
integrate peer feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
lenkis committed Sep 23, 2024
1 parent 2234d9c commit 51b895a
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions doc/reference/reference_lua/box_stat/memtx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,13 @@ and multiversion concurrency control (``box.stat.memtx().tx.mvcc``).

**Example**

Let's get memory statistics for ``used`` tuples in a transaction.
This example illustrates memory statistics for ``used`` tuples in a transaction.

First, we :ref:`enable MVCC <txn_mode_mvcc-enabling>` so that
The cluster must be started with the :ref:`database.use_mvcc_engine <configuration_reference_database_use_mvcc_engine>`
parameter set to true. This :ref:`enables MVCC <txn_mode_mvcc-enabling>` so that
``box.stat.memtx.tx().mvcc`` contained non-zero values.

.. code-block:: lua
box.cfg{memtx_use_mvcc_engine = true}
We did it within the first ``box.cfg{}`` call to a new Tarantool instance,
because the parameter ``memtx_use_mvcc_engine`` is non-dynamic.

Next, we create a space with a primary index, and begin a transaction:
The next step is to create a space with a primary index and to begin a transaction:

.. code-block:: lua
Expand All @@ -115,7 +109,7 @@ Next, we create a space with a primary index, and begin a transaction:
box.space.test:replace{1, 1}
box.space.test:replace{2, 1}
In the transaction above, we replaced three tuples by the `0` key:
In the transaction above, three tuples are replaced by the `0` key:

* ``{0, 0}``
* ``{0, 'aa...aa'}``
Expand All @@ -125,7 +119,7 @@ MVCC considers all these tuples as ``used`` since they belong to the current tra
Also, MVCC considers tuples ``{0, 0}`` and ``{0, 'aa..aa'}`` as ``retained`` because
they don't belong to any index (unlike ``{0, 1}``), but they cannot be deleted yet.

If we call ``box.stat.memtx.tx()`` now, we'll see something like this:
Calling ``box.stat.memtx.tx()`` now will bring something like this:

.. code-block:: tarantoolsession
:emphasize-lines: 33-39
Expand Down

0 comments on commit 51b895a

Please sign in to comment.