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) 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 # 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 # it under the terms of the GNU General Public License as published by
@ -254,6 +254,11 @@ INCLUDE(wsrep)
INCLUDE(cpack_rpm) INCLUDE(cpack_rpm)
INCLUDE(cpack_deb) 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. # Always enable debug sync for debug builds.
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_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> ** master/autocommit code by Brian Aker <brian@tangent.org>
** SSL by ** SSL by
** Andrei Errapart <andreie@no.spam.ee> ** 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 ** XML by Gary Huntress <ghuntress@mediaone.net> 10/10/01, cleaned up
** and adapted to mysqldump 05/11/01 by Jani Tolonen ** and adapted to mysqldump 05/11/01 by Jani Tolonen
** Added --single-transaction option 06/06/2002 by Peter Zaitsev ** Added --single-transaction option 06/06/2002 by Peter Zaitsev

View File

@ -4,6 +4,10 @@
char *push1=0; char *push1=0;
#ifndef DBUG_TRACE
#define DBUG_TRACE
#endif
#include <my_global.h> /* This includes dbug.h */ #include <my_global.h> /* This includes dbug.h */
#include <my_sys.h> #include <my_sys.h>
#include <my_pthread.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) #if defined(HAVE_ALARM) && !defined(NO_ALARM_LOOP)
#include <signal.h> #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; \ #define ALARM_VARIABLES uint alarm_old=0; \
sig_return alarm_signal=0 sig_return alarm_signal=0
#define ALARM_INIT my_have_got_alarm=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 const char* _db_get_func_(void);
extern int (*dbug_sanity)(void); extern int (*dbug_sanity)(void);
#ifdef DBUG_TRACE
#define DBUG_LEAVE do { \ #define DBUG_LEAVE do { \
_db_stack_frame_.line= __LINE__; \ _db_stack_frame_.line= __LINE__; \
_db_return_ (&_db_stack_frame_); \ _db_return_ (&_db_stack_frame_); \
@ -85,6 +86,13 @@ extern int (*dbug_sanity)(void);
#define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0) #define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0)
#endif #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) \ #define DBUG_EXECUTE(keyword,a1) \
do {if (_db_keyword_(0, (keyword), 0)) { a1 }} while(0) do {if (_db_keyword_(0, (keyword), 0)) { a1 }} while(0)
#define DBUG_EXECUTE_IF(keyword,a1) \ #define DBUG_EXECUTE_IF(keyword,a1) \

View File

@ -561,13 +561,6 @@ typedef int my_socket; /* File descriptor for sockets */
#endif #endif
/* Type for functions that handles signals */ /* Type for functions that handles signals */
#define sig_handler RETSIGTYPE #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) #if defined(__GNUC__) && !defined(_lint)
typedef char pchar; /* Mixed prototypes can take char */ typedef char pchar; /* Mixed prototypes can take char */
typedef char puchar; /* 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_top(queue) ((queue)->root[1])
#define queue_element(queue,index) ((queue)->root[index]) #define queue_element(queue,index) ((queue)->root[index])
#define queue_end(queue) ((queue)->root[(queue)->elements]) #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_cmp_arg(queue, set_arg) (queue)->first_cmp_arg= set_arg
#define queue_set_max_at_top(queue, set_arg) \ #define queue_set_max_at_top(queue, set_arg) \
(queue)->max_at_top= set_arg ? -1 : 1 (queue)->max_at_top= set_arg ? -1 : 1
@ -61,11 +61,11 @@ typedef struct st_queue {
typedef int (*queue_compare)(void *,uchar *, uchar *); typedef int (*queue_compare)(void *,uchar *, uchar *);
int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key, 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, void *first_cmp_arg, uint offset_to_queue_pos,
uint auto_extent); uint auto_extent);
int reinit_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, queue_compare compare, my_bool max_at_top, queue_compare compare,
void *first_cmp_arg, uint offset_to_queue_pos, void *first_cmp_arg, uint offset_to_queue_pos,
uint auto_extent); uint auto_extent);
int resize_queue(QUEUE *queue, uint max_elements); int resize_queue(QUEUE *queue, uint max_elements);
@ -77,7 +77,7 @@ void queue_replace(QUEUE *queue,uint idx);
#define queue_remove_all(queue) { (queue)->elements= 0; } #define queue_remove_all(queue) { (queue)->elements= 0; }
#define queue_is_full(queue) (queue->elements == queue->max_elements) #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); void queue_fix(QUEUE *queue);
#define is_queue_inited(queue) ((queue)->root != 0) #define is_queue_inited(queue) ((queue)->root != 0)

View File

@ -153,6 +153,9 @@ typedef my_socket YASSL_SOCKET_T;
#include <openssl/ssl.h> #include <openssl/ssl.h>
#undef Timeval #undef Timeval
#include <openssl/err.h> #include <openssl/err.h>
#ifdef DEPRECATED
#undef DEPRECATED
#endif
enum enum_ssl_init_error 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 { } else {
if (strcmp(arg, "--verbose") == 0) if (strcmp(arg, "--verbose") == 0)
verbose++; 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 */ /* Override parent_pid with a value provided by user */
const char* start; 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; 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 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 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; select * from t1,t2 where t1.b = t2.c and t1.c = t2.b;
a a b c a a b c
1 1 1 1 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 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 PRIMARY 1 pk A 1010 NULL NULL BTREE
t1 0 a 1 a A 1010 NULL NULL YES 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; explain select * from t0,t1 where t0.a=t1.a;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where 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; drop table t0,t1;
# #
# MDEV-21383: Possible range plan is not used under certain conditions # 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; set myisam_stats_method=@tmp1;
show keys from t1; 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; explain select * from t0,t1 where t0.a=t1.a;
drop table t0,t1; drop table t0,t1;

View File

