forked from tarantool/tarantool
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
replication: recovery mixed transacrtions
See the docbot request for details. Closes tarantool#7932 @TarantoolBot document Title: correct recovery of mixed transactions Transaction boundaries in WAL were introduced in 2.1.2 (`872d6f1`), but replication applier started to apply transaction atomically only in 2.2.1(`e94ba2e`), so within this range it is possible that transactions are mixed in WAL. There was no problem with them until 2.8.1 because recovering process was still working row-by-row, but in 2.8.1 (`9311113`) it became transactional as well so starting from 2.8.1 tarantool fails to handle mixed transactions from WAL. Mixed transactions is obviously the one of unexpected scenarios in modern tarantool, so we should not handle it in normal mode, and we take care of it only in force recovery mode. But current 'force recovery' treats all the rows of the unexpected transaction as unexpected and thus just skips the entire transaction row-by-row. However we have enough information in this case to handle it more data-friendly. Note: Let there be two nodes (`node#1` and `node#2`). And let the data be replicated from `node#1` to `node#2`. Suppose that at some point in time, `node#1` is restoring data from an xlog containing mixed transactions. To replicate data from `node#1` to `node#2`, do the following: 1. Stop `node#2` and delete all xlog files from it 2. Restart `node#1` by setting `force_recovery` to `true` 3. Make `node#2` rejoin to `node#1` again (tarantoolgh-7932).
- Loading branch information
1 parent
0e19a96
commit 8e0ce96
Showing
6 changed files
with
314 additions
and
7 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
changelogs/unreleased/gh-7932-recovery-mixed-transactions.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## feature/replication | ||
|
||
* Implemented correct recovery of mixed transactions. To do this, set | ||
`box.cfg.force_recovery` to `true`. If you need to revert to the old | ||
behavior, don't set the `force_recovery` option. | ||
|
||
* Let there be two nodes (`node#1` and `node#2`). And let the data be | ||
replicated from `node#1` to `node#2`. Suppose that at some point in time, | ||
`node#1` is restoring data from an xlog containing mixed transactions. To | ||
replicate data from `node#1` to `node#2`, do the following: | ||
1. Stop `node#2` and delete all xlog files from it | ||
2. Restart `node#1` by setting `force_recovery` to `true` | ||
3. Make `node#2` rejoin to `node#1` again (gh-7932). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+597 Bytes
test/replication-luatest/gh_7932_data/bad_xlog/00000000000000000000.xlog
Binary file not shown.
Binary file added
BIN
+646 Bytes
test/replication-luatest/gh_7932_data/good_xlog/00000000000000000000.xlog
Binary file not shown.
Binary file added
BIN
+595 Bytes
test/replication-luatest/gh_7932_data/not_finished_xlog/00000000000000000000.xlog
Binary file not shown.
Oops, something went wrong.