Skip to content

Commit 6ce92b9

Browse files
committed
Apply review suggestions
1 parent 327cf76 commit 6ce92b9

File tree

2 files changed

+60
-39
lines changed

2 files changed

+60
-39
lines changed

doc/concepts/configuration/configuration_persistence.rst

Lines changed: 54 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ that takes a new snapshot every ``snapshot.by.interval`` seconds.
4141
If the ``snapshot.by.interval`` option is set to zero, the checkpoint daemon is disabled.
4242

4343
The ``snapshot.by.wal_size`` option defines the maximum size in bytes for of all WAL files created since the last snapshot taken.
44-
Once this size is exceeded, the checkpoint daemon takes a snapshot and deletes the old WAL files.
44+
Once this size is exceeded, the checkpoint daemon takes a snapshot. Then, :ref:`Tarantool garbage collector <configuration_persistence_garbage_collector>`
45+
deletes the old WAL files.
4546

4647
The example shows how to specify the ``snapshot.by.interval`` and the ``snapshot.by.wal_size`` options:
4748

@@ -51,25 +52,6 @@ The example shows how to specify the ``snapshot.by.interval`` and the ``snapshot
5152
:end-at: 1000000000000000000
5253
:dedent:
5354

54-
.. _configuration_persistence_snapshot_count:
55-
56-
Configure a maximum number of stored snapshots
57-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58-
59-
You can set a limit on the number of snapshots stored in the :ref:`snapshot.dir <configuration_reference_snapshot_dir>`
60-
directory using the :ref:`snapshot.count <configuration_reference_snapshot_count>` option.
61-
When the number of snapshots in the directory reaches the limit,
62-
the checkpoint daemon activates Tarantool garbage collector after the new snapshot is taken.
63-
Tarantool garbage collector deletes the oldest snapshot file and any associated WAL files, after the new snapshot is taken.
64-
65-
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/persistence_snapshot/config.yaml
66-
:language: yaml
67-
:start-at: count:
68-
:end-at: 3
69-
:dedent:
70-
71-
If the ``snapshot.count`` option is set to zero, the checkpoint daemon does not delete old snapshots.
72-
7355
.. _configuration_persistence_snapshot_dir:
7456

7557
Specify a directory for snapshot files
@@ -97,6 +79,28 @@ For example, you can place snapshots and write-ahead logs on different hard driv
9779
wal:
9880
dir: '/media/drive2/wals'
9981
82+
.. _configuration_persistence_snapshot_count:
83+
84+
Configure a maximum number of stored snapshots
85+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
86+
87+
You can set a limit on the number of snapshots stored in the :ref:`snapshot.dir <configuration_reference_snapshot_dir>`
88+
directory using the :ref:`snapshot.count <configuration_reference_snapshot_count>` option.
89+
Once the number of snapshots reaches the given limit, :ref:`Tarantool garbage collector <configuration_persistence_garbage_collector>`
90+
deletes the oldest snapshot file and any associated WAL files after the new snapshot is taken.
91+
92+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/persistence_snapshot/config.yaml
93+
:language: yaml
94+
:start-at: count:
95+
:end-at: 7200
96+
:dedent:
97+
98+
In the example, the snapshot is created every two hours (every 7200 seconds) until there are three snapshots in the
99+
``snapshot.dir`` directory.
100+
After creating a new snapshot (the fourth one), the oldest snapshot and the corresponding WALs are deleted.
101+
102+
If the ``snapshot.count`` option is set to zero, the garbage collector does not delete old snapshots.
103+
100104
.. _configuration_persistence_wal:
101105

