Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä 2020-05-05 21:16:22 +03:00
commit 7bcaa541aa
140 changed files with 1689 additions and 954 deletions

View File

@ -1,5 +1,5 @@
# Copyright (c) 2006, 2017, Oracle and/or its affiliates.
# Copyright (c) 2008, 2019, MariaDB Corporation.
# Copyright (c) 2008, 2020, MariaDB Corporation.
#
# 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
@ -254,6 +254,11 @@ INCLUDE(wsrep)
INCLUDE(cpack_rpm)
INCLUDE(cpack_deb)
OPTION(WITH_DBUG_TRACE "Enable DBUG_ENTER()/DBUG_EXIT()" ON)
IF(WITH_DBUG_TRACE)
ADD_DEFINITIONS(-DDBUG_TRACE)
ENDIF()
# Always enable debug sync for debug builds.
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")

View File

@ -32,7 +32,7 @@
** master/autocommit code by Brian Aker <brian@tangent.org>
** SSL by
** Andrei Errapart <andreie@no.spam.ee>
** Tõnu Samuel <tonu@please.do.not.remove.this.spam.ee>
** Tõnu Samuel <tonu@please.do.not.remove.this.spam.ee>
** XML by Gary Huntress <ghuntress@mediaone.net> 10/10/01, cleaned up
** and adapted to mysqldump 05/11/01 by Jani Tolonen
** Added --single-transaction option 06/06/2002 by Peter Zaitsev

View File

@ -4,6 +4,10 @@
char *push1=0;
#ifndef DBUG_TRACE
#define DBUG_TRACE
#endif
#include <my_global.h> /* This includes dbug.h */
#include <my_sys.h>
#include <my_pthread.h>

View File

@ -29,6 +29,13 @@ extern ulong my_time_to_wait_for_lock;
#if defined(HAVE_ALARM) && !defined(NO_ALARM_LOOP)
#include <signal.h>
#ifdef HAVE_SIGHANDLER_T
#define sig_return sighandler_t
#elif defined(SOLARIS) || defined(__sun) || defined(__APPLE__)
typedef void (*sig_return)(int); /* Returns type from signal */
#else
typedef void (*sig_return)(void); /* Returns type from signal */
#endif
#define ALARM_VARIABLES uint alarm_old=0; \
sig_return alarm_signal=0
#define ALARM_INIT my_have_got_alarm=0 ; \

View File

@ -67,6 +67,7 @@ extern void dbug_free_code_state(void **code_state_store);
extern const char* _db_get_func_(void);
extern int (*dbug_sanity)(void);
#ifdef DBUG_TRACE
#define DBUG_LEAVE do { \
_db_stack_frame_.line= __LINE__; \
_db_return_ (&_db_stack_frame_); \
@ -85,6 +86,13 @@ extern int (*dbug_sanity)(void);
#define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0)
#endif
#else
#define DBUG_LEAVE
#define DBUG_ENTER(a)
#define DBUG_RETURN(a1) return(a1)
#define DBUG_VOID_RETURN return
#endif
#define DBUG_EXECUTE(keyword,a1) \
do {if (_db_keyword_(0, (keyword), 0)) { a1 }} while(0)
#define DBUG_EXECUTE_IF(keyword,a1) \

View File

@ -561,13 +561,6 @@ typedef int my_socket; /* File descriptor for sockets */
#endif
/* Type for functions that handles signals */
#define sig_handler RETSIGTYPE
C_MODE_START
#ifdef HAVE_SIGHANDLER_T
#define sig_return sighandler_t
#else
typedef void (*sig_return)(void); /* Returns type from signal */
#endif
C_MODE_END
#if defined(__GNUC__) && !defined(_lint)
typedef char pchar; /* Mixed prototypes can take char */
typedef char puchar; /* Mixed prototypes can take char */

View File

@ -53,7 +53,7 @@ typedef struct st_queue {
#define queue_top(queue) ((queue)->root[1])
#define queue_element(queue,index) ((queue)->root[index])
#define queue_end(queue) ((queue)->root[(queue)->elements])
#define queue_replace_top(queue) _downheap(queue, 1, (queue)->root[1])
#define queue_replace_top(queue) _downheap(queue, 1)
#define queue_set_cmp_arg(queue, set_arg) (queue)->first_cmp_arg= set_arg
#define queue_set_max_at_top(queue, set_arg) \
(queue)->max_at_top= set_arg ? -1 : 1
@ -61,23 +61,23 @@ typedef struct st_queue {
typedef int (*queue_compare)(void *,uchar *, uchar *);
int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
pbool max_at_top, queue_compare compare,
my_bool max_at_top, queue_compare compare,
void *first_cmp_arg, uint offset_to_queue_pos,
uint auto_extent);
int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key,
pbool max_at_top, queue_compare compare,
my_bool max_at_top, queue_compare compare,
void *first_cmp_arg, uint offset_to_queue_pos,
uint auto_extent);
int resize_queue(QUEUE *queue, uint max_elements);
void delete_queue(QUEUE *queue);
void queue_insert(QUEUE *queue,uchar *element);
void queue_insert(QUEUE *queue, uchar *element);
int queue_insert_safe(QUEUE *queue, uchar *element);
uchar *queue_remove(QUEUE *queue,uint idx);
void queue_replace(QUEUE *queue,uint idx);
#define queue_remove_all(queue) { (queue)->elements= 0; }
#define queue_is_full(queue) (queue->elements == queue->max_elements)
void _downheap(QUEUE *queue, uint idx, uchar *element);
void _downheap(QUEUE *queue, uint idx);
void queue_fix(QUEUE *queue);
#define is_queue_inited(queue) ((queue)->root != 0)

View File

