diff options
author | Sachin <sachinsetia1001@gmail.com> | 2021-01-29 11:59:14 +0000 |
---|---|---|
committer | Andrei <andrei.elkin@mariadb.com> | 2021-11-16 19:38:35 +0200 |
commit | f9f578c7db1924456938a061b3c6287cd09c3963 (patch) | |
tree | 820b9bebd6e9ff52f11d0f3d75eed3f3343fcbf1 /sql/sql_table.h | |
parent | 5566cbadb03856aba9c236b131f544490cd2bee4 (diff) | |
download | mariadb-git-bb-10.8-MENT-662-tmp.tar.gz |
MDEV-662 Lag Free Alter On Slavebb-10.8-MENT-662-tmp
This commit implements two phase binloggable ALTER.
When a new
@@session.binlog_alter_two_phase = YES
ALTER query gets logged in two parts, the START ALTER
and the COMMIT or ROLLBACK ALTER. START Alter is written
in binlog as soon as at its handling necessary locks are
acquired for the table. The timing is such that any
concurrent DML:s that update the same table are either
committed, thus logged into binary log having done work
on the old version of the table, or will be queued for
execution on its new version.
The "COMPLETE" COMMIT or ROLLBACK ALTER are written after
the most of ALTER work is done. When its result is positive
COMMIT ALTER is written, otherwise when there were errors
since START ALTER, ROLLBACK ALTER is written. Replication
of two-phase binloggable ALTER is cross-version safe.
Specifically the OLD slave merely does not recognized the
start alter part, still memorizing its gtid.
Two phase logged ALTER is read from binlog by mysqlbinlog
to produce BINLOG 'string', where 'string' contains base64
encoded Query_log_event containing either the start part of
ALTER, or a completion part. The Query details can be
displayed with `-v` flag, similarly to ROW format events.
Notice, mysqlbinlog output containing parts of two-phase
binloggable ALTER is processable correctly only by
binlog_alter_two_phase server.
Thanks to all people involved into early discussion of the
feature including Kristian Nielsen, those who helped to
design, implement and test: Sergei Golubchik, Andrei Elkin,
Sujatha Sivakumar, Brandon Nesterenko, Alice Sherepa.
Diffstat (limited to 'sql/sql_table.h')
-rw-r--r-- | sql/sql_table.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_table.h b/sql/sql_table.h index eaa03bfaf8c..f71d1afc098 100644 --- a/sql/sql_table.h +++ b/sql/sql_table.h @@ -209,9 +209,10 @@ void sp_prepare_create_field(THD *thd, Column_definition *sql_field); bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags); int write_bin_log(THD *thd, bool clear_error, char const *query, ulong query_length, - bool is_trans= FALSE); + bool is_trans= FALSE, bool log_zero_errcode= false); int write_bin_log_with_if_exists(THD *thd, bool clear_error, - bool is_trans, bool add_if_exists); + bool is_trans, bool add_if_exists, + bool commit_alter= false); void promote_first_timestamp_column(List<Create_field> *column_definitions); |