102106
Configure the write-ahead log
@@ -111,8 +115,15 @@ This section describes how to define WAL settings in the :ref:`wal <configuratio
111115
Set the WAL mode
112116
~~~~~~~~~~~~~~~~
113117

114-
To be able to recover data in case of a possible instance restart, enable recording to the write-ahead log.
115-
To do it, set the :ref:`wal.mode <configuration_reference_wal_mode>` configuration option to ``write`` or ``fsync``.
118+
The recording to the write-ahead log is enabled by default.
119+
It means that if an instance restart occurs, the data will be recovered.
120+
The recording to the WAL can be configured using the :ref:`wal.mode <configuration_reference_wal_mode>` configuration option.
121+
122+
There are two modes that enable writing to the WAL:
123+
124+
* ``write`` (default) -- enable WAL and write the data without waiting the data to be flushed to the storage device.
125+
* ``fsync`` -- enable WAL and ensure that the record is written to the storage device.
126+
116127
The example below shows how to specify the ``write`` WAL mode for ``instance001``:
117128

118129
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/persistence_wal/config.yaml
@@ -121,9 +132,6 @@ The example below shows how to specify the ``write`` WAL mode for ``instance001`
121132
:end-at: 'write'
122133
:dedent:
123134

124-
The ``write`` mode enables WAL and writes the data without waiting the data to be flushed to the storage device.
125-
The ``fsync`` mode enables WAL and ensures that the record is written to the storage device.
126-
127135
To turn the WAL writer off, set the ``wal.mode`` option to ``none``.
128136

129137
.. _configuration_persistence_wal_dir:
@@ -177,7 +185,7 @@ Set a delay for the garbage collector
177185

178186
In Tarantool, the :ref:`checkpoint daemon <configuration_persistence_checkpoint_daemon>`
179187
takes new snapshots at the given interval (see :ref:`snapshot.by.interval <configuration_reference_snapshot_by_interval>`).
180-
After an instance restart, the daemon activates the Tarantool garbage collector that deletes the old WAL files.
188+
After an instance restart, the Tarantool garbage collector deletes the old WAL files.
181189

182190
To delay the immediate deletion of WAL files, use the :ref:`wal.cleanup_delay <configuration_reference_wal_cleanup_delay>`
183191
configuration option. The delay eliminates possible erroneous situations when the master deletes WALs
@@ -198,7 +206,7 @@ In the example, the delay is set to 5 hours (18000 seconds):
198206
Specify the WAL extensions
199207
~~~~~~~~~~~~~~~~~~~~~~~~~~
200208

201-
In Tarantool Enterprise, you can store an old and new tuple for each crud operation performed.
209+
In Tarantool Enterprise, you can store an old and new tuple for each CRUD operation performed.
202210
The detailed description and examples of the WAL extensions are provided in the :ref:`WAL extensions <wal_extensions>` section.
203211

204212
See also: :ref:`wal.ext.* <configuration_reference_wal_ext>` configuration options.
@@ -209,37 +217,49 @@ Checkpoint daemon
209217
-----------------
210218

211219
The checkpoint daemon (snapshot daemon) is a constantly running :ref:`fiber <app-fibers>`.
212-
If the checkpoint daemon is enabled, it takes new :ref:`snapshot (.snap) files <index-box_persistence>` at the
213-
:ref:`given interval <configuration_reference_snapshot_by_interval>` automatically.
214-
If necessary, the checkpoint daemon also activates the Tarantool garbage collector that deletes old snapshot and WAL files.
220+
The checkpoint daemon creates a schedule for the periodic snapshot creation based on
221+
the :ref:`configuration options <configuration_reference_snapshot_by>`and the speed of file size growth.
222+
If enabled, the daemon makes new snapshots (.snap) files according to this schedule.
223+
224+
The work of checkpoint daemon is based on the following configuration options:
225+
226+
* :ref:`snapshot.by.interval <configuration_reference_snapshot_by_interval>` -- a new snapshot is taken once in a given period.
227+
* :ref:`snapshot.by.wal_size <configuration_reference_snapshot_by_wal_size>` -- a new snapshot is taken once the size
228+
of all WAL files created since the last snapshot exceeds a given limit.
229+
230+
If necessary, the checkpoint daemon also activates the :ref:`Tarantool garbage collector <configuration_persistence_garbage_collector>` that deletes old snapshot and WAL files.
215231

216232
.. _configuration_persistence_garbage_collector:
217233

218234
Tarantool garbage collector
219235
---------------------------
220236

237+
Tarantool garbage collector can be activated by the :ref:`checkpoint daemon <configuration_persistence_checkpoint_daemon>`.
238+
The garbage collector tracks the snapshots that are to be :ref:`relayed to a replica <memtx-replication>` or needed
239+
by other consumers. When the files are no longer needed, Tarantool garbage collector deletes them.
240+
221241
.. NOTE::
222242