@ -153,6 +153,9 @@ typedef my_socket YASSL_SOCKET_T;
#include <openssl/ssl.h>
#undef Timeval
#include <openssl/err.h>
#ifdef DEPRECATED
#undef DEPRECATED
#endif
enum enum_ssl_init_error
{

@ -1 +1 @@
Subproject commit 9c84958266a7fc61cd5b31b623cf4e26c3320713
Subproject commit ca8f94f727dba19a6ac43691df53fdc829e2124e

View File

@ -206,7 +206,7 @@ int main(int argc, const char** argv )
} else {
if (strcmp(arg, "--verbose") == 0)
verbose++;
else if (strncmp(arg, "--parent-pid", 10) == 0)
else if (strncmp(arg, "--parent-pid", 12) == 0)
{
/* Override parent_pid with a value provided by user */
const char* start;

View File

@ -405,7 +405,7 @@ c int(11) YES NULL
explain select * from t1,t2 where t1.b = t2.c and t1.c = t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using where
1 SIMPLE t1 ref b,c b 5 test.t2.c 1 Using where
1 SIMPLE t1 eq_ref b,c b 5 test.t2.c 1 Using where
select * from t1,t2 where t1.b = t2.c and t1.c = t2.b;
a a b c
1 1 1 1

View File

@ -3340,11 +3340,11 @@ show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
t1 0 PRIMARY 1 pk A 1010 NULL NULL BTREE
t1 0 a 1 a A 1010 NULL NULL YES BTREE
# t1 must use ref(t1.a=t0.a) and rows must be 1 (and not 45):
# t1 must use eq_ref(t1.a=t0.a) and rows must be 1 (and not 45):
explain select * from t0,t1 where t0.a=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
1 SIMPLE t1 ref a a 5 test.t0.a 1
1 SIMPLE t1 eq_ref a a 5 test.t0.a 1
drop table t0,t1;
#
# MDEV-21383: Possible range plan is not used under certain conditions

View File

@ -1745,7 +1745,7 @@ analyze table t1;
set myisam_stats_method=@tmp1;
show keys from t1;
--echo # t1 must use ref(t1.a=t0.a) and rows must be 1 (and not 45):
--echo # t1 must use eq_ref(t1.a=t0.a) and rows must be 1 (and not 45):
explain select * from t0,t1 where t0.a=t1.a;
drop table t0,t1;

View File

@ -643,3 +643,45 @@ SHOW STATUS LIKE 'Last_query_cost';
Variable_name Value
Last_query_cost 14.199000
DROP TABLE t1;
#
# MDEV-21480: Unique key using ref access though eq_ref access can be used
#
create table t1(a int, b int,c int, primary key(a), unique key(b,c));
insert into t1 select seq, seq, seq from seq_1_to_10;
create table t2(a int, b int,c int);
insert into t2 select seq, seq, seq+1 from seq_1_to_100;
EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 100 Using where
1 SIMPLE t1 eq_ref b b 10 test.t2.a,test.t2.b 1 Using index
SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
c c
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
alter table t1 drop PRIMARY KEY;
alter table t1 add PRIMARY KEY(b,c);
EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 100 Using where
1 SIMPLE t1 eq_ref PRIMARY,b PRIMARY 8 test.t2.a,test.t2.b 1 Using index
SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
c c
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
drop table t1,t2;

View File

@ -1,6 +1,7 @@
--disable_warnings
drop table if exists t1,t2,t3;
--enable_warnings
--source include/have_sequence.inc
SET SQL_WARNINGS=1;
#
@ -582,3 +583,23 @@ EXPLAIN SELECT a, SUM( b ) FROM t1 FORCE INDEX( a ) GROUP BY a;
SHOW STATUS LIKE 'Last_query_cost';
DROP TABLE t1;
--echo #
--echo # MDEV-21480: Unique key using ref access though eq_ref access can be used
--echo #
create table t1(a int, b int,c int, primary key(a), unique key(b,c));
insert into t1 select seq, seq, seq from seq_1_to_10;
create table t2(a int, b int,c int);
insert into t2 select seq, seq, seq+1 from seq_1_to_100;
EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
alter table t1 drop PRIMARY KEY;
alter table t1 add PRIMARY KEY(b,c);
EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b;
drop table t1,t2;

View File

@ -1589,7 +1589,7 @@ WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
ORDER BY t2.c LIMIT 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a,b,c c 5 NULL 420 Using where
1 SIMPLE t1 ref a a 39 test.t2.a,const 1 Using where; Using index
1 SIMPLE t1 eq_ref a a 39 test.t2.a,const 1 Using where; Using index
SELECT d FROM t3 AS t1, t2 AS t2
WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
ORDER BY t2.c LIMIT 1;

View File

@ -69,7 +69,7 @@ t4.b=t0.a and t4.a in (select max(t2.a) from t1, t2 group by t2.b);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 5
1 PRIMARY t0 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t4 ref a a 10 <subquery2>.max(t2.a),test.t0.a 1
1 PRIMARY t4 eq_ref a a 10 <subquery2>.max(t2.a),test.t0.a 1
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 Using temporary
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
insert into t4 select 100 + (B.a *100 + A.a), 100 + (B.a*100 + A.a), 'filler' from t4 A, t0 B;
@ -79,7 +79,7 @@ t4.b in (select max(t2.a) from t1, t2 group by t2.b);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <subquery3> ALL distinct_key NULL NULL NULL 5
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 5 Using join buffer (flat, BNL join)
1 PRIMARY t4 ref a a 10 <subquery2>.max(t2.a),<subquery3>.max(t2.a) 1
1 PRIMARY t4 eq_ref a a 10 <subquery2>.max(t2.a),<subquery3>.max(t2.a) 1
3 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 Using temporary
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 Using temporary

View File

@ -279,7 +279,7 @@ insert into t2 values
explain select t1.* from t1 left join t2 on t2.a=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 10 NULL 2 Using index
1 SIMPLE t2 ref a a 3 test.t1.a 1 Using where
1 SIMPLE t2 eq_ref a a 3 test.t1.a 1 Using where
drop table t1, t2;
#
# check UPDATE/DELETE that look like they could be eliminated

View File

@ -377,6 +377,32 @@ my $opt_stop_keep_alive= $ENV{MTR_STOP_KEEP_ALIVE};
select(STDOUT);
$| = 1; # Automatically flush STDOUT
my $set_titlebar;
BEGIN {
if (IS_WINDOWS) {
my $have_win32_console= 0;
eval {
require Win32::Console;
Win32::Console->import();
$have_win32_console = 1;
};
eval 'sub HAVE_WIN32_CONSOLE { $have_win32_console }';
} else {
sub HAVE_WIN32_CONSOLE { 0 };
}
}
if (-t STDOUT) {
if (IS_WINDOWS and HAVE_WIN32_CONSOLE) {
$set_titlebar = sub {Win32::Console::Title $_[0];};
} elsif (defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) {
$set_titlebar = sub { print "\e];$_[0]\a"; };
}
}
main();
sub main {
@ -882,7 +908,7 @@ sub run_test_server ($$$) {
delete $next->{reserved};
}
xterm_stat(scalar(@$tests));
titlebar_stat(scalar(@$tests)) if $set_titlebar;
if ($next) {
# We don't need this any more
@ -6558,19 +6584,16 @@ sub time_format($) {
our $num_tests;
sub xterm_stat {
if (-t STDOUT and defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) {
my ($left) = @_;
sub titlebar_stat {
my ($left) = @_;
# 2.5 -> best by test
$num_tests = $left + 2.5 unless $num_tests;
# 2.5 -> best by test
$num_tests = $left + 2.5 unless $num_tests;
my $done = $num_tests - $left;
my $spent = time - $^T;
my $done = $num_tests - $left;
my $spent = time - $^T;
syswrite STDOUT, sprintf
"\e];mtr: spent %s on %d tests. %s (%d tests) left\a",
&$set_titlebar(sprintf "mtr: spent %s on %d tests. %s (%d tests) left",
time_format($spent), $done,
time_format($spent/$done * $left), $left;
}
time_format($spent/$done * $left), $left);
}

View File

@ -32,7 +32,6 @@ galera_kill_nochanges : MDEV-18280 Galera test failure on galera_split_brain and
galera_load_data : MDEV-19968 galera.galera_load_data
galera_many_tables_nopk : MDEV-18182 Galera test failure on galera.galera_many_tables_nopk
galera_mdl_race : MDEV-21524 galera.galera_mdl_race
galera_parallel_autoinc_largetrx : MDEV-20916 galera.galera_parallel_autoinc_largetrx
galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails
galera_pc_ignore_sb : MDEV-20888 galera.galera_pc_ignore_sb
galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim

View File

@ -29,11 +29,11 @@ COUNT(DISTINCT f1)
30000
connection node_2;
disconnect node_1a;
SELECT COUNT(*) FROM t1;
COUNT(*)
SELECT COUNT(*) AS EXPECT_30000 FROM t1;
EXPECT_30000
30000
SELECT COUNT(DISTINCT f1) FROM t1;
COUNT(DISTINCT f1)
SELECT COUNT(DISTINCT f1) AS EXPECT_30000 FROM t1;
EXPECT_30000
30000
connection default;
DROP TABLE t1;

View File

@ -3,8 +3,8 @@ connection node_1;
connection node_1;
show status like 'wsrep_cluster_conf_id';
Variable_name Value
wsrep_cluster_conf_id 2
wsrep_cluster_conf_id #
connection node_2;
show status like 'wsrep_cluster_conf_id';
Variable_name Value
wsrep_cluster_conf_id 2
wsrep_cluster_conf_id #

View File

@ -53,10 +53,12 @@ SELECT COUNT(DISTINCT f1) FROM t1;
--connection node_2
--reap
--disconnect node_1a
--let $wait_condition = select count(*)=30000 from t1;
--let $wait_condition = SELECT COUNT(*) = 30000 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) FROM t1;
SELECT COUNT(DISTINCT f1) FROM t1;
SELECT COUNT(*) AS EXPECT_30000 FROM t1;
SELECT COUNT(DISTINCT f1) AS EXPECT_30000 FROM t1;
--disable_query_log
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;

View File

@ -1,7 +1,9 @@
--source include/galera_cluster.inc
--connection node_1
--replace_regex /18446744073709551/ERROR/ /[0-9]/#/
show status like 'wsrep_cluster_conf_id';
--connection node_2
--replace_regex /18446744073709551/ERROR/ /[0-9]/#/
show status like 'wsrep_cluster_conf_id';

View File

@ -80,7 +80,7 @@ a b c
explain select * from t1 where b in (select c from t3);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where
1 PRIMARY t3 ref c c 5 test.t1.b 1 Using index
1 PRIMARY t3 eq_ref c c 5 test.t1.b 1 Using index
# select_type=PRIMARY, type=range,ref
select * from t1 where c in (select c from t3 where c between -2 and -1);
a b c

View File

@ -80,7 +80,7 @@ a b c
explain select * from t1 where b in (select c from t3);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where
1 PRIMARY t3 ref c c 5 test.t1.b 1 Using index
1 PRIMARY t3 eq_ref c c 5 test.t1.b 1 Using index
# select_type=PRIMARY, type=range,ref
select * from t1 where c in (select c from t3 where c between -2 and -1);
a b c
@ -1110,7 +1110,7 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 AS t2 STRAIGHT_JOIN t1 FORCE INDEX(b) WHERE t1.b=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL b NULL NULL NULL 2 Using where
1 SIMPLE t1 ref b b 5 test.t2.b 1
1 SIMPLE t1 eq_ref b b 5 test.t2.b 1
EXPLAIN SELECT b FROM t1 FORCE INDEX(b);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 5 NULL 2 Using index

View File

@ -1,6 +1,6 @@
--- alter_algorithm.result
+++ alter_algorithm.reject
@@ -7,40 +7,40 @@
--- alter_algorithm.result 2020-04-30 21:39:48.923115511 +0530
+++ alter_algorithm.reject 2020-04-30 21:45:04.131642093 +0530
@@ -7,43 +7,43 @@
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
SELECT @@alter_algorithm;
@@alter_algorithm
@ -54,11 +54,16 @@
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT;
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t1;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
@@ -53,22 +53,22 @@
@@ -56,22 +56,22 @@
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
@ -91,7 +96,7 @@
DROP TABLE t2, t1;
affected rows: 0
CREATE TABLE t1(f1 INT NOT NULL,
@@ -81,27 +81,27 @@
@@ -84,28 +84,27 @@
INSERT INTO t1(f1, f2) VALUES(1, 1);
# Add column at the end of the table
ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
@ -119,7 +124,9 @@
+info: Records: 0 Duplicates: 0 Warnings: 0
# Rename table
ALTER TABLE t1 RENAME t3;
affected rows: 0
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
+affected rows: 0
# Drop Virtual Column
ALTER TABLE t3 DROP COLUMN vcol;
-affected rows: 1
@ -129,7 +136,7 @@
# Column length varies
ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
affected rows: 0
@@ -109,12 +109,12 @@
@@ -113,12 +112,12 @@
SET foreign_key_checks = 0;
affected rows: 0
ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);

View File

@ -1,6 +1,6 @@
--- alter_algorithm.result
+++ alter_algorithm.reject
@@ -7,40 +7,32 @@
--- alter_algorithm.result 2020-04-30 21:39:48.923115511 +0530
+++ alter_algorithm.reject 2020-04-30 21:47:08.245465018 +0530
@@ -7,43 +7,35 @@
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
SELECT @@alter_algorithm;
@@alter_algorithm
@ -47,10 +47,15 @@
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
+Got one of the listed errors
ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT;
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t1;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
@@ -53,22 +45,17 @@
@@ -56,22 +48,17 @@
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
@ -78,7 +83,7 @@
DROP TABLE t2, t1;
affected rows: 0
CREATE TABLE t1(f1 INT NOT NULL,
@@ -81,27 +68,27 @@
@@ -84,28 +71,27 @@
INSERT INTO t1(f1, f2) VALUES(1, 1);
# Add column at the end of the table
ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
@ -106,7 +111,9 @@
+info: Records: 0 Duplicates: 0 Warnings: 0
# Rename table
ALTER TABLE t1 RENAME t3;
affected rows: 0
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
+affected rows: 0
# Drop Virtual Column
ALTER TABLE t3 DROP COLUMN vcol;
-affected rows: 1
@ -116,7 +123,7 @@
# Column length varies
ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
affected rows: 0
@@ -109,12 +96,12 @@
@@ -113,12 +99,12 @@
SET foreign_key_checks = 0;
affected rows: 0
ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);

View File

@ -1,6 +1,6 @@
--- alter_algorithm.result
+++ alter_algorithm.reject
@@ -7,40 +7,32 @@
--- alter_algorithm.result 2020-04-30 21:39:48.923115511 +0530
+++ alter_algorithm.reject 2020-04-30 21:52:10.785967739 +0530
@@ -7,43 +7,35 @@
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
SELECT @@alter_algorithm;
@@alter_algorithm
@ -47,10 +47,15 @@
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
+Got one of the listed errors
ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT;
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
+affected rows: 0
+info: Records: 0 Duplicates: 0 Warnings: 0
DROP TABLE t1;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
@@ -53,22 +45,22 @@
@@ -56,22 +48,22 @@
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
@ -83,7 +88,7 @@
DROP TABLE t2, t1;
affected rows: 0
CREATE TABLE t1(f1 INT NOT NULL,
@@ -81,27 +73,27 @@
@@ -84,28 +76,27 @@
INSERT INTO t1(f1, f2) VALUES(1, 1);
# Add column at the end of the table
ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
@ -111,7 +116,9 @@
+info: Records: 0 Duplicates: 0 Warnings: 0
# Rename table
ALTER TABLE t1 RENAME t3;
affected rows: 0
-affected rows: 1
-info: Records: 1 Duplicates: 0 Warnings: 0
+affected rows: 0
# Drop Virtual Column
ALTER TABLE t3 DROP COLUMN vcol;
-affected rows: 1
@ -121,7 +128,7 @@
# Column length varies
ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
affected rows: 0
@@ -109,12 +101,12 @@
@@ -113,12 +104,12 @@
SET foreign_key_checks = 0;
affected rows: 0
ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);

View File

@ -41,6 +41,9 @@ info: Records: 1 Duplicates: 0 Warnings: 0
ALTER TABLE t1 ENGINE=INNODB;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
DROP TABLE t1;
affected rows: 0
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
@ -97,7 +100,8 @@ affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
# Rename table
ALTER TABLE t1 RENAME t3;
affected rows: 0
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
# Drop Virtual Column
ALTER TABLE t3 DROP COLUMN vcol;
affected rows: 1

View File

@ -0,0 +1,81 @@
CREATE TABLE t1 (a INT)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
SET alter_algorithm='INPLACE';
affected rows: 0
PREPARE stmt FROM 'ALTER TABLE t1 ADD KEY idx(a)';
affected rows: 0
info: Statement prepared
PREPARE stmt1 FROM 'ALTER TABLE t1 DROP KEY idx';
affected rows: 0
info: Statement prepared
CREATE OR REPLACE PROCEDURE p1()
BEGIN
ALTER TABLE t1 ADD KEY idx2(a);
END|
affected rows: 0
CREATE OR REPLACE PROCEDURE p2()
BEGIN
ALTER TABLE t1 DROP KEY idx2;
END|
affected rows: 0
SET alter_algorithm='COPY';
affected rows: 0
EXECUTE stmt;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
EXECUTE stmt1;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
call p1();
affected rows: 1
call p2();
affected rows: 1
SET alter_algorithm='NOCOPY';
affected rows: 0
EXECUTE stmt;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
EXECUTE stmt1;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
call p1();
affected rows: 0
call p2();
affected rows: 0
SET alter_algorithm='INSTANT';
affected rows: 0
EXECUTE stmt;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY
call p1();
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY
DROP TABLE t1;
affected rows: 0
DROP PROCEDURE p1;
affected rows: 0
DROP PROCEDURE p2;
affected rows: 0
SET @save_allowed= @@GLOBAL.innodb_instant_alter_column_allowed;
affected rows: 0
SET GLOBAL innodb_instant_alter_column_allowed=never;
affected rows: 0
CREATE TABLE t1(id INT PRIMARY KEY,
col1 INT UNSIGNED NOT NULL UNIQUE)ENGINE=InnoDB;
affected rows: 0
INSERT INTO t1 VALUES(1,1),(2,2),(3,3);
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
SET ALTER_ALGORITHM=INSTANT;
affected rows: 0
ALTER TABLE t1 DROP COLUMN col1;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=NOCOPY;
ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=DEFAULT;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t1 DROP PRIMARY KEY, ALGORITHM=DEFAULT;
affected rows: 3
info: Records: 3 Duplicates: 0 Warnings: 0
DROP TABLE t1;
affected rows: 0
SET GLOBAL innodb_instant_alter_column_allowed=@save_allowed;

View File

@ -276,6 +276,16 @@ ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES tx(x);
ALTER TABLE t1 DROP KEY idx;
ALTER TABLE t1 CHANGE a c INT;
DROP TABLE t1;
CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY idx(f1)) ENGINE=InnoDB;
ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1 (f1);
ALTER TABLE t1 ADD COLUMN f INT;
SET FOREIGN_KEY_CHECKS= OFF;
ALTER TABLE t1 DROP KEY idx;
ALTER TABLE t1 ADD KEY idx (f1);
SET FOREIGN_KEY_CHECKS= ON;
ALTER TABLE t1 DROP f3;
ALTER TABLE t1 CHANGE f f3 INT;
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=1;
# Start of 10.2 tests
#

View File

@ -318,8 +318,8 @@
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
-208
+210
-209
+211
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
SET GLOBAL innodb_instant_alter_column_allowed = @saved_allowance;
#

View File

@ -2848,11 +2848,19 @@ pk b
connection default;
DROP TABLE t1;
disconnect analyze;
#
# MDEV-22465: DROP COLUMN is wrongly claimed to be ALGORITHM=INSTANT
#
CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
ALTER TABLE t1 DROP b, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: DROP INDEX. Try ALGORITHM=NOCOPY
ALTER TABLE t1 DROP b, ALGORITHM=NOCOPY;
DROP TABLE t1;
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
208
209
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
SET GLOBAL innodb_instant_alter_column_allowed = @saved_allowance;
#

View File

@ -171,6 +171,41 @@ DROP FOREIGN KEY fk1,
CHANGE b d INT UNSIGNED,
ADD c INT;
DROP TABLE t2, t1;
#
# MDEV-22446 InnoDB aborts while adding instant column
# for discarded tablespace
#
CREATE TABLE t1(c1 INT NOT NULL, c2 INT NOT NULL DEFAULT 0)ENGINE=InnoDB;
INSERT INTO t1(c1) VALUES(1);
ALTER TABLE t1 ADD COLUMN c3 INT DEFAULT 10;
FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE t1;
CREATE TABLE t1(c1 INT NOT NULL)Engine=InnoDB;
ALTER TABLE t1 DISCARD TABLESPACE;
FLUSH TABLES;
ALTER TABLE t1 ADD COLUMN c2 INT NOT NULL;
Warnings:
Warning 1814 Tablespace has been discarded for table `t1`
ALTER TABLE t1 ADD COLUMN c3 INT DEFAULT 10;
Warnings:
Warning 1814 Tablespace has been discarded for table `t1`
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
Warnings:
Warning 1814 Tablespace has been discarded for table `t1`
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL,
`c2` int(11) NOT NULL,
`c3` int(11) DEFAULT 10
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1 c2 c3
1 0 10
DROP TABLE t1;
# End of 10.3 tests
create table t (
a varchar(9),

View File

@ -12,7 +12,7 @@ FOUND 1 /InnoDB: Tablespace 4294967280 was not found at .*, but there were no mo
# restart: --debug=d,innodb_log_abort_3,ib_log --innodb-log-file-size=4194304
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND 1 /srv_prepare_to_delete_redo_log_file: ib_log: FILE_CHECKPOINT.* written/ in mysqld.1.err
FOUND 1 /ib_log: FILE_CHECKPOINT.* written/ in mysqld.1.err
# restart
# restart
DROP TABLE t1;

View File

@ -55,6 +55,10 @@ ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
--error $error_code
ALTER TABLE t1 ENGINE=INNODB;
# Irrespective of alter_algorithm value, the following command
# should succeed because of explicitly mentioning ALGORTHM=DEFAULT
ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT;
DROP TABLE t1;
--disable_info

View File

@ -0,0 +1,63 @@
--source include/have_innodb.inc
CREATE TABLE t1 (a INT)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
# alter_algorithm variable doesn't affect when ALTER stmt
# during PREPARE PHASE or CREATE PROCEDURE
# Only when execution/call happens, alter uses the alter_algorithm
# variable when user does not mention algorithm explicitly.
--enable_info
SET alter_algorithm='INPLACE';
PREPARE stmt FROM 'ALTER TABLE t1 ADD KEY idx(a)';
PREPARE stmt1 FROM 'ALTER TABLE t1 DROP KEY idx';
DELIMITER |;
CREATE OR REPLACE PROCEDURE p1()
BEGIN
ALTER TABLE t1 ADD KEY idx2(a);
END|
CREATE OR REPLACE PROCEDURE p2()
BEGIN
ALTER TABLE t1 DROP KEY idx2;
END|
DELIMITER ;|
SET alter_algorithm='COPY';
EXECUTE stmt;
EXECUTE stmt1;
call p1();
call p2();
SET alter_algorithm='NOCOPY';
EXECUTE stmt;
EXECUTE stmt1;
call p1();
call p2();
SET alter_algorithm='INSTANT';
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
EXECUTE stmt;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
call p1();
DROP TABLE t1;
DROP PROCEDURE p1;
DROP PROCEDURE p2;
SET @save_allowed= @@GLOBAL.innodb_instant_alter_column_allowed;
SET GLOBAL innodb_instant_alter_column_allowed=never;
CREATE TABLE t1(id INT PRIMARY KEY,
col1 INT UNSIGNED NOT NULL UNIQUE)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1,1),(2,2),(3,3);
SET ALTER_ALGORITHM=INSTANT;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 DROP COLUMN col1;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=NOCOPY;
ALTER TABLE t1 DROP COLUMN col1, ALGORITHM=DEFAULT;
ALTER TABLE t1 DROP PRIMARY KEY, ALGORITHM=DEFAULT;
DROP TABLE t1;
--disable_info
SET GLOBAL innodb_instant_alter_column_allowed=@save_allowed;

View File

@ -266,6 +266,19 @@ ALTER TABLE t1 DROP KEY idx;
ALTER TABLE t1 CHANGE a c INT;
# Cleanup
DROP TABLE t1;
CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY idx(f1)) ENGINE=InnoDB;
ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1 (f1);
ALTER TABLE t1 ADD COLUMN f INT;
SET FOREIGN_KEY_CHECKS= OFF;
ALTER TABLE t1 DROP KEY idx;
ALTER TABLE t1 ADD KEY idx (f1);
SET FOREIGN_KEY_CHECKS= ON;
ALTER TABLE t1 DROP f3;
ALTER TABLE t1 CHANGE f f3 INT;
# Cleanup
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=1;
--echo # Start of 10.2 tests

View File

@ -889,6 +889,17 @@ dec $format;
let $redundant_4k= 0;
}
disconnect analyze;
--echo #
--echo # MDEV-22465: DROP COLUMN is wrongly claimed to be ALGORITHM=INSTANT
--echo #
CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 DROP b, ALGORITHM=INSTANT;
ALTER TABLE t1 DROP b, ALGORITHM=NOCOPY;
DROP TABLE t1;
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';

View File

@ -172,6 +172,42 @@ ALTER TABLE t2
CHANGE b d INT UNSIGNED,
ADD c INT;
DROP TABLE t2, t1;
--echo #
--echo # MDEV-22446 InnoDB aborts while adding instant column
--echo # for discarded tablespace
--echo #
let MYSQLD_DATADIR =`SELECT @@datadir`;
CREATE TABLE t1(c1 INT NOT NULL, c2 INT NOT NULL DEFAULT 0)ENGINE=InnoDB;
INSERT INTO t1(c1) VALUES(1);
ALTER TABLE t1 ADD COLUMN c3 INT DEFAULT 10;
--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/
FLUSH TABLES t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
EOF
UNLOCK TABLES;
DROP TABLE t1;
# Restore of instant table
CREATE TABLE t1(c1 INT NOT NULL)Engine=InnoDB;
ALTER TABLE t1 DISCARD TABLESPACE;
FLUSH TABLES;
ALTER TABLE t1 ADD COLUMN c2 INT NOT NULL;
ALTER TABLE t1 ADD COLUMN c3 INT DEFAULT 10;
# Restore files
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_restore_tablespaces("test", "t1");
EOF
ALTER TABLE t1 IMPORT TABLESPACE;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
--echo # End of 10.3 tests

View File

@ -39,7 +39,7 @@ SELECT * FROM t1;
--source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
--let SEARCH_PATTERN= srv_prepare_to_delete_redo_log_file: ib_log: FILE_CHECKPOINT.* written
--let SEARCH_PATTERN= ib_log: FILE_CHECKPOINT.* written
--source include/search_pattern_in_file.inc
--let $restart_parameters=

View File

@ -15,6 +15,7 @@
# that with the fix local variable linfo is valid along all
# mysql_show_binlog_events function scope.
#
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/master-slave.inc

View File

@ -71,5 +71,22 @@ include/diff_tables.inc [master:t1,slave:t1]
connection master;
SELECT c1 FROM /*!999999 t1 WHEREN;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '/*!999999 t1 WHEREN' at line 1
insert t1 values (/*!50505 1 /* foo */ */ + 2);
insert t1 values (/*!999999 10 /* foo */ */ + 20);
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert t1 values (/*!50505 1 /* foo */ */ + 2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; insert t1 values (/* 999999 10 (* foo *) */ + 20)
master-bin.000001 # Query # # COMMIT
connection slave;
select * from t1;
c1
62
3
20
connection master;
DROP TABLE t1;
include/rpl_end.inc

View File

@ -0,0 +1,19 @@
include/master-slave.inc
[connection master]
connection slave;
set @old_dbug=@@global.debug_dbug;
set global debug_dbug='d,fail_com_register_slave';
stop slave;
reset slave;
include/wait_for_slave_to_stop.inc
start slave;
stop slave;
include/wait_for_slave_to_stop.inc
set global debug_dbug=@old_dbug;
connection master;
kill DUMP_THREAD;
show slave hosts;
Server_id Host Port Master_id
connection slave;
start slave;
include/rpl_end.inc

View File

@ -68,7 +68,17 @@ sync_slave_with_master;
--echo # comments
--connection master
--error 1064
SELECT c1 FROM /*!999999 t1 WHEREN;
SELECT c1 FROM /*!999999 t1 WHEREN; #*/
#
# Bug#28388217 - SERVER CAN FAIL WHILE REPLICATING CONDITIONAL COMMENTS
#
insert t1 values (/*!50505 1 /* foo */ */ + 2);
insert t1 values (/*!999999 10 /* foo */ */ + 20);
source include/show_binlog_events.inc;
sync_slave_with_master;
select * from t1;
connection master;
DROP TABLE t1;
--source include/rpl_end.inc

View File

@ -0,0 +1,34 @@
source include/have_debug.inc;
source include/have_binlog_format_mixed.inc;
source include/master-slave.inc;
connection slave;
set @old_dbug=@@global.debug_dbug;
set global debug_dbug='d,fail_com_register_slave';
stop slave;
reset slave;
source include/wait_for_slave_to_stop.inc;
start slave;
stop slave;
source include/wait_for_slave_to_stop.inc;
set global debug_dbug=@old_dbug;
connection master;
### Dump thread is hanging despite slave has gracefully exited.
let $id=`SELECT id from information_schema.processlist where command='Binlog Dump'`;
if ($id) {
replace_result $id DUMP_THREAD;
eval kill $id;
let $wait_condition= SELECT count(*)=0 from information_schema.processlist where command='Binlog Dump';
source include/wait_condition.inc;
}
show slave hosts;
connection slave;
start slave;
source include/rpl_end.inc;

View File

@ -64,7 +64,7 @@ a b c
explain select * from t1 where b in (select c from t3);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where
1 PRIMARY t3 ref c c 5 test.t1.b 1 Using index
1 PRIMARY t3 eq_ref c c 5 test.t1.b 1 Using index
# select_type=PRIMARY, type=range,ref
select * from t1 where c in (select c from t3 where c between -2 and -1);
a b c

View File

@ -64,7 +64,7 @@ a b c
explain select * from t1 where b in (select c from t3);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where
1 PRIMARY t3 ref c c 5 test.t1.b 1 Using index
1 PRIMARY t3 eq_ref c c 5 test.t1.b 1 Using index
# select_type=PRIMARY, type=range,ref
select * from t1 where c in (select c from t3 where c between -2 and -1);
a b c

View File

@ -70,10 +70,9 @@
*/
int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
pbool max_at_top, int (*compare) (void *, uchar *, uchar *),
my_bool max_at_top, int (*compare) (void *, uchar *, uchar *),
void *first_cmp_arg, uint offset_to_queue_pos,
uint auto_extent)
{
DBUG_ENTER("init_queue");
if ((queue->root= (uchar **) my_malloc(key_memory_QUEUE,
@ -110,7 +109,7 @@ int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
*/
int reinit_queue(QUEUE *queue, uint max_elements, uint offset_to_key,
pbool max_at_top, int (*compare) (void *, uchar *, uchar *),
my_bool max_at_top, int (*compare) (void *, uchar *, uchar *),
void *first_cmp_arg, uint offset_to_queue_pos,
uint auto_extent)
{
@ -183,6 +182,28 @@ void delete_queue(QUEUE *queue)
}
static void insert_at(QUEUE *queue, uchar *element, uint idx)
{
uint next_index, offset_to_key= queue->offset_to_key;
uint offset_to_queue_pos= queue->offset_to_queue_pos;
/* max_at_top swaps the comparison if we want to order by desc */
while ((next_index= idx >> 1) > 0 &&
queue->compare(queue->first_cmp_arg,
element + offset_to_key,
queue->root[next_index] + offset_to_key) *
queue->max_at_top < 0)
{
queue->root[idx]= queue->root[next_index];
if (offset_to_queue_pos)
(*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx;
idx= next_index;
}
queue->root[idx]= element;
if (offset_to_queue_pos)
(*(uint*) (element + offset_to_queue_pos-1))= idx;
}
/*
Insert element in queue
@ -192,28 +213,10 @@ void delete_queue(QUEUE *queue)
element Element to insert
*/
void queue_insert(register QUEUE *queue, uchar *element)
void queue_insert(QUEUE *queue, uchar *element)
{
reg2 uint idx, next;
uint offset_to_queue_pos= queue->offset_to_queue_pos;
DBUG_ASSERT(queue->elements < queue->max_elements);
idx= ++queue->elements;
/* max_at_top swaps the comparison if we want to order by desc */
while (idx > 1 &&
(queue->compare(queue->first_cmp_arg,
element + queue->offset_to_key,
queue->root[(next= idx >> 1)] +
queue->offset_to_key) * queue->max_at_top) < 0)
{
queue->root[idx]= queue->root[next];
if (offset_to_queue_pos)
(*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx;
idx= next;
}
queue->root[idx]= element;
if (offset_to_queue_pos)
(*(uint*) (element+ offset_to_queue_pos-1))= idx;
insert_at(queue, element, ++queue->elements);
}
@ -231,7 +234,7 @@ void queue_insert(register QUEUE *queue, uchar *element)
2 auto_extend is 0; No insertion done
*/
int queue_insert_safe(register QUEUE *queue, uchar *element)
int queue_insert_safe(QUEUE *queue, uchar *element)
{
if (queue->elements == queue->max_elements)
@ -241,7 +244,7 @@ int queue_insert_safe(register QUEUE *queue, uchar *element)
if (resize_queue(queue, queue->max_elements + queue->auto_extent))
return 1;
}
queue_insert(queue, element);
return 0;
}
@ -260,81 +263,55 @@ int queue_insert_safe(register QUEUE *queue, uchar *element)
pointer to removed element
*/
uchar *queue_remove(register QUEUE *queue, uint idx)
uchar *queue_remove(QUEUE *queue, uint idx)
{
uchar *element;
DBUG_ASSERT(idx >= 1 && idx <= queue->elements);
DBUG_ASSERT(idx >= 1);
DBUG_ASSERT(idx <= queue->elements);
element= queue->root[idx];
_downheap(queue, idx, queue->root[queue->elements--]);
queue->root[idx]= queue->root[queue->elements--];
queue_replace(queue, idx);
return element;
}
/*
Add element to fixed position and update heap
Restores the heap property from idx down the heap
SYNOPSIS
_downheap()
queue Queue to use
idx Index of element to change
element Element to store at 'idx'
NOTE
This only works if element is >= all elements <= start_idx
*/
void _downheap(register QUEUE *queue, uint start_idx, uchar *element)
void _downheap(QUEUE *queue, uint idx)
{
uint elements,half_queue,offset_to_key, next_index, offset_to_queue_pos;
register uint idx= start_idx;
my_bool first= TRUE;
offset_to_key=queue->offset_to_key;
offset_to_queue_pos= queue->offset_to_queue_pos;
half_queue= (elements= queue->elements) >> 1;
uchar *element= queue->root[idx];
uint next_index,
elements= queue->elements,
half_queue= elements >> 1,
offset_to_key= queue->offset_to_key,
offset_to_queue_pos= queue->offset_to_queue_pos;
while (idx <= half_queue)
{
next_index=idx+idx;
next_index= idx+idx;
if (next_index < elements &&
(queue->compare(queue->first_cmp_arg,
queue->root[next_index]+offset_to_key,
queue->root[next_index+1]+offset_to_key) *
queue->max_at_top) > 0)
(queue->compare(queue->first_cmp_arg,
queue->root[next_index]+offset_to_key,
queue->root[next_index+1]+offset_to_key) *
queue->max_at_top) > 0)
next_index++;
if (first &&
(((queue->compare(queue->first_cmp_arg,
queue->root[next_index]+offset_to_key,
element+offset_to_key) * queue->max_at_top) >= 0)))
{
queue->root[idx]= element;
if (offset_to_queue_pos)
(*(uint*) (element + offset_to_queue_pos-1))= idx;
return;
}
first= FALSE;
queue->root[idx]= queue->root[next_index];
if (offset_to_queue_pos)
(*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx;
idx=next_index;
}
/*
Insert the element into the right position. This is the same code
as we have in queue_insert()
*/
while ((next_index= (idx >> 1)) > start_idx &&
queue->compare(queue->first_cmp_arg,
element+offset_to_key,
queue->root[next_index]+offset_to_key)*
queue->max_at_top < 0)
{
if ((queue->compare(queue->first_cmp_arg,
queue->root[next_index]+offset_to_key,
element+offset_to_key) * queue->max_at_top) >= 0)
break;
queue->root[idx]= queue->root[next_index];
if (offset_to_queue_pos)
(*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx;
idx= next_index;
}
queue->root[idx]= element;
queue->root[idx]=element;
if (offset_to_queue_pos)
(*(uint*) (element + offset_to_queue_pos-1))= idx;
}
@ -352,7 +329,7 @@ void queue_fix(QUEUE *queue)
{
uint i;
for (i= queue->elements >> 1; i > 0; i--)
_downheap(queue, i, queue_element(queue, i));
_downheap(queue, i);
}
@ -363,13 +340,47 @@ void queue_fix(QUEUE *queue)
queue_replace()
queue Queue to use
idx Index of element to change
element Element to store at 'idx'
NOTE
optimized for the case when the new position is close to the end of the
heap (typical for queue_remove() replacements).
*/
void queue_replace(QUEUE *queue, uint idx)
{
uchar *element= queue->root[idx];
DBUG_ASSERT(idx >= 1 && idx <= queue->elements);
queue_remove(queue, idx);
queue_insert(queue, element);
uint next_index,
elements= queue->elements,
half_queue= elements>>1,
offset_to_key= queue->offset_to_key,
offset_to_queue_pos= queue->offset_to_queue_pos;
my_bool first= TRUE;
while (idx <= half_queue)
{
next_index= idx + idx;
if (next_index < elements &&
queue->compare(queue->first_cmp_arg,
queue->root[next_index]+offset_to_key,
queue->root[next_index+1]+offset_to_key) *
queue->max_at_top > 0)
next_index++;
if (first &&
queue->compare(queue->first_cmp_arg,
queue->root[next_index]+offset_to_key,
element+offset_to_key) * queue->max_at_top >= 0)
{
queue->root[idx]= element;
if (offset_to_queue_pos)
(*(uint*) (element + offset_to_queue_pos-1))= idx;
break;
}
first= FALSE;
queue->root[idx]= queue->root[next_index];
if (offset_to_queue_pos)
(*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx;
idx=next_index;
}
insert_at(queue, element, idx);
}

View File

@ -26,7 +26,11 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#if defined(__FreeBSD__) || defined(SOLARIS) || defined(__sun)
#include <gssapi/gssapi.h>
#else
#include <gssapi.h>
#endif
#include <string.h>
void gssapi_errmsg(OM_uint32 major, OM_uint32 minor, char *buf, size_t size)

View File

@ -2203,6 +2203,7 @@ static void auditing_v8(MYSQL_THD thd, struct mysql_event_general_v8 *ev_v8)
#endif /*x86_64*/
#endif /*DBUG_OFF*/
#endif /* __linux__ */
struct mysql_event_general event;
if (ev_v8->event_class != MYSQL_AUDIT_GENERAL_CLASS)
@ -2263,6 +2264,7 @@ static void auditing_v13(MYSQL_THD thd, unsigned int *ev_v0)
int get_db_mysql57(MYSQL_THD thd, char **name, size_t *len)
{
#ifdef __linux__
int db_off;
int db_len_off;
if (debug_server_started)
@ -2286,7 +2288,6 @@ int get_db_mysql57(MYSQL_THD thd, char **name, size_t *len)
#endif /*x86_64*/
}
#ifdef __linux__
*name= *(char **) (((char *) thd) + db_off);
*len= *((size_t *) (((char*) thd) + db_len_off));
if (*name && (*name)[*len] != 0)

View File

@ -1188,9 +1188,23 @@ unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
{
if (field >= result + fields)
goto err;
/*
If any of the row->data[] below is NULL, it can result in a
crash. Error out early as it indicates a malformed packet.
For data[0], data[1] and data[5], strmake_root will handle
NULL values.
*/
if (!row->data[2] || !row->data[3] || !row->data[4])
{
free_rows(data);
set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
DBUG_RETURN(0);
}
cli_fetch_lengths(&lengths[0], row->data, default_value ? 6 : 5);
field->org_table= field->table= strdup_root(alloc,(char*) row->data[0]);
field->name= strdup_root(alloc,(char*) row->data[1]);
field->org_table= field->table= strmake_root(alloc,(char*) row->data[0], lengths[0]);
field->name= strmake_root(alloc,(char*) row->data[1], lengths[1]);
field->length= (uint) uint3korr(row->data[2]);
field->type= (enum enum_field_types) (uchar) row->data[3][0];
@ -1215,7 +1229,7 @@ unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
field->flags|= NUM_FLAG;
if (default_value && row->data[5])
{
field->def=strdup_root(alloc,(char*) row->data[5]);
field->def= strmake_root(alloc,(char*) row->data[5], lengths[5]);
field->def_length= lengths[5];
}
else

View File

@ -1,4 +1,5 @@
/* Copyright (c) 2006, 2013, Oracle and/or its affiliates.
/* Copyright (c) 2006, 2019, Oracle and/or its affiliates.
Copyright (c) 2009, 2020, MariaDB Corporation
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
@ -509,6 +510,7 @@ Event_scheduler::run(THD *thd)
DBUG_PRINT("info", ("job_data is NULL, the thread was killed"));
}
DBUG_PRINT("info", ("state=%s", scheduler_states_names[state].str));
free_root(thd->mem_root, MYF(0));
}
LOCK_DATA();

View File

@ -4,7 +4,7 @@
write-output "/* This file was generated using gen_win_tzname_data.ps1 */"
$xdoc = new-object System.Xml.XmlDocument
$xdoc.load("https://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml")
$xdoc.load("https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplemental/windowsZones.xml")
$nodes = $xdoc.SelectNodes("//mapZone[@territory='001']") # use default territory (001)
foreach ($node in $nodes) {
write-output ('{L"'+ $node.other + '","'+ $node.type+'"},')

View File

@ -355,9 +355,8 @@ QUICK_RANGE_SELECT *get_quick_select(PARAM *param,uint index,
uint mrr_buf_size, MEM_ROOT *alloc);
static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
bool index_read_must_be_used,
bool update_tbl_stats,
double read_time,
bool ror_scans_required);
bool for_range_access,
double read_time);
static
TRP_INDEX_INTERSECT *get_best_index_intersect(PARAM *param, SEL_TREE *tree,
double read_time);
@ -2889,7 +2888,6 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
It is possible to use a range-based quick select (but it might be
slower than 'all' table scan).
*/
TRP_RANGE *range_trp;
TRP_ROR_INTERSECT *rori_trp;
TRP_INDEX_INTERSECT *intersect_trp;
bool can_build_covering= FALSE;
@ -2902,9 +2900,9 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use,
remove_nonrange_trees(&param, tree);
/* Get best 'range' plan and prepare data for making other plans */
if ((range_trp= get_key_scans_params(&param, tree,
only_single_index_range_scan, TRUE,
best_read_time, FALSE)))
if (auto range_trp= get_key_scans_params(&param, tree,
only_single_index_range_scan,
true, best_read_time))
{
best_trp= range_trp;
best_read_time= best_trp->read_cost;
@ -5097,9 +5095,6 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
n_child_scans)))
DBUG_RETURN(NULL);
const bool only_ror_scans_required= !optimizer_flag(param->thd,
OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION);
Json_writer_object trace_best_disjunct(thd);
Json_writer_array to_merge(thd, "indexes_to_merge");
/*
@ -5115,8 +5110,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge,
"tree in SEL_IMERGE"););
Json_writer_object trace_idx(thd);
if (!(*cur_child= get_key_scans_params(param, *ptree, TRUE, FALSE,
read_time,
only_ror_scans_required)))
read_time)))
{
/*
One of index scans in this index_merge is more expensive than entire
@ -5474,9 +5468,12 @@ TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge,
a random order
2. the functions that estimate the cost of a range scan and an
index merge retrievals are not well calibrated
As the best range access has been already chosen it does not
make sense to evaluate the one obtained from a degenerated
index merge.
*/
trp= get_key_scans_params(param, *imerge->trees, FALSE, TRUE,
read_time, FALSE);
trp= 0;
}
DBUG_RETURN(trp);
@ -7361,9 +7358,9 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
tree make range select for this SEL_TREE
index_read_must_be_used if TRUE, assume 'index only' option will be set
(except for clustered PK indexes)
for_range_access if TRUE the function is called to get the best range
plan for range access, not for index merge access
read_time don't create read plans with cost > read_time.
only_ror_scans_required set to TRUE when we are only interested
in ROR scan
RETURN
Best range read plan
NULL if no plan found or error occurred
@ -7371,9 +7368,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param,
static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
bool index_read_must_be_used,
bool update_tbl_stats,
double read_time,
bool only_ror_scans_required)
bool for_range_access,
double read_time)
{
uint idx, UNINIT_VAR(best_idx);
SEL_ARG *key_to_read= NULL;
@ -7401,7 +7397,8 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
(INDEX_SCAN_INFO **) alloc_root(param->mem_root,
sizeof(INDEX_SCAN_INFO *) * param->keys);
}
tree->index_scans_end= tree->index_scans;
tree->index_scans_end= tree->index_scans;
for (idx= 0; idx < param->keys; idx++)
{
SEL_ARG *key= tree->keys[idx];
@ -7425,10 +7422,15 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
trace_idx.add("index", param->table->key_info[keynr].name);
found_records= check_quick_select(param, idx, read_index_only, key,
update_tbl_stats, &mrr_flags,
for_range_access, &mrr_flags,
&buf_size, &cost, &is_ror_scan);
if (only_ror_scans_required && !is_ror_scan)
if (!for_range_access && !is_ror_scan &&
!optimizer_flag(param->thd,OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION))
{
/* The scan is not a ROR-scan, just skip it */
continue;
}
if (found_records != HA_POS_ERROR && tree->index_scans &&
(index_scan= (INDEX_SCAN_INFO *)alloc_root(param->mem_root,
@ -7457,7 +7459,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
.add("index_only", read_index_only)
.add("rows", found_records)
.add("cost", cost.total_cost());
}
}
if ((found_records != HA_POS_ERROR) && is_ror_scan)
{
tree->n_ror_scans++;

View File

@ -4914,6 +4914,7 @@ connected:
goto err;
goto connected;
}
DBUG_EXECUTE_IF("fail_com_register_slave", goto err;);
}
DBUG_PRINT("info",("Starting reading binary log from master"));

View File

@ -71,6 +71,10 @@ bool Alter_info::set_requested_algorithm(const LEX_CSTRING *str)
return false;
}
void Alter_info::set_requested_algorithm(enum_alter_table_algorithm algo_val)
{
requested_algorithm= algo_val;
}
bool Alter_info::set_requested_lock(const LEX_CSTRING *str)
{
@ -88,13 +92,16 @@ bool Alter_info::set_requested_lock(const LEX_CSTRING *str)
return false;
}
const char* Alter_info::algorithm() const
const char* Alter_info::algorithm_clause(THD *thd) const
{
switch (requested_algorithm) {
switch (algorithm(thd)) {
case ALTER_TABLE_ALGORITHM_INPLACE:
return "ALGORITHM=INPLACE";
case ALTER_TABLE_ALGORITHM_COPY:
return "ALGORITHM=COPY";
case ALTER_TABLE_ALGORITHM_NONE:
DBUG_ASSERT(0);
/* Fall through */
case ALTER_TABLE_ALGORITHM_DEFAULT:
return "ALGORITHM=DEFAULT";
case ALTER_TABLE_ALGORITHM_NOCOPY:
@ -125,9 +132,6 @@ const char* Alter_info::lock() const
bool Alter_info::supports_algorithm(THD *thd, enum_alter_inplace_result result,
const Alter_inplace_info *ha_alter_info)
{
if (requested_algorithm == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT)
requested_algorithm = (Alter_info::enum_alter_table_algorithm) thd->variables.alter_algorithm;
switch (result) {
case HA_ALTER_INPLACE_EXCLUSIVE_LOCK:
case HA_ALTER_INPLACE_SHARED_LOCK:
@ -136,16 +140,16 @@ bool Alter_info::supports_algorithm(THD *thd, enum_alter_inplace_result result,
return false;
case HA_ALTER_INPLACE_COPY_NO_LOCK:
case HA_ALTER_INPLACE_COPY_LOCK:
if (requested_algorithm >= Alter_info::ALTER_TABLE_ALGORITHM_NOCOPY)
if (algorithm(thd) >= Alter_info::ALTER_TABLE_ALGORITHM_NOCOPY)
{
ha_alter_info->report_unsupported_error(algorithm(),
ha_alter_info->report_unsupported_error(algorithm_clause(thd),
"ALGORITHM=INPLACE");
return true;
}
return false;
case HA_ALTER_INPLACE_NOCOPY_NO_LOCK:
case HA_ALTER_INPLACE_NOCOPY_LOCK:
if (requested_algorithm == Alter_info::ALTER_TABLE_ALGORITHM_INSTANT)
if (algorithm(thd) == Alter_info::ALTER_TABLE_ALGORITHM_INSTANT)
{
ha_alter_info->report_unsupported_error("ALGORITHM=INSTANT",
"ALGORITHM=NOCOPY");
@ -153,9 +157,9 @@ bool Alter_info::supports_algorithm(THD *thd, enum_alter_inplace_result result,
}
return false;
case HA_ALTER_INPLACE_NOT_SUPPORTED:
if (requested_algorithm >= Alter_info::ALTER_TABLE_ALGORITHM_INPLACE)
if (algorithm(thd) >= Alter_info::ALTER_TABLE_ALGORITHM_INPLACE)
{
ha_alter_info->report_unsupported_error(algorithm(),
ha_alter_info->report_unsupported_error(algorithm_clause(thd),
"ALGORITHM=COPY");
return true;
}
@ -176,7 +180,7 @@ bool Alter_info::supports_lock(THD *thd, enum_alter_inplace_result result,
case HA_ALTER_INPLACE_EXCLUSIVE_LOCK:
// If SHARED lock and no particular algorithm was requested, use COPY.
if (requested_lock == Alter_info::ALTER_TABLE_LOCK_SHARED &&
requested_algorithm == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT &&
algorithm(thd) == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT &&
thd->variables.alter_algorithm ==
Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT)
return false;
@ -239,6 +243,14 @@ bool Alter_info::vers_prohibited(THD *thd) const
return false;
}
Alter_info::enum_alter_table_algorithm
Alter_info::algorithm(const THD *thd) const
{
if (requested_algorithm == ALTER_TABLE_ALGORITHM_NONE)
return (Alter_info::enum_alter_table_algorithm) thd->variables.alter_algorithm;
return requested_algorithm;
}
Alter_table_ctx::Alter_table_ctx()
: implicit_default_value_error_field(NULL),

View File

@ -58,7 +58,10 @@ public:
ALTER_TABLE_ALGORITHM_NOCOPY,
// Instant should allow any operation that changes metadata only.
ALTER_TABLE_ALGORITHM_INSTANT
ALTER_TABLE_ALGORITHM_INSTANT,
// When there is no specification of algorithm during alter table.
ALTER_TABLE_ALGORITHM_NONE
};
@ -107,8 +110,11 @@ public:
List<const char> partition_names;
// Number of partitions.
uint num_parts;
private:
// Type of ALTER TABLE algorithm.
enum_alter_table_algorithm requested_algorithm;
public:
// Type of ALTER TABLE lock.
enum_alter_table_lock requested_lock;
@ -117,7 +123,7 @@ public:
flags(0), partition_flags(0),
keys_onoff(LEAVE_AS_IS),
num_parts(0),
requested_algorithm(ALTER_TABLE_ALGORITHM_DEFAULT),
requested_algorithm(ALTER_TABLE_ALGORITHM_NONE),
requested_lock(ALTER_TABLE_LOCK_DEFAULT)
{}
@ -134,7 +140,7 @@ public:
keys_onoff= LEAVE_AS_IS;
num_parts= 0;
partition_names.empty();
requested_algorithm= ALTER_TABLE_ALGORITHM_DEFAULT;
requested_algorithm= ALTER_TABLE_ALGORITHM_NONE;
requested_lock= ALTER_TABLE_LOCK_DEFAULT;
}
@ -181,10 +187,16 @@ public:
bool set_requested_lock(const LEX_CSTRING *str);
/**
Set the requested algorithm to the given algorithm value
@param algo_value algorithm to be set
*/
void set_requested_algorithm(enum_alter_table_algorithm algo_value);
/**
Returns the algorithm value in the format "algorithm=value"
*/
const char* algorithm() const;
const char* algorithm_clause(THD *thd) const;
/**
Returns the lock value in the format "lock=value"
@ -220,6 +232,12 @@ public:
bool supports_lock(THD *thd, enum_alter_inplace_result result,
const Alter_inplace_info *ha_alter_info);
/**
Return user requested algorithm. If user does not specify
algorithm then return alter_algorithm variable value.
*/
enum_alter_table_algorithm algorithm(const THD *thd) const;
private:
Alter_info &operator=(const Alter_info &rhs); // not implemented
Alter_info(const Alter_info &rhs); // not implemented

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
/* Copyright (c) 2000, 2019, Oracle and/or its affiliates.
Copyright (c) 2009, 2020, MariaDB Corporation
This program is free software; you can redistribute it and/or modify
@ -1795,17 +1795,27 @@ static inline uint int_token(const char *str,uint length)
*/
bool Lex_input_stream::consume_comment(int remaining_recursions_permitted)
{
// only one level of nested comments are allowed
DBUG_ASSERT(remaining_recursions_permitted == 0 ||
remaining_recursions_permitted == 1);
uchar c;
while (!eof())
{
c= yyGet();
if (remaining_recursions_permitted > 0)
if (remaining_recursions_permitted == 1)
{
if ((c == '/') && (yyPeek() == '*'))
{
yySkip(); // Eat asterisk
consume_comment(remaining_recursions_permitted - 1);
yyUnput('('); // Replace nested "/*..." with "(*..."
yySkip(); // and skip "("
yySkip(); /* Eat asterisk */
if (consume_comment(0))
return true;
yyUnput(')'); // Replace "...*/" with "...*)"
yySkip(); // and skip ")"
continue;
}
}

View File

@ -2103,7 +2103,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
general_log_print(thd, command, "Log: '%s' Pos: %lu", name, pos);
if (nlen < FN_REFLEN)
mysql_binlog_send(thd, thd->strmake(name, nlen), (my_off_t)pos, flags);
thd->unregister_slave();
thd->unregister_slave(); // todo: can be extraneous
/* fake COM_QUIT -- if we get here, the thread needs to terminate */
error = TRUE;
break;

View File

@ -5908,7 +5908,7 @@ the generated partition syntax in a correct manner.
*/
if (alter_info->partition_flags != ALTER_PARTITION_INFO ||
!table->part_info ||
alter_info->requested_algorithm !=
alter_info->algorithm(thd) !=
Alter_info::ALTER_TABLE_ALGORITHM_INPLACE ||
!table->part_info->has_same_partitioning(part_info))
{

View File

@ -10741,6 +10741,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
uchar *key_buff=j->ref.key_buff, *null_ref_key= 0;
uint null_ref_part= NO_REF_PART;
bool keyuse_uses_no_tables= TRUE;
uint not_null_keyparts= 0;
if (ftkey)
{
j->ref.items[0]=((Item_func*)(keyuse->val))->key_item();
@ -10770,6 +10771,8 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
j->ref.items[i]=keyuse->val; // Save for cond removal
j->ref.cond_guards[i]= keyuse->cond_guard;
if (!keyuse->val->maybe_null || keyuse->null_rejecting)
not_null_keyparts++;
/*
Set ref.null_rejecting to true only if we are going to inject a
"keyuse->val IS NOT NULL" predicate.
@ -10829,12 +10832,18 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
ulong key_flags= j->table->actual_key_flags(keyinfo);
if (j->type == JT_CONST)
j->table->const_table= 1;
else if (!((keyparts == keyinfo->user_defined_key_parts &&
((key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME)) ||
(keyparts > keyinfo->user_defined_key_parts && // true only for extended keys
MY_TEST(key_flags & HA_EXT_NOSAME) &&
keyparts == keyinfo->ext_key_parts)) ||
null_ref_key)
else if (!((keyparts == keyinfo->user_defined_key_parts &&
(
(key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME ||
/* Unique key and all keyparts are NULL rejecting */
((key_flags & HA_NOSAME) && keyparts == not_null_keyparts)
)) ||
/* true only for extended keys */
(keyparts > keyinfo->user_defined_key_parts &&
MY_TEST(key_flags & HA_EXT_NOSAME) &&
keyparts == keyinfo->ext_key_parts)
) ||
null_ref_key)
{
/* Must read with repeat */
j->type= null_ref_key ? JT_REF_OR_NULL : JT_REF;

View File

@ -10108,7 +10108,7 @@ do_continue:;
*/
if (!(alter_info->flags & ~(ALTER_RENAME | ALTER_KEYS_ONOFF)) &&
alter_info->partition_flags == 0 &&
alter_info->requested_algorithm !=
alter_info->algorithm(thd) !=
Alter_info::ALTER_TABLE_ALGORITHM_COPY) // No need to touch frm.
{
bool res;
@ -10182,7 +10182,7 @@ do_continue:;
"LOCK=DEFAULT");
DBUG_RETURN(true);
}
else if (alter_info->requested_algorithm !=
else if (alter_info->algorithm(thd) !=
Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT)
{
my_error(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON, MYF(0),
@ -10222,20 +10222,21 @@ do_continue:;
using in-place API.
*/
if ((thd->variables.alter_algorithm == Alter_info::ALTER_TABLE_ALGORITHM_COPY &&
alter_info->requested_algorithm !=
alter_info->algorithm(thd) !=
Alter_info::ALTER_TABLE_ALGORITHM_INPLACE)
|| is_inplace_alter_impossible(table, create_info, alter_info)
|| IF_PARTITIONING((partition_changed &&
!(table->s->db_type()->partition_flags() & HA_USE_AUTO_PARTITION)), 0))
{
if (alter_info->requested_algorithm ==
if (alter_info->algorithm(thd) ==
Alter_info::ALTER_TABLE_ALGORITHM_INPLACE)
{
my_error(ER_ALTER_OPERATION_NOT_SUPPORTED, MYF(0),
"ALGORITHM=INPLACE", "ALGORITHM=COPY");
DBUG_RETURN(true);
}
alter_info->requested_algorithm= Alter_info::ALTER_TABLE_ALGORITHM_COPY;
alter_info->set_requested_algorithm(
Alter_info::ALTER_TABLE_ALGORITHM_COPY);
}
/*
@ -10327,7 +10328,7 @@ do_continue:;
DBUG_RETURN(true);
}
if (alter_info->requested_algorithm != Alter_info::ALTER_TABLE_ALGORITHM_COPY)
if (alter_info->algorithm(thd) != Alter_info::ALTER_TABLE_ALGORITHM_COPY)
{
Alter_inplace_info ha_alter_info(create_info, alter_info,
key_info, key_count,
@ -10425,7 +10426,7 @@ do_continue:;
// If SHARED lock and no particular algorithm was requested, use COPY.
if (inplace_supported == HA_ALTER_INPLACE_EXCLUSIVE_LOCK &&
alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_SHARED &&
alter_info->requested_algorithm ==
alter_info->algorithm(thd) ==
Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT &&
thd->variables.alter_algorithm ==
Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT)
@ -11368,7 +11369,8 @@ bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool table_copy)
alter_info.flags= (ALTER_CHANGE_COLUMN | ALTER_RECREATE);
if (table_copy)
alter_info.requested_algorithm= Alter_info::ALTER_TABLE_ALGORITHM_COPY;
alter_info.set_requested_algorithm(
Alter_info::ALTER_TABLE_ALGORITHM_COPY);
bool res= mysql_alter_table(thd, &null_clex_str, &null_clex_str, &create_info,
table_list, &alter_info, 0,

View File

@ -7842,8 +7842,8 @@ opt_index_lock_algorithm:
alter_algorithm_option:
ALGORITHM_SYM opt_equal DEFAULT
{
Lex->alter_info.requested_algorithm=
Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT;
Lex->alter_info.set_requested_algorithm(
Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT);
}
| ALGORITHM_SYM opt_equal ident
{

View File

@ -23,13 +23,13 @@
{L"Haiti Standard Time","America/Port-au-Prince"},
{L"Cuba Standard Time","America/Havana"},
{L"US Eastern Standard Time","America/Indianapolis"},
{L"Turks And Caicos Standard Time","America/Grand_Turk"},
{L"Paraguay Standard Time","America/Asuncion"},
{L"Atlantic Standard Time","America/Halifax"},
{L"Venezuela Standard Time","America/Caracas"},
{L"Central Brazilian Standard Time","America/Cuiaba"},
{L"SA Western Standard Time","America/La_Paz"},
{L"Pacific SA Standard Time","America/Santiago"},
{L"Turks And Caicos Standard Time","America/Grand_Turk"},
{L"Newfoundland Standard Time","America/St_Johns"},
{L"Tocantins Standard Time","America/Araguaina"},
{L"E. South America Standard Time","America/Sao_Paulo"},
@ -46,11 +46,11 @@
{L"UTC","Etc/GMT"},
{L"GMT Standard Time","Europe/London"},
{L"Greenwich Standard Time","Atlantic/Reykjavik"},
{L"Sao Tome Standard Time","Africa/Sao_Tome"},
{L"Morocco Standard Time","Africa/Casablanca"},
{L"W. Europe Standard Time","Europe/Berlin"},
{L"Central Europe Standard Time","Europe/Budapest"},
{L"Romance Standard Time","Europe/Paris"},
{L"Morocco Standard Time","Africa/Casablanca"},
{L"Sao Tome Standard Time","Africa/Sao_Tome"},
{L"Central European Standard Time","Europe/Warsaw"},
{L"W. Central Africa Standard Time","Africa/Lagos"},
{L"Jordan Standard Time","Asia/Amman"},
@ -81,11 +81,13 @@
{L"Mauritius Standard Time","Indian/Mauritius"},
{L"Saratov Standard Time","Europe/Saratov"},
{L"Georgian Standard Time","Asia/Tbilisi"},
{L"Volgograd Standard Time","Europe/Volgograd"},
{L"Caucasus Standard Time","Asia/Yerevan"},
{L"Afghanistan Standard Time","Asia/Kabul"},
{L"West Asia Standard Time","Asia/Tashkent"},
{L"Ekaterinburg Standard Time","Asia/Yekaterinburg"},
{L"Pakistan Standard Time","Asia/Karachi"},
{L"Qyzylorda Standard Time","Asia/Qyzylorda"},
{L"India Standard Time","Asia/Calcutta"},
{L"Sri Lanka Standard Time","Asia/Colombo"},
{L"Nepal Standard Time","Asia/Katmandu"},

View File

@ -817,12 +817,15 @@ bool TDBXML::Initialize(PGLOBAL g)
if (Void)
return false;
if (Columns && !Bufdone) {
if (Columns) {
// Allocate the buffers that will contain node values
for (colp = (PXMLCOL)Columns; colp; colp = (PXMLCOL)colp->GetNext())
if (!colp->IsSpecial()) // Not a pseudo column
if (colp->AllocBuf(g, Mode == MODE_INSERT))
return true;
if (!colp->IsSpecial()) { // Not a pseudo column
if (!Bufdone && colp->AllocBuf(g, Mode == MODE_INSERT))
return true;
colp->Nx = colp->Sx = -1;
} // endif Special
Bufdone = true;
} // endif Bufdone

View File

@ -157,6 +157,7 @@ class DllExport TDBXML : public TDBASE {
/* Class XMLCOL: XDB table access method column descriptor. */
/***********************************************************************/
class XMLCOL : public COLBLK {
friend class TDBXML;
public:
// Constructors
XMLCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am = "XML");

View File

@ -765,7 +765,7 @@ void btr_page_free(dict_index_t* index, buf_block_t* block, mtr_t* mtr,
@param[in,out] mtr mini-transaction
Sets the child node file address in a node pointer. */
inline void btr_node_ptr_set_child_page_no(buf_block_t *block,
rec_t *rec, const offset_t *offsets,
rec_t *rec, const rec_offs *offsets,
ulint page_no, mtr_t *mtr)
{
ut_ad(rec_offs_validate(rec, NULL, offsets));
@ -791,7 +791,7 @@ btr_node_ptr_get_child(
/*===================*/
const rec_t* node_ptr,/*!< in: node pointer */
dict_index_t* index, /*!< in: index */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
mtr_t* mtr) /*!< in: mtr */
{
ut_ad(rec_offs_validate(node_ptr, index, offsets));
@ -809,10 +809,10 @@ Returns the upper level node pointer to a page. It is assumed that mtr holds
an sx-latch on the tree.
@return rec_get_offsets() of the node pointer record */
static
offset_t*
rec_offs*
btr_page_get_father_node_ptr_func(
/*==============================*/
offset_t* offsets,/*!< in: work area for the return value */
rec_offs* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
btr_cur_t* cursor, /*!< in: cursor pointing to user record,
out: cursor on node pointer record,
@ -916,10 +916,10 @@ Returns the upper level node pointer to a page. It is assumed that mtr holds
an x-latch on the tree.
@return rec_get_offsets() of the node pointer record */
static
offset_t*
rec_offs*
btr_page_get_father_block(
/*======================*/
offset_t* offsets,/*!< in: work area for the return value */
rec_offs* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
dict_index_t* index, /*!< in: b-tree index */
buf_block_t* block, /*!< in: child page in the index */
@ -1853,7 +1853,7 @@ btr_root_raise_and_insert(
on the root page; when the function returns,
the cursor is positioned on the predecessor
of the inserted record */
offset_t** offsets,/*!< out: offsets on inserted record */
rec_offs** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
@ -2190,7 +2190,7 @@ btr_page_get_split_rec(
rec_t* next_rec;
ulint n;
mem_heap_t* heap;
offset_t* offsets;
rec_offs* offsets;
page = btr_cur_get_page(cursor);
@ -2296,7 +2296,7 @@ btr_page_insert_fits(
const rec_t* split_rec,/*!< in: suggestion for first record
on upper half-page, or NULL if
tuple to be inserted should be first */
offset_t** offsets,/*!< in: rec_get_offsets(
rec_offs** offsets,/*!< in: rec_get_offsets(
split_rec, cursor->index); out: garbage */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
@ -2396,8 +2396,8 @@ btr_insert_on_non_leaf_level_func(
dberr_t err;
rec_t* rec;
mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
rtr_info_t rtr_info;
@ -2497,7 +2497,7 @@ btr_attach_half_pages(
if (direction == FSP_DOWN) {
btr_cur_t cursor;
offset_t* offsets;
rec_offs* offsets;
lower_block = new_block;
upper_block = block;
@ -2599,7 +2599,7 @@ btr_page_tuple_smaller(
/*===================*/
btr_cur_t* cursor, /*!< in: b-tree cursor */
const dtuple_t* tuple, /*!< in: tuple to consider */
offset_t** offsets,/*!< in/out: temporary storage */
rec_offs** offsets,/*!< in/out: temporary storage */
ulint n_uniq, /*!< in: number of unique fields
in the index page records */
mem_heap_t** heap) /*!< in/out: heap for offsets */
@ -2639,7 +2639,7 @@ rec_t*
btr_insert_into_right_sibling(
ulint flags,
btr_cur_t* cursor,
offset_t** offsets,
rec_offs** offsets,
mem_heap_t* heap,
const dtuple_t* tuple,
ulint n_ext,
@ -2775,7 +2775,7 @@ btr_page_split_and_insert(
btr_cur_t* cursor, /*!< in: cursor at which to insert; when the
function returns, the cursor is positioned
on the predecessor of the inserted record */
offset_t** offsets,/*!< out: offsets on inserted record */
rec_offs** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
@ -3249,7 +3249,7 @@ btr_lift_page_up(
{
btr_cur_t cursor;
offset_t* offsets = NULL;
rec_offs* offsets = NULL;
mem_heap_t* heap = mem_heap_create(
sizeof(*offsets)
* (REC_OFFS_HEADER_SIZE + 1 + 1
@ -3432,7 +3432,7 @@ btr_compress(
page_t* page;
btr_cur_t father_cursor;
mem_heap_t* heap;
offset_t* offsets;
rec_offs* offsets;
ulint nth_rec = 0; /* remove bogus warning */
bool mbr_changed = false;
#ifdef UNIV_DEBUG
@ -3573,7 +3573,7 @@ retry:
if (is_left) {
btr_cur_t cursor2;
rtr_mbr_t new_mbr;
offset_t* offsets2 = NULL;
rec_offs* offsets2 = NULL;
/* For rtree, we need to update father's mbr. */
if (dict_index_is_spatial(index)) {
@ -3768,7 +3768,7 @@ retry:
/* For rtree, we need to update father's mbr. */
if (dict_index_is_spatial(index)) {
offset_t* offsets2;
rec_offs* offsets2;
ulint rec_info;
offsets2 = rec_get_offsets(
@ -3996,7 +3996,7 @@ btr_discard_only_page_on_level(
mem_heap_t* heap = NULL;
const rec_t* rec = NULL;
offset_t* offsets = NULL;
rec_offs* offsets = NULL;
if (index->table->instant) {
const rec_t* r = page_rec_get_next(page_get_infimum_rec(
block->frame));
@ -4226,7 +4226,7 @@ btr_print_recursive(
ulint width, /*!< in: print this many entries from start
and end */
mem_heap_t** heap, /*!< in/out: heap for rec_get_offsets() */
offset_t** offsets,/*!< in/out: buffer for rec_get_offsets() */
rec_offs** offsets,/*!< in/out: buffer for rec_get_offsets() */
mtr_t* mtr) /*!< in: mtr */
{
const page_t* page = buf_block_get_frame(block);
@ -4290,8 +4290,8 @@ btr_print_index(
mtr_t mtr;
buf_block_t* root;
mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
fputs("--------------------------\n"
@ -4325,7 +4325,7 @@ btr_check_node_ptr(
{
mem_heap_t* heap;
dtuple_t* tuple;
offset_t* offsets;
rec_offs* offsets;
btr_cur_t cursor;
page_t* page = buf_block_get_frame(block);
@ -4405,8 +4405,8 @@ btr_index_rec_validate(
ulint len;
const page_t* page;
mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
page = page_align(rec);
@ -4671,8 +4671,8 @@ btr_validate_level(
bool ret = true;
mtr_t mtr;
mem_heap_t* heap = mem_heap_create(256);
offset_t* offsets = NULL;
offset_t* offsets2= NULL;
rec_offs* offsets = NULL;
rec_offs* offsets2= NULL;
#ifdef UNIV_ZIP_DEBUG
page_zip_des_t* page_zip;
#endif /* UNIV_ZIP_DEBUG */

View File

@ -153,7 +153,7 @@ PageBulk::init()
@param[in,out] rec record
@param[in] offsets record offsets */
template<PageBulk::format fmt>
inline void PageBulk::insertPage(rec_t *rec, offset_t *offsets)
inline void PageBulk::insertPage(rec_t *rec, rec_offs *offsets)
{
ut_ad((m_page_zip != nullptr) == (fmt == COMPRESSED));
ut_ad((fmt != REDUNDANT) == m_is_comp);
@ -171,7 +171,7 @@ inline void PageBulk::insertPage(rec_t *rec, offset_t *offsets)
(fmt == REDUNDANT ? PAGE_OLD_INFIMUM : PAGE_NEW_INFIMUM))
{
const rec_t *old_rec = m_cur_rec;
offset_t *old_offsets= rec_get_offsets(old_rec, m_index, nullptr, is_leaf,
rec_offs *old_offsets= rec_get_offsets(old_rec, m_index, nullptr, is_leaf,
ULINT_UNDEFINED, &m_heap);
ut_ad(cmp_rec_rec(rec, old_rec, offsets, old_offsets, m_index) > 0);
}
@ -321,7 +321,7 @@ rec_done:
/** Insert a record in the page.
@param[in] rec record
@param[in] offsets record offsets */
inline void PageBulk::insert(const rec_t *rec, offset_t *offsets)
inline void PageBulk::insert(const rec_t *rec, rec_offs *offsets)
{
byte rec_hdr[REC_N_OLD_EXTRA_BYTES];
static_assert(REC_N_OLD_EXTRA_BYTES > REC_N_NEW_EXTRA_BYTES, "file format");
@ -572,7 +572,7 @@ rec_t*
PageBulk::getSplitRec()
{
rec_t* rec;
offset_t* offsets;
rec_offs* offsets;
ulint total_used_size;
ulint total_recs_size;
ulint n_recs;
@ -618,7 +618,7 @@ PageBulk::copyIn(
{
rec_t* rec = split_rec;
offset_t* offsets = NULL;
rec_offs* offsets = NULL;
ut_ad(m_rec_no == 0);
ut_ad(page_rec_is_user_rec(rec));
@ -664,7 +664,7 @@ PageBulk::copyOut(
ut_ad(n > 0);
/* Set last record's next in page */
offset_t* offsets = NULL;
rec_offs* offsets = NULL;
rec = page_rec_get_prev(split_rec);
offsets = rec_get_offsets(rec, m_index, offsets,
page_rec_is_leaf(split_rec),
@ -773,7 +773,7 @@ the blob data is logged first, then the record is logged in bulk mode.
dberr_t
PageBulk::storeExt(
const big_rec_t* big_rec,
offset_t* offsets)
rec_offs* offsets)
{
/* Note: not all fileds are initialized in btr_pcur. */
btr_pcur_t btr_pcur;
@ -1028,7 +1028,7 @@ BtrBulk::insert(
ulint rec_size = rec_get_converted_size(m_index, tuple, n_ext);
big_rec_t* big_rec = NULL;
rec_t* rec = NULL;
offset_t* offsets = NULL;
rec_offs* offsets = NULL;
if (page_bulk->needExt(tuple, rec_size)) {
/* The record is so big that we have to store some fields

View File

@ -157,7 +157,7 @@ btr_cur_unmark_extern_fields(
buf_block_t* block, /*!< in/out: index page */
rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
mtr_t* mtr); /*!< in: mtr, or NULL if not logged */
/*******************************************************************//**
Adds path information to the cursor for the current page, for which
@ -181,7 +181,7 @@ btr_rec_free_updated_extern_fields(
X-latched */
rec_t* rec, /*!< in: record */
buf_block_t* block, /*!< in: index page of rec */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
const upd_t* update, /*!< in: update vector */
bool rollback,/*!< in: performing rollback? */
mtr_t* mtr); /*!< in: mini-transaction handle which contains
@ -195,7 +195,7 @@ btr_rec_free_externally_stored_fields(
dict_index_t* index, /*!< in: index of the data, the index
tree MUST be X-latched */
rec_t* rec, /*!< in: record */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
buf_block_t* block, /*!< in: index page of rec */
bool rollback,/*!< in: performing rollback? */
mtr_t* mtr); /*!< in: mini-transaction handle which contains
@ -590,7 +590,7 @@ incompatible:
}
mem_heap_t* heap = NULL;
offset_t* offsets = rec_get_offsets(rec, index, NULL, true,
rec_offs* offsets = rec_get_offsets(rec, index, NULL, true,
ULINT_UNDEFINED, &heap);
if (rec_offs_any_default(offsets)) {
inconsistent:
@ -1286,10 +1286,10 @@ btr_cur_search_to_nth_level_func(
btr_search_t* info;
#endif /* BTR_CUR_ADAPT */
mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
offset_t offsets2_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets2 = offsets2_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
rec_offs offsets2_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets2 = offsets2_;
rec_offs_init(offsets_);
rec_offs_init(offsets2_);
/* Currently, PAGE_CUR_LE is the only search mode used for searches
@ -2545,8 +2545,8 @@ btr_cur_open_at_index_side_func(
ulint n_blocks = 0;
ulint n_releases = 0;
mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
dberr_t err = DB_SUCCESS;
rec_offs_init(offsets_);
@ -2896,8 +2896,8 @@ btr_cur_open_at_rnd_pos_func(
ulint n_blocks = 0;
ulint n_releases = 0;
mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(!index->is_spatial());
@ -3185,7 +3185,7 @@ btr_cur_insert_if_possible(
cursor stays valid */
const dtuple_t* tuple, /*!< in: tuple to insert; the size info need not
have been stored to tuple */
offset_t** offsets,/*!< out: offsets on *rec */
rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
ulint n_ext, /*!< in: number of externally stored columns */
mtr_t* mtr) /*!< in/out: mini-transaction */
@ -3341,7 +3341,7 @@ btr_cur_optimistic_insert(
specified */
btr_cur_t* cursor, /*!< in: cursor on page after which to insert;
cursor stays valid */
offset_t** offsets,/*!< out: offsets on *rec */
rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap */
dtuple_t* entry, /*!< in/out: entry to insert */
rec_t** rec, /*!< out: pointer to inserted record if
@ -3646,7 +3646,7 @@ btr_cur_pessimistic_insert(
insertion will certainly succeed */
btr_cur_t* cursor, /*!< in: cursor after which to insert;
cursor stays valid */
offset_t** offsets,/*!< out: offsets on *rec */
rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
that can be emptied */
dtuple_t* entry, /*!< in/out: entry to insert */
@ -3819,7 +3819,7 @@ btr_cur_upd_lock_and_undo(
/*======================*/
ulint flags, /*!< in: undo logging and locking flags */
btr_cur_t* cursor, /*!< in: cursor on record to update */
const offset_t* offsets,/*!< in: rec_get_offsets() on cursor */
const rec_offs* offsets,/*!< in: rec_get_offsets() on cursor */
const upd_t* update, /*!< in: update vector */
ulint cmpl_info,/*!< in: compiler info on secondary index
updates */
@ -3900,7 +3900,7 @@ static void btr_cur_write_sys(
@param[in] roll_ptr DB_ROLL_PTR value
@param[in,out] mtr mini-transaction */
static void btr_cur_upd_rec_sys(buf_block_t *block, rec_t *rec,
dict_index_t *index, const offset_t *offsets,
dict_index_t *index, const rec_offs *offsets,
const trx_t *trx, roll_ptr_t roll_ptr,
mtr_t *mtr)
{
@ -4001,7 +4001,7 @@ btr_cur_update_alloc_zip_func(
page_cur_t* cursor, /*!< in/out: B-tree page cursor */
dict_index_t* index, /*!< in: the index corresponding to cursor */
#ifdef UNIV_DEBUG
offset_t* offsets,/*!< in/out: offsets of the cursor record */
rec_offs* offsets,/*!< in/out: offsets of the cursor record */
#endif /* UNIV_DEBUG */
ulint length, /*!< in: size needed */
bool create, /*!< in: true=delete-and-insert,
@ -4081,7 +4081,7 @@ counterpart in ibuf_insert_to_index_page().
@param[in,out] block index page
@param[in,out] mtr mini-transaction */
void btr_cur_upd_rec_in_place(rec_t *rec, const dict_index_t *index,
const offset_t *offsets, const upd_t *update,
const rec_offs *offsets, const upd_t *update,
buf_block_t *block, mtr_t *mtr)
{
ut_ad(rec_offs_validate(rec, index, offsets));
@ -4211,7 +4211,7 @@ btr_cur_update_in_place(
btr_cur_t* cursor, /*!< in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
offset_t* offsets,/*!< in/out: offsets on cursor->page_cur.rec */
rec_offs* offsets,/*!< in/out: offsets on cursor->page_cur.rec */
const upd_t* update, /*!< in: update vector */
ulint cmpl_info,/*!< in: compiler info on secondary index
updates */
@ -4499,7 +4499,7 @@ btr_cur_optimistic_update(
btr_cur_t* cursor, /*!< in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
offset_t** offsets,/*!< out: offsets on cursor->page_cur.rec */
rec_offs** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** heap, /*!< in/out: pointer to NULL or memory heap */
const upd_t* update, /*!< in: update vector; this must also
contain trx id and roll ptr fields */
@ -4834,7 +4834,7 @@ btr_cur_pessimistic_update(
btr_cur_t* cursor, /*!< in/out: cursor on the record to update;
cursor may become invalid if *big_rec == NULL
|| !(flags & BTR_KEEP_POS_FLAG) */
offset_t** offsets,/*!< out: offsets on cursor->page_cur.rec */
rec_offs** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** offsets_heap,
/*!< in/out: pointer to memory heap
that can be emptied */
@ -5321,7 +5321,7 @@ btr_cur_del_mark_set_clust_rec(
buf_block_t* block, /*!< in/out: buffer block of the record */
rec_t* rec, /*!< in/out: record */
dict_index_t* index, /*!< in: clustered index of the record */
const offset_t* offsets,/*!< in: rec_get_offsets(rec) */
const rec_offs* offsets,/*!< in: rec_get_offsets(rec) */
que_thr_t* thr, /*!< in: query thread */
const dtuple_t* entry, /*!< in: dtuple for the deleting record, also
contains the virtual cols if there are any */
@ -5449,8 +5449,8 @@ btr_cur_optimistic_delete_func(
buf_block_t* block;
rec_t* rec;
mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
ibool no_compress_needed;
rec_offs_init(offsets_);
@ -5632,7 +5632,7 @@ btr_cur_pessimistic_delete(
bool success;
ibool ret = FALSE;
mem_heap_t* heap;
offset_t* offsets;
rec_offs* offsets;
#ifdef UNIV_DEBUG
bool parent_latched = false;
#endif /* UNIV_DEBUG */
@ -5784,7 +5784,7 @@ discard_page:
rtr_mbr_t father_mbr;
rec_t* father_rec;
btr_cur_t father_cursor;
offset_t* offsets;
rec_offs* offsets;
bool upd_ret;
ulint len;
@ -6527,7 +6527,7 @@ btr_record_not_null_field_in_rec(
ulint n_unique, /*!< in: dict_index_get_n_unique(index),
number of columns uniquely determine
an index entry */
const offset_t* offsets, /*!< in: rec_get_offsets(rec, index),
const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index),
its size could be for all fields or
that of "n_unique" */
ib_uint64_t* n_not_null) /*!< in/out: array to record number of
@ -6581,8 +6581,8 @@ btr_estimate_number_of_different_key_vals(
uintmax_t add_on;
mtr_t mtr;
mem_heap_t* heap = NULL;
offset_t* offsets_rec = NULL;
offset_t* offsets_next_rec = NULL;
rec_offs* offsets_rec = NULL;
rec_offs* offsets_next_rec = NULL;
/* For spatial index, there is no such stats can be
fetched. */
@ -6771,7 +6771,7 @@ btr_estimate_number_of_different_key_vals(
and assign the old offsets_rec buffer to
offsets_next_rec. */
{
offset_t* offsets_tmp = offsets_rec;
rec_offs* offsets_tmp = offsets_rec;
offsets_rec = offsets_next_rec;
offsets_next_rec = offsets_tmp;
}
@ -6856,7 +6856,7 @@ static
ulint
btr_rec_get_field_ref_offs(
/*=======================*/
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint n) /*!< in: index of the external field */
{
ulint field_ref_offs;
@ -6885,7 +6885,7 @@ btr_rec_get_field_ref_offs(
ulint
btr_rec_get_externally_stored_len(
const rec_t* rec,
const offset_t* offsets)
const rec_offs* offsets)
{
ulint n_fields;
ulint total_extern_len = 0;
@ -6923,7 +6923,7 @@ btr_cur_set_ownership_of_extern_field(
buf_block_t* block, /*!< in/out: index page */
rec_t* rec, /*!< in/out: clustered index record */
dict_index_t* index, /*!< in: index of the page */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
ulint i, /*!< in: field number */
bool val, /*!< in: value to set */
mtr_t* mtr) /*!< in: mtr, or NULL if not logged */
@ -6969,7 +6969,7 @@ btr_cur_disown_inherited_fields(
buf_block_t* block, /*!< in/out: index page */
rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
const upd_t* update, /*!< in: update vector */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
@ -6997,7 +6997,7 @@ btr_cur_unmark_extern_fields(
buf_block_t* block, /*!< in/out: index page */
rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
mtr_t* mtr) /*!< in: mtr, or NULL if not logged */
{
ut_ad(!rec_offs_comp(offsets) || !rec_get_node_ptr_flag(rec));
@ -7067,7 +7067,7 @@ struct btr_blob_log_check_t {
/** Mini transaction holding the latches for m_pcur */
mtr_t* m_mtr;
/** rec_get_offsets(rec, index); offset of clust_rec */
const offset_t* m_offsets;
const rec_offs* m_offsets;
/** The block containing clustered record */
buf_block_t** m_block;
/** The clustered record pointer */
@ -7087,7 +7087,7 @@ struct btr_blob_log_check_t {
btr_blob_log_check_t(
btr_pcur_t* pcur,
mtr_t* mtr,
const offset_t* offsets,
const rec_offs* offsets,
buf_block_t** block,
rec_t** rec,
enum blob_op op)
@ -7152,7 +7152,7 @@ struct btr_blob_log_check_t {
*m_rec = btr_pcur_get_rec(m_pcur);
rec_offs_make_valid(*m_rec, index, true,
const_cast<offset_t*>(m_offsets));
const_cast<rec_offs*>(m_offsets));
ut_ad(m_mtr->memo_contains_page_flagged(
*m_rec,
@ -7183,7 +7183,7 @@ btr_store_big_rec_extern_fields(
btr_pcur_t* pcur, /*!< in/out: a persistent cursor. if
btr_mtr is restarted, then this can
be repositioned. */
offset_t* offsets, /*!< in/out: rec_get_offsets() on
rec_offs* offsets, /*!< in/out: rec_get_offsets() on
pcur. the "external storage" flags
in offsets will correctly correspond
to rec when this function returns */
@ -7615,7 +7615,7 @@ btr_free_externally_stored_field(
byte* field_ref, /*!< in/out: field reference */
const rec_t* rec, /*!< in: record containing field_ref, for
page_zip_write_blob_ptr(), or NULL */
const offset_t* offsets, /*!< in: rec_get_offsets(rec, index),
const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index),
or NULL */
buf_block_t* block, /*!< in/out: page of field_ref */
ulint i, /*!< in: field number of field_ref;
@ -7782,7 +7782,7 @@ btr_rec_free_externally_stored_fields(
dict_index_t* index, /*!< in: index of the data, the index
tree MUST be X-latched */
rec_t* rec, /*!< in/out: record */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
buf_block_t* block, /*!< in: index page of rec */
bool rollback,/*!< in: performing rollback? */
mtr_t* mtr) /*!< in: mini-transaction handle which contains
@ -7821,7 +7821,7 @@ btr_rec_free_updated_extern_fields(
X-latched */
rec_t* rec, /*!< in/out: record */
buf_block_t* block, /*!< in: index page of rec */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
const upd_t* update, /*!< in: update vector */
bool rollback,/*!< in: performing rollback? */
mtr_t* mtr) /*!< in: mini-transaction handle which contains
@ -8218,7 +8218,7 @@ protected by a lock or a page latch
byte*
btr_rec_copy_externally_stored_field(
const rec_t* rec,
const offset_t* offsets,
const rec_offs* offsets,
ulint zip_size,
ulint no,
ulint* len,

View File

@ -367,8 +367,8 @@ btr_defragment_calc_n_recs_for_size(
{
page_t* page = buf_block_get_frame(block);
ulint n_recs = 0;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
mem_heap_t* heap = NULL;
ulint size = 0;

View File

@ -326,10 +326,10 @@ btr_pcur_restore_position_func(
if (cursor->rel_pos == BTR_PCUR_ON) {
#ifdef UNIV_DEBUG
const rec_t* rec;
offset_t offsets1_[REC_OFFS_NORMAL_SIZE];
offset_t offsets2_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets1 = offsets1_;
offset_t* offsets2 = offsets2_;
rec_offs offsets1_[REC_OFFS_NORMAL_SIZE];
rec_offs offsets2_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets1 = offsets1_;
rec_offs* offsets2 = offsets2_;
rec = btr_pcur_get_rec(cursor);
rec_offs_init(offsets1_);
@ -399,7 +399,7 @@ btr_pcur_restore_position_func(
ut_ad(cursor->rel_pos == BTR_PCUR_ON
|| cursor->rel_pos == BTR_PCUR_BEFORE
|| cursor->rel_pos == BTR_PCUR_AFTER);
offset_t offsets[REC_OFFS_NORMAL_SIZE];
rec_offs offsets[REC_OFFS_NORMAL_SIZE];
rec_offs_init(offsets);
if (cursor->rel_pos == BTR_PCUR_ON
&& btr_pcur_is_on_user_rec(cursor)

View File

@ -97,7 +97,7 @@ static inline
ulint
rec_fold(
const rec_t* rec,
const offset_t* offsets,
const rec_offs* offsets,
ulint n_fields,
ulint n_bytes,
index_id_t tree_id)
@ -665,7 +665,7 @@ btr_search_update_hash_ref(
&& (block->curr_n_bytes == info->n_bytes)
&& (block->curr_left_side == info->left_side)) {
mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs_init(offsets_);
rec = btr_cur_get_rec(cursor);
@ -718,8 +718,8 @@ btr_search_check_guess(
ulint match;
int cmp;
mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
ibool success = FALSE;
rec_offs_init(offsets_);
@ -1177,7 +1177,7 @@ void btr_search_drop_page_hash_index(buf_block_t* block)
ulint i;
mem_heap_t* heap;
const dict_index_t* index;
offset_t* offsets;
rec_offs* offsets;
rw_lock_t* latch;
btr_search_t* info;
@ -1432,8 +1432,8 @@ btr_search_build_page_hash_index(
const rec_t** recs;
ulint i;
mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
#ifdef MYSQL_INDEX_DISABLE_AHI
if (index->disable_ahi) return;
@ -1737,7 +1737,7 @@ void btr_search_update_hash_on_delete(btr_cur_t* cursor)
const rec_t* rec;
ulint fold;
dict_index_t* index;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
mem_heap_t* heap = NULL;
rec_offs_init(offsets_);
@ -1892,8 +1892,8 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor, rw_lock_t* ahi_latch)
ibool left_side;
bool locked = false;
mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(ahi_latch == btr_get_search_latch(cursor->index));
@ -2050,8 +2050,8 @@ btr_search_hash_table_validate(ulint hash_table_id)
ulint i;
ulint cell_count;
mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
if (!btr_search_enabled) {
return(TRUE);

View File

@ -1027,11 +1027,12 @@ buf_madvise_do_dump()
/* mirrors allocation in log_t::create() */
if (log_sys.buf) {
ret+= madvise(log_sys.first_in_use
? log_sys.buf
: log_sys.buf - srv_log_buffer_size,
srv_log_buffer_size * 2,
MADV_DODUMP);
ret += madvise(log_sys.buf,
srv_log_buffer_size,
MADV_DODUMP);
ret += madvise(log_sys.flush_buf,
srv_log_buffer_size,
MADV_DODUMP);
}
/* mirrors recv_sys_t::create() */
if (recv_sys.buf)

View File

@ -606,17 +606,15 @@ dict_mem_table_col_rename_low(
}
}
dict_index_t* new_index = dict_foreign_find_index(
/* New index can be null if InnoDB already dropped
the foreign index when FOREIGN_KEY_CHECKS is
disabled */
foreign->foreign_index = dict_foreign_find_index(
foreign->foreign_table, NULL,
foreign->foreign_col_names,
foreign->n_fields, NULL, true, false,
NULL, NULL, NULL);
/* New index can be null if InnoDB already dropped
the foreign index when FOREIGN_KEY_CHECKS is
disabled */
foreign->foreign_index = new_index;
} else {
for (unsigned f = 0; f < foreign->n_fields; f++) {
@ -638,7 +636,41 @@ dict_mem_table_col_rename_low(
foreign = *it;
ut_ad(foreign->referenced_index != NULL);
if (!foreign->referenced_index) {
/* Referenced index could have been dropped
when foreign_key_checks is disabled. In that case,
rename the corresponding referenced_col_names and
find the equivalent referenced index also */
for (unsigned f = 0; f < foreign->n_fields; f++) {
const char*& rc =
foreign->referenced_col_names[f];
if (strcmp(rc, from)) {
continue;
}
if (to_len <= strlen(rc)) {
memcpy(const_cast<char*>(rc), to,
to_len + 1);
} else {
rc = static_cast<char*>(
mem_heap_dup(
foreign->heap,
to, to_len + 1));
}
}
/* New index can be null if InnoDB already dropped
the referenced index when FOREIGN_KEY_CHECKS is
disabled */
foreign->referenced_index = dict_foreign_find_index(
foreign->referenced_table, NULL,
foreign->referenced_col_names,
foreign->n_fields, NULL, true, false,
NULL, NULL, NULL);
return;
}
for (unsigned f = 0; f < foreign->n_fields; f++) {
/* foreign->referenced_col_names[] need to be
@ -1288,7 +1320,7 @@ bool dict_table_t::deserialise_columns(const byte* metadata, ulint len)
bool
dict_index_t::vers_history_row(
const rec_t* rec,
const offset_t* offsets)
const rec_offs* offsets)
{
ut_ad(is_primary());
@ -1319,8 +1351,8 @@ dict_index_t::vers_history_row(
bool error = false;
mem_heap_t* heap = NULL;
dict_index_t* clust_index = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
mtr_t mtr;

View File

@ -1010,8 +1010,8 @@ dict_stats_analyze_index_level(
bool prev_rec_is_copied;
byte* prev_rec_buf = NULL;
ulint prev_rec_buf_size = 0;
offset_t* rec_offsets;
offset_t* prev_rec_offsets;
rec_offs* rec_offsets;
rec_offs* prev_rec_offsets;
ulint i;
DEBUG_PRINTF(" %s(table=%s, index=%s, level=" ULINTPF ")\n",
@ -1032,9 +1032,9 @@ dict_stats_analyze_index_level(
i = (REC_OFFS_HEADER_SIZE + 1 + 1) + n_uniq;
heap = mem_heap_create((2 * sizeof *rec_offsets) * i);
rec_offsets = static_cast<offset_t*>(
rec_offsets = static_cast<rec_offs*>(
mem_heap_alloc(heap, i * sizeof *rec_offsets));
prev_rec_offsets = static_cast<offset_t*>(
prev_rec_offsets = static_cast<rec_offs*>(
mem_heap_alloc(heap, i * sizeof *prev_rec_offsets));
rec_offs_set_n_alloc(rec_offsets, i);
rec_offs_set_n_alloc(prev_rec_offsets, i);
@ -1323,11 +1323,11 @@ to the number of externally stored pages which were encountered
@return offsets1 or offsets2 (the offsets of *out_rec),
or NULL if the page is empty and does not contain user records. */
UNIV_INLINE
offset_t*
rec_offs*
dict_stats_scan_page(
const rec_t** out_rec,
offset_t* offsets1,
offset_t* offsets2,
rec_offs* offsets1,
rec_offs* offsets2,
const dict_index_t* index,
const page_t* page,
ulint n_prefix,
@ -1335,8 +1335,8 @@ dict_stats_scan_page(
ib_uint64_t* n_diff,
ib_uint64_t* n_external_pages)
{
offset_t* offsets_rec = offsets1;
offset_t* offsets_next_rec = offsets2;
rec_offs* offsets_rec = offsets1;
rec_offs* offsets_next_rec = offsets2;
const rec_t* rec;
const rec_t* next_rec;
/* A dummy heap, to be passed to rec_get_offsets().
@ -1449,9 +1449,9 @@ dict_stats_analyze_index_below_cur(
const page_t* page;
mem_heap_t* heap;
const rec_t* rec;
offset_t* offsets1;
offset_t* offsets2;
offset_t* offsets_rec;
rec_offs* offsets1;
rec_offs* offsets2;
rec_offs* offsets_rec;
ulint size;
mtr_t mtr;
@ -1469,10 +1469,10 @@ dict_stats_analyze_index_below_cur(
heap = mem_heap_create(size * (sizeof *offsets1 + sizeof *offsets2));
offsets1 = static_cast<offset_t*>(mem_heap_alloc(
offsets1 = static_cast<rec_offs*>(mem_heap_alloc(
heap, size * sizeof *offsets1));
offsets2 = static_cast<offset_t*>(mem_heap_alloc(
offsets2 = static_cast<rec_offs*>(mem_heap_alloc(
heap, size * sizeof *offsets2));
rec_offs_set_n_alloc(offsets1, size);

View File

@ -3177,7 +3177,7 @@ fts_fetch_doc_from_rec(
dict_index_t* clust_index, /*!< in: cluster index */
btr_pcur_t* pcur, /*!< in: cursor whose position
has been stored */
offset_t* offsets, /*!< in: offsets */
rec_offs* offsets, /*!< in: offsets */
fts_doc_t* doc) /*!< out: fts doc to hold parsed
documents */
{
@ -3451,7 +3451,7 @@ fts_add_doc_by_id(
btr_pcur_t* doc_pcur;
const rec_t* clust_rec;
btr_pcur_t clust_pcur;
offset_t* offsets = NULL;
rec_offs* offsets = NULL;
ulint num_idx = ib_vector_size(cache->get_docs);
rec = btr_pcur_get_rec(&pcur);
@ -5120,7 +5120,7 @@ doc_id_t
fts_get_doc_id_from_rec(
const rec_t* rec,
const dict_index_t* index,
const offset_t* offsets)
const rec_offs* offsets)
{
ulint f = dict_col_get_index_pos(
&index->table->cols[index->table->fts->doc_col], index);

View File

@ -51,7 +51,7 @@ rtr_page_split_initialize_nodes(
btr_cur_t* cursor, /*!< in: cursor at which to insert; when the
function returns, the cursor is positioned
on the predecessor of the inserted record */
offset_t** offsets,/*!< in: offsets on inserted record */
rec_offs** offsets,/*!< in: offsets on inserted record */
const dtuple_t* tuple, /*!< in: tuple to insert */
double** buf_pos)/*!< in/out: current buffer position */
{
@ -190,7 +190,7 @@ bool
rtr_update_mbr_field(
/*=================*/
btr_cur_t* cursor, /*!< in/out: cursor pointed to rec.*/
offset_t* offsets, /*!< in/out: offsets on rec. */
rec_offs* offsets, /*!< in/out: offsets on rec. */
btr_cur_t* cursor2, /*!< in/out: cursor pointed to rec
that should be deleted.
this cursor is for btr_compress to
@ -218,7 +218,7 @@ rtr_update_mbr_field(
bool ins_suc = true;
ulint cur2_pos = 0;
ulint del_page_no = 0;
offset_t* offsets2;
rec_offs* offsets2;
rec = btr_cur_get_rec(cursor);
page = page_align(rec);
@ -306,7 +306,7 @@ rtr_update_mbr_field(
}
if (cursor2) {
offset_t* offsets2;
rec_offs* offsets2;
if (UNIV_LIKELY_NULL(page_zip)) {
cursor2->page_cur.rec
@ -328,7 +328,7 @@ rtr_update_mbr_field(
page_cur_t page_cur;
rec_t* insert_rec;
offset_t* insert_offsets = NULL;
rec_offs* insert_offsets = NULL;
ulint old_pos;
rec_t* old_rec;
@ -360,7 +360,7 @@ update_mbr:
/* When there're not only 1 rec in the page, we do delete/insert
to avoid page split. */
rec_t* insert_rec;
offset_t* insert_offsets = NULL;
rec_offs* insert_offsets = NULL;
rec_t* next_rec;
/* Delete the rec which cursor point to. */
@ -556,7 +556,7 @@ rtr_adjust_upper_level(
ulint new_page_no;
dict_index_t* index = sea_cur->index;
btr_cur_t cursor;
offset_t* offsets;
rec_offs* offsets;
mem_heap_t* heap;
ulint level;
dtuple_t* node_ptr_upper;
@ -713,8 +713,8 @@ rtr_split_page_move_rec_list(
page_cur_t new_page_cursor;
page_t* page;
page_t* new_page;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
page_zip_des_t* new_page_zip
= buf_block_get_page_zip(new_block);
rec_t* rec;
@ -872,7 +872,7 @@ rtr_page_split_and_insert(
btr_cur_t* cursor, /*!< in/out: cursor at which to insert; when the
function returns, the cursor is positioned
on the predecessor of the inserted record */
offset_t** offsets,/*!< out: offsets on inserted record */
rec_offs** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
@ -1229,7 +1229,7 @@ rtr_ins_enlarge_mbr(
mem_heap_t* heap;
dict_index_t* index = btr_cur->index;
page_cur_t* page_cursor;
offset_t* offsets;
rec_offs* offsets;
node_visit_t* node_visit;
btr_cur_t cursor;
page_t* page;
@ -1313,10 +1313,10 @@ rtr_page_copy_rec_list_end_no_locks(
page_cur_t page_cur;
page_cur_t cur1;
rec_t* cur_rec;
offset_t offsets_1[REC_OFFS_NORMAL_SIZE];
offset_t* offsets1 = offsets_1;
offset_t offsets_2[REC_OFFS_NORMAL_SIZE];
offset_t* offsets2 = offsets_2;
rec_offs offsets_1[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets1 = offsets_1;
rec_offs offsets_2[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets2 = offsets_2;
ulint moved = 0;
bool is_leaf = page_is_leaf(new_page);
@ -1439,10 +1439,10 @@ rtr_page_copy_rec_list_start_no_locks(
{
page_cur_t cur1;
rec_t* cur_rec;
offset_t offsets_1[REC_OFFS_NORMAL_SIZE];
offset_t* offsets1 = offsets_1;
offset_t offsets_2[REC_OFFS_NORMAL_SIZE];
offset_t* offsets2 = offsets_2;
rec_offs offsets_1[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets1 = offsets_1;
rec_offs offsets_2[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets2 = offsets_2;
page_cur_t page_cur;
ulint moved = 0;
bool is_leaf = page_is_leaf(buf_block_get_frame(block));
@ -1546,8 +1546,8 @@ rtr_merge_mbr_changed(
/*==================*/
btr_cur_t* cursor, /*!< in/out: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */
offset_t* offsets, /*!< in: rec offsets */
offset_t* offsets2, /*!< in: rec offsets */
rec_offs* offsets, /*!< in: rec offsets */
rec_offs* offsets2, /*!< in: rec offsets */
rtr_mbr_t* new_mbr) /*!< out: MBR to update */
{
double* mbr;
@ -1590,8 +1590,8 @@ rtr_merge_and_update_mbr(
/*=====================*/
btr_cur_t* cursor, /*!< in/out: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */
offset_t* offsets, /*!< in: rec offsets */
offset_t* offsets2, /*!< in: rec offsets */
rec_offs* offsets, /*!< in: rec offsets */
rec_offs* offsets2, /*!< in: rec offsets */
page_t* child_page, /*!< in: the page. */
mtr_t* mtr) /*!< in: mtr */
{
@ -1654,7 +1654,7 @@ rtr_check_same_block(
{
ulint page_no = childb->page.id.page_no();
offset_t* offsets;
rec_offs* offsets;
rec_t* rec = page_rec_get_next(page_get_infimum_rec(
buf_block_get_frame(parentb)));

View File

@ -524,7 +524,7 @@ rtr_compare_cursor_rec(
mem_heap_t** heap) /*!< in: memory heap */
{
const rec_t* rec;
offset_t* offsets;
rec_offs* offsets;
rec = btr_cur_get_rec(cursor);
@ -666,7 +666,7 @@ rtr_page_get_father(
{
mem_heap_t* heap = mem_heap_create(100);
#ifdef UNIV_DEBUG
offset_t* offsets;
rec_offs* offsets;
offsets = rtr_page_get_father_block(
NULL, heap, index, block, mtr, sea_cur, cursor);
@ -802,9 +802,9 @@ func_exit:
that mtr holds an SX-latch or X-latch on the tree.
@return rec_get_offsets() of the node pointer record */
static
offset_t*
rec_offs*
rtr_page_get_father_node_ptr(
offset_t* offsets,/*!< in: work area for the return value */
rec_offs* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
btr_cur_t* sea_cur,/*!< in: search cursor */
btr_cur_t* cursor, /*!< in: cursor pointing to user record,
@ -897,10 +897,10 @@ rtr_page_get_father_node_ptr(
Returns the father block to a page. It is assumed that mtr holds
an X or SX latch on the tree.
@return rec_get_offsets() of the node pointer record */
offset_t*
rec_offs*
rtr_page_get_father_block(
/*======================*/
offset_t* offsets,/*!< in: work area for the return value */
rec_offs* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
dict_index_t* index, /*!< in: b-tree index */
buf_block_t* block, /*!< in: child page in the index */
@ -1284,8 +1284,8 @@ rtr_cur_restore_position(
#ifdef UNIV_DEBUG
do {
const rec_t* rec;
const offset_t* offsets1;
const offset_t* offsets2;
const rec_offs* offsets1;
const rec_offs* offsets2;
ulint comp;
rec = btr_pcur_get_rec(r_cursor);
@ -1356,8 +1356,8 @@ search_again:
if (low_match == r_cursor->old_n_fields) {
const rec_t* rec;
const offset_t* offsets1;
const offset_t* offsets2;
const rec_offs* offsets1;
const rec_offs* offsets2;
ulint comp;
rec = btr_pcur_get_rec(r_cursor);
@ -1403,7 +1403,7 @@ rtr_leaf_push_match_rec(
/*====================*/
const rec_t* rec, /*!< in: record to copy */
rtr_info_t* rtr_info, /*!< in/out: search stack */
offset_t* offsets, /*!< in: offsets */
rec_offs* offsets, /*!< in: offsets */
bool is_comp) /*!< in: is compact format */
{
byte* buf;
@ -1588,7 +1588,7 @@ void
rtr_get_mbr_from_rec(
/*=================*/
const rec_t* rec, /*!< in: data tuple */
const offset_t* offsets,/*!< in: offsets array */
const rec_offs* offsets,/*!< in: offsets array */
rtr_mbr_t* mbr) /*!< out MBR */
{
ulint rec_f_len;
@ -1689,8 +1689,8 @@ rtr_cur_search_with_match(
const page_t* page;
const rec_t* rec;
const rec_t* last_rec;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
mem_heap_t* heap = NULL;
int cmp = 1;
double least_inc = DBL_MAX;
@ -1970,8 +1970,8 @@ rtr_cur_search_with_match(
test_rec = match_rec->matched_recs->back();
#ifdef UNIV_DEBUG
offset_t offsets_2[REC_OFFS_NORMAL_SIZE];
offset_t* offsets2 = offsets_2;
rec_offs offsets_2[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets2 = offsets_2;
rec_offs_init(offsets_2);
ut_ad(found);

View File

@ -2435,7 +2435,8 @@ next_column:
}
}
if (supports_instant) {
if (supports_instant && !(ha_alter_info->handler_flags
& INNOBASE_ALTER_NOREBUILD)) {
DBUG_RETURN(HA_ALTER_INPLACE_INSTANT);
}
@ -2545,7 +2546,7 @@ cannot_create_many_fulltext_index:
online = false;
}
if (need_rebuild || fts_need_rebuild) {
if ((need_rebuild && !supports_instant) || fts_need_rebuild) {
ha_alter_info->handler_flags |= ALTER_RECREATE_TABLE;
DBUG_RETURN(online
? HA_ALTER_INPLACE_COPY_NO_LOCK
@ -3215,7 +3216,7 @@ innobase_rec_to_mysql(
struct TABLE* table, /*!< in/out: MySQL table */
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: index */
const offset_t* offsets)/*!< in: rec_get_offsets(
const rec_offs* offsets)/*!< in: rec_get_offsets(
rec, index, ...) */
{
uint n_fields = table->s->fields;
@ -5766,6 +5767,14 @@ add_all_virtual:
return true;
}
if (!user_table->space) {
/* In case of ALTER TABLE...DISCARD TABLESPACE,
update only the metadata and transform the dictionary
cache entry to the canonical format. */
index->clear_instant_alter();
return false;
}
unsigned i = unsigned(user_table->n_cols) - DATA_N_SYS_COLS;
DBUG_ASSERT(i >= altered_table->s->stored_fields);
DBUG_ASSERT(i <= altered_table->s->stored_fields + 1);
@ -5867,7 +5876,7 @@ add_all_virtual:
ut_ad(j == n + f);
offset_t* offsets = NULL;
rec_offs* offsets = NULL;
mem_heap_t* offsets_heap = NULL;
big_rec_t* big_rec;
err = btr_cur_pessimistic_update(

View File

@ -3206,7 +3206,7 @@ ibuf_insert_low(
dtuple_t* ibuf_entry;
mem_heap_t* offsets_heap = NULL;
mem_heap_t* heap;
offset_t* offsets = NULL;
rec_offs* offsets = NULL;
ulint buffered;
lint min_n_recs;
rec_t* ins_rec;
@ -3643,7 +3643,7 @@ ibuf_insert_to_index_page_low(
buf_block_t* block, /*!< in/out: index page where the buffered
entry should be placed */
dict_index_t* index, /*!< in: record descriptor */
offset_t** offsets,/*!< out: offsets on *rec */
rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t* heap, /*!< in/out: memory heap */
mtr_t* mtr, /*!< in/out: mtr */
page_cur_t* page_cur)/*!< in/out: cursor positioned on the record
@ -3719,7 +3719,7 @@ ibuf_insert_to_index_page(
ulint low_match;
page_t* page = buf_block_get_frame(block);
rec_t* rec;
offset_t* offsets;
rec_offs* offsets;
mem_heap_t* heap;
DBUG_ENTER("ibuf_insert_to_index_page");
@ -3961,8 +3961,8 @@ ibuf_delete(
/* TODO: the below should probably be a separate function,
it's a bastardized version of btr_cur_optimistic_delete. */
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
mem_heap_t* heap = NULL;
ulint max_ins_size = 0;

View File

@ -326,7 +326,7 @@ ulint
btr_node_ptr_get_child_page_no(
/*===========================*/
const rec_t* rec, /*!< in: node pointer record */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
MY_ATTRIBUTE((warn_unused_result));
/** Create the root node for a new index tree.
@ -417,7 +417,7 @@ btr_root_raise_and_insert(
on the root page; when the function returns,
the cursor is positioned on the predecessor
of the inserted record */
offset_t** offsets,/*!< out: offsets on inserted record */
rec_offs** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
that can be emptied, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
@ -475,7 +475,7 @@ btr_page_split_and_insert(
btr_cur_t* cursor, /*!< in: cursor at which to insert; when the
function returns, the cursor is positioned
on the predecessor of the inserted record */
offset_t** offsets,/*!< out: offsets on inserted record */
rec_offs** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
that can be emptied, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */

View File

@ -94,7 +94,7 @@ ulint
btr_node_ptr_get_child_page_no(
/*===========================*/
const rec_t* rec, /*!< in: node pointer record */
const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */
const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */
{
const byte* field;
ulint len;

View File

@ -99,7 +99,7 @@ public:
/** Insert a record in the page.
@param[in] rec record
@param[in] offsets record offsets */
inline void insert(const rec_t* rec, offset_t* offsets);
inline void insert(const rec_t* rec, rec_offs* offsets);
private:
/** Page format */
enum format { REDUNDANT, DYNAMIC, COMPRESSED };
@ -111,7 +111,7 @@ private:
@tparam format the page format
@param[in,out] rec record
@param[in] offsets record offsets */
template<format> inline void insertPage(rec_t* rec, offset_t* offsets);
template<format> inline void insertPage(rec_t* rec, rec_offs* offsets);
public:
/** Mark end of insertion to the page. Scan all records to set page
@ -136,7 +136,7 @@ public:
@param[in] big_rec external recrod
@param[in] offsets record offsets
@return error code */
dberr_t storeExt(const big_rec_t* big_rec, offset_t* offsets);
dberr_t storeExt(const big_rec_t* big_rec, rec_offs* offsets);
/** Get node pointer
@return node pointer */

View File

@ -272,7 +272,7 @@ btr_cur_optimistic_insert(
specified */
btr_cur_t* cursor, /*!< in: cursor on page after which to insert;
cursor stays valid */
offset_t** offsets,/*!< out: offsets on *rec */
rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap */
dtuple_t* entry, /*!< in/out: entry to insert */
rec_t** rec, /*!< out: pointer to inserted record if
@ -308,7 +308,7 @@ btr_cur_pessimistic_insert(
insertion will certainly succeed */
btr_cur_t* cursor, /*!< in: cursor after which to insert;
cursor stays valid */
offset_t** offsets,/*!< out: offsets on *rec */
rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap
that can be emptied */
dtuple_t* entry, /*!< in/out: entry to insert */
@ -342,7 +342,7 @@ btr_cur_update_alloc_zip_func(
page_cur_t* cursor, /*!< in/out: B-tree page cursor */
dict_index_t* index, /*!< in: the index corresponding to cursor */
#ifdef UNIV_DEBUG
offset_t* offsets,/*!< in/out: offsets of the cursor record */
rec_offs* offsets,/*!< in/out: offsets of the cursor record */
#endif /* UNIV_DEBUG */
ulint length, /*!< in: size needed */
bool create, /*!< in: true=delete-and-insert,
@ -369,7 +369,7 @@ counterpart in ibuf_insert_to_index_page().
@param[in,out] block index page
@param[in,out] mtr mini-transaction */
void btr_cur_upd_rec_in_place(rec_t *rec, const dict_index_t *index,
const offset_t *offsets, const upd_t *update,
const rec_offs *offsets, const upd_t *update,
buf_block_t *block, mtr_t *mtr)
MY_ATTRIBUTE((nonnull));
/*************************************************************//**
@ -385,7 +385,7 @@ btr_cur_update_in_place(
btr_cur_t* cursor, /*!< in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
offset_t* offsets,/*!< in/out: offsets on cursor->page_cur.rec */
rec_offs* offsets,/*!< in/out: offsets on cursor->page_cur.rec */
const upd_t* update, /*!< in: update vector */
ulint cmpl_info,/*!< in: compiler info on secondary index
updates */
@ -414,7 +414,7 @@ btr_cur_optimistic_update(
btr_cur_t* cursor, /*!< in: cursor on the record to update;
cursor stays valid and positioned on the
same record */
offset_t** offsets,/*!< out: offsets on cursor->page_cur.rec */
rec_offs** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** heap, /*!< in/out: pointer to NULL or memory heap */
const upd_t* update, /*!< in: update vector; this must also
contain trx id and roll ptr fields */
@ -441,7 +441,7 @@ btr_cur_pessimistic_update(
btr_cur_t* cursor, /*!< in/out: cursor on the record to update;
cursor may become invalid if *big_rec == NULL
|| !(flags & BTR_KEEP_POS_FLAG) */
offset_t** offsets,/*!< out: offsets on cursor->page_cur.rec */
rec_offs** offsets,/*!< out: offsets on cursor->page_cur.rec */
mem_heap_t** offsets_heap,
/*!< in/out: pointer to memory heap
that can be emptied */
@ -473,7 +473,7 @@ btr_cur_del_mark_set_clust_rec(
buf_block_t* block, /*!< in/out: buffer block of the record */
rec_t* rec, /*!< in/out: record */
dict_index_t* index, /*!< in: clustered index of the record */
const offset_t* offsets,/*!< in: rec_get_offsets(rec) */
const rec_offs* offsets,/*!< in: rec_get_offsets(rec) */
que_thr_t* thr, /*!< in: query thread */
const dtuple_t* entry, /*!< in: dtuple for the deleting record */
mtr_t* mtr) /*!< in/out: mini-transaction */
@ -614,7 +614,7 @@ btr_estimate_number_of_different_key_vals(
ulint
btr_rec_get_externally_stored_len(
const rec_t* rec,
const offset_t* offsets);
const rec_offs* offsets);
/*******************************************************************//**
Marks non-updated off-page fields as disowned by this record. The ownership
@ -627,7 +627,7 @@ btr_cur_disown_inherited_fields(
buf_block_t* block, /*!< in/out: index page */
rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */
const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */
const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */
const upd_t* update, /*!< in: update vector */
mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((nonnull(2,3,4,5,6)));
@ -666,7 +666,7 @@ btr_store_big_rec_extern_fields(
btr_pcur_t* pcur, /*!< in/out: a persistent cursor. if
btr_mtr is restarted, then this can
be repositioned. */
offset_t* offsets, /*!< in/out: rec_get_offsets() on
rec_offs* offsets, /*!< in/out: rec_get_offsets() on
pcur. the "external storage" flags
in offsets will correctly correspond
to rec when this function returns */
@ -697,7 +697,7 @@ btr_free_externally_stored_field(
byte* field_ref, /*!< in/out: field reference */
const rec_t* rec, /*!< in: record containing field_ref, for
page_zip_write_blob_ptr(), or NULL */
const offset_t* offsets, /*!< in: rec_get_offsets(rec, index),
const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index),
or NULL */
buf_block_t* block, /*!< in/out: page of field_ref */
ulint i, /*!< in: field number of field_ref;
@ -755,7 +755,7 @@ protected by a lock or a page latch
byte*
btr_rec_copy_externally_stored_field(
const rec_t* rec,
const offset_t* offsets,
const rec_offs* offsets,
ulint zip_size,
ulint no,
ulint* len,

View File

@ -1256,7 +1256,7 @@ struct dict_index_t {
@param[in] offsets offsets
@return true if row is historical */
bool
vers_history_row(const rec_t* rec, const offset_t* offsets);
vers_history_row(const rec_t* rec, const rec_offs* offsets);
/** Check if record in secondary index is historical row.
@param[in] rec record in a secondary index

View File

@ -596,7 +596,7 @@ doc_id_t
fts_get_doc_id_from_rec(
const rec_t* rec,
const dict_index_t* index,
const offset_t* offsets);
const rec_offs* offsets);
/** Add new fts doc id to the update vector.
@param[in] table the table that contains the FTS index.

View File

@ -89,7 +89,7 @@ rtr_page_split_and_insert(
btr_cur_t* cursor, /*!< in/out: cursor at which to insert; when the
function returns, the cursor is positioned
on the predecessor of the inserted record */
offset_t** offsets,/*!< out: offsets on inserted record */
rec_offs** offsets,/*!< out: offsets on inserted record */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */
@ -257,7 +257,7 @@ void
rtr_get_mbr_from_rec(
/*=================*/
const rec_t* rec, /*!< in: data tuple */
const offset_t* offsets,/*!< in: offsets array */
const rec_offs* offsets,/*!< in: offsets array */
rtr_mbr_t* mbr); /*!< out MBR */
/****************************************************************//**
@ -289,10 +289,10 @@ rtr_page_get_father(
Returns the father block to a page. It is assumed that mtr holds
an X or SX latch on the tree.
@return rec_get_offsets() of the node pointer record */
offset_t*
rec_offs*
rtr_page_get_father_block(
/*======================*/
offset_t* offsets,/*!< in: work area for the return value */
rec_offs* offsets,/*!< in: work area for the return value */
mem_heap_t* heap, /*!< in: memory heap to use */
dict_index_t* index, /*!< in: b-tree index */
buf_block_t* block, /*!< in: child page in the index */
@ -399,8 +399,8 @@ rtr_merge_and_update_mbr(
/*=====================*/
btr_cur_t* cursor, /*!< in/out: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */
offset_t* offsets, /*!< in: rec offsets */
offset_t* offsets2, /*!< in: rec offsets */
rec_offs* offsets, /*!< in: rec offsets */
rec_offs* offsets2, /*!< in: rec offsets */
page_t* child_page, /*!< in: the child page. */
mtr_t* mtr); /*!< in: mtr */
@ -420,8 +420,8 @@ rtr_merge_mbr_changed(
/*==================*/
btr_cur_t* cursor, /*!< in: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */
offset_t* offsets, /*!< in: rec offsets */
offset_t* offsets2, /*!< in: rec offsets */
rec_offs* offsets, /*!< in: rec offsets */
rec_offs* offsets2, /*!< in: rec offsets */
rtr_mbr_t* new_mbr); /*!< out: MBR to update */
@ -432,7 +432,7 @@ bool
rtr_update_mbr_field(
/*=================*/
btr_cur_t* cursor, /*!< in: cursor pointed to rec.*/
offset_t* offsets, /*!< in: offsets on rec. */
rec_offs* offsets, /*!< in: offsets on rec. */
btr_cur_t* cursor2, /*!< in/out: cursor pointed to rec
that should be deleted.
this cursor is for btr_compress to

View File

@ -40,7 +40,7 @@ rtr_page_cal_mbr(
rec_t* rec;
const byte* field;
ulint len;
offset_t* offsets = NULL;
rec_offs* offsets = NULL;
double bmin, bmax;
double* amin;
double* amax;

View File

@ -32,7 +32,7 @@ innobase_rec_to_mysql(
struct TABLE* table, /*!< in/out: MySQL table */
const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: index */
const offset_t* offsets)/*!< in: rec_get_offsets(
const rec_offs* offsets)/*!< in: rec_get_offsets(
rec, index, ...) */
MY_ATTRIBUTE((nonnull));

View File

@ -300,7 +300,7 @@ lock_clust_rec_modify_check_and_lock(
const rec_t* rec, /*!< in: record which should be
modified */
dict_index_t* index, /*!< in: clustered index */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
que_thr_t* thr) /*!< in: query thread */
MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************//**
@ -338,7 +338,7 @@ lock_sec_rec_read_check_and_lock(
be read or passed over by a
read cursor */
dict_index_t* index, /*!< in: secondary index */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
lock_mode mode, /*!< in: mode of the lock which
the read cursor should set on
records: LOCK_S or LOCK_X; the
@ -366,7 +366,7 @@ lock_clust_rec_read_check_and_lock(
be read or passed over by a
read cursor */
dict_index_t* index, /*!< in: clustered index */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
lock_mode mode, /*!< in: mode of the lock which
the read cursor should set on
records: LOCK_S or LOCK_X; the
@ -415,7 +415,7 @@ lock_clust_rec_cons_read_sees(
const rec_t* rec, /*!< in: user record which should be read or
passed over by a read cursor */
dict_index_t* index, /*!< in: clustered index */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
ReadView* view); /*!< in: consistent read view */
/*********************************************************************//**
Checks that a non-clustered index record is seen in a consistent read.
@ -547,7 +547,7 @@ lock_report_trx_id_insanity(
trx_id_t trx_id, /*!< in: trx id */
const rec_t* rec, /*!< in: user record */
dict_index_t* index, /*!< in: index */
const offset_t* offsets, /*!< in: rec_get_offsets(rec, index) */
const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index) */
trx_id_t max_trx_id); /*!< in: trx_sys.get_max_trx_id() */
/*********************************************************************//**
Prints info of locks for all transactions.
@ -714,7 +714,7 @@ lock_check_trx_id_sanity(
trx_id_t trx_id, /*!< in: trx id */
const rec_t* rec, /*!< in: user record */
dict_index_t* index, /*!< in: index */
const offset_t* offsets); /*!< in: rec_get_offsets(rec, index) */
const rec_offs* offsets); /*!< in: rec_get_offsets(rec, index) */
#ifdef UNIV_DEBUG
/*******************************************************************//**
Check if the transaction holds any locks on the sys tables

View File

@ -469,7 +469,7 @@ lock_clust_rec_some_has_impl(
/*=========================*/
const rec_t* rec, /*!< in: user record */
const dict_index_t* index, /*!< in: clustered index */
const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */
const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */
MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************//**

View File

@ -59,7 +59,7 @@ lock_clust_rec_some_has_impl(
/*=========================*/
const rec_t* rec, /*!< in: user record */
const dict_index_t* index, /*!< in: clustered index */
const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */
const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */
{
ut_ad(dict_index_is_clust(index));
ut_ad(page_rec_is_user_rec(rec));

View File

@ -537,33 +537,22 @@ private:
std::atomic<bool> check_flush_or_checkpoint_;
public:
MY_ALIGNED(CACHE_LINE_SIZE)
LogSysMutex mutex; /*!< mutex protecting the log */
MY_ALIGNED(CACHE_LINE_SIZE)
FlushOrderMutex log_flush_order_mutex;/*!< mutex to serialize access to
the flush list when we are putting
dirty blocks in the list. The idea
behind this mutex is to be able
to release log_sys.mutex during
mtr_commit and still ensure that
insertions in the flush_list happen
in the LSN order. */
byte* buf; /*!< Memory of double the
srv_log_buffer_size is
allocated here. This pointer will change
however to either the first half or the
second half in turns, so that log
write/flush to disk don't block
concurrent mtrs which will write
log to this buffer. Care to switch back
to the first half before freeing/resizing
must be undertaken. */
bool first_in_use; /*!< true if buf points to the first
half of the buffer, false
if the second half */
size_t max_buf_free; /*!< recommended maximum value of
buf_free for the buffer in use, after
which the buffer is flushed */
/** mutex protecting the log */
MY_ALIGNED(CACHE_LINE_SIZE)
LogSysMutex mutex;
/** mutex to serialize access to the flush list when we are putting
dirty blocks in the list. The idea behind this mutex is to be able
to release log_sys.mutex during mtr_commit and still ensure that
insertions in the flush_list happen in the LSN order. */
MY_ALIGNED(CACHE_LINE_SIZE) FlushOrderMutex
log_flush_order_mutex;
/** log_buffer, append data here */
byte *buf;
/** log_buffer, writing data to file from this buffer.
Before flushing write_buf is swapped with flush_buf */
byte *flush_buf;
/** recommended maximum size of buf, after which the buffer is flushed */
size_t max_buf_free;
/** Log file stuff. Protected by mutex or write_mutex. */
struct file {
/** format of the redo log: e.g., FORMAT_10_5 */

View File

@ -147,7 +147,7 @@ page_cur_tuple_insert(
page_cur_t* cursor, /*!< in/out: a page cursor */
const dtuple_t* tuple, /*!< in: pointer to a data tuple */
dict_index_t* index, /*!< in: record descriptor */
offset_t** offsets,/*!< out: offsets on *rec */
rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
ulint n_ext, /*!< in: number of externally stored columns */
mtr_t* mtr) /*!< in/out: mini-transaction */
@ -163,7 +163,7 @@ page_cur_insert_rec_low(
const page_cur_t*cur, /*!< in: page cursor */
dict_index_t* index, /*!< in: record descriptor */
const rec_t* rec, /*!< in: record to insert after cur */
offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */
rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((nonnull, warn_unused_result));
@ -185,7 +185,7 @@ page_cur_insert_rec_zip(
page_cur_t* cursor, /*!< in/out: page cursor */
dict_index_t* index, /*!< in: record descriptor */
const rec_t* rec, /*!< in: pointer to a physical record */
offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */
rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/***********************************************************//**
@ -196,7 +196,7 @@ page_cur_delete_rec(
/*================*/
page_cur_t* cursor, /*!< in/out: a page cursor */
const dict_index_t* index, /*!< in: record descriptor */
const offset_t* offsets,/*!< in: rec_get_offsets(
const rec_offs* offsets,/*!< in: rec_get_offsets(
cursor->rec, index) */
mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((nonnull));
@ -341,7 +341,7 @@ page_cur_open_on_rnd_user_rec(
struct page_cur_t{
const dict_index_t* index;
rec_t* rec; /*!< pointer to a record on page */
offset_t* offsets;
rec_offs* offsets;
buf_block_t* block; /*!< pointer to the block containing rec */
};

View File

@ -254,7 +254,7 @@ page_cur_tuple_insert(
page_cur_t* cursor, /*!< in/out: a page cursor */
const dtuple_t* tuple, /*!< in: pointer to a data tuple */
dict_index_t* index, /*!< in: record descriptor */
offset_t** offsets,/*!< out: offsets on *rec */
rec_offs** offsets,/*!< out: offsets on *rec */
mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
ulint n_ext, /*!< in: number of externally stored columns */
mtr_t* mtr) /*!< in/out: mini-transaction */

View File

@ -1066,7 +1066,7 @@ void
page_rec_print(
/*===========*/
const rec_t* rec, /*!< in: physical record */
const offset_t* offsets);/*!< in: record descriptor */
const rec_offs* offsets);/*!< in: record descriptor */
# ifdef UNIV_BTR_PRINT
/***************************************************************//**
This is used to print the contents of the directory for
@ -1113,7 +1113,7 @@ ibool
page_rec_validate(
/*==============*/
const rec_t* rec, /*!< in: physical record */
const offset_t* offsets);/*!< in: array returned by rec_get_offsets() */
const rec_offs* offsets);/*!< in: array returned by rec_get_offsets() */
#ifdef UNIV_DEBUG
/***************************************************************//**
Checks that the first directory slot points to the infimum record and

View File

@ -239,7 +239,7 @@ The data must already have been written to the uncompressed page.
@param[in] create nonzero=insert, zero=update
@param[in,out] mtr mini-transaction */
void page_zip_write_rec(buf_block_t *block, const byte *rec,
const dict_index_t *index, const offset_t *offsets,
const dict_index_t *index, const rec_offs *offsets,
ulint create, mtr_t *mtr)
MY_ATTRIBUTE((nonnull));
@ -253,7 +253,7 @@ page_zip_write_blob_ptr(
const byte* rec, /*!< in/out: record whose data is being
written */
dict_index_t* index, /*!< in: index of the page */
const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */
const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */
ulint n, /*!< in: column index */
mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((nonnull));
@ -282,7 +282,7 @@ void
page_zip_write_trx_id_and_roll_ptr(
buf_block_t* block,
byte* rec,
const offset_t* offsets,
const rec_offs* offsets,
ulint trx_id_col,
trx_id_t trx_id,
roll_ptr_t roll_ptr,
@ -319,7 +319,7 @@ when a record is deleted.
@param[in] free previous start of the free list
@param[in,out] mtr mini-transaction */
void page_zip_dir_delete(buf_block_t *block, byte *rec,
const dict_index_t *index, const offset_t *offsets,
const dict_index_t *index, const rec_offs *offsets,
const byte *free, mtr_t *mtr)
MY_ATTRIBUTE((nonnull(1,2,3,4,6)));

View File

@ -148,7 +148,7 @@ int
cmp_dtuple_rec_with_match_low(
const dtuple_t* dtuple,
const rec_t* rec,
const offset_t* offsets,
const rec_offs* offsets,
ulint n_cmp,
ulint* matched_fields)
MY_ATTRIBUTE((nonnull));
@ -172,7 +172,7 @@ cmp_dtuple_rec_with_match_bytes(
const dtuple_t* dtuple,
const rec_t* rec,
const dict_index_t* index,
const offset_t* offsets,
const rec_offs* offsets,
ulint* matched_fields,
ulint* matched_bytes)
MY_ATTRIBUTE((warn_unused_result));
@ -189,7 +189,7 @@ int
cmp_dtuple_rec(
const dtuple_t* dtuple,
const rec_t* rec,
const offset_t* offsets);
const rec_offs* offsets);
/**************************************************************//**
Checks if a dtuple is a prefix of a record. The last field in dtuple
is allowed to be a prefix of the corresponding field in the record.
@ -199,7 +199,7 @@ cmp_dtuple_is_prefix_of_rec(
/*========================*/
const dtuple_t* dtuple, /*!< in: data tuple */
const rec_t* rec, /*!< in: physical record */
const offset_t* offsets);/*!< in: array returned by rec_get_offsets() */
const rec_offs* offsets);/*!< in: array returned by rec_get_offsets() */
/** Compare two physical records that contain the same number of columns,
none of which are stored externally.
@retval positive if rec1 (including non-ordering columns) is greater than rec2
@ -210,8 +210,8 @@ cmp_rec_rec_simple(
/*===============*/
const rec_t* rec1, /*!< in: physical record */
const rec_t* rec2, /*!< in: physical record */
const offset_t* offsets1,/*!< in: rec_get_offsets(rec1, ...) */
const offset_t* offsets2,/*!< in: rec_get_offsets(rec2, ...) */
const rec_offs* offsets1,/*!< in: rec_get_offsets(rec1, ...) */
const rec_offs* offsets2,/*!< in: rec_get_offsets(rec2, ...) */
const dict_index_t* index, /*!< in: data dictionary index */
struct TABLE* table) /*!< in: MySQL table, for reporting
duplicate key value if applicable,
@ -238,8 +238,8 @@ int
cmp_rec_rec(
const rec_t* rec1,
const rec_t* rec2,
const offset_t* offsets1,
const offset_t* offsets2,
const rec_offs* offsets1,
const rec_offs* offsets2,
const dict_index_t* index,
bool nulls_unequal = false,
ulint* matched_fields = NULL)

Some files were not shown because too many files have changed in this diff Show More