@ -643,3 +643,45 @@ SHOW STATUS LIKE 'Last_query_cost';
Variable_name Value Variable_name Value
Last_query_cost 14.199000 Last_query_cost 14.199000
DROP TABLE t1; 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 --disable_warnings
drop table if exists t1,t2,t3; drop table if exists t1,t2,t3;
--enable_warnings --enable_warnings
--source include/have_sequence.inc
SET SQL_WARNINGS=1; 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'; SHOW STATUS LIKE 'Last_query_cost';
DROP TABLE t1; 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; ORDER BY t2.c LIMIT 1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a,b,c c 5 NULL 420 Using where 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 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' WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE'
ORDER BY t2.c LIMIT 1; 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 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 <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 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 t2 ALL NULL NULL NULL NULL 5 Using temporary
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) 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; 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 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 <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 <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 t2 ALL NULL NULL NULL NULL 5 Using temporary
3 MATERIALIZED t1 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) 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 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; 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 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 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; drop table t1, t2;
# #
# check UPDATE/DELETE that look like they could be eliminated # 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); select(STDOUT);
$| = 1; # Automatically flush 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(); main();
sub main { sub main {
@ -882,7 +908,7 @@ sub run_test_server ($$$) {
delete $next->{reserved}; delete $next->{reserved};
} }
xterm_stat(scalar(@$tests)); titlebar_stat(scalar(@$tests)) if $set_titlebar;
if ($next) { if ($next) {
# We don't need this any more # We don't need this any more
@ -6558,8 +6584,7 @@ sub time_format($) {
our $num_tests; our $num_tests;
sub xterm_stat { sub titlebar_stat {
if (-t STDOUT and defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) {
my ($left) = @_; my ($left) = @_;
# 2.5 -> best by test # 2.5 -> best by test
@ -6568,9 +6593,7 @@ sub xterm_stat {
my $done = $num_tests - $left; my $done = $num_tests - $left;
my $spent = time - $^T; my $spent = time - $^T;
syswrite STDOUT, sprintf &$set_titlebar(sprintf "mtr: spent %s on %d tests. %s (%d tests) left",
"\e];mtr: spent %s on %d tests. %s (%d tests) left\a",
time_format($spent), $done, 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_load_data : MDEV-19968 galera.galera_load_data
galera_many_tables_nopk : MDEV-18182 Galera test failure on galera.galera_many_tables_nopk 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_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_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails
galera_pc_ignore_sb : MDEV-20888 galera.galera_pc_ignore_sb galera_pc_ignore_sb : MDEV-20888 galera.galera_pc_ignore_sb
galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim

View File

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

View File

@ -3,8 +3,8 @@ connection node_1;
connection node_1; connection node_1;
show status like 'wsrep_cluster_conf_id'; show status like 'wsrep_cluster_conf_id';
Variable_name Value Variable_name Value
wsrep_cluster_conf_id 2 wsrep_cluster_conf_id #
connection node_2; connection node_2;
show status like 'wsrep_cluster_conf_id'; show status like 'wsrep_cluster_conf_id';
Variable_name Value 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 --connection node_2
--reap --reap
--disconnect node_1a --disconnect node_1a
--let $wait_condition = select count(*)=30000 from t1;
--let $wait_condition = SELECT COUNT(*) = 30000 FROM t1;
--source include/wait_condition.inc --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 --disable_query_log
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;

View File

@ -1,7 +1,9 @@
--source include/galera_cluster.inc --source include/galera_cluster.inc
--connection node_1 --connection node_1
--replace_regex /18446744073709551/ERROR/ /[0-9]/#/
show status like 'wsrep_cluster_conf_id'; show status like 'wsrep_cluster_conf_id';
--connection node_2 --connection node_2
--replace_regex /18446744073709551/ERROR/ /[0-9]/#/
show status like 'wsrep_cluster_conf_id'; 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); explain select * from t1 where b in (select c from t3);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where 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_type=PRIMARY, type=range,ref
select * from t1 where c in (select c from t3 where c between -2 and -1); select * from t1 where c in (select c from t3 where c between -2 and -1);
a b c a b c

View File

@ -80,7 +80,7 @@ a b c
explain select * from t1 where b in (select c from t3); explain select * from t1 where b in (select c from t3);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where 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_type=PRIMARY, type=range,ref
select * from t1 where c in (select c from t3 where c between -2 and -1); select * from t1 where c in (select c from t3 where c between -2 and -1);
a b c 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; 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 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 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); EXPLAIN SELECT b FROM t1 FORCE INDEX(b);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL b 5 NULL 2 Using index 1 SIMPLE t1 index NULL b 5 NULL 2 Using index

View File

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

View File

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

View File

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

View File

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

View File

@ -2848,11 +2848,19 @@ pk b
connection default; connection default;
DROP TABLE t1; DROP TABLE t1;
disconnect analyze; 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 SELECT variable_value-@old_instant instants
FROM information_schema.global_status FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column'; WHERE variable_name = 'innodb_instant_alter_column';
instants instants
208 209
SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
SET GLOBAL innodb_instant_alter_column_allowed = @saved_allowance; SET GLOBAL innodb_instant_alter_column_allowed = @saved_allowance;
# #

View File

@ -171,6 +171,41 @@ DROP FOREIGN KEY fk1,
CHANGE b d INT UNSIGNED, CHANGE b d INT UNSIGNED,
ADD c INT; ADD c INT;
DROP TABLE t2, t1; 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 # End of 10.3 tests
create table t ( create table t (
a varchar(9), 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 # restart: --debug=d,innodb_log_abort_3,ib_log --innodb-log-file-size=4194304
SELECT * FROM t1; SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB' 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
# restart # restart
DROP TABLE t1; DROP TABLE t1;

View File

@ -55,6 +55,10 @@ ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
--error $error_code --error $error_code
ALTER TABLE t1 ENGINE=INNODB; 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; DROP TABLE t1;
--disable_info --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; ALTER TABLE t1 CHANGE a c INT;
# Cleanup # Cleanup
DROP TABLE t1; 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; SET FOREIGN_KEY_CHECKS=1;
--echo # Start of 10.2 tests --echo # Start of 10.2 tests

View File

@ -889,6 +889,17 @@ dec $format;
let $redundant_4k= 0; let $redundant_4k= 0;
} }
disconnect analyze; 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 SELECT variable_value-@old_instant instants
FROM information_schema.global_status FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column'; WHERE variable_name = 'innodb_instant_alter_column';

View File

@ -172,6 +172,42 @@ ALTER TABLE t2
CHANGE b d INT UNSIGNED, CHANGE b d INT UNSIGNED,
ADD c INT; ADD c INT;
DROP TABLE t2, t1; 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 --echo # End of 10.3 tests

View File

@ -39,7 +39,7 @@ SELECT * FROM t1;
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE --error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1; 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 --source include/search_pattern_in_file.inc
--let $restart_parameters= --let $restart_parameters=

View File

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

View File

@ -71,5 +71,22 @@ include/diff_tables.inc [master:t1,slave:t1]
connection master; connection master;
SELECT c1 FROM /*!999999 t1 WHEREN; 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 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; DROP TABLE t1;
include/rpl_end.inc 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 --echo # comments
--connection master --connection master
--error 1064 --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; DROP TABLE t1;
--source include/rpl_end.inc --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); explain select * from t1 where b in (select c from t3);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where 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_type=PRIMARY, type=range,ref
select * from t1 where c in (select c from t3 where c between -2 and -1); select * from t1 where c in (select c from t3 where c between -2 and -1);
a b c a b c

View File

@ -64,7 +64,7 @@ a b c
explain select * from t1 where b in (select c from t3); explain select * from t1 where b in (select c from t3);
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where 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_type=PRIMARY, type=range,ref
select * from t1 where c in (select c from t3 where c between -2 and -1); select * from t1 where c in (select c from t3 where c between -2 and -1);
a b c a b c

View File

@ -70,10 +70,9 @@
*/ */
int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key, 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, void *first_cmp_arg, uint offset_to_queue_pos,
uint auto_extent) uint auto_extent)
{ {
DBUG_ENTER("init_queue"); DBUG_ENTER("init_queue");
if ((queue->root= (uchar **) my_malloc(key_memory_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, 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, void *first_cmp_arg, uint offset_to_queue_pos,
uint auto_extent) 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 Insert element in queue
@ -192,28 +213,10 @@ void delete_queue(QUEUE *queue)
element Element to insert 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); DBUG_ASSERT(queue->elements < queue->max_elements);
insert_at(queue, element, ++queue->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;
} }
@ -231,7 +234,7 @@ void queue_insert(register QUEUE *queue, uchar *element)
2 auto_extend is 0; No insertion done 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) if (queue->elements == queue->max_elements)
@ -260,38 +263,35 @@ int queue_insert_safe(register QUEUE *queue, uchar *element)
pointer to removed element pointer to removed element
*/ */
uchar *queue_remove(register QUEUE *queue, uint idx) uchar *queue_remove(QUEUE *queue, uint idx)
{ {
uchar *element; uchar *element;
DBUG_ASSERT(idx >= 1 && idx <= queue->elements); DBUG_ASSERT(idx >= 1);
DBUG_ASSERT(idx <= queue->elements);
element= queue->root[idx]; element= queue->root[idx];
_downheap(queue, idx, queue->root[queue->elements--]); queue->root[idx]= queue->root[queue->elements--];
queue_replace(queue, idx);
return element; return element;
} }
/* /*
Add element to fixed position and update heap Restores the heap property from idx down the heap
SYNOPSIS SYNOPSIS
_downheap() _downheap()
queue Queue to use queue Queue to use
idx Index of element to change 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; uchar *element= queue->root[idx];
register uint idx= start_idx; uint next_index,
my_bool first= TRUE; elements= queue->elements,
half_queue= elements >> 1,
offset_to_key=queue->offset_to_key; offset_to_key= queue->offset_to_key,
offset_to_queue_pos= queue->offset_to_queue_pos; offset_to_queue_pos= queue->offset_to_queue_pos;
half_queue= (elements= queue->elements) >> 1;
while (idx <= half_queue) while (idx <= half_queue)
{ {
@ -302,33 +302,10 @@ void _downheap(register QUEUE *queue, uint start_idx, uchar *element)
queue->root[next_index+1]+offset_to_key) * queue->root[next_index+1]+offset_to_key) *
queue->max_at_top) > 0) queue->max_at_top) > 0)
next_index++; next_index++;
if (first && if ((queue->compare(queue->first_cmp_arg,
(((queue->compare(queue->first_cmp_arg,
queue->root[next_index]+offset_to_key, queue->root[next_index]+offset_to_key,
element+offset_to_key) * queue->max_at_top) >= 0))) element+offset_to_key) * queue->max_at_top) >= 0)
{ break;
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)
{
queue->root[idx]= queue->root[next_index]; queue->root[idx]= queue->root[next_index];
if (offset_to_queue_pos) if (offset_to_queue_pos)
(*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx; (*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx;
@ -352,7 +329,7 @@ void queue_fix(QUEUE *queue)
{ {
uint i; uint i;
for (i= queue->elements >> 1; i > 0; 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_replace()
queue Queue to use queue Queue to use
idx Index of element to change 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) void queue_replace(QUEUE *queue, uint idx)
{ {
uchar *element= queue->root[idx]; uchar *element= queue->root[idx];
DBUG_ASSERT(idx >= 1 && idx <= queue->elements); uint next_index,
queue_remove(queue, idx); elements= queue->elements,
queue_insert(queue, element); 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. POSSIBILITY OF SUCH DAMAGE.
*/ */
#if defined(__FreeBSD__) || defined(SOLARIS) || defined(__sun)
#include <gssapi/gssapi.h>
#else
#include <gssapi.h> #include <gssapi.h>
#endif
#include <string.h> #include <string.h>
void gssapi_errmsg(OM_uint32 major, OM_uint32 minor, char *buf, size_t size) 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 /*x86_64*/
#endif /*DBUG_OFF*/ #endif /*DBUG_OFF*/
#endif /* __linux__ */ #endif /* __linux__ */
struct mysql_event_general event; struct mysql_event_general event;
if (ev_v8->event_class != MYSQL_AUDIT_GENERAL_CLASS) 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) int get_db_mysql57(MYSQL_THD thd, char **name, size_t *len)
{ {
#ifdef __linux__
int db_off; int db_off;
int db_len_off; int db_len_off;
if (debug_server_started) if (debug_server_started)
@ -2286,7 +2288,6 @@ int get_db_mysql57(MYSQL_THD thd, char **name, size_t *len)
#endif /*x86_64*/ #endif /*x86_64*/
} }
#ifdef __linux__
*name= *(char **) (((char *) thd) + db_off); *name= *(char **) (((char *) thd) + db_off);
*len= *((size_t *) (((char*) thd) + db_len_off)); *len= *((size_t *) (((char*) thd) + db_len_off));
if (*name && (*name)[*len] != 0) 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) if (field >= result + fields)
goto err; 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); cli_fetch_lengths(&lengths[0], row->data, default_value ? 6 : 5);
field->org_table= field->table= strdup_root(alloc,(char*) row->data[0]); field->org_table= field->table= strmake_root(alloc,(char*) row->data[0], lengths[0]);
field->name= strdup_root(alloc,(char*) row->data[1]); field->name= strmake_root(alloc,(char*) row->data[1], lengths[1]);
field->length= (uint) uint3korr(row->data[2]); field->length= (uint) uint3korr(row->data[2]);
field->type= (enum enum_field_types) (uchar) row->data[3][0]; 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; field->flags|= NUM_FLAG;
if (default_value && row->data[5]) 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]; field->def_length= lengths[5];
} }
else 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 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 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", ("job_data is NULL, the thread was killed"));
} }
DBUG_PRINT("info", ("state=%s", scheduler_states_names[state].str)); DBUG_PRINT("info", ("state=%s", scheduler_states_names[state].str));
free_root(thd->mem_root, MYF(0));
} }
LOCK_DATA(); LOCK_DATA();

View File

@ -4,7 +4,7 @@
write-output "/* This file was generated using gen_win_tzname_data.ps1 */" write-output "/* This file was generated using gen_win_tzname_data.ps1 */"
$xdoc = new-object System.Xml.XmlDocument $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) $nodes = $xdoc.SelectNodes("//mapZone[@territory='001']") # use default territory (001)
foreach ($node in $nodes) { foreach ($node in $nodes) {
write-output ('{L"'+ $node.other + '","'+ $node.type+'"},') 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); uint mrr_buf_size, MEM_ROOT *alloc);
static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
bool index_read_must_be_used, bool index_read_must_be_used,
bool update_tbl_stats, bool for_range_access,
double read_time, double read_time);
bool ror_scans_required);
static static
TRP_INDEX_INTERSECT *get_best_index_intersect(PARAM *param, SEL_TREE *tree, TRP_INDEX_INTERSECT *get_best_index_intersect(PARAM *param, SEL_TREE *tree,
double read_time); 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 It is possible to use a range-based quick select (but it might be
slower than 'all' table scan). slower than 'all' table scan).
*/ */
TRP_RANGE *range_trp;
TRP_ROR_INTERSECT *rori_trp; TRP_ROR_INTERSECT *rori_trp;
TRP_INDEX_INTERSECT *intersect_trp; TRP_INDEX_INTERSECT *intersect_trp;
bool can_build_covering= FALSE; 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); remove_nonrange_trees(&param, tree);
/* Get best 'range' plan and prepare data for making other plans */ /* Get best 'range' plan and prepare data for making other plans */
if ((range_trp= get_key_scans_params(&param, tree, if (auto range_trp= get_key_scans_params(&param, tree,
only_single_index_range_scan, TRUE, only_single_index_range_scan,
best_read_time, FALSE))) true, best_read_time))
{ {
best_trp= range_trp; best_trp= range_trp;
best_read_time= best_trp->read_cost; 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))) n_child_scans)))
DBUG_RETURN(NULL); 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_object trace_best_disjunct(thd);
Json_writer_array to_merge(thd, "indexes_to_merge"); 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");); "tree in SEL_IMERGE"););
Json_writer_object trace_idx(thd); Json_writer_object trace_idx(thd);
if (!(*cur_child= get_key_scans_params(param, *ptree, TRUE, FALSE, if (!(*cur_child= get_key_scans_params(param, *ptree, TRUE, FALSE,
read_time, read_time)))
only_ror_scans_required)))
{ {
/* /*
One of index scans in this index_merge is more expensive than entire 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 a random order
2. the functions that estimate the cost of a range scan and an 2. the functions that estimate the cost of a range scan and an
index merge retrievals are not well calibrated 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, trp= 0;
read_time, FALSE);
} }
DBUG_RETURN(trp); 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 tree make range select for this SEL_TREE
index_read_must_be_used if TRUE, assume 'index only' option will be set index_read_must_be_used if TRUE, assume 'index only' option will be set
(except for clustered PK indexes) (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. 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 RETURN
Best range read plan Best range read plan
NULL if no plan found or error occurred 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, static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
bool index_read_must_be_used, bool index_read_must_be_used,
bool update_tbl_stats, bool for_range_access,
double read_time, double read_time)
bool only_ror_scans_required)
{ {
uint idx, UNINIT_VAR(best_idx); uint idx, UNINIT_VAR(best_idx);
SEL_ARG *key_to_read= NULL; SEL_ARG *key_to_read= NULL;
@ -7402,6 +7398,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
sizeof(INDEX_SCAN_INFO *) * param->keys); 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++) for (idx= 0; idx < param->keys; idx++)
{ {
SEL_ARG *key= tree->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); trace_idx.add("index", param->table->key_info[keynr].name);
found_records= check_quick_select(param, idx, read_index_only, key, 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); &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; continue;
}
if (found_records != HA_POS_ERROR && tree->index_scans && if (found_records != HA_POS_ERROR && tree->index_scans &&
(index_scan= (INDEX_SCAN_INFO *)alloc_root(param->mem_root, (index_scan= (INDEX_SCAN_INFO *)alloc_root(param->mem_root,

View File

@ -4914,6 +4914,7 @@ connected:
goto err; goto err;
goto connected; goto connected;
} }
DBUG_EXECUTE_IF("fail_com_register_slave", goto err;);
} }
DBUG_PRINT("info",("Starting reading binary log from master")); 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; 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) 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; 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: case ALTER_TABLE_ALGORITHM_INPLACE:
return "ALGORITHM=INPLACE"; return "ALGORITHM=INPLACE";
case ALTER_TABLE_ALGORITHM_COPY: case ALTER_TABLE_ALGORITHM_COPY:
return "ALGORITHM=COPY"; return "ALGORITHM=COPY";
case ALTER_TABLE_ALGORITHM_NONE:
DBUG_ASSERT(0);
/* Fall through */
case ALTER_TABLE_ALGORITHM_DEFAULT: case ALTER_TABLE_ALGORITHM_DEFAULT:
return "ALGORITHM=DEFAULT"; return "ALGORITHM=DEFAULT";
case ALTER_TABLE_ALGORITHM_NOCOPY: 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, bool Alter_info::supports_algorithm(THD *thd, enum_alter_inplace_result result,
const Alter_inplace_info *ha_alter_info) 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) { switch (result) {
case HA_ALTER_INPLACE_EXCLUSIVE_LOCK: case HA_ALTER_INPLACE_EXCLUSIVE_LOCK:
case HA_ALTER_INPLACE_SHARED_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; return false;
case HA_ALTER_INPLACE_COPY_NO_LOCK: case HA_ALTER_INPLACE_COPY_NO_LOCK:
case HA_ALTER_INPLACE_COPY_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"); "ALGORITHM=INPLACE");
return true; return true;
} }
return false; return false;
case HA_ALTER_INPLACE_NOCOPY_NO_LOCK: case HA_ALTER_INPLACE_NOCOPY_NO_LOCK:
case HA_ALTER_INPLACE_NOCOPY_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", ha_alter_info->report_unsupported_error("ALGORITHM=INSTANT",
"ALGORITHM=NOCOPY"); "ALGORITHM=NOCOPY");
@ -153,9 +157,9 @@ bool Alter_info::supports_algorithm(THD *thd, enum_alter_inplace_result result,
} }
return false; return false;
case HA_ALTER_INPLACE_NOT_SUPPORTED: 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"); "ALGORITHM=COPY");
return true; return true;
} }
@ -176,7 +180,7 @@ bool Alter_info::supports_lock(THD *thd, enum_alter_inplace_result result,
case HA_ALTER_INPLACE_EXCLUSIVE_LOCK: case HA_ALTER_INPLACE_EXCLUSIVE_LOCK:
// If SHARED lock and no particular algorithm was requested, use COPY. // If SHARED lock and no particular algorithm was requested, use COPY.
if (requested_lock == Alter_info::ALTER_TABLE_LOCK_SHARED && 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 == thd->variables.alter_algorithm ==
Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT) Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT)
return false; return false;
@ -239,6 +243,14 @@ bool Alter_info::vers_prohibited(THD *thd) const
return false; 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() Alter_table_ctx::Alter_table_ctx()
: implicit_default_value_error_field(NULL), : implicit_default_value_error_field(NULL),

