mariadb/storage/innobase
Marko Mäkelä 0ba6aaf030 MDEV-11415 Remove excessive undo logging during ALTER TABLE…ALGORITHM=COPY
If a crash occurs during ALTER TABLE…ALGORITHM=COPY, InnoDB would spend
a lot of time rolling back writes to the intermediate copy of the table.
To reduce the amount of busy work done, a work-around was introduced in
commit fd069e2bb3 in MySQL 4.1.8 and 5.0.2,
to commit the transaction after every 10,000 inserted rows.

A proper fix would have been to disable the undo logging altogether and
to simply drop the intermediate copy of the table on subsequent server
startup. This is what happens in MariaDB 10.3 with MDEV-14717,MDEV-14585.
In MariaDB 10.2, the intermediate copy of the table would be left behind
with a name starting with the string #sql.

This is a backport of a bug fix from MySQL 8.0.0 to MariaDB,
contributed by jixianliang <271365745@qq.com>.

Unlike recent MySQL, MariaDB supports ALTER IGNORE. For that operation
InnoDB must for now keep the undo logging enabled, so that the latest
row can be rolled back in case of an error.

In Galera cluster, the LOAD DATA statement will retain the existing
behaviour and commit the transaction after every 10,000 rows if
the parameter wsrep_load_data_splitting=ON is set. The logic to do
so (the wsrep_load_data_split() function and the call
handler::extra(HA_EXTRA_FAKE_START_STMT)) are joint work
by Ji Xianliang and Marko Mäkelä.

The original fix:

Author: Thirunarayanan Balathandayuthapani <thirunarayanan.balathandayuth@oracle.com>
Date:   Wed Dec 2 16:09:15 2015 +0530

Bug#17479594 AVOID INTERMEDIATE COMMIT WHILE DOING ALTER TABLE ALGORITHM=COPY

Problem:

During ALTER TABLE, we commit and restart the transaction for every
10,000 rows, so that the rollback after recovery would not take so long.

Fix:

Suppress the undo logging during copy alter operation. If fts_index is
present then insert directly into fts auxiliary table rather
than doing at commit time.

ha_innobase::num_write_row: Remove the variable.

ha_innobase::write_row(): Remove the hack for committing every 10000 rows.

row_lock_table_for_mysql(): Remove the extra 2 parameters.

lock_get_src_table(), lock_is_table_exclusive(): Remove.

Reviewed-by: Marko Mäkelä <marko.makela@oracle.com>
Reviewed-by: Shaohua Wang <shaohua.wang@oracle.com>
Reviewed-by: Jon Olav Hauglid <jon.hauglid@oracle.com>
2018-01-30 20:24:23 +02:00
..
btr MDEV-14941 Timeouts on persistent statistics tables caused by MDEV-14511 2018-01-22 08:58:47 +02:00
buf Allocate page_cleaner and page_cleaner.slot[] statically 2018-01-24 11:10:33 +02:00
data Add a missing const qualifier 2017-09-20 16:53:34 +03:00
dict MDEV-15063: InnoDB assertion failure !is_owned() at dict0defrag_bg.cc:327 2018-01-25 11:28:38 +02:00
eval
fil MDEV-12121 follow-up: Unbreak the WITH_INNODB_AHI=OFF build 2018-01-15 15:40:28 +02:00
fsp MDEV-14606 Assertion failure on IMPORT TABLESPACE 2017-12-08 09:53:11 +02:00
fts MDEV-11415 Remove excessive undo logging during ALTER TABLE…ALGORITHM=COPY 2018-01-30 20:24:23 +02:00
fut
gis MDEV-14130 InnoDB messages should not refer to the MySQL 5.7 manual 2018-01-10 13:53:44 +02:00
ha Skip btr_search_latches[] in SHOW ENGINE INNODB STATUS 2017-12-12 20:00:28 +02:00
handler MDEV-11415 Remove excessive undo logging during ALTER TABLE…ALGORITHM=COPY 2018-01-30 20:24:23 +02:00
ibuf MDEV-12173 "[Warning] Trying to access missing tablespace" 2018-01-22 16:53:33 +02:00
include MDEV-11415 Remove excessive undo logging during ALTER TABLE…ALGORITHM=COPY 2018-01-30 20:24:23 +02:00
lock MDEV-11415 Remove excessive undo logging during ALTER TABLE…ALGORITHM=COPY 2018-01-30 20:24:23 +02:00
log MDEV-14130 InnoDB messages should not refer to the MySQL 5.7 manual 2018-01-10 13:53:44 +02:00
mach Fix Bug#24707869 GCC 5 AND 6 MISCOMPILE MACH_PARSE_COMPRESSED 2017-04-26 23:03:29 +03:00
mem
mtr Revert "MDEV-6928: Add trx pointer to struct mtr_t" 2018-01-29 15:45:16 +02:00
mysql-test/storage_engine Merge branch '10.0' into 10.1 2017-08-08 10:18:43 +02:00
os InnoDB: Remove ut_snprintf() and the use of my_snprintf(); use snprintf() 2017-11-13 02:11:48 +02:00
page InnoDB: Remove ut_snprintf() and the use of my_snprintf(); use snprintf() 2017-11-13 02:11:48 +02:00
pars Remove unused parameters and dead code 2017-09-29 16:19:28 +03:00
que Fix some printf format type mismatch 2017-06-06 12:04:29 +03:00
read
rem MDEV-13487 Assertion failure in rec_get_trx_id() 2018-01-08 13:00:04 +02:00
row MDEV-11415 Remove excessive undo logging during ALTER TABLE…ALGORITHM=COPY 2018-01-30 20:24:23 +02:00
srv MDEV-14968 On upgrade, InnoDB reports "started; log sequence number 0" 2018-01-16 20:02:38 +02:00
sync Remove unused metadata for non-existing sync_thread_mutex 2018-01-28 22:17:54 +02:00
trx MDEV-11415 Remove excessive undo logging during ALTER TABLE…ALGORITHM=COPY 2018-01-30 20:24:23 +02:00
usr Merge 10.1 into 10.2 2017-05-22 09:46:51 +03:00
ut MDEV-14130 InnoDB messages should not refer to the MySQL 5.7 manual 2018-01-10 13:53:44 +02:00
bzip2.cmake cleanup: innodb files in cmake/ 2017-03-29 00:40:22 +02:00
CMakeLists.txt MDEV-14283 : Fix Solaris 10 build. 2017-11-21 21:14:06 +01:00
compile-innodb
COPYING.Google
COPYING.Percona
innodb.cmake Remove references to UNIV_SYNC_DEBUG which was merged with UNIV_DEBUG 2017-12-04 11:48:12 +02:00
lz4.cmake cleanup: innodb files in cmake/ 2017-03-29 00:40:22 +02:00
lzma.cmake cleanup: innodb files in cmake/ 2017-03-29 00:40:22 +02:00
lzo.cmake cleanup: innodb files in cmake/ 2017-03-29 00:40:22 +02:00
plugin_exports
snappy.cmake cleanup: innodb files in cmake/ 2017-03-29 00:40:22 +02:00