Skip to content

Commit 0031251

Browse files
committed
persistence: add wal and snapshot sections
1 parent 1f7a33a commit 0031251

File tree

3 files changed

+260
-13
lines changed

3 files changed

+260
-13
lines changed

doc/enterprise/wal_extensions.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ For example, you can enable storing an old and new tuple for each CRUD operation
88
This information might be helpful for implementing a CDC (Change Data Capture) utility
99
that transforms a data replication stream.
1010

11-
1211
.. _wal_extensions_configuration:
1312

1413
Configuration
1514
-------------
1615

17-
To configure WAL extensions, use the ``wal_ext`` :ref:`configuration property <index-book_cfg>`.
16+
To configure WAL extensions, use the ``wal.ext`` :ref:`configuration property <configuration_reference_wal>`.
1817
Inside the ``wal_ext`` block, you can enable storing old and new tuples as follows:
1918

2019
* Set the ``old`` and ``new`` options to ``true`` to store old and new tuples in a write-ahead log for all spaces.

doc/reference/configuration/cfg_binary_logging_snapshots.rst

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
Since version 1.7.4.
3737

3838
The maximum number of bytes in a single write-ahead log file.
39-
When a request would cause an .xlog file to become larger than
40-
``wal_max_size``, Tarantool creates another WAL file.
39+
When a request would cause an ``.xlog`` file to become larger than
40+
``wal_max_size``, Tarantool creates a new WAL file.
4141

4242
| Type: integer
4343
| Default: 268435456 (256 * 1024 * 1024) bytes
@@ -58,7 +58,7 @@
5858
locations and moving snapshots to a separate disk.
5959
The limit also affects what
6060
:ref:`box.stat.vinyl().regulator <box_introspection-box_stat_vinyl_regulator>`
61-
may show for the write rate of dumps to .run and .index files.
61+
may show for the write rate of dumps to ``.run`` and ``.index`` files.
6262

6363
| Type: float
6464
| Default: null
@@ -73,12 +73,14 @@
7373

7474
Specify fiber-WAL-disk synchronization mode as:
7575

76-
* ``none``: write-ahead log is not maintained.
77-
A node with ``wal_mode = none`` can't be replication master;
78-
* ``write``: :ref:`fibers <fiber-fibers>` wait for their data to be written to
79-
the write-ahead log (no :manpage:`fsync(2)`);
80-
* ``fsync``: fibers wait for their data, :manpage:`fsync(2)`
81-
follows each :manpage:`write(2)`;
76+
* ``none``: write-ahead log is not maintained.
77+
A node with ``wal_mode = none`` can't be replication master.
78+
79+
* ``write``: :ref:`fibers <fiber-fibers>` wait for their data to be written to
80+
the write-ahead log (no :manpage:`fsync(2)`).
81+
82+
* ``fsync``: fibers wait for their data, :manpage:`fsync(2)`
83+
follows each :manpage:`write(2)`.
8284

8385
| Type: string
8486
| Default: "write"
@@ -129,7 +131,7 @@
129131
Since version :doc:`2.6.3 </release/2.6.3>`.
130132

131133
The delay (in seconds) used to prevent the :ref:`Tarantool garbage collector <cfg_checkpoint_daemon-garbage-collector>`
132-
from immediately removing :ref:`write-ahead log<internals-wal>` files after a node restart.
134+
from immediately removing :ref:`write-ahead log <internals-wal>` files after a node restart.
133135
This delay eliminates possible erroneous situations when the master deletes WALs
134136
needed by :ref:`replicas <replication-roles>` after restart.
135137
As a consequence, replicas sync with the master faster after its restart and
@@ -141,7 +143,7 @@
141143
.. NOTE::
142144

143145
The ``wal_cleanup_delay`` option has no effect on nodes running as
144-
:ref:`anonymous replicas<cfg_replication-replication_anon>`.
146+
:ref:`anonymous replicas <cfg_replication-replication_anon>`.
145147

146148
| Type: number
147149
| Default: 14400 seconds

