tarantool / tarantool/doc

[3pt] feedback: Решение конфликтов репликации | Tarantool

Open
#2,478 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

add details replication
Dominant language
CSS
Stars
15
Forks
49
Avg merge
1d 13h
Merged PRs (30d)
3

Description

Product: Tarantool
Root document: https://www.tarantool.io/en/doc/latest/book/replication/repl_problem_solving/#replacing-the-same-primary-key
SME: @ alyapunov

Details

Feedback from a user:

<…>ы получить доступ к создаваемому спейсу. В результате код будет |выглядеть следующим образом|:

https://www.tarantool.io/en/doc/latest/book/replication/repl_problem_solving/#replacing-the-same-primary-key

Добрый день, в документации приведен пример установки треггера для резолва master-master. Если я не ошибаюсь, тригер в таком случае будет выпонятся для загружаемых из WAL записей.
Я отслеживал box.info.status чтобы этого избежать.

local function loading_before_replace(old, new)
    if box.info.status == "loading" then
        return
    end
    box.space.my_space_name:before_replace(before_replace, loading_before_replace)
    return before_replace(old,new)
end

Возможно будет полезно кому-то.


** Questions to and comments from @ alyapunov **

  • Триггер выполняется для загружаемых из WAL записей?
    Это зависит от того, что в "my_trigger", могу предположить.
    Когда загружается WAL (речь ведь идет про recovery, когда Тарантул перезапущен), memtx находится в частично рабочем состоянии. Это неизбежно - без полностью загруженных данных нет полной картины состояния БД. В частности все selectы для определенности возвращают пустоту. Судя по всем такой хитрый триггер просто не будет работать как ожидается.
    Собственно, это всегда надо иметь ввиду при использовании on_schema_init.

  • Почему выполнять триггер для записей из WAL может быть плохо?

Это скорее всего просто бессмысленно - если данные есть в WAL, то триггер по ним уже отработал в тот момент, когда эти данные попадали в WAL. Второй раз не нужно.

ToDo

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the “Replacing the same primary key” section in the linked replication troubleshooting article and compare its trigger example with the SME’s comments about WAL recovery and on_schema_init. Verify whether triggers run for WAL-loaded records and whether checking box.info.status is useful. Done means updating the article with confirmed guidance, or documenting why no change is needed.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.