View File

@ -58,7 +58,10 @@ public:
ALTER_TABLE_ALGORITHM_NOCOPY, ALTER_TABLE_ALGORITHM_NOCOPY,
// Instant should allow any operation that changes metadata only. // 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; List<const char> partition_names;
// Number of partitions. // Number of partitions.
uint num_parts; uint num_parts;
private:
// Type of ALTER TABLE algorithm. // Type of ALTER TABLE algorithm.
enum_alter_table_algorithm requested_algorithm; enum_alter_table_algorithm requested_algorithm;
public:
// Type of ALTER TABLE lock. // Type of ALTER TABLE lock.
enum_alter_table_lock requested_lock; enum_alter_table_lock requested_lock;
@ -117,7 +123,7 @@ public:
flags(0), partition_flags(0), flags(0), partition_flags(0),
keys_onoff(LEAVE_AS_IS), keys_onoff(LEAVE_AS_IS),
num_parts(0), num_parts(0),
requested_algorithm(ALTER_TABLE_ALGORITHM_DEFAULT), requested_algorithm(ALTER_TABLE_ALGORITHM_NONE),
requested_lock(ALTER_TABLE_LOCK_DEFAULT) requested_lock(ALTER_TABLE_LOCK_DEFAULT)
{} {}
@ -134,7 +140,7 @@ public:
keys_onoff= LEAVE_AS_IS; keys_onoff= LEAVE_AS_IS;
num_parts= 0; num_parts= 0;
partition_names.empty(); partition_names.empty();
requested_algorithm= ALTER_TABLE_ALGORITHM_DEFAULT; requested_algorithm= ALTER_TABLE_ALGORITHM_NONE;
requested_lock= ALTER_TABLE_LOCK_DEFAULT; requested_lock= ALTER_TABLE_LOCK_DEFAULT;
} }
@ -181,10 +187,16 @@ public:
bool set_requested_lock(const LEX_CSTRING *str); 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" 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" Returns the lock value in the format "lock=value"
@ -220,6 +232,12 @@ public:
bool supports_lock(THD *thd, enum_alter_inplace_result result, bool supports_lock(THD *thd, enum_alter_inplace_result result,
const Alter_inplace_info *ha_alter_info); 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: private:
Alter_info &operator=(const Alter_info &rhs); // not implemented Alter_info &operator=(const Alter_info &rhs); // not implemented
Alter_info(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 Copyright (c) 2009, 2020, MariaDB Corporation
This program is free software; you can redistribute it and/or modify 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) 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; uchar c;
while (!eof()) while (!eof())
{ {
c= yyGet(); c= yyGet();
if (remaining_recursions_permitted > 0) if (remaining_recursions_permitted == 1)
{ {
if ((c == '/') && (yyPeek() == '*')) if ((c == '/') && (yyPeek() == '*'))
{ {
yySkip(); // Eat asterisk yyUnput('('); // Replace nested "/*..." with "(*..."
consume_comment(remaining_recursions_permitted - 1); yySkip(); // and skip "("
yySkip(); /* Eat asterisk */
if (consume_comment(0))
return true;
yyUnput(')'); // Replace "...*/" with "...*)"
yySkip(); // and skip ")"
continue; 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); general_log_print(thd, command, "Log: '%s' Pos: %lu", name, pos);
if (nlen < FN_REFLEN) if (nlen < FN_REFLEN)
mysql_binlog_send(thd, thd->strmake(name, nlen), (my_off_t)pos, flags); 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 */ /* fake COM_QUIT -- if we get here, the thread needs to terminate */
error = TRUE; error = TRUE;
break; break;

View File

@ -5908,7 +5908,7 @@ the generated partition syntax in a correct manner.
*/ */
if (alter_info->partition_flags != ALTER_PARTITION_INFO || if (alter_info->partition_flags != ALTER_PARTITION_INFO ||
!table->part_info || !table->part_info ||
alter_info->requested_algorithm != alter_info->algorithm(thd) !=
Alter_info::ALTER_TABLE_ALGORITHM_INPLACE || Alter_info::ALTER_TABLE_ALGORITHM_INPLACE ||
!table->part_info->has_same_partitioning(part_info)) !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; uchar *key_buff=j->ref.key_buff, *null_ref_key= 0;
uint null_ref_part= NO_REF_PART; uint null_ref_part= NO_REF_PART;
bool keyuse_uses_no_tables= TRUE; bool keyuse_uses_no_tables= TRUE;
uint not_null_keyparts= 0;
if (ftkey) if (ftkey)
{ {
j->ref.items[0]=((Item_func*)(keyuse->val))->key_item(); 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.items[i]=keyuse->val; // Save for cond removal
j->ref.cond_guards[i]= keyuse->cond_guard; 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 Set ref.null_rejecting to true only if we are going to inject a
"keyuse->val IS NOT NULL" predicate. "keyuse->val IS NOT NULL" predicate.
@ -10830,10 +10833,16 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j,
if (j->type == JT_CONST) if (j->type == JT_CONST)
j->table->const_table= 1; j->table->const_table= 1;
else if (!((keyparts == keyinfo->user_defined_key_parts && 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 (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) && MY_TEST(key_flags & HA_EXT_NOSAME) &&
keyparts == keyinfo->ext_key_parts)) || keyparts == keyinfo->ext_key_parts)
) ||
null_ref_key) null_ref_key)
{ {
/* Must read with repeat */ /* Must read with repeat */

View File

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

View File

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

View File

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

View File

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

View File

@ -157,6 +157,7 @@ class DllExport TDBXML : public TDBASE {
/* Class XMLCOL: XDB table access method column descriptor. */ /* Class XMLCOL: XDB table access method column descriptor. */
/***********************************************************************/ /***********************************************************************/
class XMLCOL : public COLBLK { class XMLCOL : public COLBLK {
friend class TDBXML;
public: public:
// Constructors // Constructors
XMLCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am = "XML"); 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 @param[in,out] mtr mini-transaction
Sets the child node file address in a node pointer. */ Sets the child node file address in a node pointer. */
inline void btr_node_ptr_set_child_page_no(buf_block_t *block, 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) ulint page_no, mtr_t *mtr)
{ {
ut_ad(rec_offs_validate(rec, NULL, offsets)); 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 */ const rec_t* node_ptr,/*!< in: node pointer */
dict_index_t* index, /*!< in: index */ 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 */ mtr_t* mtr) /*!< in: mtr */
{ {
ut_ad(rec_offs_validate(node_ptr, index, offsets)); 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. an sx-latch on the tree.
@return rec_get_offsets() of the node pointer record */ @return rec_get_offsets() of the node pointer record */
static static
offset_t* rec_offs*
btr_page_get_father_node_ptr_func( 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 */ mem_heap_t* heap, /*!< in: memory heap to use */
btr_cur_t* cursor, /*!< in: cursor pointing to user record, btr_cur_t* cursor, /*!< in: cursor pointing to user record,
out: cursor on node pointer 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. an x-latch on the tree.
@return rec_get_offsets() of the node pointer record */ @return rec_get_offsets() of the node pointer record */
static static
offset_t* rec_offs*
btr_page_get_father_block( 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 */ mem_heap_t* heap, /*!< in: memory heap to use */
dict_index_t* index, /*!< in: b-tree index */ dict_index_t* index, /*!< in: b-tree index */
buf_block_t* block, /*!< in: child page in the 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, on the root page; when the function returns,
the cursor is positioned on the predecessor the cursor is positioned on the predecessor
of the inserted record */ 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 */ mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */ const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */ ulint n_ext, /*!< in: number of externally stored columns */
@ -2190,7 +2190,7 @@ btr_page_get_split_rec(
rec_t* next_rec; rec_t* next_rec;
ulint n; ulint n;
mem_heap_t* heap; mem_heap_t* heap;
offset_t* offsets; rec_offs* offsets;
page = btr_cur_get_page(cursor); page = btr_cur_get_page(cursor);
@ -2296,7 +2296,7 @@ btr_page_insert_fits(
const rec_t* split_rec,/*!< in: suggestion for first record const rec_t* split_rec,/*!< in: suggestion for first record
on upper half-page, or NULL if on upper half-page, or NULL if
tuple to be inserted should be first */ 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 */ split_rec, cursor->index); out: garbage */
const dtuple_t* tuple, /*!< in: tuple to insert */ const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */ ulint n_ext, /*!< in: number of externally stored columns */
@ -2396,8 +2396,8 @@ btr_insert_on_non_leaf_level_func(
dberr_t err; dberr_t err;
rec_t* rec; rec_t* rec;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_; rec_offs* offsets = offsets_;
rec_offs_init(offsets_); rec_offs_init(offsets_);
rtr_info_t rtr_info; rtr_info_t rtr_info;
@ -2497,7 +2497,7 @@ btr_attach_half_pages(
if (direction == FSP_DOWN) { if (direction == FSP_DOWN) {
btr_cur_t cursor; btr_cur_t cursor;
offset_t* offsets; rec_offs* offsets;
lower_block = new_block; lower_block = new_block;
upper_block = block; upper_block = block;
@ -2599,7 +2599,7 @@ btr_page_tuple_smaller(
/*===================*/ /*===================*/
btr_cur_t* cursor, /*!< in: b-tree cursor */ btr_cur_t* cursor, /*!< in: b-tree cursor */
const dtuple_t* tuple, /*!< in: tuple to consider */ 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 ulint n_uniq, /*!< in: number of unique fields
in the index page records */ in the index page records */
mem_heap_t** heap) /*!< in/out: heap for offsets */ mem_heap_t** heap) /*!< in/out: heap for offsets */
@ -2639,7 +2639,7 @@ rec_t*
btr_insert_into_right_sibling( btr_insert_into_right_sibling(
ulint flags, ulint flags,
btr_cur_t* cursor, btr_cur_t* cursor,
offset_t** offsets, rec_offs** offsets,
mem_heap_t* heap, mem_heap_t* heap,
const dtuple_t* tuple, const dtuple_t* tuple,
ulint n_ext, ulint n_ext,
@ -2775,7 +2775,7 @@ btr_page_split_and_insert(
btr_cur_t* cursor, /*!< in: cursor at which to insert; when the btr_cur_t* cursor, /*!< in: cursor at which to insert; when the
function returns, the cursor is positioned function returns, the cursor is positioned
on the predecessor of the inserted record */ 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 */ mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */ const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */ ulint n_ext, /*!< in: number of externally stored columns */
@ -3249,7 +3249,7 @@ btr_lift_page_up(
{ {
btr_cur_t cursor; btr_cur_t cursor;
offset_t* offsets = NULL; rec_offs* offsets = NULL;
mem_heap_t* heap = mem_heap_create( mem_heap_t* heap = mem_heap_create(
sizeof(*offsets) sizeof(*offsets)
* (REC_OFFS_HEADER_SIZE + 1 + 1 * (REC_OFFS_HEADER_SIZE + 1 + 1
@ -3432,7 +3432,7 @@ btr_compress(
page_t* page; page_t* page;
btr_cur_t father_cursor; btr_cur_t father_cursor;
mem_heap_t* heap; mem_heap_t* heap;
offset_t* offsets; rec_offs* offsets;
ulint nth_rec = 0; /* remove bogus warning */ ulint nth_rec = 0; /* remove bogus warning */
bool mbr_changed = false; bool mbr_changed = false;
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
@ -3573,7 +3573,7 @@ retry:
if (is_left) { if (is_left) {
btr_cur_t cursor2; btr_cur_t cursor2;
rtr_mbr_t new_mbr; rtr_mbr_t new_mbr;
offset_t* offsets2 = NULL; rec_offs* offsets2 = NULL;
/* For rtree, we need to update father's mbr. */ /* For rtree, we need to update father's mbr. */
if (dict_index_is_spatial(index)) { if (dict_index_is_spatial(index)) {
@ -3768,7 +3768,7 @@ retry:
/* For rtree, we need to update father's mbr. */ /* For rtree, we need to update father's mbr. */
if (dict_index_is_spatial(index)) { if (dict_index_is_spatial(index)) {
offset_t* offsets2; rec_offs* offsets2;
ulint rec_info; ulint rec_info;
offsets2 = rec_get_offsets( offsets2 = rec_get_offsets(
@ -3996,7 +3996,7 @@ btr_discard_only_page_on_level(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
const rec_t* rec = NULL; const rec_t* rec = NULL;
offset_t* offsets = NULL; rec_offs* offsets = NULL;
if (index->table->instant) { if (index->table->instant) {
const rec_t* r = page_rec_get_next(page_get_infimum_rec( const rec_t* r = page_rec_get_next(page_get_infimum_rec(
block->frame)); block->frame));
@ -4226,7 +4226,7 @@ btr_print_recursive(
ulint width, /*!< in: print this many entries from start ulint width, /*!< in: print this many entries from start
and end */ and end */
mem_heap_t** heap, /*!< in/out: heap for rec_get_offsets() */ 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 */ mtr_t* mtr) /*!< in: mtr */
{ {
const page_t* page = buf_block_get_frame(block); const page_t* page = buf_block_get_frame(block);
@ -4290,8 +4290,8 @@ btr_print_index(
mtr_t mtr; mtr_t mtr;
buf_block_t* root; buf_block_t* root;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_; rec_offs* offsets = offsets_;
rec_offs_init(offsets_); rec_offs_init(offsets_);
fputs("--------------------------\n" fputs("--------------------------\n"
@ -4325,7 +4325,7 @@ btr_check_node_ptr(
{ {
mem_heap_t* heap; mem_heap_t* heap;
dtuple_t* tuple; dtuple_t* tuple;
offset_t* offsets; rec_offs* offsets;
btr_cur_t cursor; btr_cur_t cursor;
page_t* page = buf_block_get_frame(block); page_t* page = buf_block_get_frame(block);
@ -4405,8 +4405,8 @@ btr_index_rec_validate(
ulint len; ulint len;
const page_t* page; const page_t* page;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_; rec_offs* offsets = offsets_;
rec_offs_init(offsets_); rec_offs_init(offsets_);
page = page_align(rec); page = page_align(rec);
@ -4671,8 +4671,8 @@ btr_validate_level(
bool ret = true; bool ret = true;
mtr_t mtr; mtr_t mtr;
mem_heap_t* heap = mem_heap_create(256); mem_heap_t* heap = mem_heap_create(256);
offset_t* offsets = NULL; rec_offs* offsets = NULL;
offset_t* offsets2= NULL; rec_offs* offsets2= NULL;
#ifdef UNIV_ZIP_DEBUG #ifdef UNIV_ZIP_DEBUG
page_zip_des_t* page_zip; page_zip_des_t* page_zip;
#endif /* UNIV_ZIP_DEBUG */ #endif /* UNIV_ZIP_DEBUG */

View File

@ -153,7 +153,7 @@ PageBulk::init()
@param[in,out] rec record @param[in,out] rec record
@param[in] offsets record offsets */ @param[in] offsets record offsets */
template<PageBulk::format fmt> 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((m_page_zip != nullptr) == (fmt == COMPRESSED));
ut_ad((fmt != REDUNDANT) == m_is_comp); 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)) (fmt == REDUNDANT ? PAGE_OLD_INFIMUM : PAGE_NEW_INFIMUM))
{ {
const rec_t *old_rec = m_cur_rec; 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); ULINT_UNDEFINED, &m_heap);
ut_ad(cmp_rec_rec(rec, old_rec, offsets, old_offsets, m_index) > 0); 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. /** Insert a record in the page.
@param[in] rec record @param[in] rec record
@param[in] offsets record offsets */ @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]; byte rec_hdr[REC_N_OLD_EXTRA_BYTES];
static_assert(REC_N_OLD_EXTRA_BYTES > REC_N_NEW_EXTRA_BYTES, "file format"); static_assert(REC_N_OLD_EXTRA_BYTES > REC_N_NEW_EXTRA_BYTES, "file format");
@ -572,7 +572,7 @@ rec_t*
PageBulk::getSplitRec() PageBulk::getSplitRec()
{ {
rec_t* rec; rec_t* rec;
offset_t* offsets; rec_offs* offsets;
ulint total_used_size; ulint total_used_size;
ulint total_recs_size; ulint total_recs_size;
ulint n_recs; ulint n_recs;
@ -618,7 +618,7 @@ PageBulk::copyIn(
{ {
rec_t* rec = split_rec; rec_t* rec = split_rec;
offset_t* offsets = NULL; rec_offs* offsets = NULL;
ut_ad(m_rec_no == 0); ut_ad(m_rec_no == 0);
ut_ad(page_rec_is_user_rec(rec)); ut_ad(page_rec_is_user_rec(rec));
@ -664,7 +664,7 @@ PageBulk::copyOut(
ut_ad(n > 0); ut_ad(n > 0);
/* Set last record's next in page */ /* Set last record's next in page */
offset_t* offsets = NULL; rec_offs* offsets = NULL;
rec = page_rec_get_prev(split_rec); rec = page_rec_get_prev(split_rec);
offsets = rec_get_offsets(rec, m_index, offsets, offsets = rec_get_offsets(rec, m_index, offsets,
page_rec_is_leaf(split_rec), 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 dberr_t
PageBulk::storeExt( PageBulk::storeExt(
const big_rec_t* big_rec, const big_rec_t* big_rec,
offset_t* offsets) rec_offs* offsets)
{ {
/* Note: not all fileds are initialized in btr_pcur. */ /* Note: not all fileds are initialized in btr_pcur. */
btr_pcur_t 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); ulint rec_size = rec_get_converted_size(m_index, tuple, n_ext);
big_rec_t* big_rec = NULL; big_rec_t* big_rec = NULL;
rec_t* rec = NULL; rec_t* rec = NULL;
offset_t* offsets = NULL; rec_offs* offsets = NULL;
if (page_bulk->needExt(tuple, rec_size)) { if (page_bulk->needExt(tuple, rec_size)) {
/* The record is so big that we have to store some fields /* 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 */ buf_block_t* block, /*!< in/out: index page */
rec_t* rec, /*!< in/out: record in a clustered index */ rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */ 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 */ mtr_t* mtr); /*!< in: mtr, or NULL if not logged */
/*******************************************************************//** /*******************************************************************//**
Adds path information to the cursor for the current page, for which Adds path information to the cursor for the current page, for which
@ -181,7 +181,7 @@ btr_rec_free_updated_extern_fields(
X-latched */ X-latched */
rec_t* rec, /*!< in: record */ rec_t* rec, /*!< in: record */
buf_block_t* block, /*!< in: index page of rec */ 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 */ const upd_t* update, /*!< in: update vector */
bool rollback,/*!< in: performing rollback? */ bool rollback,/*!< in: performing rollback? */
mtr_t* mtr); /*!< in: mini-transaction handle which contains 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 dict_index_t* index, /*!< in: index of the data, the index
tree MUST be X-latched */ tree MUST be X-latched */
rec_t* rec, /*!< in: record */ 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 */ buf_block_t* block, /*!< in: index page of rec */
bool rollback,/*!< in: performing rollback? */ bool rollback,/*!< in: performing rollback? */
mtr_t* mtr); /*!< in: mini-transaction handle which contains mtr_t* mtr); /*!< in: mini-transaction handle which contains
@ -590,7 +590,7 @@ incompatible:
} }
mem_heap_t* heap = NULL; 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); ULINT_UNDEFINED, &heap);
if (rec_offs_any_default(offsets)) { if (rec_offs_any_default(offsets)) {
inconsistent: inconsistent:
@ -1286,10 +1286,10 @@ btr_cur_search_to_nth_level_func(
btr_search_t* info; btr_search_t* info;
#endif /* BTR_CUR_ADAPT */ #endif /* BTR_CUR_ADAPT */
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_; rec_offs* offsets = offsets_;
offset_t offsets2_[REC_OFFS_NORMAL_SIZE]; rec_offs offsets2_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets2 = offsets2_; rec_offs* offsets2 = offsets2_;
rec_offs_init(offsets_); rec_offs_init(offsets_);
rec_offs_init(offsets2_); rec_offs_init(offsets2_);
/* Currently, PAGE_CUR_LE is the only search mode used for searches /* 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_blocks = 0;
ulint n_releases = 0; ulint n_releases = 0;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_; rec_offs* offsets = offsets_;
dberr_t err = DB_SUCCESS; dberr_t err = DB_SUCCESS;
rec_offs_init(offsets_); rec_offs_init(offsets_);
@ -2896,8 +2896,8 @@ btr_cur_open_at_rnd_pos_func(
ulint n_blocks = 0; ulint n_blocks = 0;
ulint n_releases = 0; ulint n_releases = 0;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_; rec_offs* offsets = offsets_;
rec_offs_init(offsets_); rec_offs_init(offsets_);
ut_ad(!index->is_spatial()); ut_ad(!index->is_spatial());
@ -3185,7 +3185,7 @@ btr_cur_insert_if_possible(
cursor stays valid */ cursor stays valid */
const dtuple_t* tuple, /*!< in: tuple to insert; the size info need not const dtuple_t* tuple, /*!< in: tuple to insert; the size info need not
have been stored to tuple */ 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 */ mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
ulint n_ext, /*!< in: number of externally stored columns */ ulint n_ext, /*!< in: number of externally stored columns */
mtr_t* mtr) /*!< in/out: mini-transaction */ mtr_t* mtr) /*!< in/out: mini-transaction */
@ -3341,7 +3341,7 @@ btr_cur_optimistic_insert(
specified */ specified */
btr_cur_t* cursor, /*!< in: cursor on page after which to insert; btr_cur_t* cursor, /*!< in: cursor on page after which to insert;
cursor stays valid */ 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 */ mem_heap_t** heap, /*!< in/out: pointer to memory heap */
dtuple_t* entry, /*!< in/out: entry to insert */ dtuple_t* entry, /*!< in/out: entry to insert */
rec_t** rec, /*!< out: pointer to inserted record if rec_t** rec, /*!< out: pointer to inserted record if
@ -3646,7 +3646,7 @@ btr_cur_pessimistic_insert(
insertion will certainly succeed */ insertion will certainly succeed */
btr_cur_t* cursor, /*!< in: cursor after which to insert; btr_cur_t* cursor, /*!< in: cursor after which to insert;
cursor stays valid */ 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 mem_heap_t** heap, /*!< in/out: pointer to memory heap
that can be emptied */ that can be emptied */
dtuple_t* entry, /*!< in/out: entry to insert */ 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 */ ulint flags, /*!< in: undo logging and locking flags */
btr_cur_t* cursor, /*!< in: cursor on record to update */ 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 */ const upd_t* update, /*!< in: update vector */
ulint cmpl_info,/*!< in: compiler info on secondary index ulint cmpl_info,/*!< in: compiler info on secondary index
updates */ updates */
@ -3900,7 +3900,7 @@ static void btr_cur_write_sys(
@param[in] roll_ptr DB_ROLL_PTR value @param[in] roll_ptr DB_ROLL_PTR value
@param[in,out] mtr mini-transaction */ @param[in,out] mtr mini-transaction */
static void btr_cur_upd_rec_sys(buf_block_t *block, rec_t *rec, 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, const trx_t *trx, roll_ptr_t roll_ptr,
mtr_t *mtr) mtr_t *mtr)
{ {
@ -4001,7 +4001,7 @@ btr_cur_update_alloc_zip_func(
page_cur_t* cursor, /*!< in/out: B-tree page cursor */ page_cur_t* cursor, /*!< in/out: B-tree page cursor */
dict_index_t* index, /*!< in: the index corresponding to cursor */ dict_index_t* index, /*!< in: the index corresponding to cursor */
#ifdef UNIV_DEBUG #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 */ #endif /* UNIV_DEBUG */
ulint length, /*!< in: size needed */ ulint length, /*!< in: size needed */
bool create, /*!< in: true=delete-and-insert, 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] block index page
@param[in,out] mtr mini-transaction */ @param[in,out] mtr mini-transaction */
void btr_cur_upd_rec_in_place(rec_t *rec, const dict_index_t *index, 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) buf_block_t *block, mtr_t *mtr)
{ {
ut_ad(rec_offs_validate(rec, index, offsets)); 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; btr_cur_t* cursor, /*!< in: cursor on the record to update;
cursor stays valid and positioned on the cursor stays valid and positioned on the
same record */ 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 */ const upd_t* update, /*!< in: update vector */
ulint cmpl_info,/*!< in: compiler info on secondary index ulint cmpl_info,/*!< in: compiler info on secondary index
updates */ updates */
@ -4499,7 +4499,7 @@ btr_cur_optimistic_update(
btr_cur_t* cursor, /*!< in: cursor on the record to update; btr_cur_t* cursor, /*!< in: cursor on the record to update;
cursor stays valid and positioned on the cursor stays valid and positioned on the
same record */ 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 */ mem_heap_t** heap, /*!< in/out: pointer to NULL or memory heap */
const upd_t* update, /*!< in: update vector; this must also const upd_t* update, /*!< in: update vector; this must also
contain trx id and roll ptr fields */ 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; btr_cur_t* cursor, /*!< in/out: cursor on the record to update;
cursor may become invalid if *big_rec == NULL cursor may become invalid if *big_rec == NULL
|| !(flags & BTR_KEEP_POS_FLAG) */ || !(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, mem_heap_t** offsets_heap,
/*!< in/out: pointer to memory heap /*!< in/out: pointer to memory heap
that can be emptied */ 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 */ buf_block_t* block, /*!< in/out: buffer block of the record */
rec_t* rec, /*!< in/out: record */ rec_t* rec, /*!< in/out: record */
dict_index_t* index, /*!< in: clustered index of the 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 */ que_thr_t* thr, /*!< in: query thread */
const dtuple_t* entry, /*!< in: dtuple for the deleting record, also const dtuple_t* entry, /*!< in: dtuple for the deleting record, also
contains the virtual cols if there are any */ contains the virtual cols if there are any */
@ -5449,8 +5449,8 @@ btr_cur_optimistic_delete_func(
buf_block_t* block; buf_block_t* block;
rec_t* rec; rec_t* rec;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_; rec_offs* offsets = offsets_;
ibool no_compress_needed; ibool no_compress_needed;
rec_offs_init(offsets_); rec_offs_init(offsets_);
@ -5632,7 +5632,7 @@ btr_cur_pessimistic_delete(
bool success; bool success;
ibool ret = FALSE; ibool ret = FALSE;
mem_heap_t* heap; mem_heap_t* heap;
offset_t* offsets; rec_offs* offsets;
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
bool parent_latched = false; bool parent_latched = false;
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
@ -5784,7 +5784,7 @@ discard_page:
rtr_mbr_t father_mbr; rtr_mbr_t father_mbr;
rec_t* father_rec; rec_t* father_rec;
btr_cur_t father_cursor; btr_cur_t father_cursor;
offset_t* offsets; rec_offs* offsets;
bool upd_ret; bool upd_ret;
ulint len; ulint len;
@ -6527,7 +6527,7 @@ btr_record_not_null_field_in_rec(
ulint n_unique, /*!< in: dict_index_get_n_unique(index), ulint n_unique, /*!< in: dict_index_get_n_unique(index),
number of columns uniquely determine number of columns uniquely determine
an index entry */ 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 its size could be for all fields or
that of "n_unique" */ that of "n_unique" */
ib_uint64_t* n_not_null) /*!< in/out: array to record number of 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; uintmax_t add_on;
mtr_t mtr; mtr_t mtr;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
offset_t* offsets_rec = NULL; rec_offs* offsets_rec = NULL;
offset_t* offsets_next_rec = NULL; rec_offs* offsets_next_rec = NULL;
/* For spatial index, there is no such stats can be /* For spatial index, there is no such stats can be
fetched. */ fetched. */
@ -6771,7 +6771,7 @@ btr_estimate_number_of_different_key_vals(
and assign the old offsets_rec buffer to and assign the old offsets_rec buffer to
offsets_next_rec. */ offsets_next_rec. */
{ {
offset_t* offsets_tmp = offsets_rec; rec_offs* offsets_tmp = offsets_rec;
offsets_rec = offsets_next_rec; offsets_rec = offsets_next_rec;
offsets_next_rec = offsets_tmp; offsets_next_rec = offsets_tmp;
} }
@ -6856,7 +6856,7 @@ static
ulint ulint
btr_rec_get_field_ref_offs( 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 n) /*!< in: index of the external field */
{ {
ulint field_ref_offs; ulint field_ref_offs;
@ -6885,7 +6885,7 @@ btr_rec_get_field_ref_offs(
ulint ulint
btr_rec_get_externally_stored_len( btr_rec_get_externally_stored_len(
const rec_t* rec, const rec_t* rec,
const offset_t* offsets) const rec_offs* offsets)
{ {
ulint n_fields; ulint n_fields;
ulint total_extern_len = 0; ulint total_extern_len = 0;
@ -6923,7 +6923,7 @@ btr_cur_set_ownership_of_extern_field(
buf_block_t* block, /*!< in/out: index page */ buf_block_t* block, /*!< in/out: index page */
rec_t* rec, /*!< in/out: clustered index record */ rec_t* rec, /*!< in/out: clustered index record */
dict_index_t* index, /*!< in: index of the page */ 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 */ ulint i, /*!< in: field number */
bool val, /*!< in: value to set */ bool val, /*!< in: value to set */
mtr_t* mtr) /*!< in: mtr, or NULL if not logged */ 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 */ buf_block_t* block, /*!< in/out: index page */
rec_t* rec, /*!< in/out: record in a clustered index */ rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */ 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 */ const upd_t* update, /*!< in: update vector */
mtr_t* mtr) /*!< in/out: mini-transaction */ mtr_t* mtr) /*!< in/out: mini-transaction */
{ {
@ -6997,7 +6997,7 @@ btr_cur_unmark_extern_fields(
buf_block_t* block, /*!< in/out: index page */ buf_block_t* block, /*!< in/out: index page */
rec_t* rec, /*!< in/out: record in a clustered index */ rec_t* rec, /*!< in/out: record in a clustered index */
dict_index_t* index, /*!< in: index of the page */ 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 */ mtr_t* mtr) /*!< in: mtr, or NULL if not logged */
{ {
ut_ad(!rec_offs_comp(offsets) || !rec_get_node_ptr_flag(rec)); 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 */ /** Mini transaction holding the latches for m_pcur */
mtr_t* m_mtr; mtr_t* m_mtr;
/** rec_get_offsets(rec, index); offset of clust_rec */ /** rec_get_offsets(rec, index); offset of clust_rec */
const offset_t* m_offsets; const rec_offs* m_offsets;
/** The block containing clustered record */ /** The block containing clustered record */
buf_block_t** m_block; buf_block_t** m_block;
/** The clustered record pointer */ /** The clustered record pointer */
@ -7087,7 +7087,7 @@ struct btr_blob_log_check_t {
btr_blob_log_check_t( btr_blob_log_check_t(
btr_pcur_t* pcur, btr_pcur_t* pcur,
mtr_t* mtr, mtr_t* mtr,
const offset_t* offsets, const rec_offs* offsets,
buf_block_t** block, buf_block_t** block,
rec_t** rec, rec_t** rec,
enum blob_op op) enum blob_op op)
@ -7152,7 +7152,7 @@ struct btr_blob_log_check_t {
*m_rec = btr_pcur_get_rec(m_pcur); *m_rec = btr_pcur_get_rec(m_pcur);
rec_offs_make_valid(*m_rec, index, true, 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( ut_ad(m_mtr->memo_contains_page_flagged(
*m_rec, *m_rec,
@ -7183,7 +7183,7 @@ btr_store_big_rec_extern_fields(
btr_pcur_t* pcur, /*!< in/out: a persistent cursor. if btr_pcur_t* pcur, /*!< in/out: a persistent cursor. if
btr_mtr is restarted, then this can btr_mtr is restarted, then this can
be repositioned. */ 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 pcur. the "external storage" flags
in offsets will correctly correspond in offsets will correctly correspond
to rec when this function returns */ to rec when this function returns */
@ -7615,7 +7615,7 @@ btr_free_externally_stored_field(
byte* field_ref, /*!< in/out: field reference */ byte* field_ref, /*!< in/out: field reference */
const rec_t* rec, /*!< in: record containing field_ref, for const rec_t* rec, /*!< in: record containing field_ref, for
page_zip_write_blob_ptr(), or NULL */ 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 */ or NULL */
buf_block_t* block, /*!< in/out: page of field_ref */ buf_block_t* block, /*!< in/out: page of field_ref */
ulint i, /*!< in: field number 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 dict_index_t* index, /*!< in: index of the data, the index
tree MUST be X-latched */ tree MUST be X-latched */
rec_t* rec, /*!< in/out: record */ 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 */ buf_block_t* block, /*!< in: index page of rec */
bool rollback,/*!< in: performing rollback? */ bool rollback,/*!< in: performing rollback? */
mtr_t* mtr) /*!< in: mini-transaction handle which contains mtr_t* mtr) /*!< in: mini-transaction handle which contains
@ -7821,7 +7821,7 @@ btr_rec_free_updated_extern_fields(
X-latched */ X-latched */
rec_t* rec, /*!< in/out: record */ rec_t* rec, /*!< in/out: record */
buf_block_t* block, /*!< in: index page of rec */ 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 */ const upd_t* update, /*!< in: update vector */
bool rollback,/*!< in: performing rollback? */ bool rollback,/*!< in: performing rollback? */
mtr_t* mtr) /*!< in: mini-transaction handle which contains mtr_t* mtr) /*!< in: mini-transaction handle which contains
@ -8218,7 +8218,7 @@ protected by a lock or a page latch
byte* byte*
btr_rec_copy_externally_stored_field( btr_rec_copy_externally_stored_field(
const rec_t* rec, const rec_t* rec,
const offset_t* offsets, const rec_offs* offsets,
ulint zip_size, ulint zip_size,
ulint no, ulint no,
ulint* len, ulint* len,

View File

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

View File

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

View File

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

View File

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

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_table, NULL,
foreign->foreign_col_names, foreign->foreign_col_names,
foreign->n_fields, NULL, true, false, foreign->n_fields, NULL, true, false,
NULL, NULL, NULL); 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 { } else {
for (unsigned f = 0; f < foreign->n_fields; f++) { for (unsigned f = 0; f < foreign->n_fields; f++) {
@ -638,7 +636,41 @@ dict_mem_table_col_rename_low(
foreign = *it; 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++) { for (unsigned f = 0; f < foreign->n_fields; f++) {
/* foreign->referenced_col_names[] need to be /* foreign->referenced_col_names[] need to be
@ -1288,7 +1320,7 @@ bool dict_table_t::deserialise_columns(const byte* metadata, ulint len)
bool bool
dict_index_t::vers_history_row( dict_index_t::vers_history_row(
const rec_t* rec, const rec_t* rec,
const offset_t* offsets) const rec_offs* offsets)
{ {
ut_ad(is_primary()); ut_ad(is_primary());
@ -1319,8 +1351,8 @@ dict_index_t::vers_history_row(
bool error = false; bool error = false;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
dict_index_t* clust_index = NULL; dict_index_t* clust_index = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_; rec_offs* offsets = offsets_;
rec_offs_init(offsets_); rec_offs_init(offsets_);
mtr_t mtr; mtr_t mtr;

View File

@ -1010,8 +1010,8 @@ dict_stats_analyze_index_level(
bool prev_rec_is_copied; bool prev_rec_is_copied;
byte* prev_rec_buf = NULL; byte* prev_rec_buf = NULL;
ulint prev_rec_buf_size = 0; ulint prev_rec_buf_size = 0;
offset_t* rec_offsets; rec_offs* rec_offsets;
offset_t* prev_rec_offsets; rec_offs* prev_rec_offsets;
ulint i; ulint i;
DEBUG_PRINTF(" %s(table=%s, index=%s, level=" ULINTPF ")\n", 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; i = (REC_OFFS_HEADER_SIZE + 1 + 1) + n_uniq;
heap = mem_heap_create((2 * sizeof *rec_offsets) * i); 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)); 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)); mem_heap_alloc(heap, i * sizeof *prev_rec_offsets));
rec_offs_set_n_alloc(rec_offsets, i); rec_offs_set_n_alloc(rec_offsets, i);
rec_offs_set_n_alloc(prev_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), @return offsets1 or offsets2 (the offsets of *out_rec),
or NULL if the page is empty and does not contain user records. */ or NULL if the page is empty and does not contain user records. */
UNIV_INLINE UNIV_INLINE
offset_t* rec_offs*
dict_stats_scan_page( dict_stats_scan_page(
const rec_t** out_rec, const rec_t** out_rec,
offset_t* offsets1, rec_offs* offsets1,
offset_t* offsets2, rec_offs* offsets2,
const dict_index_t* index, const dict_index_t* index,
const page_t* page, const page_t* page,
ulint n_prefix, ulint n_prefix,
@ -1335,8 +1335,8 @@ dict_stats_scan_page(
ib_uint64_t* n_diff, ib_uint64_t* n_diff,
ib_uint64_t* n_external_pages) ib_uint64_t* n_external_pages)
{ {
offset_t* offsets_rec = offsets1; rec_offs* offsets_rec = offsets1;
offset_t* offsets_next_rec = offsets2; rec_offs* offsets_next_rec = offsets2;
const rec_t* rec; const rec_t* rec;
const rec_t* next_rec; const rec_t* next_rec;
/* A dummy heap, to be passed to rec_get_offsets(). /* A dummy heap, to be passed to rec_get_offsets().
@ -1449,9 +1449,9 @@ dict_stats_analyze_index_below_cur(
const page_t* page; const page_t* page;
mem_heap_t* heap; mem_heap_t* heap;
const rec_t* rec; const rec_t* rec;
offset_t* offsets1; rec_offs* offsets1;
offset_t* offsets2; rec_offs* offsets2;
offset_t* offsets_rec; rec_offs* offsets_rec;
ulint size; ulint size;
mtr_t mtr; mtr_t mtr;
@ -1469,10 +1469,10 @@ dict_stats_analyze_index_below_cur(
heap = mem_heap_create(size * (sizeof *offsets1 + sizeof *offsets2)); 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)); heap, size * sizeof *offsets1));
offsets2 = static_cast<offset_t*>(mem_heap_alloc( offsets2 = static_cast<rec_offs*>(mem_heap_alloc(
heap, size * sizeof *offsets2)); heap, size * sizeof *offsets2));
rec_offs_set_n_alloc(offsets1, size); 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 */ dict_index_t* clust_index, /*!< in: cluster index */
btr_pcur_t* pcur, /*!< in: cursor whose position btr_pcur_t* pcur, /*!< in: cursor whose position
has been stored */ has been stored */
offset_t* offsets, /*!< in: offsets */ rec_offs* offsets, /*!< in: offsets */
fts_doc_t* doc) /*!< out: fts doc to hold parsed fts_doc_t* doc) /*!< out: fts doc to hold parsed
documents */ documents */
{ {
@ -3451,7 +3451,7 @@ fts_add_doc_by_id(
btr_pcur_t* doc_pcur; btr_pcur_t* doc_pcur;
const rec_t* clust_rec; const rec_t* clust_rec;
btr_pcur_t clust_pcur; btr_pcur_t clust_pcur;
offset_t* offsets = NULL; rec_offs* offsets = NULL;
ulint num_idx = ib_vector_size(cache->get_docs); ulint num_idx = ib_vector_size(cache->get_docs);
rec = btr_pcur_get_rec(&pcur); rec = btr_pcur_get_rec(&pcur);
@ -5120,7 +5120,7 @@ doc_id_t
fts_get_doc_id_from_rec( fts_get_doc_id_from_rec(
const rec_t* rec, const rec_t* rec,
const dict_index_t* index, const dict_index_t* index,
const offset_t* offsets) const rec_offs* offsets)
{ {
ulint f = dict_col_get_index_pos( ulint f = dict_col_get_index_pos(
&index->table->cols[index->table->fts->doc_col], index); &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 btr_cur_t* cursor, /*!< in: cursor at which to insert; when the
function returns, the cursor is positioned function returns, the cursor is positioned
on the predecessor of the inserted record */ 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 */ const dtuple_t* tuple, /*!< in: tuple to insert */
double** buf_pos)/*!< in/out: current buffer position */ double** buf_pos)/*!< in/out: current buffer position */
{ {
@ -190,7 +190,7 @@ bool
rtr_update_mbr_field( rtr_update_mbr_field(
/*=================*/ /*=================*/
btr_cur_t* cursor, /*!< in/out: cursor pointed to rec.*/ 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 btr_cur_t* cursor2, /*!< in/out: cursor pointed to rec
that should be deleted. that should be deleted.
this cursor is for btr_compress to this cursor is for btr_compress to
@ -218,7 +218,7 @@ rtr_update_mbr_field(
bool ins_suc = true; bool ins_suc = true;
ulint cur2_pos = 0; ulint cur2_pos = 0;
ulint del_page_no = 0; ulint del_page_no = 0;
offset_t* offsets2; rec_offs* offsets2;
rec = btr_cur_get_rec(cursor); rec = btr_cur_get_rec(cursor);
page = page_align(rec); page = page_align(rec);
@ -306,7 +306,7 @@ rtr_update_mbr_field(
} }
if (cursor2) { if (cursor2) {
offset_t* offsets2; rec_offs* offsets2;
if (UNIV_LIKELY_NULL(page_zip)) { if (UNIV_LIKELY_NULL(page_zip)) {
cursor2->page_cur.rec cursor2->page_cur.rec
@ -328,7 +328,7 @@ rtr_update_mbr_field(
page_cur_t page_cur; page_cur_t page_cur;
rec_t* insert_rec; rec_t* insert_rec;
offset_t* insert_offsets = NULL; rec_offs* insert_offsets = NULL;
ulint old_pos; ulint old_pos;
rec_t* old_rec; rec_t* old_rec;
@ -360,7 +360,7 @@ update_mbr:
/* When there're not only 1 rec in the page, we do delete/insert /* When there're not only 1 rec in the page, we do delete/insert
to avoid page split. */ to avoid page split. */
rec_t* insert_rec; rec_t* insert_rec;
offset_t* insert_offsets = NULL; rec_offs* insert_offsets = NULL;
rec_t* next_rec; rec_t* next_rec;
/* Delete the rec which cursor point to. */ /* Delete the rec which cursor point to. */
@ -556,7 +556,7 @@ rtr_adjust_upper_level(
ulint new_page_no; ulint new_page_no;
dict_index_t* index = sea_cur->index; dict_index_t* index = sea_cur->index;
btr_cur_t cursor; btr_cur_t cursor;
offset_t* offsets; rec_offs* offsets;
mem_heap_t* heap; mem_heap_t* heap;
ulint level; ulint level;
dtuple_t* node_ptr_upper; dtuple_t* node_ptr_upper;
@ -713,8 +713,8 @@ rtr_split_page_move_rec_list(
page_cur_t new_page_cursor; page_cur_t new_page_cursor;
page_t* page; page_t* page;
page_t* new_page; page_t* new_page;
offset_t offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_; rec_offs* offsets = offsets_;
page_zip_des_t* new_page_zip page_zip_des_t* new_page_zip
= buf_block_get_page_zip(new_block); = buf_block_get_page_zip(new_block);
rec_t* rec; 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 btr_cur_t* cursor, /*!< in/out: cursor at which to insert; when the
function returns, the cursor is positioned function returns, the cursor is positioned
on the predecessor of the inserted record */ 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 */ mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */ const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */ ulint n_ext, /*!< in: number of externally stored columns */
@ -1229,7 +1229,7 @@ rtr_ins_enlarge_mbr(
mem_heap_t* heap; mem_heap_t* heap;
dict_index_t* index = btr_cur->index; dict_index_t* index = btr_cur->index;
page_cur_t* page_cursor; page_cur_t* page_cursor;
offset_t* offsets; rec_offs* offsets;
node_visit_t* node_visit; node_visit_t* node_visit;
btr_cur_t cursor; btr_cur_t cursor;
page_t* page; page_t* page;
@ -1313,10 +1313,10 @@ rtr_page_copy_rec_list_end_no_locks(
page_cur_t page_cur; page_cur_t page_cur;
page_cur_t cur1; page_cur_t cur1;
rec_t* cur_rec; rec_t* cur_rec;
offset_t offsets_1[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_1[REC_OFFS_NORMAL_SIZE];
offset_t* offsets1 = offsets_1; rec_offs* offsets1 = offsets_1;
offset_t offsets_2[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_2[REC_OFFS_NORMAL_SIZE];
offset_t* offsets2 = offsets_2; rec_offs* offsets2 = offsets_2;
ulint moved = 0; ulint moved = 0;
bool is_leaf = page_is_leaf(new_page); bool is_leaf = page_is_leaf(new_page);
@ -1439,10 +1439,10 @@ rtr_page_copy_rec_list_start_no_locks(
{ {
page_cur_t cur1; page_cur_t cur1;
rec_t* cur_rec; rec_t* cur_rec;
offset_t offsets_1[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_1[REC_OFFS_NORMAL_SIZE];
offset_t* offsets1 = offsets_1; rec_offs* offsets1 = offsets_1;
offset_t offsets_2[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_2[REC_OFFS_NORMAL_SIZE];
offset_t* offsets2 = offsets_2; rec_offs* offsets2 = offsets_2;
page_cur_t page_cur; page_cur_t page_cur;
ulint moved = 0; ulint moved = 0;
bool is_leaf = page_is_leaf(buf_block_get_frame(block)); 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* cursor, /*!< in/out: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */ btr_cur_t* cursor2, /*!< in: the other cursor */
offset_t* offsets, /*!< in: rec offsets */ rec_offs* offsets, /*!< in: rec offsets */
offset_t* offsets2, /*!< in: rec offsets */ rec_offs* offsets2, /*!< in: rec offsets */
rtr_mbr_t* new_mbr) /*!< out: MBR to update */ rtr_mbr_t* new_mbr) /*!< out: MBR to update */
{ {
double* mbr; double* mbr;
@ -1590,8 +1590,8 @@ rtr_merge_and_update_mbr(
/*=====================*/ /*=====================*/
btr_cur_t* cursor, /*!< in/out: cursor */ btr_cur_t* cursor, /*!< in/out: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */ btr_cur_t* cursor2, /*!< in: the other cursor */
offset_t* offsets, /*!< in: rec offsets */ rec_offs* offsets, /*!< in: rec offsets */
offset_t* offsets2, /*!< in: rec offsets */ rec_offs* offsets2, /*!< in: rec offsets */
page_t* child_page, /*!< in: the page. */ page_t* child_page, /*!< in: the page. */
mtr_t* mtr) /*!< in: mtr */ mtr_t* mtr) /*!< in: mtr */
{ {
@ -1654,7 +1654,7 @@ rtr_check_same_block(
{ {
ulint page_no = childb->page.id.page_no(); 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( rec_t* rec = page_rec_get_next(page_get_infimum_rec(
buf_block_get_frame(parentb))); buf_block_get_frame(parentb)));

View File

@ -524,7 +524,7 @@ rtr_compare_cursor_rec(
mem_heap_t** heap) /*!< in: memory heap */ mem_heap_t** heap) /*!< in: memory heap */
{ {
const rec_t* rec; const rec_t* rec;
offset_t* offsets; rec_offs* offsets;
rec = btr_cur_get_rec(cursor); rec = btr_cur_get_rec(cursor);
@ -666,7 +666,7 @@ rtr_page_get_father(
{ {
mem_heap_t* heap = mem_heap_create(100); mem_heap_t* heap = mem_heap_create(100);
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
offset_t* offsets; rec_offs* offsets;
offsets = rtr_page_get_father_block( offsets = rtr_page_get_father_block(
NULL, heap, index, block, mtr, sea_cur, cursor); 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. that mtr holds an SX-latch or X-latch on the tree.
@return rec_get_offsets() of the node pointer record */ @return rec_get_offsets() of the node pointer record */
static static
offset_t* rec_offs*
rtr_page_get_father_node_ptr( 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 */ mem_heap_t* heap, /*!< in: memory heap to use */
btr_cur_t* sea_cur,/*!< in: search cursor */ btr_cur_t* sea_cur,/*!< in: search cursor */
btr_cur_t* cursor, /*!< in: cursor pointing to user record, 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 Returns the father block to a page. It is assumed that mtr holds
an X or SX latch on the tree. an X or SX latch on the tree.
@return rec_get_offsets() of the node pointer record */ @return rec_get_offsets() of the node pointer record */
offset_t* rec_offs*
rtr_page_get_father_block( 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 */ mem_heap_t* heap, /*!< in: memory heap to use */
dict_index_t* index, /*!< in: b-tree index */ dict_index_t* index, /*!< in: b-tree index */
buf_block_t* block, /*!< in: child page in the index */ buf_block_t* block, /*!< in: child page in the index */
@ -1284,8 +1284,8 @@ rtr_cur_restore_position(
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
do { do {
const rec_t* rec; const rec_t* rec;
const offset_t* offsets1; const rec_offs* offsets1;
const offset_t* offsets2; const rec_offs* offsets2;
ulint comp; ulint comp;
rec = btr_pcur_get_rec(r_cursor); rec = btr_pcur_get_rec(r_cursor);
@ -1356,8 +1356,8 @@ search_again:
if (low_match == r_cursor->old_n_fields) { if (low_match == r_cursor->old_n_fields) {
const rec_t* rec; const rec_t* rec;
const offset_t* offsets1; const rec_offs* offsets1;
const offset_t* offsets2; const rec_offs* offsets2;
ulint comp; ulint comp;
rec = btr_pcur_get_rec(r_cursor); rec = btr_pcur_get_rec(r_cursor);
@ -1403,7 +1403,7 @@ rtr_leaf_push_match_rec(
/*====================*/ /*====================*/
const rec_t* rec, /*!< in: record to copy */ const rec_t* rec, /*!< in: record to copy */
rtr_info_t* rtr_info, /*!< in/out: search stack */ 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 */ bool is_comp) /*!< in: is compact format */
{ {
byte* buf; byte* buf;
@ -1588,7 +1588,7 @@ void
rtr_get_mbr_from_rec( rtr_get_mbr_from_rec(
/*=================*/ /*=================*/
const rec_t* rec, /*!< in: data tuple */ 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 */ rtr_mbr_t* mbr) /*!< out MBR */
{ {
ulint rec_f_len; ulint rec_f_len;
@ -1689,8 +1689,8 @@ rtr_cur_search_with_match(
const page_t* page; const page_t* page;
const rec_t* rec; const rec_t* rec;
const rec_t* last_rec; const rec_t* last_rec;
offset_t offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_; rec_offs* offsets = offsets_;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
int cmp = 1; int cmp = 1;
double least_inc = DBL_MAX; double least_inc = DBL_MAX;
@ -1970,8 +1970,8 @@ rtr_cur_search_with_match(
test_rec = match_rec->matched_recs->back(); test_rec = match_rec->matched_recs->back();
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
offset_t offsets_2[REC_OFFS_NORMAL_SIZE]; rec_offs offsets_2[REC_OFFS_NORMAL_SIZE];
offset_t* offsets2 = offsets_2; rec_offs* offsets2 = offsets_2;
rec_offs_init(offsets_2); rec_offs_init(offsets_2);
ut_ad(found); 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); DBUG_RETURN(HA_ALTER_INPLACE_INSTANT);
} }
@ -2545,7 +2546,7 @@ cannot_create_many_fulltext_index:
online = false; online = false;
} }
if (need_rebuild || fts_need_rebuild) { if ((need_rebuild && !supports_instant) || fts_need_rebuild) {
ha_alter_info->handler_flags |= ALTER_RECREATE_TABLE; ha_alter_info->handler_flags |= ALTER_RECREATE_TABLE;
DBUG_RETURN(online DBUG_RETURN(online
? HA_ALTER_INPLACE_COPY_NO_LOCK ? HA_ALTER_INPLACE_COPY_NO_LOCK
@ -3215,7 +3216,7 @@ innobase_rec_to_mysql(
struct TABLE* table, /*!< in/out: MySQL table */ struct TABLE* table, /*!< in/out: MySQL table */
const rec_t* rec, /*!< in: record */ const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: index */ 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, ...) */ rec, index, ...) */
{ {
uint n_fields = table->s->fields; uint n_fields = table->s->fields;
@ -5766,6 +5767,14 @@ add_all_virtual:
return true; 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; 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);
DBUG_ASSERT(i <= altered_table->s->stored_fields + 1); DBUG_ASSERT(i <= altered_table->s->stored_fields + 1);
@ -5867,7 +5876,7 @@ add_all_virtual:
ut_ad(j == n + f); ut_ad(j == n + f);
offset_t* offsets = NULL; rec_offs* offsets = NULL;
mem_heap_t* offsets_heap = NULL; mem_heap_t* offsets_heap = NULL;
big_rec_t* big_rec; big_rec_t* big_rec;
err = btr_cur_pessimistic_update( err = btr_cur_pessimistic_update(

View File

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

View File

@ -326,7 +326,7 @@ ulint
btr_node_ptr_get_child_page_no( btr_node_ptr_get_child_page_no(
/*===========================*/ /*===========================*/
const rec_t* rec, /*!< in: node pointer record */ 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)); MY_ATTRIBUTE((warn_unused_result));
/** Create the root node for a new index tree. /** 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, on the root page; when the function returns,
the cursor is positioned on the predecessor the cursor is positioned on the predecessor
of the inserted record */ 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 mem_heap_t** heap, /*!< in/out: pointer to memory heap
that can be emptied, or NULL */ that can be emptied, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */ 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 btr_cur_t* cursor, /*!< in: cursor at which to insert; when the
function returns, the cursor is positioned function returns, the cursor is positioned
on the predecessor of the inserted record */ 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 mem_heap_t** heap, /*!< in/out: pointer to memory heap
that can be emptied, or NULL */ that can be emptied, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */ const dtuple_t* tuple, /*!< in: tuple to insert */

View File

@ -94,7 +94,7 @@ ulint
btr_node_ptr_get_child_page_no( btr_node_ptr_get_child_page_no(
/*===========================*/ /*===========================*/
const rec_t* rec, /*!< in: node pointer record */ 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; const byte* field;
ulint len; ulint len;

View File

@ -99,7 +99,7 @@ public:
/** Insert a record in the page. /** Insert a record in the page.
@param[in] rec record @param[in] rec record
@param[in] offsets record offsets */ @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: private:
/** Page format */ /** Page format */
enum format { REDUNDANT, DYNAMIC, COMPRESSED }; enum format { REDUNDANT, DYNAMIC, COMPRESSED };
@ -111,7 +111,7 @@ private:
@tparam format the page format @tparam format the page format
@param[in,out] rec record @param[in,out] rec record
@param[in] offsets record offsets */ @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: public:
/** Mark end of insertion to the page. Scan all records to set page /** 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] big_rec external recrod
@param[in] offsets record offsets @param[in] offsets record offsets
@return error code */ @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 /** Get node pointer
@return node pointer */ @return node pointer */

View File

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

View File

@ -1256,7 +1256,7 @@ struct dict_index_t {
@param[in] offsets offsets @param[in] offsets offsets
@return true if row is historical */ @return true if row is historical */
bool 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. /** Check if record in secondary index is historical row.
@param[in] rec record in a secondary index @param[in] rec record in a secondary index

View File

@ -596,7 +596,7 @@ doc_id_t
fts_get_doc_id_from_rec( fts_get_doc_id_from_rec(
const rec_t* rec, const rec_t* rec,
const dict_index_t* index, const dict_index_t* index,
const offset_t* offsets); const rec_offs* offsets);
/** Add new fts doc id to the update vector. /** Add new fts doc id to the update vector.
@param[in] table the table that contains the FTS index. @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 btr_cur_t* cursor, /*!< in/out: cursor at which to insert; when the
function returns, the cursor is positioned function returns, the cursor is positioned
on the predecessor of the inserted record */ 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 */ mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
const dtuple_t* tuple, /*!< in: tuple to insert */ const dtuple_t* tuple, /*!< in: tuple to insert */
ulint n_ext, /*!< in: number of externally stored columns */ ulint n_ext, /*!< in: number of externally stored columns */
@ -257,7 +257,7 @@ void
rtr_get_mbr_from_rec( rtr_get_mbr_from_rec(
/*=================*/ /*=================*/
const rec_t* rec, /*!< in: data tuple */ 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 */ 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 Returns the father block to a page. It is assumed that mtr holds
an X or SX latch on the tree. an X or SX latch on the tree.
@return rec_get_offsets() of the node pointer record */ @return rec_get_offsets() of the node pointer record */
offset_t* rec_offs*
rtr_page_get_father_block( 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 */ mem_heap_t* heap, /*!< in: memory heap to use */
dict_index_t* index, /*!< in: b-tree index */ dict_index_t* index, /*!< in: b-tree index */
buf_block_t* block, /*!< in: child page in the 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* cursor, /*!< in/out: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */ btr_cur_t* cursor2, /*!< in: the other cursor */
offset_t* offsets, /*!< in: rec offsets */ rec_offs* offsets, /*!< in: rec offsets */
offset_t* offsets2, /*!< in: rec offsets */ rec_offs* offsets2, /*!< in: rec offsets */
page_t* child_page, /*!< in: the child page. */ page_t* child_page, /*!< in: the child page. */
mtr_t* mtr); /*!< in: mtr */ mtr_t* mtr); /*!< in: mtr */
@ -420,8 +420,8 @@ rtr_merge_mbr_changed(
/*==================*/ /*==================*/
btr_cur_t* cursor, /*!< in: cursor */ btr_cur_t* cursor, /*!< in: cursor */
btr_cur_t* cursor2, /*!< in: the other cursor */ btr_cur_t* cursor2, /*!< in: the other cursor */
offset_t* offsets, /*!< in: rec offsets */ rec_offs* offsets, /*!< in: rec offsets */
offset_t* offsets2, /*!< in: rec offsets */ rec_offs* offsets2, /*!< in: rec offsets */
rtr_mbr_t* new_mbr); /*!< out: MBR to update */ rtr_mbr_t* new_mbr); /*!< out: MBR to update */
@ -432,7 +432,7 @@ bool
rtr_update_mbr_field( rtr_update_mbr_field(
/*=================*/ /*=================*/
btr_cur_t* cursor, /*!< in: cursor pointed to rec.*/ 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 btr_cur_t* cursor2, /*!< in/out: cursor pointed to rec
that should be deleted. that should be deleted.
this cursor is for btr_compress to this cursor is for btr_compress to

View File

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

View File

@ -32,7 +32,7 @@ innobase_rec_to_mysql(
struct TABLE* table, /*!< in/out: MySQL table */ struct TABLE* table, /*!< in/out: MySQL table */
const rec_t* rec, /*!< in: record */ const rec_t* rec, /*!< in: record */
const dict_index_t* index, /*!< in: index */ 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, ...) */ rec, index, ...) */
MY_ATTRIBUTE((nonnull)); 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 const rec_t* rec, /*!< in: record which should be
modified */ modified */
dict_index_t* index, /*!< in: clustered index */ 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 */ que_thr_t* thr) /*!< in: query thread */
MY_ATTRIBUTE((warn_unused_result)); MY_ATTRIBUTE((warn_unused_result));
/*********************************************************************//** /*********************************************************************//**
@ -338,7 +338,7 @@ lock_sec_rec_read_check_and_lock(
be read or passed over by a be read or passed over by a
read cursor */ read cursor */
dict_index_t* index, /*!< in: secondary index */ 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 lock_mode mode, /*!< in: mode of the lock which
the read cursor should set on the read cursor should set on
records: LOCK_S or LOCK_X; the 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 be read or passed over by a
read cursor */ read cursor */
dict_index_t* index, /*!< in: clustered index */ 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 lock_mode mode, /*!< in: mode of the lock which
the read cursor should set on the read cursor should set on
records: LOCK_S or LOCK_X; the 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 const rec_t* rec, /*!< in: user record which should be read or
passed over by a read cursor */ passed over by a read cursor */
dict_index_t* index, /*!< in: clustered index */ 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 */ ReadView* view); /*!< in: consistent read view */
/*********************************************************************//** /*********************************************************************//**
Checks that a non-clustered index record is seen in a consistent read. 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 */ trx_id_t trx_id, /*!< in: trx id */
const rec_t* rec, /*!< in: user record */ const rec_t* rec, /*!< in: user record */
dict_index_t* index, /*!< in: index */ 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() */ trx_id_t max_trx_id); /*!< in: trx_sys.get_max_trx_id() */
/*********************************************************************//** /*********************************************************************//**
Prints info of locks for all transactions. Prints info of locks for all transactions.
@ -714,7 +714,7 @@ lock_check_trx_id_sanity(
trx_id_t trx_id, /*!< in: trx id */ trx_id_t trx_id, /*!< in: trx id */
const rec_t* rec, /*!< in: user record */ const rec_t* rec, /*!< in: user record */
dict_index_t* index, /*!< in: index */ 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 #ifdef UNIV_DEBUG
/*******************************************************************//** /*******************************************************************//**
Check if the transaction holds any locks on the sys tables 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 rec_t* rec, /*!< in: user record */
const dict_index_t* index, /*!< in: clustered index */ 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)); 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 rec_t* rec, /*!< in: user record */
const dict_index_t* index, /*!< in: clustered index */ 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(dict_index_is_clust(index));
ut_ad(page_rec_is_user_rec(rec)); ut_ad(page_rec_is_user_rec(rec));

View File

@ -537,33 +537,22 @@ private:
std::atomic<bool> check_flush_or_checkpoint_; std::atomic<bool> check_flush_or_checkpoint_;
public: public:
/** mutex protecting the log */
MY_ALIGNED(CACHE_LINE_SIZE) MY_ALIGNED(CACHE_LINE_SIZE)
LogSysMutex mutex; /*!< mutex protecting the log */ LogSysMutex mutex;
MY_ALIGNED(CACHE_LINE_SIZE) /** mutex to serialize access to the flush list when we are putting
FlushOrderMutex log_flush_order_mutex;/*!< mutex to serialize access to dirty blocks in the list. The idea behind this mutex is to be able
the flush list when we are putting to release log_sys.mutex during mtr_commit and still ensure that
dirty blocks in the list. The idea insertions in the flush_list happen in the LSN order. */
behind this mutex is to be able MY_ALIGNED(CACHE_LINE_SIZE) FlushOrderMutex
to release log_sys.mutex during log_flush_order_mutex;
mtr_commit and still ensure that /** log_buffer, append data here */
insertions in the flush_list happen byte *buf;
in the LSN order. */ /** log_buffer, writing data to file from this buffer.
byte* buf; /*!< Memory of double the Before flushing write_buf is swapped with flush_buf */
srv_log_buffer_size is byte *flush_buf;
allocated here. This pointer will change /** recommended maximum size of buf, after which the buffer is flushed */
however to either the first half or the size_t max_buf_free;
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 */
/** Log file stuff. Protected by mutex or write_mutex. */ /** Log file stuff. Protected by mutex or write_mutex. */
struct file { struct file {
/** format of the redo log: e.g., FORMAT_10_5 */ /** 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 */ page_cur_t* cursor, /*!< in/out: a page cursor */
const dtuple_t* tuple, /*!< in: pointer to a data tuple */ const dtuple_t* tuple, /*!< in: pointer to a data tuple */
dict_index_t* index, /*!< in: record descriptor */ 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 */ mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
ulint n_ext, /*!< in: number of externally stored columns */ ulint n_ext, /*!< in: number of externally stored columns */
mtr_t* mtr) /*!< in/out: mini-transaction */ mtr_t* mtr) /*!< in/out: mini-transaction */
@ -163,7 +163,7 @@ page_cur_insert_rec_low(
const page_cur_t*cur, /*!< in: page cursor */ const page_cur_t*cur, /*!< in: page cursor */
dict_index_t* index, /*!< in: record descriptor */ dict_index_t* index, /*!< in: record descriptor */
const rec_t* rec, /*!< in: record to insert after cur */ 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 */ mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((nonnull, warn_unused_result)); MY_ATTRIBUTE((nonnull, warn_unused_result));
@ -185,7 +185,7 @@ page_cur_insert_rec_zip(
page_cur_t* cursor, /*!< in/out: page cursor */ page_cur_t* cursor, /*!< in/out: page cursor */
dict_index_t* index, /*!< in: record descriptor */ dict_index_t* index, /*!< in: record descriptor */
const rec_t* rec, /*!< in: pointer to a physical record */ 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 */ mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((nonnull, warn_unused_result)); MY_ATTRIBUTE((nonnull, warn_unused_result));
/***********************************************************//** /***********************************************************//**
@ -196,7 +196,7 @@ page_cur_delete_rec(
/*================*/ /*================*/
page_cur_t* cursor, /*!< in/out: a page cursor */ page_cur_t* cursor, /*!< in/out: a page cursor */
const dict_index_t* index, /*!< in: record descriptor */ 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) */ cursor->rec, index) */
mtr_t* mtr) /*!< in/out: mini-transaction */ mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((nonnull)); MY_ATTRIBUTE((nonnull));
@ -341,7 +341,7 @@ page_cur_open_on_rnd_user_rec(
struct page_cur_t{ struct page_cur_t{
const dict_index_t* index; const dict_index_t* index;
rec_t* rec; /*!< pointer to a record on page */ 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 */ 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 */ page_cur_t* cursor, /*!< in/out: a page cursor */
const dtuple_t* tuple, /*!< in: pointer to a data tuple */ const dtuple_t* tuple, /*!< in: pointer to a data tuple */
dict_index_t* index, /*!< in: record descriptor */ 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 */ mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */
ulint n_ext, /*!< in: number of externally stored columns */ ulint n_ext, /*!< in: number of externally stored columns */
mtr_t* mtr) /*!< in/out: mini-transaction */ mtr_t* mtr) /*!< in/out: mini-transaction */

View File

@ -1066,7 +1066,7 @@ void
page_rec_print( page_rec_print(
/*===========*/ /*===========*/
const rec_t* rec, /*!< in: physical record */ 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 # ifdef UNIV_BTR_PRINT
/***************************************************************//** /***************************************************************//**
This is used to print the contents of the directory for This is used to print the contents of the directory for
@ -1113,7 +1113,7 @@ ibool
page_rec_validate( page_rec_validate(
/*==============*/ /*==============*/
const rec_t* rec, /*!< in: physical record */ 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 #ifdef UNIV_DEBUG
/***************************************************************//** /***************************************************************//**
Checks that the first directory slot points to the infimum record and 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] create nonzero=insert, zero=update
@param[in,out] mtr mini-transaction */ @param[in,out] mtr mini-transaction */
void page_zip_write_rec(buf_block_t *block, const byte *rec, 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) ulint create, mtr_t *mtr)
MY_ATTRIBUTE((nonnull)); MY_ATTRIBUTE((nonnull));
@ -253,7 +253,7 @@ page_zip_write_blob_ptr(
const byte* rec, /*!< in/out: record whose data is being const byte* rec, /*!< in/out: record whose data is being
written */ written */
dict_index_t* index, /*!< in: index of the page */ 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 */ ulint n, /*!< in: column index */
mtr_t* mtr) /*!< in/out: mini-transaction */ mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((nonnull)); MY_ATTRIBUTE((nonnull));
@ -282,7 +282,7 @@ void
page_zip_write_trx_id_and_roll_ptr( page_zip_write_trx_id_and_roll_ptr(
buf_block_t* block, buf_block_t* block,
byte* rec, byte* rec,
const offset_t* offsets, const rec_offs* offsets,
ulint trx_id_col, ulint trx_id_col,
trx_id_t trx_id, trx_id_t trx_id,
roll_ptr_t roll_ptr, 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] free previous start of the free list
@param[in,out] mtr mini-transaction */ @param[in,out] mtr mini-transaction */
void page_zip_dir_delete(buf_block_t *block, byte *rec, 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) const byte *free, mtr_t *mtr)
MY_ATTRIBUTE((nonnull(1,2,3,4,6))); MY_ATTRIBUTE((nonnull(1,2,3,4,6)));

View File

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

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