Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä 2022-11-08 16:04:01 +02:00
commit 93b4f84ab2
25 changed files with 225 additions and 329 deletions

View File

@ -3794,10 +3794,6 @@ static dberr_t xb_assign_undo_space_start()
int n_retries = 5; int n_retries = 5;
ulint fsp_flags; ulint fsp_flags;
if (srv_undo_tablespaces == 0) {
return error;
}
file = os_file_create(0, srv_sys_space.first_datafile()->filepath(), file = os_file_create(0, srv_sys_space.first_datafile()->filepath(),
OS_FILE_OPEN, OS_FILE_NORMAL, OS_DATA_FILE, true, &ret); OS_FILE_OPEN, OS_FILE_NORMAL, OS_DATA_FILE, true, &ret);

View File

@ -31,7 +31,9 @@ extern ulong my_time_to_wait_for_lock;
#include <signal.h> #include <signal.h>
#ifdef HAVE_SIGHANDLER_T #ifdef HAVE_SIGHANDLER_T
#define sig_return sighandler_t #define sig_return sighandler_t
#elif defined(SOLARIS) || defined(__sun) || defined(__APPLE__) #elif defined(SOLARIS) || defined(__sun) || defined(__APPLE__) || \
defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
defined(__DragonFly__)
typedef void (*sig_return)(int); /* Returns type from signal */ typedef void (*sig_return)(int); /* Returns type from signal */
#else #else
typedef void (*sig_return)(void); /* Returns type from signal */ typedef void (*sig_return)(void); /* Returns type from signal */

View File

@ -340,7 +340,9 @@ program to set the server\'s scheduling priority to the given value\&.
.\} .\}
.\" mysqld_safe: no-auto-restart option .\" mysqld_safe: no-auto-restart option
.\" no-auto-restart option: mysqld_safe .\" no-auto-restart option: mysqld_safe
\fB\-\-no\-auto\-restart\fR \fB\-\-no\-auto\-restart\fR,
\fB\-\-nowatch\fR,
\fB\-\-no\-watch\fR
.sp .sp
Exit after starting mysqld\&. Exit after starting mysqld\&.
.RE .RE
@ -368,21 +370,6 @@ Do not read any option files\&. This must be the first option on the command lin
.sp -1 .sp -1
.IP \(bu 2.3 .IP \(bu 2.3
.\} .\}
.\" mysqld_safe: no-watch option
.\" no-watch option: mysqld_safe
\fB\-\-no\-auto\-restart\fR
.sp
Exit after starting mysqld\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysqld_safe: numa-interleave option .\" mysqld_safe: numa-interleave option
.\" numa-interleave option: mysqld_safe .\" numa-interleave option: mysqld_safe
\fB\-\-numa\-interleave\fR \fB\-\-numa\-interleave\fR

View File

