You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/concepts/configuration/configuration_persistence.rst
+75-32Lines changed: 75 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -26,32 +26,32 @@ This section describes how to define snapshot settings in the :ref:`snapshot <co
26
26
27
27
.. _configuration_persistence_snapshot_creation:
28
28
29
-
Configure the automatic snapshot creation
30
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29
+
Set up automatic snapshot creation
30
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31
31
32
-
In Tarantool, it is possible to set automatic :ref:`snapshot creation </reference/reference_lua/box_snapshot>`.
33
-
To enable it, the :ref:`snapshot.by.interval <configuration_reference_snapshot_by_interval>` option is used.
34
-
The option sets up the :ref:`checkpoint daemon <configuration_persistence_checkpoint_daemon>` that takes new snapshots
35
-
every ``snapshot.by.interval`` seconds.
36
-
When the number of snapshots reaches the limit of :ref:`snapshot.count <configuration_reference_snapshot_count>` size,
37
-
the daemon activates Tarantool garbage collector after the new snapshot is taken.
38
-
Tarantool garbage collector deletes the oldest snapshot file and any associated WAL files.
32
+
In Tarantool, it is possible to automate the :ref:`snapshot creation </reference/reference_lua/box_snapshot>`.
33
+
Automatic creation is enabled by default and can be configured in two ways:
39
34
40
-
The :ref:`snapshot.by.wal_size <configuration_reference_snapshot_by_wal_size>` option defines the maximum size in bytes
41
-
for of all WAL files created since the last snapshot taken.
42
-
Once this size is exceeded, the checkpoint daemon takes a snapshot and deletes the old WAL files.
35
+
* A new snapshot is taken once in a given period (see :ref:`snapshot.by.interval <configuration_reference_snapshot_by_interval>`).
36
+
* A new snapshot is taken once the size of all WAL files created since the last snapshot exceeds a given limit
37
+
(see :ref:`snapshot.by.wal_size <configuration_reference_snapshot_by_wal_size>`).
43
38
44
-
The configuration of the checkpoint daemon might look as follows:
39
+
The ``snapshot.by.interval`` option sets up the :ref:`checkpoint daemon <configuration_persistence_checkpoint_daemon>`
40
+
that takes a new snapshot every ``snapshot.by.interval`` seconds.
41
+
If the ``snapshot.by.interval`` option is set to zero, the checkpoint daemon is disabled.
42
+
43
+
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. Then, :ref:`Tarantool garbage collector <configuration_persistence_garbage_collector>`
45
+
deletes the old WAL files.
46
+
47
+
The example shows how to specify the ``snapshot.by.interval`` and the ``snapshot.by.wal_size`` options:
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.
231
+
232
+
.. _configuration_persistence_garbage_collector:
233
+
234
+
Tarantool garbage collector
235
+
---------------------------
236
+
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.
197
240
198
241
.. NOTE::
199
242
200
-
This garbage collector 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>`_
201
244
which is for Lua objects, and distinct from the Tarantool garbage collector that specializes in :ref:`handling shard buckets <vshard-gc>`.
202
245
203
246
This garbage collector is called as follows:
204
247
205
248
* When the number of snapshots reaches the limit of :ref:`snapshot.count <configuration_reference_snapshot_count>` size.
206
249
After a new snapshot is taken, Tarantool garbage collector deletes the oldest snapshot file and any associated WAL files.
207
250
208
-
* 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>`.
209
252
Once this size is exceeded, the checkpoint daemon takes a snapshot, then the garbage collector deletes the old WAL files.
210
253
211
-
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
212
255
any :ref:`write-ahead log (.xlog) <internals-wal>` files that meet the following conditions:
213
256
214
257
* The WAL files are older than the snapshot file.
215
258
* The WAL files contain information present in the snapshot file.
216
259
217
260
Tarantool garbage collector also deletes obsolete vinyl ``.run`` files.
218
261
219
-
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:
220
263
221
264
* A **backup** is running, and the file has not been backed up
222
265
(see :ref:`"Hot backup" <admin-backups-hot_backup_vinyl_memtx>`).
0 commit comments