doc/reference/configuration/configuration_reference.rst

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2389,3 +2389,249 @@ The ``security`` section defines configuration parameters related to various sec
23892389
| Type: boolean
23902390
| Default: false
23912391
| Environment variable: TT_SECURITY_SECURE_ERASING
2392+
2393+
.. _configuration_reference_snapshot:
2394+
2395+
snapshot
2396+
--------
2397+
2398+
The ``snapshot`` section defines configuration parameters related to
2399+
2400+
.. NOTE::
2401+
2402+
``snapshot`` can be defined in any :ref:`scope <configuration_scopes>`.
2403+
2404+
- :ref:`snapshot.by.interval <configuration_reference_snapshot_by_interval>`
2405+
- :ref:`snapshot.by.wal_size <configuration_reference_snapshot_by_wal_size>`
2406+
- :ref:`snapshot.count <configuration_reference_snapshot_count>`
2407+
- :ref:`snapshot.dir <configuration_reference_snapshot_dir>`
2408+
- :ref:`snapshot.snap_io_rate_limit <configuration_reference_snapshot_snap_io_rate_limit>`
2409+
2410+
.. _configuration_reference_snapshot_by_interval:
2411+
2412+
.. confval:: snapshot.by.interval
2413+
2414+
Description
2415+
2416+
|
2417+
| Type: number
2418+
| Default: 3600
2419+
| Environment variable: TT_SNAPSHOT_BY_INTERVAL
2420+
2421+
.. _configuration_reference_snapshot_by_wal_size:
2422+
2423+
.. confval:: snapshot.by.wal_size
2424+
2425+
Description
2426+
2427+
|
2428+
| Type: number
2429+
| Default: 3600
2430+
| Environment variable: TT_SNAPSHOT_BY_WAL_SIZE
2431+
2432+
.. _configuration_reference_snapshot_count:
2433+
2434+
.. confval:: snapshot.count
2435+
2436+
Description
2437+
2438+
|
2439+
| Type: integer
2440+
| Default: 2
2441+
| Environment variable: TT_SNAPSHOT_COUNT
2442+
2443+
.. _configuration_reference_snapshot_dir:
2444+
2445+
.. confval:: snapshot.dir
2446+
2447+
Description
2448+
2449+
|
2450+
| Type: string
2451+
| Default: 'var/lib/{{ instance_name }}'
2452+
| Environment variable: TT_SNAPSHOT_DIR
2453+
2454+
2455+
.. _configuration_reference_snapshot_snap_io_rate_limit:
2456+
2457+
.. confval:: snapshot.snap_io_rate_limit
2458+
2459+
Reduce the throttling effect of :doc:`box.snapshot() </reference/reference_lua/box_snapshot>` on
2460+
INSERT/UPDATE/DELETE performance by setting a limit on how many
2461+
megabytes per second it can write to disk. The same can be
2462+
achieved by splitting :ref:`wal.dir <configuration_reference_wal_dir>` and
2463+
:ref:`memtx_dir <cfg_basic-memtx_dir>`
2464+
locations and moving snapshots to a separate disk.
2465+
The limit also affects what
2466+
:ref:`box.stat.vinyl().regulator <box_introspection-box_stat_vinyl_regulator>`
2467+
may show for the write rate of dumps to ``.run`` and ``.index`` files.
2468+
2469+
|
2470+
| Type: number
2471+
| Default: box.NULL
2472+
| Environment variable: TT_SNAPSHOT_SNAP_IO_RATE_LIMIT
2473+
2474+
2475+
.. _configuration_reference_wal:
2476+
2477+
wal
2478+
---
2479+
2480+
The ``wal`` section defines configuration parameters related to
2481+
2482+
.. NOTE::
2483+
2484+
``wal`` can be defined in any :ref:`scope <configuration_scopes>`.
2485+
2486+
- :ref:`wal.cleanup_delay <configuration_reference_wal_cleanup_delay>`
2487+
- :ref:`wal.dir <configuration_reference_wal_dir>`
2488+
- :ref:`wal.dir_rescan_delay <configuration_reference_wal_dir_rescan_delay>`
2489+
- :ref:`wal.ext.new <configuration_reference_wal_ext_new>`
2490+
- :ref:`wal.ext.old <configuration_reference_wal_ext_old>`
2491+
- :ref:`wal.ext.spaces <configuration_reference_wal_ext_spaces>`
2492+
- :ref:`wal.wal_max_size <configuration_reference_wal_max_size>`
2493+
- :ref:`wal.mode <configuration_reference_wal_mode>`
2494+
- :ref:`wal.queue_max_size <configuration_reference_wal_queue_max_size>`
2495+
2496+
.. _configuration_reference_wal_cleanup_delay:
2497+
2498+
.. confval:: wal.cleanup_delay
2499+
2500+
The delay in seconds used to prevent the :ref:`Tarantool garbage collector <cfg_checkpoint_daemon-garbage-collector>`
2501+
from immediately removing :ref:`write-ahead log <internals-wal>` files after a node restart.
2502+
This delay eliminates possible erroneous situations when the master deletes WALs
2503+
needed by :ref:`replicas <replication-roles>` after restart.
2504+
As a consequence, replicas sync with the master faster after its restart and
2505+
don't need to download all the data again.
2506+
2507+
Once all the nodes in the replica set are up and running,
2508+
automatic cleanup is started again even if ``wal.cleanup_delay`` has not expired.
2509+
2510+
.. NOTE::
2511+
2512+
The option has no effect on nodes running as
2513+
:ref:`anonymous replicas <cfg_replication-replication_anon>`.
2514+
2515+
|
2516+
| Type: number
2517+
| Default: 14400
2518+
| Environment variable: TT_WAL_CLEANUP_DELAY
2519+
2520+
.. _configuration_reference_wal_dir:
2521+
2522+
.. confval:: wal.dir
2523+
2524+
A directory where write-ahead log (.xlog) files are stored. Can be relative
2525+
to :ref:`work_dir <cfg_basic-work_dir>`. Sometimes ``wal_dir`` and
2526+
:ref:`memtx_dir <cfg_basic-memtx_dir>` are specified with different values, so
2527+
that write-ahead log files and snapshot files can be stored on different
2528+
disks. If not specified, defaults to ``work_dir``.
2529+
2530+
|
2531+
| Type: string
2532+
| Default: 'var/lib/{{ instance_name }}'
2533+
| Environment variable: TT_WAL_DIR
2534+
2535+
.. _configuration_reference_wal_dir_rescan_delay:
2536+
2537+
.. confval:: wal.dir_rescan_delay
2538+
2539+
Number of seconds between periodic scans of the write-ahead-log
2540+
file directory, when checking for changes to write-ahead-log
2541+
files for the sake of :ref:`replication <replication>` or :ref:`hot standby <index-hot_standby>`.
2542+
2543+
|
2544+
| Type: number
2545+
| Default: 2
2546+
| Environment variable: TT_WAL_DIR_RESCAN_DELAY
2547+
2548+
.. _configuration_reference_wal_ext_new:
2549+
2550+
.. confval:: wal.ext_new
2551+
2552+
(**Enterprise Edition only**)
2553+
2554+
Description
2555+
2556+
|
2557+
| Type: boolean
2558+
| Default: nil
2559+
| Environment variable: TT_WAL_EXT_NEW
2560+
2561+
.. _configuration_reference_wal_ext_old:
2562+
2563+
.. confval:: wal.ext_old
2564+
2565+
(**Enterprise Edition only**)
2566+
Description
2567+
2568+
|
2569+
| Type: boolean
2570+
| Default: nil
2571+
| Environment variable: TT_WAL_EXT_OLD
2572+
2573+
.. _configuration_reference_wal_ext_spaces:
2574+
2575+
.. confval:: wal.ext_spaces
2576+
2577+
(**Enterprise Edition only**)
2578+
Description
2579+
2580+
|
2581+
| Type: map
2582+
| Default: nil
2583+
| Environment variable: TT_WAL_EXT_SPACES
2584+
2585+
2586+
.. _configuration_reference_wal_max_size:
2587+
2588+
.. confval:: wal.wal_max_size
2589+
2590+
The maximum number of bytes in a single write-ahead log file.
2591+
When a request would cause an ``.xlog`` file to become larger than
2592+
``wal_max_size``, Tarantool creates a new WAL file.
2593+
2594+
|
2595+
| Type: integer
2596+
| Default: 268435456
2597+
| Environment variable: TT_WAL_MAX_SIZE
2598+
2599+
.. _configuration_reference_wal_mode:
2600+
2601+
.. confval:: wal.mode
2602+
2603+
Specify fiber-WAL-disk synchronization mode as:
2604+
2605+
* ``none``: write-ahead log is not maintained.
2606+
A node with ``wal.mode = none`` can't be replication master.
2607+
2608+
* ``write``: :ref:`fibers <fiber-fibers>` wait for their data to be written to
2609+
the write-ahead log (no :manpage:`fsync(2)`).
2610+
2611+
* ``fsync``: fibers wait for their data, :manpage:`fsync(2)`
2612+
follows each :manpage:`write(2)`.
2613+
2614+
|
2615+
| Type: string
2616+
| Default: 'write'
2617+
| Environment variable: TT_WAL_MODE
2618+
2619+
.. _configuration_reference_wal_queue_max_size:
2620+
2621+
.. confval:: wal.queue_max_size
2622+
2623+
The size of the queue in bytes used by a :ref:`replica <replication-roles>` to submit
2624+
new transactions to a :ref:`write-ahead log<internals-wal>` (WAL).
2625+
This option helps limit the rate at which a replica submits transactions to the WAL.
2626+
Limiting the queue size might be useful when a replica is trying to sync with a master and
2627+
reads new transactions faster than writing them to the WAL.
2628+
2629+
.. NOTE::
2630+
2631+
You might consider increasing the ``wal.queue_max_size`` value in case of
2632+
large tuples (approximately one megabyte or larger).
2633+
2634+
|
2635+
| Type: integer
2636+
| Default: 16777216
2637+
| Environment variable: TT_WAL_QUEUE_MAX_SIZE

0 commit comments

Comments
 (0)