@ -1,8 +1,8 @@
drop table if exists t0,t1,t2,t3;
# #
# MDEV-6434: Wrong result (extra rows) with ORDER BY, multiple-column index, InnoDB # MDEV-6434: Wrong result (extra rows) with ORDER BY, multiple-column index, InnoDB
# #
CREATE TABLE t1 (a INT, b INT, c INT, d TEXT, KEY idx(a,b,c)) ENGINE=InnoDB; CREATE TABLE t1 (a INT, b INT, c INT, d TEXT, KEY idx(a,b,c)) ENGINE=InnoDB
STATS_PERSISTENT=0;
INSERT INTO t1 (a,c) VALUES INSERT INTO t1 (a,c) VALUES
(8, 9),(8, 10),(13, 15),(16, 17),(16, 18),(16, 19),(20, 21), (8, 9),(8, 10),(13, 15),(16, 17),(16, 18),(16, 19),(20, 21),
(20, 22),(20, 24),(20, 25),(20, 26),(20, 27),(20, 28); (20, 22),(20, 24),(20, 25),(20, 26),(20, 27),(20, 28);
@ -14,8 +14,6 @@ DROP TABLE t1;
# #
# MDEV-9457: Poor query plan chosen for ORDER BY query by a recent 10.1 # MDEV-9457: Poor query plan chosen for ORDER BY query by a recent 10.1
# #
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 ( create table t1 (
pk int primary key, pk int primary key,
key1 int, key1 int,
@ -23,15 +21,9 @@ key2 int,
col1 char(255), col1 char(255),
key(key1), key(key1),
key(key2) key(key2)
) engine=innodb; ) engine=innodb stats_persistent=0;
set @a=-1;
insert into t1 insert into t1
select select seq,seq,seq,repeat('abcd', 63) from seq_0_to_9999;
@a:=@a+1,
@a,
@a,
repeat('abcd', 63)
from t0 A, t0 B, t0 C, t0 D;
# The following must NOT use 'index' on PK. # The following must NOT use 'index' on PK.
# It should use index_merge(key1,key2) + filesort # It should use index_merge(key1,key2) + filesort
explain explain
@ -47,7 +39,7 @@ from t1
where key1<3 or key2<3; where key1<3 or key2<3;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where 1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL # Using sort_union(key1,key2); Using where
drop table t0, t1; drop table t1;
# #
# MDEV-18094: Query with order by limit picking index scan over filesort # MDEV-18094: Query with order by limit picking index scan over filesort
# #
@ -78,9 +70,12 @@ drop table t1,t0;
# MDEV-14071: wrong results with orderby_uses_equalities=on # MDEV-14071: wrong results with orderby_uses_equalities=on
# (duplicate of MDEV-13994) # (duplicate of MDEV-13994)
# #
CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB; CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB
CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB; STATS_PERSISTENT=0;
CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB; CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB
STATS_PERSISTENT=0;
CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB
STATS_PERSISTENT=0;
INSERT INTO t1 VALUES INSERT INTO t1 VALUES
(127,0,1),(188,0,1),(206,0,1),(218,0,1),(292,0,1),(338,0,1),(375,0,1), (127,0,1),(188,0,1),(206,0,1),(218,0,1),(292,0,1),(338,0,1),(375,0,1),
(381,0,1),(409,0,1),(466,0,1),(469,0,1),(498,0,1),(656,0,1); (381,0,1),(409,0,1),(466,0,1),(469,0,1),(498,0,1),(656,0,1);
@ -150,7 +145,8 @@ DROP TABLE t1,t2,t3;
# #
# MDEV-25858: Query results are incorrect when indexes are added # MDEV-25858: Query results are incorrect when indexes are added
# #
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY) engine=innodb; CREATE TABLE t1 (id int NOT NULL PRIMARY KEY) engine=innodb
STATS_PERSISTENT=0;
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
CREATE TABLE t2 ( CREATE TABLE t2 (
id int NOT NULL PRIMARY KEY, id int NOT NULL PRIMARY KEY,

View File

@ -2,16 +2,14 @@
# ORDER BY handling (e.g. filesort) tests that require innodb # ORDER BY handling (e.g. filesort) tests that require innodb
# #
-- source include/have_innodb.inc -- source include/have_innodb.inc
-- source include/have_sequence.inc
--disable_warnings
drop table if exists t0,t1,t2,t3;
--enable_warnings
--echo # --echo #
--echo # MDEV-6434: Wrong result (extra rows) with ORDER BY, multiple-column index, InnoDB --echo # MDEV-6434: Wrong result (extra rows) with ORDER BY, multiple-column index, InnoDB
--echo # --echo #
CREATE TABLE t1 (a INT, b INT, c INT, d TEXT, KEY idx(a,b,c)) ENGINE=InnoDB; CREATE TABLE t1 (a INT, b INT, c INT, d TEXT, KEY idx(a,b,c)) ENGINE=InnoDB
STATS_PERSISTENT=0;
INSERT INTO t1 (a,c) VALUES INSERT INTO t1 (a,c) VALUES
(8, 9),(8, 10),(13, 15),(16, 17),(16, 18),(16, 19),(20, 21), (8, 9),(8, 10),(13, 15),(16, 17),(16, 18),(16, 19),(20, 21),
@ -24,9 +22,6 @@ DROP TABLE t1;
--echo # --echo #
--echo # MDEV-9457: Poor query plan chosen for ORDER BY query by a recent 10.1 --echo # MDEV-9457: Poor query plan chosen for ORDER BY query by a recent 10.1
--echo # --echo #
create table t0 (a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 ( create table t1 (
pk int primary key, pk int primary key,
key1 int, key1 int,
@ -34,16 +29,10 @@ create table t1 (
col1 char(255), col1 char(255),
key(key1), key(key1),
key(key2) key(key2)
) engine=innodb; ) engine=innodb stats_persistent=0;
set @a=-1;
insert into t1 insert into t1
select select seq,seq,seq,repeat('abcd', 63) from seq_0_to_9999;
@a:=@a+1,
@a,
@a,
repeat('abcd', 63)
from t0 A, t0 B, t0 C, t0 D;
--echo # The following must NOT use 'index' on PK. --echo # The following must NOT use 'index' on PK.
--echo # It should use index_merge(key1,key2) + filesort --echo # It should use index_merge(key1,key2) + filesort
@ -60,7 +49,7 @@ select *
from t1 from t1
where key1<3 or key2<3; where key1<3 or key2<3;
drop table t0, t1; drop table t1;
--echo # --echo #
--echo # MDEV-18094: Query with order by limit picking index scan over filesort --echo # MDEV-18094: Query with order by limit picking index scan over filesort
@ -93,9 +82,12 @@ drop table t1,t0;
--echo # (duplicate of MDEV-13994) --echo # (duplicate of MDEV-13994)
--echo # --echo #
CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB; CREATE TABLE t1 (i int, j int, z int,PRIMARY KEY (i,j), KEY (z)) ENGINE=InnoDB
CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB; STATS_PERSISTENT=0;
CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB; CREATE TABLE t2 (i int, j int, PRIMARY KEY (i,j)) ENGINE=InnoDB
STATS_PERSISTENT=0;
CREATE TABLE t3 (j int, n varchar(5), PRIMARY KEY (j)) ENGINE=InnoDB
STATS_PERSISTENT=0;
INSERT INTO t1 VALUES INSERT INTO t1 VALUES
(127,0,1),(188,0,1),(206,0,1),(218,0,1),(292,0,1),(338,0,1),(375,0,1), (127,0,1),(188,0,1),(206,0,1),(218,0,1),(292,0,1),(338,0,1),(375,0,1),
@ -139,7 +131,8 @@ DROP TABLE t1,t2,t3;
--echo # MDEV-25858: Query results are incorrect when indexes are added --echo # MDEV-25858: Query results are incorrect when indexes are added
--echo # --echo #
CREATE TABLE t1 (id int NOT NULL PRIMARY KEY) engine=innodb; CREATE TABLE t1 (id int NOT NULL PRIMARY KEY) engine=innodb
STATS_PERSISTENT=0;
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
CREATE TABLE t2 ( CREATE TABLE t2 (

View File

@ -1,15 +1,11 @@
# #
# Range optimizer (and related) tests that need InnoDB. # Range optimizer (and related) tests that need InnoDB.
# #
drop table if exists t0, t1, t2;
# #
# MDEV-6735: Range checked for each record used with key # MDEV-6735: Range checked for each record used with key
# #
create table t0(a int); create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int);
insert into t1 select A.a + B.a* 10 + C.a * 100 + D.a * 1000
from t0 A, t0 B, t0 C, t0 D;
create table t2 ( create table t2 (
a int, a int,
b int, b int,
@ -22,12 +18,12 @@ key(b)
) engine=innodb; ) engine=innodb;
insert into t2 insert into t2
select select
a,a, seq,seq,
repeat('0123456789', 10), repeat('0123456789', 10),
repeat('0123456789', 10), repeat('0123456789', 10),
repeat('0123456789', 10), repeat('0123456789', 10),
repeat('0123456789', 10) repeat('0123456789', 10)
from t1; from seq_0_to_9999;
analyze table t2; analyze table t2;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Engine-independent statistics collected
@ -37,7 +33,7 @@ explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 1 SIMPLE t0 ALL NULL NULL NULL NULL 10
1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join) 1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join)
drop table t0,t1,t2; drop table t0,t2;
# #
# MDEV-10466: constructing an invalid SEL_ARG # MDEV-10466: constructing an invalid SEL_ARG
# #
@ -89,15 +85,14 @@ drop table t1,t2;
# #
set @optimizer_switch_save= @@optimizer_switch; set @optimizer_switch_save= @@optimizer_switch;
set optimizer_switch='index_merge_sort_intersection=off'; set optimizer_switch='index_merge_sort_intersection=off';
create table t0 (a int)engine=innodb; create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 ( create table t1 (
a int, b int, c int, a int, b int, c int,
key(a),key(b),key(c) key(a),key(b),key(c)
)engine=innodb; )engine=innodb;
insert into t1 insert into t1
select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a select a.seq/10, a.seq/10, a.seq from seq_0_to_499 a, seq_0_to_4 b;
from t0 A, t0 B, t0 C, t0 D where D.a<5;
SET @saved_dbug = @@GLOBAL.debug_dbug; SET @saved_dbug = @@GLOBAL.debug_dbug;
set @@global.debug_dbug="+d,ha_index_init_fail"; set @@global.debug_dbug="+d,ha_index_init_fail";
explain select * from t1 where a=10 and b=10; explain select * from t1 where a=10 and b=10;

View File

@ -4,12 +4,9 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_debug.inc --source include/have_debug.inc
--source include/have_sequence.inc
--source include/no_valgrind_without_big.inc --source include/no_valgrind_without_big.inc
--disable_warnings
drop table if exists t0, t1, t2;
--enable_warnings
--echo # --echo #
--echo # MDEV-6735: Range checked for each record used with key --echo # MDEV-6735: Range checked for each record used with key
--echo # --echo #
@ -17,10 +14,6 @@ drop table if exists t0, t1, t2;
create table t0(a int); create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1(a int);
insert into t1 select A.a + B.a* 10 + C.a * 100 + D.a * 1000
from t0 A, t0 B, t0 C, t0 D;
create table t2 ( create table t2 (
a int, a int,
b int, b int,
@ -34,18 +27,18 @@ create table t2 (
insert into t2 insert into t2
select select
a,a, seq,seq,
repeat('0123456789', 10), repeat('0123456789', 10),
repeat('0123456789', 10), repeat('0123456789', 10),
repeat('0123456789', 10), repeat('0123456789', 10),
repeat('0123456789', 10) repeat('0123456789', 10)
from t1; from seq_0_to_9999;
analyze table t2; analyze table t2;
--echo # The following must not use "Range checked for each record": --echo # The following must not use "Range checked for each record":
explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250; explain select * from t0 left join t2 on t2.a <t0.a and t2.b between 50 and 250;
drop table t0,t1,t2; drop table t0,t2;
--echo # --echo #
@ -98,15 +91,14 @@ drop table t1,t2;
set @optimizer_switch_save= @@optimizer_switch; set @optimizer_switch_save= @@optimizer_switch;
set optimizer_switch='index_merge_sort_intersection=off'; set optimizer_switch='index_merge_sort_intersection=off';
create table t0 (a int)engine=innodb; create table t0(a int);
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t1 ( create table t1 (
a int, b int, c int, a int, b int, c int,
key(a),key(b),key(c) key(a),key(b),key(c)
)engine=innodb; )engine=innodb;
insert into t1 insert into t1
select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a select a.seq/10, a.seq/10, a.seq from seq_0_to_499 a, seq_0_to_4 b;
from t0 A, t0 B, t0 C, t0 D where D.a<5;
SET @saved_dbug = @@GLOBAL.debug_dbug; SET @saved_dbug = @@GLOBAL.debug_dbug;
set @@global.debug_dbug="+d,ha_index_init_fail"; set @@global.debug_dbug="+d,ha_index_init_fail";
explain select * from t1 where a=10 and b=10; explain select * from t1 where a=10 and b=10;
@ -122,8 +114,6 @@ set @@optimizer_switch= @optimizer_switch_save;
--echo # MDEV-27262: Index intersection with full scan over an index --echo # MDEV-27262: Index intersection with full scan over an index
--echo # --echo #
--source include/have_sequence.inc
CREATE TABLE t1 ( CREATE TABLE t1 (
id int(10) unsigned NOT NULL AUTO_INCREMENT, id int(10) unsigned NOT NULL AUTO_INCREMENT,
p char(32) DEFAULT NULL, p char(32) DEFAULT NULL,

View File

@ -13,3 +13,4 @@
rtree_concurrent_srch : MDEV-15284 COUNT(*) mismatch rtree_concurrent_srch : MDEV-15284 COUNT(*) mismatch
rtree_recovery : MDEV-15284 COUNT(*) mismatch rtree_recovery : MDEV-15284 COUNT(*) mismatch
rtree_compress2 : MDEV-16269 CHECK TABLE reports wrong count rtree_compress2 : MDEV-16269 CHECK TABLE reports wrong count
types : MDEV-22512 recovery runs out of memory before 10.5

View File

@ -795,4 +795,14 @@ ENGINE=InnoDB;
INSERT INTO t VALUES (REPEAT('MariaDB Corporation Ab ',351),POINT(0,0)); INSERT INTO t VALUES (REPEAT('MariaDB Corporation Ab ',351),POINT(0,0));
ALTER TABLE t FORCE; ALTER TABLE t FORCE;
DROP TABLE t; DROP TABLE t;
#
# MDEV-29856 heap-use-after-poison in row_merge_spatial_rows()
# with PRIMARY KEY on column prefix
#
CREATE TABLE t (id INT, f TEXT, s POINT NOT NULL,
PRIMARY KEY(id,f(1)), SPATIAL(s)) ENGINE=InnoDB;
INSERT INTO t VALUES
(1,REPEAT('x',8192),@p:=ST_GeomFromText('POINT(0 0)')),(2,'',@p);
ALTER TABLE t FORCE;
DROP TABLE t;
# End of 10.3 tests # End of 10.3 tests

View File

@ -791,4 +791,16 @@ ALTER TABLE t FORCE;
# Cleanup # Cleanup
DROP TABLE t; DROP TABLE t;
--echo #
--echo # MDEV-29856 heap-use-after-poison in row_merge_spatial_rows()
--echo # with PRIMARY KEY on column prefix
--echo #
CREATE TABLE t (id INT, f TEXT, s POINT NOT NULL,
PRIMARY KEY(id,f(1)), SPATIAL(s)) ENGINE=InnoDB;
INSERT INTO t VALUES
(1,REPEAT('x',8192),@p:=ST_GeomFromText('POINT(0 0)')),(2,'',@p);
ALTER TABLE t FORCE;
DROP TABLE t;
--echo # End of 10.3 tests --echo # End of 10.3 tests

View File

@ -1 +1 @@
recover : MDEV-22512 recovery runs out of memory before 10.5

View File

@ -0,0 +1 @@
--innodb_undo_tablespaces=2

View File

@ -12,3 +12,18 @@ SELECT * FROM t;
i i
1 1
DROP TABLE t; DROP TABLE t;
#
# MDEV-27121 mariabackup incompatible with disabled dedicated
# undo log tablespaces
#
call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces");
# restart: --innodb_undo_tablespaces=0
# xtrabackup backup
# xtrabackup prepare
# shutdown server
# remove datadir
# xtrabackup move back
# restart: --innodb_undo_tablespaces=0
# Display undo log files from target directory
undo001
undo002

View File

@ -29,3 +29,27 @@ SELECT * FROM t;
DROP TABLE t; DROP TABLE t;
rmdir $targetdir; rmdir $targetdir;
--echo #
--echo # MDEV-27121 mariabackup incompatible with disabled dedicated
--echo # undo log tablespaces
--echo #
call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces");
let $restart_parameters=--innodb_undo_tablespaces=0;
--source include/restart_mysqld.inc
echo # xtrabackup backup;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
--enable_result_log
echo # xtrabackup prepare;
--disable_result_log
exec $XTRABACKUP --prepare --target-dir=$targetdir;
-- source include/restart_and_restore.inc
--enable_result_log
--echo # Display undo log files from target directory
list_files $targetdir undo*;
rmdir $targetdir;

View File

@ -202,7 +202,7 @@ int start_addr2line_fork(const char *binary_path)
close(out[0]); close(out[0]);
close(out[1]); close(out[1]);
execlp("addr2line", "addr2line", "-C", "-f", "-e", binary_path, NULL); execlp("addr2line", "addr2line", "-C", "-f", "-e", binary_path, NULL);
exit(1); _exit(1);
} }
close(in[0]); close(in[0]);

View File

@ -33,8 +33,14 @@ static my_bool memcpy_and_test(uchar *to, uchar *from, uint len)
return res; return res;
} }
#if defined(__APPLE__) || defined(__FreeBSD__) #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
#ifdef __OpenBSD__
#include <netinet/in.h>
#include <net/if_arp.h>
#include <netinet/if_ether.h>
#else
#include <net/ethernet.h> #include <net/ethernet.h>
#endif
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <net/route.h> #include <net/route.h>
#include <net/if.h> #include <net/if.h>

View File

@ -4252,8 +4252,8 @@ static int init_common_variables()
files= my_set_max_open_files(max_open_files); files= my_set_max_open_files(max_open_files);
SYSVAR_AUTOSIZE_IF_CHANGED(open_files_limit, files, ulong); SYSVAR_AUTOSIZE_IF_CHANGED(open_files_limit, files, ulong);
if (files < wanted_files && global_system_variables.log_warnings) if (files < max_open_files && global_system_variables.log_warnings)
sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, wanted_files); sql_print_warning("Could not increase number of max_open_files to more than %u (request: %u)", files, max_open_files);
/* If we required too much tc_instances than we reduce */ /* If we required too much tc_instances than we reduce */
SYSVAR_AUTOSIZE_IF_CHANGED(tc_instances, SYSVAR_AUTOSIZE_IF_CHANGED(tc_instances,

View File

@ -398,8 +398,9 @@ PageBulk::finish()
void PageBulk::commit(bool success) void PageBulk::commit(bool success)
{ {
finish(); finish();
if (success && !dict_index_is_clust(m_index) && page_is_leaf(m_page)) if (success && !m_index->is_clust() && page_is_leaf(m_page))
ibuf_set_bitmap_for_bulk_load(m_block, innobase_fill_factor == 100); ibuf_set_bitmap_for_bulk_load(m_block, &m_mtr,
innobase_fill_factor == 100);
m_mtr.commit(); m_mtr.commit();
} }

View File

@ -1160,7 +1160,7 @@ buf_page_is_corrupted(
DBUG_EXECUTE_IF( DBUG_EXECUTE_IF(
"page_intermittent_checksum_mismatch", { "page_intermittent_checksum_mismatch", {
static int page_counter; static int page_counter;
if (page_counter++ == 2) return true; if (page_counter++ == 3) return true;
}); });
if ((checksum_field1 != crc32 if ((checksum_field1 != crc32

View File

@ -1904,10 +1904,7 @@ ibuf_data_too_much_free(void)
Allocates a new page from the ibuf file segment and adds it to the free Allocates a new page from the ibuf file segment and adds it to the free
list. list.
@return TRUE on success, FALSE if no space left */ @return TRUE on success, FALSE if no space left */
static static bool ibuf_add_free_page()
ibool
ibuf_add_free_page(void)
/*====================*/
{ {
mtr_t mtr; mtr_t mtr;
page_t* header_page; page_t* header_page;
@ -1916,7 +1913,7 @@ ibuf_add_free_page(void)
page_t* root; page_t* root;
page_t* bitmap_page; page_t* bitmap_page;
mtr_start(&mtr); mtr.start();
/* Acquire the fsp latch before the ibuf header, obeying the latching /* Acquire the fsp latch before the ibuf header, obeying the latching
order */ order */
mtr_x_lock_space(fil_system.sys_space, &mtr); mtr_x_lock_space(fil_system.sys_space, &mtr);
@ -1937,9 +1934,8 @@ ibuf_add_free_page(void)
&mtr); &mtr);
if (block == NULL) { if (block == NULL) {
mtr_commit(&mtr); mtr.commit();
return false;
return(FALSE);
} }
ut_ad(rw_lock_get_x_lock_count(&block->lock) == 1); ut_ad(rw_lock_get_x_lock_count(&block->lock) == 1);
@ -1973,8 +1969,7 @@ ibuf_add_free_page(void)
IBUF_BITMAP_IBUF, TRUE, &mtr); IBUF_BITMAP_IBUF, TRUE, &mtr);
ibuf_mtr_commit(&mtr); ibuf_mtr_commit(&mtr);
return true;
return(TRUE);
} }
/*********************************************************************//** /*********************************************************************//**
@ -2470,6 +2465,7 @@ ibuf_merge_space(
ut_ad(space < SRV_LOG_SPACE_FIRST_ID); ut_ad(space < SRV_LOG_SPACE_FIRST_ID);
log_free_check();
ibuf_mtr_start(&mtr); ibuf_mtr_start(&mtr);
/* Position the cursor on the first matching record. */ /* Position the cursor on the first matching record. */
@ -2625,6 +2621,8 @@ ibuf_merge_in_background(
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
while (sum_pages < n_pages) { while (sum_pages < n_pages) {
log_free_check();
ulint n_bytes; ulint n_bytes;
n_bytes = ibuf_merge(&n_pag2, false); n_bytes = ibuf_merge(&n_pag2, false);
@ -4684,6 +4682,7 @@ void ibuf_delete_for_discarded_space(ulint space)
memset(dops, 0, sizeof(dops)); memset(dops, 0, sizeof(dops));
loop: loop:
log_free_check();
ibuf_mtr_start(&mtr); ibuf_mtr_start(&mtr);
/* Position pcur in the insert buffer at the first entry for the /* Position pcur in the insert buffer at the first entry for the
@ -4844,9 +4843,6 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space)
} }
mtr_start(&mtr); mtr_start(&mtr);
mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO);
ibuf_enter(&mtr); ibuf_enter(&mtr);
bitmap_page = ibuf_bitmap_get_map_page( bitmap_page = ibuf_bitmap_get_map_page(
@ -4934,36 +4930,24 @@ dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space)
return(DB_SUCCESS); return(DB_SUCCESS);
} }
/** Updates free bits and buffered bits for bulk loaded page. void ibuf_set_bitmap_for_bulk_load(buf_block_t *block, mtr_t *mtr, bool reset)
@param[in] block index page
@param[in] reset flag if reset free val */
void
ibuf_set_bitmap_for_bulk_load(
buf_block_t* block,
bool reset)
{ {
page_t* bitmap_page; page_t* bitmap_page;
mtr_t mtr;
ulint free_val; ulint free_val;
ut_a(page_is_leaf(buf_block_get_frame(block))); ut_a(page_is_leaf(buf_block_get_frame(block)));
free_val = ibuf_index_page_calc_free(block); free_val = ibuf_index_page_calc_free(block);
mtr_start(&mtr);
fil_space_t* space = mtr.set_named_space_id(block->page.id.space());
bitmap_page = ibuf_bitmap_get_map_page(block->page.id, bitmap_page = ibuf_bitmap_get_map_page(block->page.id,
space->zip_size(), &mtr); block->zip_size(), mtr);
free_val = reset ? 0 : ibuf_index_page_calc_free(block); free_val = reset ? 0 : ibuf_index_page_calc_free(block);
ibuf_bitmap_page_set_bits( ibuf_bitmap_page_set_bits(
bitmap_page, block->page.id, block->physical_size(), bitmap_page, block->page.id, block->physical_size(),
IBUF_BITMAP_FREE, free_val, &mtr); IBUF_BITMAP_FREE, free_val, mtr);
ibuf_bitmap_page_set_bits( ibuf_bitmap_page_set_bits(
bitmap_page, block->page.id, block->physical_size(), bitmap_page, block->page.id, block->physical_size(),
IBUF_BITMAP_BUFFERED, FALSE, &mtr); IBUF_BITMAP_BUFFERED, FALSE, mtr);
mtr_commit(&mtr);
} }

View File

@ -268,7 +268,6 @@ ibuf_page_low(
MY_ATTRIBUTE((warn_unused_result)); MY_ATTRIBUTE((warn_unused_result));
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
/** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages. /** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages.
Must not be called when recv_no_ibuf_operations==true. Must not be called when recv_no_ibuf_operations==true.
@param[in] page_id tablespace/page identifier @param[in] page_id tablespace/page identifier
@ -278,7 +277,7 @@ Must not be called when recv_no_ibuf_operations==true.
# define ibuf_page(page_id, zip_size, mtr) \ # define ibuf_page(page_id, zip_size, mtr) \
ibuf_page_low(page_id, zip_size, true, __FILE__, __LINE__, mtr) ibuf_page_low(page_id, zip_size, true, __FILE__, __LINE__, mtr)
#else /* UVIV_DEBUG */ #else /* UNIV_DEBUG */
/** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages. /** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages.
Must not be called when recv_no_ibuf_operations==true. Must not be called when recv_no_ibuf_operations==true.
@ -289,7 +288,7 @@ Must not be called when recv_no_ibuf_operations==true.
# define ibuf_page(page_id, zip_size, mtr) \ # define ibuf_page(page_id, zip_size, mtr) \
ibuf_page_low(page_id, zip_size, __FILE__, __LINE__, mtr) ibuf_page_low(page_id, zip_size, __FILE__, __LINE__, mtr)
#endif /* UVIV_DEBUG */ #endif /* UNIV_DEBUG */
/***********************************************************************//** /***********************************************************************//**
Frees excess pages from the ibuf free list. This function is called when an OS Frees excess pages from the ibuf free list. This function is called when an OS
thread calls fsp services to allocate a new file segment, or a new page to a thread calls fsp services to allocate a new file segment, or a new page to a
@ -397,13 +396,11 @@ ibuf_close(void);
dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space)
MY_ATTRIBUTE((nonnull, warn_unused_result)); MY_ATTRIBUTE((nonnull, warn_unused_result));
/** Updates free bits and buffered bits for bulk loaded page. /** Update free bits and buffered bits for bulk loaded page.
@param[in] block index page @param block secondary index leaf page
@param]in] reset flag if reset free val */ @param mtr mini-transaction
void @param reset whether the page is full */
ibuf_set_bitmap_for_bulk_load( void ibuf_set_bitmap_for_bulk_load(buf_block_t *block, mtr_t *mtr, bool reset);
buf_block_t* block,
bool reset);
#define IBUF_HEADER_PAGE_NO FSP_IBUF_HEADER_PAGE_NO #define IBUF_HEADER_PAGE_NO FSP_IBUF_HEADER_PAGE_NO
#define IBUF_TREE_ROOT_PAGE_NO FSP_IBUF_TREE_ROOT_PAGE_NO #define IBUF_TREE_ROOT_PAGE_NO FSP_IBUF_TREE_ROOT_PAGE_NO

View File

@ -57,6 +57,7 @@ Created 9/20/1997 Heikki Tuuri
#include "trx0roll.h" #include "trx0roll.h"
#include "row0merge.h" #include "row0merge.h"
#include "fil0pagecompress.h" #include "fil0pagecompress.h"
#include "log.h"
/** Log records are stored in the hash table in chunks at most of this size; /** Log records are stored in the hash table in chunks at most of this size;
this must be less than srv_page_size as it is stored in the buffer pool */ this must be less than srv_page_size as it is stored in the buffer pool */
@ -1151,7 +1152,7 @@ static dberr_t recv_log_format_0_recover(lsn_t lsn, bool crypt)
byte* buf = log_sys.buf; byte* buf = log_sys.buf;
static const char* NO_UPGRADE_RECOVERY_MSG = static const char* NO_UPGRADE_RECOVERY_MSG =
"Upgrade after a crash is not supported." "InnoDB: Upgrade after a crash is not supported."
" This redo log was created before MariaDB 10.2.2"; " This redo log was created before MariaDB 10.2.2";
fil_io(IORequestLogRead, true, fil_io(IORequestLogRead, true,
@ -1164,21 +1165,24 @@ static dberr_t recv_log_format_0_recover(lsn_t lsn, bool crypt)
if (log_block_calc_checksum_format_0(buf) if (log_block_calc_checksum_format_0(buf)
!= log_block_get_checksum(buf) != log_block_get_checksum(buf)
&& !log_crypt_101_read_block(buf)) { && !log_crypt_101_read_block(buf)) {
ib::error() << NO_UPGRADE_RECOVERY_MSG sql_print_error("%s, and it appears corrupted.",
<< ", and it appears corrupted."; NO_UPGRADE_RECOVERY_MSG);
return(DB_CORRUPTION); return DB_CORRUPTION;
} }
if (log_block_get_data_len(buf) if (log_block_get_data_len(buf)
== (source_offset & (OS_FILE_LOG_BLOCK_SIZE - 1))) { == (source_offset & (OS_FILE_LOG_BLOCK_SIZE - 1))) {
} else if (crypt) { } else if (crypt) {
ib::error() << "Cannot decrypt log for upgrading." sql_print_error("InnoDB: Cannot decrypt log for upgrading."
" The encrypted log was created" " The encrypted log was created"
" before MariaDB 10.2.2."; " before MariaDB 10.2.2.");
return DB_ERROR; return DB_ERROR;
} else { } else {
ib::error() << NO_UPGRADE_RECOVERY_MSG << "."; sql_print_error("%s. You must start up and shut down"
return(DB_ERROR); " MariaDB 10.1 or MySQL 5.6 or earlier"
" on the data directory.",
NO_UPGRADE_RECOVERY_MSG);
return DB_ERROR;
} }
/* Mark the redo log for upgrading. */ /* Mark the redo log for upgrading. */

View File

@ -1,14 +0,0 @@
{
global:
_maria_plugin_interface_version_;
_maria_sizeof_struct_st_plugin_;
_maria_plugin_declarations_;
my_snprintf_service;
thd_alloc_service;
thd_autoinc_service;
thd_error_context_service;
thd_kill_statement_service;
thd_wait_service;
local:
*;
};

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2021, MariaDB Corporation. Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
@ -402,17 +402,10 @@ que_graph_free_recursive(
ind_node_t* cre_ind; ind_node_t* cre_ind;
purge_node_t* purge; purge_node_t* purge;
DBUG_ENTER("que_graph_free_recursive");
if (node == NULL) { if (node == NULL) {
return;
DBUG_VOID_RETURN;
} }
DBUG_PRINT("que_graph_free_recursive",
("node: %p, type: " ULINTPF, node,
que_node_get_type(node)));
switch (que_node_get_type(node)) { switch (que_node_get_type(node)) {
case QUE_NODE_FORK: case QUE_NODE_FORK:
@ -558,8 +551,6 @@ que_graph_free_recursive(
default: default:
ut_error; ut_error;
} }
DBUG_VOID_RETURN;
} }
/**********************************************************************//** /**********************************************************************//**
@ -892,65 +883,6 @@ que_node_get_containing_loop_node(
return(node); return(node);
} }
#ifdef DBUG_TRACE
/** Gets information of an SQL query graph node.
@return type description */
static MY_ATTRIBUTE((warn_unused_result, nonnull))
const char*
que_node_type_string(
/*=================*/
const que_node_t* node) /*!< in: query graph node */
{
switch (que_node_get_type(node)) {
case QUE_NODE_SELECT:
return("SELECT");
case QUE_NODE_INSERT:
return("INSERT");
case QUE_NODE_UPDATE:
return("UPDATE");
case QUE_NODE_WHILE:
return("WHILE");
case QUE_NODE_ASSIGNMENT:
return("ASSIGNMENT");
case QUE_NODE_IF:
return("IF");
case QUE_NODE_FETCH:
return("FETCH");
case QUE_NODE_OPEN:
return("OPEN");
case QUE_NODE_PROC:
return("STORED PROCEDURE");
case QUE_NODE_FUNC:
return("FUNCTION");
case QUE_NODE_LOCK:
return("LOCK");
case QUE_NODE_THR:
return("QUERY THREAD");
case QUE_NODE_COMMIT:
return("COMMIT");
case QUE_NODE_UNDO:
return("UNDO ROW");
case QUE_NODE_PURGE:
return("PURGE ROW");
case QUE_NODE_ROLLBACK:
return("ROLLBACK");
case QUE_NODE_CREATE_TABLE:
return("CREATE TABLE");
case QUE_NODE_CREATE_INDEX:
return("CREATE INDEX");
case QUE_NODE_FOR:
return("FOR LOOP");
case QUE_NODE_RETURN:
return("RETURN");
case QUE_NODE_EXIT:
return("EXIT");
default:
ut_ad(0);
return("UNKNOWN NODE TYPE");
}
}
#endif /* DBUG_TRACE */
/**********************************************************************//** /**********************************************************************//**
Performs an execution step on a query thread. Performs an execution step on a query thread.
@return query thread to run next: it may differ from the input @return query thread to run next: it may differ from the input
@ -978,10 +910,6 @@ que_thr_step(
old_thr = thr; old_thr = thr;
DBUG_PRINT("ib_que", ("Execute %u (%s) at %p",
unsigned(type), que_node_type_string(node),
(const void*) node));
if (type & QUE_NODE_CONTROL_STAT) { if (type & QUE_NODE_CONTROL_STAT) {
if ((thr->prev_node != que_node_get_parent(node)) if ((thr->prev_node != que_node_get_parent(node))
&& que_node_get_next(thr->prev_node)) { && que_node_get_next(thr->prev_node)) {

View File

@ -60,63 +60,48 @@ Completed by Sunny Bains and Marko Makela
/* Whether to disable file system cache */ /* Whether to disable file system cache */
char srv_disable_sort_file_cache; char srv_disable_sort_file_cache;
/** Class that caches index row tuples made from a single cluster /** Class that caches spatial index row tuples made from a single cluster
index page scan, and then insert into corresponding index tree */ index page scan, and then insert into corresponding index tree */
class index_tuple_info_t { class spatial_index_info {
public: public:
/** constructor /** constructor
@param[in] heap memory heap @param index spatial index to be created */
@param[in] index index to be created */ spatial_index_info(dict_index_t *index) : index(index)
index_tuple_info_t( {
mem_heap_t* heap, ut_ad(index->is_spatial());
dict_index_t* index) UNIV_NOTHROW }
{
m_heap = heap;
m_index = index;
m_dtuple_vec = UT_NEW_NOKEY(idx_tuple_vec());
}
/** destructor */ /** Caches an index row into index tuple vector
~index_tuple_info_t() @param[in] row table row
{ @param[in] ext externally stored column prefixes, or NULL */
UT_DELETE(m_dtuple_vec); void add(const dtuple_t *row, const row_ext_t *ext, mem_heap_t *heap)
} {
dtuple_t *dtuple= row_build_index_entry(row, ext, index, heap);
/** Get the index object ut_ad(dtuple);
@return the index object */ ut_ad(dtuple->n_fields == index->n_fields);
dict_index_t* get_index() UNIV_NOTHROW if (ext)
{ {
return(m_index); /* Replace any references to ext, because ext will be allocated
} from row_heap. */
for (ulint i= 1; i < dtuple->n_fields; i++)
/** Caches an index row into index tuple vector {
@param[in] row table row dfield_t &dfield= dtuple->fields[i];
@param[in] ext externally stored column if (dfield.data >= ext->buf &&
prefixes, or NULL */ dfield.data <= &ext->buf[ext->n_ext * ext->max_len])
void add( dfield_dup(&dfield, heap);
const dtuple_t* row, }
const row_ext_t* ext) UNIV_NOTHROW }
{ m_dtuple_vec.push_back(dtuple);
dtuple_t* dtuple; }
dtuple = row_build_index_entry(row, ext, m_index, m_heap);
ut_ad(dtuple);
m_dtuple_vec->push_back(dtuple);
}
/** Insert spatial index rows cached in vector into spatial index /** Insert spatial index rows cached in vector into spatial index
@param[in] trx_id transaction id @param[in] trx_id transaction id
@param[in,out] row_heap memory heap
@param[in] pcur cluster index scanning cursor @param[in] pcur cluster index scanning cursor
@param[in,out] heap temporary memory heap
@param[in,out] scan_mtr mini-transaction for pcur @param[in,out] scan_mtr mini-transaction for pcur
@return DB_SUCCESS if successful, else error number */ @return DB_SUCCESS if successful, else error number */
inline dberr_t insert( inline dberr_t insert(trx_id_t trx_id, btr_pcur_t* pcur,
trx_id_t trx_id, mem_heap_t* heap, mtr_t* scan_mtr)
mem_heap_t* row_heap,
btr_pcur_t* pcur,
mtr_t* scan_mtr)
{ {
big_rec_t* big_rec; big_rec_t* big_rec;
rec_t* rec; rec_t* rec;
@ -130,14 +115,12 @@ public:
| BTR_NO_LOCKING_FLAG | BTR_NO_LOCKING_FLAG
| BTR_KEEP_SYS_FLAG | BTR_CREATE_FLAG; | BTR_KEEP_SYS_FLAG | BTR_CREATE_FLAG;
ut_ad(dict_index_is_spatial(m_index));
DBUG_EXECUTE_IF("row_merge_instrument_log_check_flush", DBUG_EXECUTE_IF("row_merge_instrument_log_check_flush",
log_sys.check_flush_or_checkpoint = true; log_sys.check_flush_or_checkpoint = true;
); );
for (idx_tuple_vec::iterator it = m_dtuple_vec->begin(); for (idx_tuple_vec::iterator it = m_dtuple_vec.begin();
it != m_dtuple_vec->end(); it != m_dtuple_vec.end();
++it) { ++it) {
dtuple = *it; dtuple = *it;
ut_ad(dtuple); ut_ad(dtuple);
@ -153,14 +136,14 @@ public:
} }
mtr.start(); mtr.start();
m_index->set_modified(mtr); index->set_modified(mtr);
ins_cur.index = m_index; ins_cur.index = index;
rtr_init_rtr_info(&rtr_info, false, &ins_cur, m_index, rtr_init_rtr_info(&rtr_info, false, &ins_cur, index,
false); false);
rtr_info_update_btr(&ins_cur, &rtr_info); rtr_info_update_btr(&ins_cur, &rtr_info);
btr_cur_search_to_nth_level(m_index, 0, dtuple, btr_cur_search_to_nth_level(index, 0, dtuple,
PAGE_CUR_RTREE_INSERT, PAGE_CUR_RTREE_INSERT,
BTR_MODIFY_LEAF, &ins_cur, BTR_MODIFY_LEAF, &ins_cur,
__FILE__, __LINE__, __FILE__, __LINE__,
@ -169,44 +152,44 @@ public:
/* It need to update MBR in parent entry, /* It need to update MBR in parent entry,
so change search mode to BTR_MODIFY_TREE */ so change search mode to BTR_MODIFY_TREE */
if (rtr_info.mbr_adj) { if (rtr_info.mbr_adj) {
mtr_commit(&mtr); mtr.commit();
rtr_clean_rtr_info(&rtr_info, true); rtr_clean_rtr_info(&rtr_info, true);
rtr_init_rtr_info(&rtr_info, false, &ins_cur, rtr_init_rtr_info(&rtr_info, false, &ins_cur,
m_index, false); index, false);
rtr_info_update_btr(&ins_cur, &rtr_info); rtr_info_update_btr(&ins_cur, &rtr_info);
mtr_start(&mtr); mtr.start();
m_index->set_modified(mtr); index->set_modified(mtr);
btr_cur_search_to_nth_level( btr_cur_search_to_nth_level(
m_index, 0, dtuple, index, 0, dtuple,
PAGE_CUR_RTREE_INSERT, PAGE_CUR_RTREE_INSERT,
BTR_MODIFY_TREE, &ins_cur, BTR_MODIFY_TREE, &ins_cur,
__FILE__, __LINE__, &mtr); __FILE__, __LINE__, &mtr);
} }
error = btr_cur_optimistic_insert( error = btr_cur_optimistic_insert(
flag, &ins_cur, &ins_offsets, &row_heap, flag, &ins_cur, &ins_offsets, &heap,
dtuple, &rec, &big_rec, 0, NULL, &mtr); dtuple, &rec, &big_rec, 0, NULL, &mtr);
if (error == DB_FAIL) { if (error == DB_FAIL) {
ut_ad(!big_rec); ut_ad(!big_rec);
mtr.commit(); mtr.commit();
mtr.start(); mtr.start();
m_index->set_modified(mtr); index->set_modified(mtr);
rtr_clean_rtr_info(&rtr_info, true); rtr_clean_rtr_info(&rtr_info, true);
rtr_init_rtr_info(&rtr_info, false, rtr_init_rtr_info(&rtr_info, false,
&ins_cur, m_index, false); &ins_cur, index, false);
rtr_info_update_btr(&ins_cur, &rtr_info); rtr_info_update_btr(&ins_cur, &rtr_info);
btr_cur_search_to_nth_level( btr_cur_search_to_nth_level(
m_index, 0, dtuple, index, 0, dtuple,
PAGE_CUR_RTREE_INSERT, PAGE_CUR_RTREE_INSERT,
BTR_MODIFY_TREE, BTR_MODIFY_TREE,
&ins_cur, __FILE__, __LINE__, &mtr); &ins_cur, __FILE__, __LINE__, &mtr);
error = btr_cur_pessimistic_insert( error = btr_cur_pessimistic_insert(
flag, &ins_cur, &ins_offsets, flag, &ins_cur, &ins_offsets,
&row_heap, dtuple, &rec, &heap, dtuple, &rec,
&big_rec, 0, NULL, &mtr); &big_rec, 0, NULL, &mtr);
} }
@ -229,30 +212,26 @@ public:
} }
} }
mtr_commit(&mtr); mtr.commit();
rtr_clean_rtr_info(&rtr_info, true); rtr_clean_rtr_info(&rtr_info, true);
} }
m_dtuple_vec->clear(); m_dtuple_vec.clear();
return(error); return(error);
} }
private: private:
/** Cache index rows made from a cluster index scan. Usually /** Cache index rows made from a cluster index scan. Usually
for rows on single cluster index page */ for rows on single cluster index page */
typedef std::vector<dtuple_t*, ut_allocator<dtuple_t*> > typedef std::vector<dtuple_t*, ut_allocator<dtuple_t*> > idx_tuple_vec;
idx_tuple_vec;
/** vector used to cache index rows made from cluster index scan */ /** vector used to cache index rows made from cluster index scan */
idx_tuple_vec* m_dtuple_vec; idx_tuple_vec m_dtuple_vec;
public:
/** the index being built */ /** the index being built */
dict_index_t* m_index; dict_index_t*const index;
/** memory heap for creating index tuples */
mem_heap_t* m_heap;
}; };
/* Maximum pending doc memory limit in bytes for a fts tokenization thread */ /* Maximum pending doc memory limit in bytes for a fts tokenization thread */
@ -1566,7 +1545,6 @@ row_mtuple_cmp(
@param[in] trx_id transaction id @param[in] trx_id transaction id
@param[in] sp_tuples cached spatial rows @param[in] sp_tuples cached spatial rows
@param[in] num_spatial number of spatial indexes @param[in] num_spatial number of spatial indexes
@param[in,out] row_heap heap for insert
@param[in,out] sp_heap heap for tuples @param[in,out] sp_heap heap for tuples
@param[in,out] pcur cluster index cursor @param[in,out] pcur cluster index cursor
@param[in,out] mtr mini transaction @param[in,out] mtr mini transaction
@ -1575,9 +1553,8 @@ static
dberr_t dberr_t
row_merge_spatial_rows( row_merge_spatial_rows(
trx_id_t trx_id, trx_id_t trx_id,
index_tuple_info_t** sp_tuples, spatial_index_info** sp_tuples,
ulint num_spatial, ulint num_spatial,
mem_heap_t* row_heap,
mem_heap_t* sp_heap, mem_heap_t* sp_heap,
btr_pcur_t* pcur, btr_pcur_t* pcur,
mtr_t* mtr) mtr_t* mtr)
@ -1591,7 +1568,7 @@ row_merge_spatial_rows(
ut_ad(sp_heap != NULL); ut_ad(sp_heap != NULL);
for (ulint j = 0; j < num_spatial; j++) { for (ulint j = 0; j < num_spatial; j++) {
err = sp_tuples[j]->insert(trx_id, row_heap, pcur, mtr); err = sp_tuples[j]->insert(trx_id, pcur, sp_heap, mtr);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
return(err); return(err);
@ -1714,8 +1691,7 @@ row_merge_read_clustered_index(
os_event_t fts_parallel_sort_event = NULL; os_event_t fts_parallel_sort_event = NULL;
ibool fts_pll_sort = FALSE; ibool fts_pll_sort = FALSE;
int64_t sig_count = 0; int64_t sig_count = 0;
index_tuple_info_t** sp_tuples = NULL; spatial_index_info** sp_tuples = NULL;
mem_heap_t* sp_heap = NULL;
ulint num_spatial = 0; ulint num_spatial = 0;
BtrBulk* clust_btr_bulk = NULL; BtrBulk* clust_btr_bulk = NULL;
bool clust_temp_file = false; bool clust_temp_file = false;
@ -1805,9 +1781,7 @@ row_merge_read_clustered_index(
if (num_spatial > 0) { if (num_spatial > 0) {
ulint count = 0; ulint count = 0;
sp_heap = mem_heap_create(512); sp_tuples = static_cast<spatial_index_info**>(
sp_tuples = static_cast<index_tuple_info_t**>(
ut_malloc_nokey(num_spatial ut_malloc_nokey(num_spatial
* sizeof(*sp_tuples))); * sizeof(*sp_tuples)));
@ -1815,9 +1789,7 @@ row_merge_read_clustered_index(
if (dict_index_is_spatial(index[i])) { if (dict_index_is_spatial(index[i])) {
sp_tuples[count] sp_tuples[count]
= UT_NEW_NOKEY( = UT_NEW_NOKEY(
index_tuple_info_t( spatial_index_info(index[i]));
sp_heap,
index[i]));
count++; count++;
} }
} }
@ -1948,7 +1920,7 @@ row_merge_read_clustered_index(
/* Insert the cached spatial index rows. */ /* Insert the cached spatial index rows. */
err = row_merge_spatial_rows( err = row_merge_spatial_rows(
trx->id, sp_tuples, num_spatial, trx->id, sp_tuples, num_spatial,
row_heap, sp_heap, &pcur, &mtr); row_heap, &pcur, &mtr);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
goto func_exit; goto func_exit;
@ -2328,7 +2300,7 @@ write_buffers:
continue; continue;
} }
ut_ad(sp_tuples[s_idx_cnt]->get_index() ut_ad(sp_tuples[s_idx_cnt]->index
== buf->index); == buf->index);
/* If the geometry field is invalid, report /* If the geometry field is invalid, report
@ -2338,7 +2310,7 @@ write_buffers:
break; break;
} }
sp_tuples[s_idx_cnt]->add(row, ext); sp_tuples[s_idx_cnt]->add(row, ext, buf->heap);
s_idx_cnt++; s_idx_cnt++;
continue; continue;
@ -2468,7 +2440,7 @@ write_buffers:
err = row_merge_spatial_rows( err = row_merge_spatial_rows(
trx->id, sp_tuples, trx->id, sp_tuples,
num_spatial, num_spatial,
row_heap, sp_heap, row_heap,
&pcur, &mtr); &pcur, &mtr);
if (err != DB_SUCCESS) { if (err != DB_SUCCESS) {
@ -2846,10 +2818,6 @@ wait_again:
UT_DELETE(sp_tuples[i]); UT_DELETE(sp_tuples[i]);
} }
ut_free(sp_tuples); ut_free(sp_tuples);
if (sp_heap) {
mem_heap_free(sp_heap);
}
} }
/* Update the next Doc ID we used. Table should be locked, so /* Update the next Doc ID we used. Table should be locked, so