-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-30046 Refactor and fix idempotent replication
Idempotent write_row works same as REPLACE: if there is a duplicating record in the table, then it will be deleted and re-inserted, with the same update optimization. The code in Rows:log_event::write_row was basically copy-pasted from write_record. What's done: REPLACE operation was unified across replication and sql. It is now representred as two methods: locate and replace. * locate_dup_record: find the conflicting record and save in in record[1]. locating through dup_ref is used whenever possible. Locating by the key is now done though lookup_handler, if it exists. The reason is that duplicate error could be on the normal key, but RND could be inited. * TABLE::replace_row: delete or update the conflicting row. It does not re-insert allowing to continue to general retry-loop of insertion. The result is described by replace_execution_result structure, containing the type of execution path chosen and a kind of error, allowing to treat it differently. Drawbacks: alloca is removed in favor of simple allocation. Anyway using alloca is bad, since it 's harder to catch stack overflows related to maximally long fields. A simple stack allocation of MAX_KEY could be used, but better not to abuse the stack. Now there is a memory leak with the statement duration. It'll be fixed a bit later, in the next refactoring.
- Loading branch information
1 parent
12e8f8c
commit 703e73e
Showing
8 changed files
with
308 additions
and
266 deletions.
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.