223-
The garbage collector called by the checkpoint daemon, is distinct from the `Lua garbage collector <https://www.lua.org/manual/5.1/manual.html#2.10>`_
243+
The garbage collector called by the checkpoint daemon, is distinct from the `Lua garbage collector <https://www.lua.org/manual/5.1/manual.html#2.10>`_
224244
which is for Lua objects, and distinct from the Tarantool garbage collector that specializes in :ref:`handling shard buckets <vshard-gc>`.
225245

226246
This garbage collector is called as follows:
227247

228248
* When the number of snapshots reaches the limit of :ref:`snapshot.count <configuration_reference_snapshot_count>` size.
229249
After a new snapshot is taken, Tarantool garbage collector deletes the oldest snapshot file and any associated WAL files.
230250

231-
* When the size all WAL files created since the last snapshot reaches the limit of :ref:`snapshot.by.wal_size <configuration_reference_snapshot_by_wal_size>`.
251+
* When the size of all WAL files created since the last snapshot reaches the limit of :ref:`snapshot.by.wal_size <configuration_reference_snapshot_by_wal_size>`.
232252
Once this size is exceeded, the checkpoint daemon takes a snapshot, then the garbage collector deletes the old WAL files.
233253

234-
If the checkpoint daemon deletes an old snapshot file, the Tarantool garbage collector also deletes
254+
If an old snapshot filen is deleted, the Tarantool garbage collector also deletes
235255
any :ref:`write-ahead log (.xlog) <internals-wal>` files that meet the following conditions:
236256

237257
* The WAL files are older than the snapshot file.
238258
* The WAL files contain information present in the snapshot file.
239259

240260
Tarantool garbage collector also deletes obsolete vinyl ``.run`` files.
241261

242-
The checkpoint daemon and the Tarantool garbage collector don't delete a file in the following cases:
262+
Tarantool garbage collector doesn't delete a file in the following cases:
243263

244264
* A **backup** is running, and the file has not been backed up
245265
(see :ref:`"Hot backup" <admin-backups-hot_backup_vinyl_memtx>`).

doc/reference/configuration/configuration_reference.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2451,8 +2451,8 @@ To learn more about the snapshots' configuration, check the :ref:`Persistence <c
24512451

24522452
The maximum number of snapshots that are stored in the
24532453
:ref:`snapshot.dir <configuration_reference_snapshot_dir>` directory
2454-
before the :ref:`checkpoint daemon <configuration_persistence_checkpoint_daemon>` deletes old snapshots.
2455-
If ``snapshot.count`` is set to zero zero, the checkpoint daemon
2454+
before the :ref:`Tarantool garbage collector <configuration_persistence_garbage_collector>` deletes old snapshots.
2455+
If ``snapshot.count`` is set to zero zero, the garbage collector
24562456
does not delete old snapshots.
24572457

24582458
Example:
@@ -2464,9 +2464,9 @@ To learn more about the snapshots' configuration, check the :ref:`Persistence <c
24642464
interval: 7200
24652465
count: 3
24662466
2467-
In the example, the checkpoint daemon creates a new snapshot every two hours until
2468-
it has created three snapshots. After that, it deletes the oldest snapshot
2469-
(and any associated write-ahead-log files) after creating a new one.
2467+
In the example, the checkpoint daemon creates a snapshot every two hours until
2468+
it has created three snapshots. After creating a new snapshot (the fourth one), the oldest snapshot
2469+
(and any associated write-ahead-log files) is deleted.
24702470

24712471
.. NOTE::
24722472

@@ -2639,6 +2639,7 @@ To learn more about the WAL configuration, check the :ref:`Persistence <configur
26392639
The size of the queue in bytes used by a :ref:`replica <replication-roles>` to submit
26402640
new transactions to a :ref:`write-ahead log <internals-wal>` (WAL).
26412641
This option helps limit the rate at which a replica submits transactions to the WAL.
2642+
26422643
Limiting the queue size might be useful when a replica is trying to sync with a master and
26432644
reads new transactions faster than writing them to the WAL.
26442645

0 commit comments

Comments
 (0)