From e04d5b47220fdf20d3f863fbac38f8245f662343 Mon Sep 17 00:00:00 2001 From: andreyaksenov Date: Thu, 15 Aug 2024 10:02:32 +0300 Subject: [PATCH 1/3] Force recovery sample --- .../force_recovery/README.md | 18 ++++++++++++++++++ .../force_recovery/config.yaml | 9 +++++++++ .../force_recovery/instances.yml | 1 + .../lib/instance001/00000000000000000000.snap | Bin 0 -> 5086 bytes .../lib/instance001/00000000000000000000.xlog | Bin 0 -> 849 bytes 5 files changed, 28 insertions(+) create mode 100644 doc/code_snippets/snippets/config/instances.enabled/force_recovery/README.md create mode 100644 doc/code_snippets/snippets/config/instances.enabled/force_recovery/config.yaml create mode 100644 doc/code_snippets/snippets/config/instances.enabled/force_recovery/instances.yml create mode 100644 doc/code_snippets/snippets/config/instances.enabled/force_recovery/var/lib/instance001/00000000000000000000.snap create mode 100644 doc/code_snippets/snippets/config/instances.enabled/force_recovery/var/lib/instance001/00000000000000000000.xlog diff --git a/doc/code_snippets/snippets/config/instances.enabled/force_recovery/README.md b/doc/code_snippets/snippets/config/instances.enabled/force_recovery/README.md new file mode 100644 index 0000000000..9eb681ec5b --- /dev/null +++ b/doc/code_snippets/snippets/config/instances.enabled/force_recovery/README.md @@ -0,0 +1,18 @@ +# Force recovery + +A sample application demonstrating how to start an instance with a corrupted write-ahead log file. + +## Running + +- To start the instance using the `tt` utility, execute the following command in the [config](../../../config) directory: + + ```console + $ TT_FORCE_RECOVERY=true tt start force_recovery + ``` + +- To start the instance using the `tarantool` command, you can use both the `TT_FORCE_RECOVERY` environment variable and add the `--force-recovery` option. + In the example below, the `tarantool` command is executed in the [config/instances.enabled/force_recovery](../../../config/instances.enabled/force_recovery) directory: + + ```console + $ tarantool --name instance001 --config config.yaml --force-recovery -i + ``` diff --git a/doc/code_snippets/snippets/config/instances.enabled/force_recovery/config.yaml b/doc/code_snippets/snippets/config/instances.enabled/force_recovery/config.yaml new file mode 100644 index 0000000000..69ccf58c8c --- /dev/null +++ b/doc/code_snippets/snippets/config/instances.enabled/force_recovery/config.yaml @@ -0,0 +1,9 @@ +groups: + group001: + replicasets: + replicaset001: + instances: + instance001: + iproto: + listen: + - uri: '127.0.0.1:3301' \ No newline at end of file diff --git a/doc/code_snippets/snippets/config/instances.enabled/force_recovery/instances.yml b/doc/code_snippets/snippets/config/instances.enabled/force_recovery/instances.yml new file mode 100644 index 0000000000..aa60c2fc42 --- /dev/null +++ b/doc/code_snippets/snippets/config/instances.enabled/force_recovery/instances.yml @@ -0,0 +1 @@ +instance001: diff --git a/doc/code_snippets/snippets/config/instances.enabled/force_recovery/var/lib/instance001/00000000000000000000.snap b/doc/code_snippets/snippets/config/instances.enabled/force_recovery/var/lib/instance001/00000000000000000000.snap new file mode 100644 index 0000000000000000000000000000000000000000..43e18b23557890e8e5a5ed6db34255b02154294b GIT binary patch literal 5086 zcmV<46CvzVPC-x#FfK7O3RY!ub7^mGIv_JHF)lGJFfC_dHZ^8AFf|HEZgX^DZewLS zAUI@VH8^52G%Yk`G-NF_WoBh9IXN<6Eiq;`HaTH2W;iu9WC~V8Y;R+0Iv{&}3JTS_ z3%bn{XaLTf$2hvB0000004TLD{Qy|~ngB|$^d?6TfN695|NsA;0LqkVpzl-GZ%G>j z0_y&)8UJm}_=3KaDGAAxWF$&b$|Q0MJ=!hfRd=~)s_iC1XJ4L=(Tr!#>~ErE(++I{ zeF7r_S*xabs-|j|O{Pg^)5NA}{>IWYMbb2N*!DMG>u#QZ9&i6)=GYCEO2r$RKqM-LOh0@oa^xBW*UZA>1QOWo zoDA)D2MGBl2zYOR6YrTEaK&G($rXP=23!&AioYdHa$!I30D_`DexT_6@dzNd!^gO}h&>k$fF9($dZ$b?b)!o`Y~ z#hdRe*;UPlMw`i~WR|vh_8qUj6=*XVRg@f#G(xf!*@}#ih;l{Z5mC;DD}2W9+KtV}nmma>#5j2aF>R4hY8__lb9(fN#jbS2yC|Ya4Lzm9K2Pk=Hfc z$g3J{!urSC_u}U=zj4}HE zLX7^s2&4c0y8z>VF24AG3oriv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pgh6RY$aLe$hObPm6#@dNvxO2?=VQiY)y%qL3cbM?C7Fof>c4(Jw!~+P zsa74VM^#C-g(QXborGmF#>P&L!Hh@jM0s?B2s@T^!;qZ{XozF>&Xvrl56s` zDUXaMs0~lVTdT@V;mswR+WWqK|I^_p=~~!~J{g1Obn+qtX`BGoMpK)JaA60Vd7)bh z#K4w^XW}S`on|OaV$$I|+w8G#`xcy;id-E+qM&>&tTT{n`iuzWYhj&(oYH4R!nn1m zyg~qg_t&5V+^LTl-y{k@y-fX#;F2-=#M_D|#+SswPaIob8UF-B$;j}&7ypV3Das)x zLo2aDxyjBdK+7Ied=y5r%d5{q1-N7LeCI&N;xw0rv&aYX@ptDk&@(jV3QH|2&dkrVQZUvt)HBpI&`nP=GflHFFy->hD=taQOHQ>?ut-TV zwMa5D(KSgmNdXdRsk)YyMv1zHX=Y}YiH2zwrlu)eVa_@E$=Oy4)wNt)S9fu*)@C@D z>l3N4oB;w_7?_wCnHgD5JKkKM>v-hYwI+eHj1r2|&oVJEE=@|zODSHOo0?lv!O$=P zq`QFOT&v8MMF`z2K;29*-8ZFMK)OX46($1pD^8re(3X92(~`Wz+|)&xDN9N!3sP5< z<`rkA=cT4Vgja&BhzBVE%PuP}Day=ChsZ6dOie68)dX^a9mBbYPg9;CoB;9wGt3Eh zvp^nDP@D#I0K@WvqRiaHqRJ&DMX9Nc%S!Vy3rkZEPn^U6cLm5mONMhN&i&v{1nmb2=$paj0gqL(FzAlxzo@4UEFcjLU=a zD^g2JQqQs<0(nr4;oRcsK1!(CIAGeOS)kgORt6{M7Zm_gaPe98wIGce4Cf5bOUR;X z Date: Thu, 15 Aug 2024 11:42:50 +0300 Subject: [PATCH 2/3] Force recovery docs --- doc/reference/tarantool_cli_options.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/doc/reference/tarantool_cli_options.rst b/doc/reference/tarantool_cli_options.rst index 8e79ed8d76..4750cf5c5b 100644 --- a/doc/reference/tarantool_cli_options.rst +++ b/doc/reference/tarantool_cli_options.rst @@ -65,6 +65,25 @@ Options Start an external coordinator used for a :ref:`supervised failover `. +.. _tarantool_cli_force_recovery: + +.. option:: --force-recovery + + **Since:** :doc:`3.0.0 `. + + Try to start an instance if there is an error while reading a corrupted snapshot or write-ahead log file during the recovery process: + + - For a corrupted :ref:`snapshot file ` -- at the instance start. + - For a corrupted :ref:`write-ahead log file ` -- at the instance start or when applying an update at a replica. + + With this option enabled, Tarantool skips invalid records, reads as much data as possible, and lets the process finish with a warning. + Then call :ref:`box.snapshot() ` to make a new snapshot so that the corrupted snapshots or write-ahead logs aren't used for recovery anymore. + + You can also enable this option using the ``TT_FORCE_RECOVERY`` environment variable. + ``TT_FORCE_RECOVERY`` has a lower priority than the ``--force-recovery`` option. + + Example on GitHub: `force_recovery `_ + .. _index-tarantool_version: .. option:: -v, -V, --version From e7a3acbb7216ca37e620fe8246d00176e2190e62 Mon Sep 17 00:00:00 2001 From: andreyaksenov Date: Mon, 19 Aug 2024 13:44:41 +0300 Subject: [PATCH 3/3] Cosmetics --- doc/reference/tarantool_cli_options.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/reference/tarantool_cli_options.rst b/doc/reference/tarantool_cli_options.rst index 4750cf5c5b..108e3c1200 100644 --- a/doc/reference/tarantool_cli_options.rst +++ b/doc/reference/tarantool_cli_options.rst @@ -77,9 +77,9 @@ Options - For a corrupted :ref:`write-ahead log file ` -- at the instance start or when applying an update at a replica. With this option enabled, Tarantool skips invalid records, reads as much data as possible, and lets the process finish with a warning. - Then call :ref:`box.snapshot() ` to make a new snapshot so that the corrupted snapshots or write-ahead logs aren't used for recovery anymore. + When the instance has started, call :ref:`box.snapshot() ` to make a new snapshot so that the corrupted snapshots or write-ahead logs aren't used for recovery anymore. - You can also enable this option using the ``TT_FORCE_RECOVERY`` environment variable. + You can also enable force recovery using the ``TT_FORCE_RECOVERY`` environment variable. ``TT_FORCE_RECOVERY`` has a lower priority than the ``--force-recovery`` option. Example on GitHub: `force_recovery `_