diff options
140 files changed, 1688 insertions, 953 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3db3a8f9ef3..e3979595c1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2006, 2017, Oracle and/or its affiliates. -# Copyright (c) 2008, 2019, MariaDB Corporation. +# Copyright (c) 2008, 2020, MariaDB Corporation. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -254,6 +254,11 @@ INCLUDE(wsrep) INCLUDE(cpack_rpm) INCLUDE(cpack_deb) +OPTION(WITH_DBUG_TRACE "Enable DBUG_ENTER()/DBUG_EXIT()" ON) +IF(WITH_DBUG_TRACE) + ADD_DEFINITIONS(-DDBUG_TRACE) +ENDIF() + # Always enable debug sync for debug builds. SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") diff --git a/client/mysqldump.c b/client/mysqldump.c index 12c2831ec30..161485ca125 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -32,7 +32,7 @@ ** master/autocommit code by Brian Aker <brian@tangent.org> ** SSL by ** Andrei Errapart <andreie@no.spam.ee> -** Tõnu Samuel <tonu@please.do.not.remove.this.spam.ee> +** Tõnu Samuel <tonu@please.do.not.remove.this.spam.ee> ** XML by Gary Huntress <ghuntress@mediaone.net> 10/10/01, cleaned up ** and adapted to mysqldump 05/11/01 by Jani Tolonen ** Added --single-transaction option 06/06/2002 by Peter Zaitsev diff --git a/dbug/tests.c b/dbug/tests.c index 70424046bf4..3e77bf82236 100644 --- a/dbug/tests.c +++ b/dbug/tests.c @@ -4,6 +4,10 @@ char *push1=0; +#ifndef DBUG_TRACE +#define DBUG_TRACE +#endif + #include <my_global.h> /* This includes dbug.h */ #include <my_sys.h> #include <my_pthread.h> diff --git a/include/my_alarm.h b/include/my_alarm.h index 6010da6e2c3..bc0004476ca 100644 --- a/include/my_alarm.h +++ b/include/my_alarm.h @@ -29,6 +29,13 @@ extern ulong my_time_to_wait_for_lock; #if defined(HAVE_ALARM) && !defined(NO_ALARM_LOOP) #include <signal.h> +#ifdef HAVE_SIGHANDLER_T +#define sig_return sighandler_t +#elif defined(SOLARIS) || defined(__sun) || defined(__APPLE__) +typedef void (*sig_return)(int); /* Returns type from signal */ +#else +typedef void (*sig_return)(void); /* Returns type from signal */ +#endif #define ALARM_VARIABLES uint alarm_old=0; \ sig_return alarm_signal=0 #define ALARM_INIT my_have_got_alarm=0 ; \ diff --git a/include/my_dbug.h b/include/my_dbug.h index 56afe9335ae..09ccb6102fc 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -67,6 +67,7 @@ extern void dbug_free_code_state(void **code_state_store); extern const char* _db_get_func_(void); extern int (*dbug_sanity)(void); +#ifdef DBUG_TRACE #define DBUG_LEAVE do { \ _db_stack_frame_.line= __LINE__; \ _db_return_ (&_db_stack_frame_); \ @@ -85,6 +86,13 @@ extern int (*dbug_sanity)(void); #define DBUG_VOID_RETURN do {DBUG_LEAVE; return;} while(0) #endif +#else +#define DBUG_LEAVE +#define DBUG_ENTER(a) +#define DBUG_RETURN(a1) return(a1) +#define DBUG_VOID_RETURN return +#endif + #define DBUG_EXECUTE(keyword,a1) \ do {if (_db_keyword_(0, (keyword), 0)) { a1 }} while(0) #define DBUG_EXECUTE_IF(keyword,a1) \ diff --git a/include/my_global.h b/include/my_global.h index 68033d8a9e6..5d80b3881d4 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -561,13 +561,6 @@ typedef int my_socket; /* File descriptor for sockets */ #endif /* Type for functions that handles signals */ #define sig_handler RETSIGTYPE -C_MODE_START -#ifdef HAVE_SIGHANDLER_T -#define sig_return sighandler_t -#else -typedef void (*sig_return)(void); /* Returns type from signal */ -#endif -C_MODE_END #if defined(__GNUC__) && !defined(_lint) typedef char pchar; /* Mixed prototypes can take char */ typedef char puchar; /* Mixed prototypes can take char */ diff --git a/include/queues.h b/include/queues.h index 86ee48b98b5..e9948857dde 100644 --- a/include/queues.h +++ b/include/queues.h @@ -53,7 +53,7 @@ typedef struct st_queue { #define queue_top(queue) ((queue)->root[1]) #define queue_element(queue,index) ((queue)->root[index]) #define queue_end(queue) ((queue)->root[(queue)->elements]) -#define queue_replace_top(queue) _downheap(queue, 1, (queue)->root[1]) +#define queue_replace_top(queue) _downheap(queue, 1) #define queue_set_cmp_arg(queue, set_arg) (queue)->first_cmp_arg= set_arg #define queue_set_max_at_top(queue, set_arg) \ (queue)->max_at_top= set_arg ? -1 : 1 @@ -61,23 +61,23 @@ typedef struct st_queue { typedef int (*queue_compare)(void *,uchar *, uchar *); int init_queue(QUEUE *queue,uint max_elements,uint offset_to_key, - pbool max_at_top, queue_compare compare, + my_bool max_at_top, queue_compare compare, void *first_cmp_arg, uint offset_to_queue_pos, uint auto_extent); int reinit_queue(QUEUE *queue,uint max_elements,uint offset_to_key, - pbool max_at_top, queue_compare compare, + my_bool max_at_top, queue_compare compare, void *first_cmp_arg, uint offset_to_queue_pos, uint auto_extent); int resize_queue(QUEUE *queue, uint max_elements); void delete_queue(QUEUE *queue); -void queue_insert(QUEUE *queue,uchar *element); +void queue_insert(QUEUE *queue, uchar *element); int queue_insert_safe(QUEUE *queue, uchar *element); uchar *queue_remove(QUEUE *queue,uint idx); void queue_replace(QUEUE *queue,uint idx); #define queue_remove_all(queue) { (queue)->elements= 0; } #define queue_is_full(queue) (queue->elements == queue->max_elements) -void _downheap(QUEUE *queue, uint idx, uchar *element); +void _downheap(QUEUE *queue, uint idx); void queue_fix(QUEUE *queue); #define is_queue_inited(queue) ((queue)->root != 0) diff --git a/include/violite.h b/include/violite.h index 95a4830df89..51aada128cf 100644 --- a/include/violite.h +++ b/include/violite.h @@ -153,6 +153,9 @@ typedef my_socket YASSL_SOCKET_T; #include <openssl/ssl.h> #undef Timeval #include <openssl/err.h> +#ifdef DEPRECATED +#undef DEPRECATED +#endif enum enum_ssl_init_error { diff --git a/libmariadb b/libmariadb -Subproject 9c84958266a7fc61cd5b31b623cf4e26c332071 +Subproject ca8f94f727dba19a6ac43691df53fdc829e2124 diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc index 7267de84259..8a5bb60a3f5 100644 --- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc @@ -206,7 +206,7 @@ int main(int argc, const char** argv ) } else { if (strcmp(arg, "--verbose") == 0) verbose++; - else if (strncmp(arg, "--parent-pid", 10) == 0) + else if (strncmp(arg, "--parent-pid", 12) == 0) { /* Override parent_pid with a value provided by user */ const char* start; diff --git a/mysql-test/main/invisible_field.result b/mysql-test/main/invisible_field.result index 0b3ec037613..a57298dd5c5 100644 --- a/mysql-test/main/invisible_field.result +++ b/mysql-test/main/invisible_field.result @@ -405,7 +405,7 @@ c int(11) YES NULL explain select * from t1,t2 where t1.b = t2.c and t1.c = t2.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t1 ref b,c b 5 test.t2.c 1 Using where +1 SIMPLE t1 eq_ref b,c b 5 test.t2.c 1 Using where select * from t1,t2 where t1.b = t2.c and t1.c = t2.b; a a b c 1 1 1 1 diff --git a/mysql-test/main/join.result b/mysql-test/main/join.result index e5fa88512b9..d8eb9795b4e 100644 --- a/mysql-test/main/join.result +++ b/mysql-test/main/join.result @@ -3340,11 +3340,11 @@ show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment t1 0 PRIMARY 1 pk A 1010 NULL NULL BTREE t1 0 a 1 a A 1010 NULL NULL YES BTREE -# t1 must use ref(t1.a=t0.a) and rows must be 1 (and not 45): +# t1 must use eq_ref(t1.a=t0.a) and rows must be 1 (and not 45): explain select * from t0,t1 where t0.a=t1.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where -1 SIMPLE t1 ref a a 5 test.t0.a 1 +1 SIMPLE t1 eq_ref a a 5 test.t0.a 1 drop table t0,t1; # # MDEV-21383: Possible range plan is not used under certain conditions diff --git a/mysql-test/main/join.test b/mysql-test/main/join.test index bab1ce42a25..08930b622e2 100644 --- a/mysql-test/main/join.test +++ b/mysql-test/main/join.test @@ -1745,7 +1745,7 @@ analyze table t1; set myisam_stats_method=@tmp1; show keys from t1; ---echo # t1 must use ref(t1.a=t0.a) and rows must be 1 (and not 45): +--echo # t1 must use eq_ref(t1.a=t0.a) and rows must be 1 (and not 45): explain select * from t0,t1 where t0.a=t1.a; drop table t0,t1; diff --git a/mysql-test/main/key.result b/mysql-test/main/key.result index 996341e1557..78a2f42c477 100644 --- a/mysql-test/main/key.result +++ b/mysql-test/main/key.result @@ -643,3 +643,45 @@ SHOW STATUS LIKE 'Last_query_cost'; Variable_name Value Last_query_cost 14.199000 DROP TABLE t1; +# +# MDEV-21480: Unique key using ref access though eq_ref access can be used +# +create table t1(a int, b int,c int, primary key(a), unique key(b,c)); +insert into t1 select seq, seq, seq from seq_1_to_10; +create table t2(a int, b int,c int); +insert into t2 select seq, seq, seq+1 from seq_1_to_100; +EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE t1 eq_ref b b 10 test.t2.a,test.t2.b 1 Using index +SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; +c c +1 2 +2 3 +3 4 +4 5 +5 6 +6 7 +7 8 +8 9 +9 10 +10 11 +alter table t1 drop PRIMARY KEY; +alter table t1 add PRIMARY KEY(b,c); +EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 100 Using where +1 SIMPLE t1 eq_ref PRIMARY,b PRIMARY 8 test.t2.a,test.t2.b 1 Using index +SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; +c c +1 2 +2 3 +3 4 +4 5 +5 6 +6 7 +7 8 +8 9 +9 10 +10 11 +drop table t1,t2; diff --git a/mysql-test/main/key.test b/mysql-test/main/key.test index ccaef163d08..4e3e02c8add 100644 --- a/mysql-test/main/key.test +++ b/mysql-test/main/key.test @@ -1,6 +1,7 @@ --disable_warnings drop table if exists t1,t2,t3; --enable_warnings +--source include/have_sequence.inc SET SQL_WARNINGS=1; # @@ -582,3 +583,23 @@ EXPLAIN SELECT a, SUM( b ) FROM t1 FORCE INDEX( a ) GROUP BY a; SHOW STATUS LIKE 'Last_query_cost'; DROP TABLE t1; + +--echo # +--echo # MDEV-21480: Unique key using ref access though eq_ref access can be used +--echo # + +create table t1(a int, b int,c int, primary key(a), unique key(b,c)); +insert into t1 select seq, seq, seq from seq_1_to_10; + +create table t2(a int, b int,c int); +insert into t2 select seq, seq, seq+1 from seq_1_to_100; + +EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; +SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; + +alter table t1 drop PRIMARY KEY; +alter table t1 add PRIMARY KEY(b,c); +EXPLAIN SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; +SELECT t1.c, t2.c FROM t1, t2 WHERE t1.b=t2.a and t1.c=t2.b; + +drop table t1,t2; diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result index b4e508f1bda..120a318a683 100644 --- a/mysql-test/main/order_by.result +++ b/mysql-test/main/order_by.result @@ -1589,7 +1589,7 @@ WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE' ORDER BY t2.c LIMIT 1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range a,b,c c 5 NULL 420 Using where -1 SIMPLE t1 ref a a 39 test.t2.a,const 1 Using where; Using index +1 SIMPLE t1 eq_ref a a 39 test.t2.a,const 1 Using where; Using index SELECT d FROM t3 AS t1, t2 AS t2 WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE' ORDER BY t2.c LIMIT 1; diff --git a/mysql-test/main/subselect_sj_nonmerged.result b/mysql-test/main/subselect_sj_nonmerged.result index cd32c815de8..422af02c31a 100644 --- a/mysql-test/main/subselect_sj_nonmerged.result +++ b/mysql-test/main/subselect_sj_nonmerged.result @@ -69,7 +69,7 @@ t4.b=t0.a and t4.a in (select max(t2.a) from t1, t2 group by t2.b); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 5 1 PRIMARY t0 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t4 ref a a 10 <subquery2>.max(t2.a),test.t0.a 1 +1 PRIMARY t4 eq_ref a a 10 <subquery2>.max(t2.a),test.t0.a 1 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 Using temporary 2 MATERIALIZED t1 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) insert into t4 select 100 + (B.a *100 + A.a), 100 + (B.a*100 + A.a), 'filler' from t4 A, t0 B; @@ -79,7 +79,7 @@ t4.b in (select max(t2.a) from t1, t2 group by t2.b); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY <subquery3> ALL distinct_key NULL NULL NULL 5 1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 5 Using join buffer (flat, BNL join) -1 PRIMARY t4 ref a a 10 <subquery2>.max(t2.a),<subquery3>.max(t2.a) 1 +1 PRIMARY t4 eq_ref a a 10 <subquery2>.max(t2.a),<subquery3>.max(t2.a) 1 3 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 Using temporary 3 MATERIALIZED t1 ALL NULL NULL NULL NULL 10 Using join buffer (flat, BNL join) 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 Using temporary diff --git a/mysql-test/main/table_elim.result b/mysql-test/main/table_elim.result index 7b0806c63bf..2088e94c65a 100644 --- a/mysql-test/main/table_elim.result +++ b/mysql-test/main/table_elim.result @@ -279,7 +279,7 @@ insert into t2 values explain select t1.* from t1 left join t2 on t2.a=t1.a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL PRIMARY 10 NULL 2 Using index -1 SIMPLE t2 ref a a 3 test.t1.a 1 Using where +1 SIMPLE t2 eq_ref a a 3 test.t1.a 1 Using where drop table t1, t2; # # check UPDATE/DELETE that look like they could be eliminated diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 6b910fbeef2..0991695bf51 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -377,6 +377,32 @@ my $opt_stop_keep_alive= $ENV{MTR_STOP_KEEP_ALIVE}; select(STDOUT); $| = 1; # Automatically flush STDOUT +my $set_titlebar; + + + BEGIN { + if (IS_WINDOWS) { + my $have_win32_console= 0; + eval { + require Win32::Console; + Win32::Console->import(); + $have_win32_console = 1; + }; + eval 'sub HAVE_WIN32_CONSOLE { $have_win32_console }'; + } else { + sub HAVE_WIN32_CONSOLE { 0 }; + } +} + +if (-t STDOUT) { + if (IS_WINDOWS and HAVE_WIN32_CONSOLE) { + $set_titlebar = sub {Win32::Console::Title $_[0];}; + } elsif (defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) { + $set_titlebar = sub { print "\e];$_[0]\a"; }; + } +} + + main(); sub main { @@ -882,7 +908,7 @@ sub run_test_server ($$$) { delete $next->{reserved}; } - xterm_stat(scalar(@$tests)); + titlebar_stat(scalar(@$tests)) if $set_titlebar; if ($next) { # We don't need this any more @@ -6558,19 +6584,16 @@ sub time_format($) { our $num_tests; -sub xterm_stat { - if (-t STDOUT and defined $ENV{TERM} and $ENV{TERM} =~ /xterm/) { - my ($left) = @_; +sub titlebar_stat { + my ($left) = @_; - # 2.5 -> best by test - $num_tests = $left + 2.5 unless $num_tests; + # 2.5 -> best by test + $num_tests = $left + 2.5 unless $num_tests; - my $done = $num_tests - $left; - my $spent = time - $^T; + my $done = $num_tests - $left; + my $spent = time - $^T; - syswrite STDOUT, sprintf - "\e];mtr: spent %s on %d tests. %s (%d tests) left\a", + &$set_titlebar(sprintf "mtr: spent %s on %d tests. %s (%d tests) left", time_format($spent), $done, - time_format($spent/$done * $left), $left; - } + time_format($spent/$done * $left), $left); } diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 5b3a040c293..99e3012d947 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -32,7 +32,6 @@ galera_kill_nochanges : MDEV-18280 Galera test failure on galera_split_brain and galera_load_data : MDEV-19968 galera.galera_load_data galera_many_tables_nopk : MDEV-18182 Galera test failure on galera.galera_many_tables_nopk galera_mdl_race : MDEV-21524 galera.galera_mdl_race -galera_parallel_autoinc_largetrx : MDEV-20916 galera.galera_parallel_autoinc_largetrx galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails galera_pc_ignore_sb : MDEV-20888 galera.galera_pc_ignore_sb galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim diff --git a/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result index 034e23dcaad..6249edbe173 100644 --- a/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result +++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result @@ -29,11 +29,11 @@ COUNT(DISTINCT f1) 30000 connection node_2; disconnect node_1a; -SELECT COUNT(*) FROM t1; -COUNT(*) +SELECT COUNT(*) AS EXPECT_30000 FROM t1; +EXPECT_30000 30000 -SELECT COUNT(DISTINCT f1) FROM t1; -COUNT(DISTINCT f1) +SELECT COUNT(DISTINCT f1) AS EXPECT_30000 FROM t1; +EXPECT_30000 30000 connection default; DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_var_cluster_conf_id.result b/mysql-test/suite/galera/r/galera_var_cluster_conf_id.result index 2507b1f96f2..c78d704d9b1 100644 --- a/mysql-test/suite/galera/r/galera_var_cluster_conf_id.result +++ b/mysql-test/suite/galera/r/galera_var_cluster_conf_id.result @@ -3,8 +3,8 @@ connection node_1; connection node_1; show status like 'wsrep_cluster_conf_id'; Variable_name Value -wsrep_cluster_conf_id 2 +wsrep_cluster_conf_id # connection node_2; show status like 'wsrep_cluster_conf_id'; Variable_name Value -wsrep_cluster_conf_id 2 +wsrep_cluster_conf_id # diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test index 7f3a8e5f693..df0200fab55 100644 --- a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test +++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test @@ -53,10 +53,12 @@ SELECT COUNT(DISTINCT f1) FROM t1; --connection node_2 --reap --disconnect node_1a ---let $wait_condition = select count(*)=30000 from t1; + +--let $wait_condition = SELECT COUNT(*) = 30000 FROM t1; --source include/wait_condition.inc -SELECT COUNT(*) FROM t1; -SELECT COUNT(DISTINCT f1) FROM t1; + +SELECT COUNT(*) AS EXPECT_30000 FROM t1; +SELECT COUNT(DISTINCT f1) AS EXPECT_30000 FROM t1; --disable_query_log --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; diff --git a/mysql-test/suite/galera/t/galera_var_cluster_conf_id.test b/mysql-test/suite/galera/t/galera_var_cluster_conf_id.test index 95ade07f043..c569634823f 100644 --- a/mysql-test/suite/galera/t/galera_var_cluster_conf_id.test +++ b/mysql-test/suite/galera/t/galera_var_cluster_conf_id.test @@ -1,7 +1,9 @@ --source include/galera_cluster.inc --connection node_1 +--replace_regex /18446744073709551/ERROR/ /[0-9]/#/ show status like 'wsrep_cluster_conf_id'; --connection node_2 +--replace_regex /18446744073709551/ERROR/ /[0-9]/#/ show status like 'wsrep_cluster_conf_id'; diff --git a/mysql-test/suite/gcol/r/gcol_select_innodb.result b/mysql-test/suite/gcol/r/gcol_select_innodb.result index 392fb0de7a2..17acbcf2bb2 100644 --- a/mysql-test/suite/gcol/r/gcol_select_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_select_innodb.result @@ -80,7 +80,7 @@ a b c explain select * from t1 where b in (select c from t3); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY t3 ref c c 5 test.t1.b 1 Using index +1 PRIMARY t3 eq_ref c c 5 test.t1.b 1 Using index # select_type=PRIMARY, type=range,ref select * from t1 where c in (select c from t3 where c between -2 and -1); a b c diff --git a/mysql-test/suite/gcol/r/gcol_select_myisam.result b/mysql-test/suite/gcol/r/gcol_select_myisam.result index 88623028b54..77ab0cdb926 100644 --- a/mysql-test/suite/gcol/r/gcol_select_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_select_myisam.result @@ -80,7 +80,7 @@ a b c explain select * from t1 where b in (select c from t3); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY t3 ref c c 5 test.t1.b 1 Using index +1 PRIMARY t3 eq_ref c c 5 test.t1.b 1 Using index # select_type=PRIMARY, type=range,ref select * from t1 where c in (select c from t3 where c between -2 and -1); a b c @@ -1110,7 +1110,7 @@ id select_type table type possible_keys key key_len ref rows Extra EXPLAIN SELECT * FROM t1 AS t2 STRAIGHT_JOIN t1 FORCE INDEX(b) WHERE t1.b=t2.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL b NULL NULL NULL 2 Using where -1 SIMPLE t1 ref b b 5 test.t2.b 1 +1 SIMPLE t1 eq_ref b b 5 test.t2.b 1 EXPLAIN SELECT b FROM t1 FORCE INDEX(b); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index NULL b 5 NULL 2 Using index diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff index 805ccdb563c..a176a9af29e 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff +++ b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff @@ -1,6 +1,6 @@ ---- alter_algorithm.result -+++ alter_algorithm.reject -@@ -7,40 +7,40 @@ +--- alter_algorithm.result 2020-04-30 21:39:48.923115511 +0530 ++++ alter_algorithm.reject 2020-04-30 21:45:04.131642093 +0530 +@@ -7,43 +7,43 @@ INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); SELECT @@alter_algorithm; @@alter_algorithm @@ -55,10 +55,15 @@ -info: Records: 1 Duplicates: 0 Warnings: 0 +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 + ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 DROP TABLE t1; affected rows: 0 CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, -@@ -53,22 +53,22 @@ +@@ -56,22 +56,22 @@ FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; @@ -91,7 +96,7 @@ DROP TABLE t2, t1; affected rows: 0 CREATE TABLE t1(f1 INT NOT NULL, -@@ -81,27 +81,27 @@ +@@ -84,28 +84,27 @@ INSERT INTO t1(f1, f2) VALUES(1, 1); # Add column at the end of the table ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL'; @@ -119,7 +124,9 @@ +info: Records: 0 Duplicates: 0 Warnings: 0 # Rename table ALTER TABLE t1 RENAME t3; - affected rows: 0 +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 # Drop Virtual Column ALTER TABLE t3 DROP COLUMN vcol; -affected rows: 1 @@ -129,7 +136,7 @@ # Column length varies ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20); affected rows: 0 -@@ -109,12 +109,12 @@ +@@ -113,12 +112,12 @@ SET foreign_key_checks = 0; affected rows: 0 ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1); diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff index 6d2ee160e46..414b7dc8b0c 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff +++ b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff @@ -1,6 +1,6 @@ ---- alter_algorithm.result -+++ alter_algorithm.reject -@@ -7,40 +7,32 @@ +--- alter_algorithm.result 2020-04-30 21:39:48.923115511 +0530 ++++ alter_algorithm.reject 2020-04-30 21:47:08.245465018 +0530 +@@ -7,43 +7,35 @@ INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); SELECT @@alter_algorithm; @@alter_algorithm @@ -47,10 +47,15 @@ -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 +Got one of the listed errors + ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 DROP TABLE t1; affected rows: 0 CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, -@@ -53,22 +45,17 @@ +@@ -56,22 +48,17 @@ FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; @@ -78,7 +83,7 @@ DROP TABLE t2, t1; affected rows: 0 CREATE TABLE t1(f1 INT NOT NULL, -@@ -81,27 +68,27 @@ +@@ -84,28 +71,27 @@ INSERT INTO t1(f1, f2) VALUES(1, 1); # Add column at the end of the table ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL'; @@ -106,7 +111,9 @@ +info: Records: 0 Duplicates: 0 Warnings: 0 # Rename table ALTER TABLE t1 RENAME t3; - affected rows: 0 +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 # Drop Virtual Column ALTER TABLE t3 DROP COLUMN vcol; -affected rows: 1 @@ -116,7 +123,7 @@ # Column length varies ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20); affected rows: 0 -@@ -109,12 +96,12 @@ +@@ -113,12 +99,12 @@ SET foreign_key_checks = 0; affected rows: 0 ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1); diff --git a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff index c6ce83b5d9f..2aa8c72265a 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff +++ b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff @@ -1,6 +1,6 @@ ---- alter_algorithm.result -+++ alter_algorithm.reject -@@ -7,40 +7,32 @@ +--- alter_algorithm.result 2020-04-30 21:39:48.923115511 +0530 ++++ alter_algorithm.reject 2020-04-30 21:52:10.785967739 +0530 +@@ -7,43 +7,35 @@ INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); SELECT @@alter_algorithm; @@alter_algorithm @@ -47,10 +47,15 @@ -affected rows: 1 -info: Records: 1 Duplicates: 0 Warnings: 0 +Got one of the listed errors + ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 ++info: Records: 0 Duplicates: 0 Warnings: 0 DROP TABLE t1; affected rows: 0 CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, -@@ -53,22 +45,22 @@ +@@ -56,22 +48,22 @@ FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB; INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4); ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1; @@ -83,7 +88,7 @@ DROP TABLE t2, t1; affected rows: 0 CREATE TABLE t1(f1 INT NOT NULL, -@@ -81,27 +73,27 @@ +@@ -84,28 +76,27 @@ INSERT INTO t1(f1, f2) VALUES(1, 1); # Add column at the end of the table ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL'; @@ -111,7 +116,9 @@ +info: Records: 0 Duplicates: 0 Warnings: 0 # Rename table ALTER TABLE t1 RENAME t3; - affected rows: 0 +-affected rows: 1 +-info: Records: 1 Duplicates: 0 Warnings: 0 ++affected rows: 0 # Drop Virtual Column ALTER TABLE t3 DROP COLUMN vcol; -affected rows: 1 @@ -121,7 +128,7 @@ # Column length varies ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20); affected rows: 0 -@@ -109,12 +101,12 @@ +@@ -113,12 +104,12 @@ SET foreign_key_checks = 0; affected rows: 0 ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1); diff --git a/mysql-test/suite/innodb/r/alter_algorithm.result b/mysql-test/suite/innodb/r/alter_algorithm.result index bcfbe3355f9..717d31de6a0 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm.result +++ b/mysql-test/suite/innodb/r/alter_algorithm.result @@ -41,6 +41,9 @@ info: Records: 1 Duplicates: 0 Warnings: 0 ALTER TABLE t1 ENGINE=INNODB; affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 +ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 DROP TABLE t1; affected rows: 0 CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL, @@ -97,7 +100,8 @@ affected rows: 1 info: Records: 1 Duplicates: 0 Warnings: 0 # Rename table ALTER TABLE t1 RENAME t3; -affected rows: 0 +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 # Drop Virtual Column ALTER TABLE t3 DROP COLUMN vcol; affected rows: 1 diff --git a/mysql-test/suite/innodb/r/alter_algorithm2.result b/mysql-test/suite/innodb/r/alter_algorithm2.result new file mode 100644 index 00000000000..f4443c80c77 --- /dev/null +++ b/mysql-test/suite/innodb/r/alter_algorithm2.result @@ -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; diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result index 2cb2d829e53..b3c662bc32a 100644 --- a/mysql-test/suite/innodb/r/foreign_key.result +++ b/mysql-test/suite/innodb/r/foreign_key.result @@ -276,6 +276,16 @@ ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES tx(x); ALTER TABLE t1 DROP KEY idx; ALTER TABLE t1 CHANGE a c INT; DROP TABLE t1; +CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY idx(f1)) ENGINE=InnoDB; +ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1 (f1); +ALTER TABLE t1 ADD COLUMN f INT; +SET FOREIGN_KEY_CHECKS= OFF; +ALTER TABLE t1 DROP KEY idx; +ALTER TABLE t1 ADD KEY idx (f1); +SET FOREIGN_KEY_CHECKS= ON; +ALTER TABLE t1 DROP f3; +ALTER TABLE t1 CHANGE f f3 INT; +DROP TABLE t1; SET FOREIGN_KEY_CHECKS=1; # Start of 10.2 tests # diff --git a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff index 71394d4b43b..14ef4971267 100644 --- a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff @@ -318,8 +318,8 @@ FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; instants --208 -+210 +-209 ++211 SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency; SET GLOBAL innodb_instant_alter_column_allowed = @saved_allowance; # diff --git a/mysql-test/suite/innodb/r/instant_alter.result b/mysql-test/suite/innodb/r/instant_alter.result index 004f535291b..3ee879fd925 100644 --- a/mysql-test/suite/innodb/r/instant_alter.result +++ b/mysql-test/suite/innodb/r/instant_alter.result @@ -2848,11 +2848,19 @@ pk b connection default; DROP TABLE t1; disconnect analyze; +# +# MDEV-22465: DROP COLUMN is wrongly claimed to be ALGORITHM=INSTANT +# +CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB; +ALTER TABLE t1 DROP b, ALGORITHM=INSTANT; +ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: DROP INDEX. Try ALGORITHM=NOCOPY +ALTER TABLE t1 DROP b, ALGORITHM=NOCOPY; +DROP TABLE t1; SELECT variable_value-@old_instant instants FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; instants -208 +209 SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency; SET GLOBAL innodb_instant_alter_column_allowed = @saved_allowance; # diff --git a/mysql-test/suite/innodb/r/instant_alter_bugs.result b/mysql-test/suite/innodb/r/instant_alter_bugs.result index 53f2d4f1c60..84c9ba2d630 100644 --- a/mysql-test/suite/innodb/r/instant_alter_bugs.result +++ b/mysql-test/suite/innodb/r/instant_alter_bugs.result @@ -171,6 +171,41 @@ DROP FOREIGN KEY fk1, CHANGE b d INT UNSIGNED, ADD c INT; DROP TABLE t2, t1; +# +# MDEV-22446 InnoDB aborts while adding instant column +# for discarded tablespace +# +CREATE TABLE t1(c1 INT NOT NULL, c2 INT NOT NULL DEFAULT 0)ENGINE=InnoDB; +INSERT INTO t1(c1) VALUES(1); +ALTER TABLE t1 ADD COLUMN c3 INT DEFAULT 10; +FLUSH TABLES t1 FOR EXPORT; +backup: t1 +UNLOCK TABLES; +DROP TABLE t1; +CREATE TABLE t1(c1 INT NOT NULL)Engine=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +FLUSH TABLES; +ALTER TABLE t1 ADD COLUMN c2 INT NOT NULL; +Warnings: +Warning 1814 Tablespace has been discarded for table `t1` +ALTER TABLE t1 ADD COLUMN c3 INT DEFAULT 10; +Warnings: +Warning 1814 Tablespace has been discarded for table `t1` +restore: t1 .ibd and .cfg files +ALTER TABLE t1 IMPORT TABLESPACE; +Warnings: +Warning 1814 Tablespace has been discarded for table `t1` +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL, + `c2` int(11) NOT NULL, + `c3` int(11) DEFAULT 10 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SELECT * FROM t1; +c1 c2 c3 +1 0 10 +DROP TABLE t1; # End of 10.3 tests create table t ( a varchar(9), diff --git a/mysql-test/suite/innodb/r/log_file_name_debug.result b/mysql-test/suite/innodb/r/log_file_name_debug.result index 102db617a64..cb2ee68fc98 100644 --- a/mysql-test/suite/innodb/r/log_file_name_debug.result +++ b/mysql-test/suite/innodb/r/log_file_name_debug.result @@ -12,7 +12,7 @@ FOUND 1 /InnoDB: Tablespace 4294967280 was not found at .*, but there were no mo # restart: --debug=d,innodb_log_abort_3,ib_log --innodb-log-file-size=4194304 SELECT * FROM t1; ERROR 42000: Unknown storage engine 'InnoDB' -FOUND 1 /srv_prepare_to_delete_redo_log_file: ib_log: FILE_CHECKPOINT.* written/ in mysqld.1.err +FOUND 1 /ib_log: FILE_CHECKPOINT.* written/ in mysqld.1.err # restart # restart DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/alter_algorithm.test b/mysql-test/suite/innodb/t/alter_algorithm.test index d410a15154d..08c23b505f3 100644 --- a/mysql-test/suite/innodb/t/alter_algorithm.test +++ b/mysql-test/suite/innodb/t/alter_algorithm.test @@ -55,6 +55,10 @@ ALTER TABLE t1 ROW_FORMAT=COMPRESSED; --error $error_code ALTER TABLE t1 ENGINE=INNODB; +# Irrespective of alter_algorithm value, the following command +# should succeed because of explicitly mentioning ALGORTHM=DEFAULT +ALTER TABLE t1 FORCE, ALGORITHM=DEFAULT; + DROP TABLE t1; --disable_info diff --git a/mysql-test/suite/innodb/t/alter_algorithm2.test b/mysql-test/suite/innodb/t/alter_algorithm2.test new file mode 100644 index 00000000000..cdece2398f0 --- /dev/null +++ b/mysql-test/suite/innodb/t/alter_algorithm2.test @@ -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; diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test index 330d718e5e4..8e2ae0a5528 100644 --- a/mysql-test/suite/innodb/t/foreign_key.test +++ b/mysql-test/suite/innodb/t/foreign_key.test @@ -266,6 +266,19 @@ ALTER TABLE t1 DROP KEY idx; ALTER TABLE t1 CHANGE a c INT; # Cleanup DROP TABLE t1; + +CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY idx(f1)) ENGINE=InnoDB; +ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1 (f1); +ALTER TABLE t1 ADD COLUMN f INT; +SET FOREIGN_KEY_CHECKS= OFF; +ALTER TABLE t1 DROP KEY idx; +ALTER TABLE t1 ADD KEY idx (f1); +SET FOREIGN_KEY_CHECKS= ON; +ALTER TABLE t1 DROP f3; +ALTER TABLE t1 CHANGE f f3 INT; +# Cleanup +DROP TABLE t1; + SET FOREIGN_KEY_CHECKS=1; --echo # Start of 10.2 tests diff --git a/mysql-test/suite/innodb/t/instant_alter.test b/mysql-test/suite/innodb/t/instant_alter.test index 5f859d7f9a8..ab2636f7554 100644 --- a/mysql-test/suite/innodb/t/instant_alter.test +++ b/mysql-test/suite/innodb/t/instant_alter.test @@ -889,6 +889,17 @@ dec $format; let $redundant_4k= 0; } disconnect analyze; + +--echo # +--echo # MDEV-22465: DROP COLUMN is wrongly claimed to be ALGORITHM=INSTANT +--echo # + +CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 DROP b, ALGORITHM=INSTANT; +ALTER TABLE t1 DROP b, ALGORITHM=NOCOPY; +DROP TABLE t1; + SELECT variable_value-@old_instant instants FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test index d76a586cfa1..b6b4cadc654 100644 --- a/mysql-test/suite/innodb/t/instant_alter_bugs.test +++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test @@ -172,6 +172,42 @@ ALTER TABLE t2 CHANGE b d INT UNSIGNED, ADD c INT; DROP TABLE t2, t1; + +--echo # +--echo # MDEV-22446 InnoDB aborts while adding instant column +--echo # for discarded tablespace +--echo # + +let MYSQLD_DATADIR =`SELECT @@datadir`; +CREATE TABLE t1(c1 INT NOT NULL, c2 INT NOT NULL DEFAULT 0)ENGINE=InnoDB; +INSERT INTO t1(c1) VALUES(1); + +ALTER TABLE t1 ADD COLUMN c3 INT DEFAULT 10; +--replace_regex /, .*\).*t1.cfg/, Bad file descriptor) t1.cfg/ +FLUSH TABLES t1 FOR EXPORT; + +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_backup_tablespaces("test", "t1"); +EOF +UNLOCK TABLES; +DROP TABLE t1; + +# Restore of instant table +CREATE TABLE t1(c1 INT NOT NULL)Engine=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +FLUSH TABLES; +ALTER TABLE t1 ADD COLUMN c2 INT NOT NULL; +ALTER TABLE t1 ADD COLUMN c3 INT DEFAULT 10; +# Restore files +perl; +do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl"; +ib_restore_tablespaces("test", "t1"); +EOF +ALTER TABLE t1 IMPORT TABLESPACE; +SHOW CREATE TABLE t1; +SELECT * FROM t1; +DROP TABLE t1; --echo # End of 10.3 tests diff --git a/mysql-test/suite/innodb/t/log_file_name_debug.test b/mysql-test/suite/innodb/t/log_file_name_debug.test index 8b56ccaa55f..d90be6d8916 100644 --- a/mysql-test/suite/innodb/t/log_file_name_debug.test +++ b/mysql-test/suite/innodb/t/log_file_name_debug.test @@ -39,7 +39,7 @@ SELECT * FROM t1; --source include/restart_mysqld.inc --error ER_UNKNOWN_STORAGE_ENGINE SELECT * FROM t1; ---let SEARCH_PATTERN= srv_prepare_to_delete_redo_log_file: ib_log: FILE_CHECKPOINT.* written +--let SEARCH_PATTERN= ib_log: FILE_CHECKPOINT.* written --source include/search_pattern_in_file.inc --let $restart_parameters= diff --git a/mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc b/mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc index 7801498adb4..cddc9286bd2 100644 --- a/mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc +++ b/mysql-test/suite/rpl/include/rpl_parallel_show_binlog_events_purge_logs.inc @@ -15,6 +15,7 @@ # that with the fix local variable linfo is valid along all # mysql_show_binlog_events function scope. # +--source include/have_debug.inc --source include/have_debug_sync.inc --source include/master-slave.inc diff --git a/mysql-test/suite/rpl/r/rpl_conditional_comments.result b/mysql-test/suite/rpl/r/rpl_conditional_comments.result index 044f31427be..036824d60aa 100644 --- a/mysql-test/suite/rpl/r/rpl_conditional_comments.result +++ b/mysql-test/suite/rpl/r/rpl_conditional_comments.result @@ -71,5 +71,22 @@ include/diff_tables.inc [master:t1,slave:t1] connection master; SELECT c1 FROM /*!999999 t1 WHEREN; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '/*!999999 t1 WHEREN' at line 1 +insert t1 values (/*!50505 1 /* foo */ */ + 2); +insert t1 values (/*!999999 10 /* foo */ */ + 20); +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; insert t1 values (/*!50505 1 /* foo */ */ + 2) +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; insert t1 values (/* 999999 10 (* foo *) */ + 20) +master-bin.000001 # Query # # COMMIT +connection slave; +select * from t1; +c1 +62 +3 +20 +connection master; DROP TABLE t1; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_fail_register.result b/mysql-test/suite/rpl/r/rpl_fail_register.result new file mode 100644 index 00000000000..2cddc796314 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_fail_register.result @@ -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 diff --git a/mysql-test/suite/rpl/t/rpl_conditional_comments.test b/mysql-test/suite/rpl/t/rpl_conditional_comments.test index bcc964a92c7..6e4ec8745f4 100644 --- a/mysql-test/suite/rpl/t/rpl_conditional_comments.test +++ b/mysql-test/suite/rpl/t/rpl_conditional_comments.test @@ -68,7 +68,17 @@ sync_slave_with_master; --echo # comments --connection master --error 1064 -SELECT c1 FROM /*!999999 t1 WHEREN; +SELECT c1 FROM /*!999999 t1 WHEREN; #*/ + +# +# Bug#28388217 - SERVER CAN FAIL WHILE REPLICATING CONDITIONAL COMMENTS +# +insert t1 values (/*!50505 1 /* foo */ */ + 2); +insert t1 values (/*!999999 10 /* foo */ */ + 20); +source include/show_binlog_events.inc; +sync_slave_with_master; +select * from t1; +connection master; DROP TABLE t1; --source include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_fail_register.test b/mysql-test/suite/rpl/t/rpl_fail_register.test new file mode 100644 index 00000000000..d0502e734e2 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_fail_register.test @@ -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; diff --git a/mysql-test/suite/vcol/r/vcol_select_innodb.result b/mysql-test/suite/vcol/r/vcol_select_innodb.result index 1ac4bb32a49..e275a66091c 100644 --- a/mysql-test/suite/vcol/r/vcol_select_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_select_innodb.result @@ -64,7 +64,7 @@ a b c explain select * from t1 where b in (select c from t3); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY t3 ref c c 5 test.t1.b 1 Using index +1 PRIMARY t3 eq_ref c c 5 test.t1.b 1 Using index # select_type=PRIMARY, type=range,ref select * from t1 where c in (select c from t3 where c between -2 and -1); a b c diff --git a/mysql-test/suite/vcol/r/vcol_select_myisam.result b/mysql-test/suite/vcol/r/vcol_select_myisam.result index fb6da695896..05f86347706 100644 --- a/mysql-test/suite/vcol/r/vcol_select_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_select_myisam.result @@ -64,7 +64,7 @@ a b c explain select * from t1 where b in (select c from t3); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY t3 ref c c 5 test.t1.b 1 Using index +1 PRIMARY t3 eq_ref c c 5 test.t1.b 1 Using index # select_type=PRIMARY, type=range,ref select * from t1 where c in (select c from t3 where c between -2 and -1); a b c diff --git a/mysys/queues.c b/mysys/queues.c index aac70a4825d..0a1149bf9fc 100644 --- a/mysys/queues.c +++ b/mysys/queues.c @@ -70,10 +70,9 @@ */ int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key, - pbool max_at_top, int (*compare) (void *, uchar *, uchar *), + my_bool max_at_top, int (*compare) (void *, uchar *, uchar *), void *first_cmp_arg, uint offset_to_queue_pos, uint auto_extent) - { DBUG_ENTER("init_queue"); if ((queue->root= (uchar **) my_malloc(key_memory_QUEUE, @@ -110,7 +109,7 @@ int init_queue(QUEUE *queue, uint max_elements, uint offset_to_key, */ int reinit_queue(QUEUE *queue, uint max_elements, uint offset_to_key, - pbool max_at_top, int (*compare) (void *, uchar *, uchar *), + my_bool max_at_top, int (*compare) (void *, uchar *, uchar *), void *first_cmp_arg, uint offset_to_queue_pos, uint auto_extent) { @@ -183,6 +182,28 @@ void delete_queue(QUEUE *queue) } +static void insert_at(QUEUE *queue, uchar *element, uint idx) +{ + uint next_index, offset_to_key= queue->offset_to_key; + uint offset_to_queue_pos= queue->offset_to_queue_pos; + /* max_at_top swaps the comparison if we want to order by desc */ + while ((next_index= idx >> 1) > 0 && + queue->compare(queue->first_cmp_arg, + element + offset_to_key, + queue->root[next_index] + offset_to_key) * + queue->max_at_top < 0) + { + queue->root[idx]= queue->root[next_index]; + if (offset_to_queue_pos) + (*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx; + idx= next_index; + } + queue->root[idx]= element; + if (offset_to_queue_pos) + (*(uint*) (element + offset_to_queue_pos-1))= idx; +} + + /* Insert element in queue @@ -192,28 +213,10 @@ void delete_queue(QUEUE *queue) element Element to insert */ -void queue_insert(register QUEUE *queue, uchar *element) +void queue_insert(QUEUE *queue, uchar *element) { - reg2 uint idx, next; - uint offset_to_queue_pos= queue->offset_to_queue_pos; DBUG_ASSERT(queue->elements < queue->max_elements); - - idx= ++queue->elements; - /* max_at_top swaps the comparison if we want to order by desc */ - while (idx > 1 && - (queue->compare(queue->first_cmp_arg, - element + queue->offset_to_key, - queue->root[(next= idx >> 1)] + - queue->offset_to_key) * queue->max_at_top) < 0) - { - queue->root[idx]= queue->root[next]; - if (offset_to_queue_pos) - (*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx; - idx= next; - } - queue->root[idx]= element; - if (offset_to_queue_pos) - (*(uint*) (element+ offset_to_queue_pos-1))= idx; + insert_at(queue, element, ++queue->elements); } @@ -231,7 +234,7 @@ void queue_insert(register QUEUE *queue, uchar *element) 2 auto_extend is 0; No insertion done */ -int queue_insert_safe(register QUEUE *queue, uchar *element) +int queue_insert_safe(QUEUE *queue, uchar *element) { if (queue->elements == queue->max_elements) @@ -241,7 +244,7 @@ int queue_insert_safe(register QUEUE *queue, uchar *element) if (resize_queue(queue, queue->max_elements + queue->auto_extent)) return 1; } - + queue_insert(queue, element); return 0; } @@ -260,81 +263,55 @@ int queue_insert_safe(register QUEUE *queue, uchar *element) pointer to removed element */ -uchar *queue_remove(register QUEUE *queue, uint idx) +uchar *queue_remove(QUEUE *queue, uint idx) { uchar *element; - DBUG_ASSERT(idx >= 1 && idx <= queue->elements); + DBUG_ASSERT(idx >= 1); + DBUG_ASSERT(idx <= queue->elements); element= queue->root[idx]; - _downheap(queue, idx, queue->root[queue->elements--]); + queue->root[idx]= queue->root[queue->elements--]; + queue_replace(queue, idx); return element; } /* - Add element to fixed position and update heap + Restores the heap property from idx down the heap SYNOPSIS _downheap() queue Queue to use idx Index of element to change - element Element to store at 'idx' - - NOTE - This only works if element is >= all elements <= start_idx */ -void _downheap(register QUEUE *queue, uint start_idx, uchar *element) +void _downheap(QUEUE *queue, uint idx) { - uint elements,half_queue,offset_to_key, next_index, offset_to_queue_pos; - register uint idx= start_idx; - my_bool first= TRUE; - - offset_to_key=queue->offset_to_key; - offset_to_queue_pos= queue->offset_to_queue_pos; - half_queue= (elements= queue->elements) >> 1; + uchar *element= queue->root[idx]; + uint next_index, + elements= queue->elements, + half_queue= elements >> 1, + offset_to_key= queue->offset_to_key, + offset_to_queue_pos= queue->offset_to_queue_pos; while (idx <= half_queue) { - next_index=idx+idx; + next_index= idx+idx; if (next_index < elements && - (queue->compare(queue->first_cmp_arg, - queue->root[next_index]+offset_to_key, - queue->root[next_index+1]+offset_to_key) * - queue->max_at_top) > 0) + (queue->compare(queue->first_cmp_arg, + queue->root[next_index]+offset_to_key, + queue->root[next_index+1]+offset_to_key) * + queue->max_at_top) > 0) next_index++; - if (first && - (((queue->compare(queue->first_cmp_arg, - queue->root[next_index]+offset_to_key, - element+offset_to_key) * queue->max_at_top) >= 0))) - { - queue->root[idx]= element; - if (offset_to_queue_pos) - (*(uint*) (element + offset_to_queue_pos-1))= idx; - return; - } - first= FALSE; - queue->root[idx]= queue->root[next_index]; - if (offset_to_queue_pos) - (*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx; - idx=next_index; - } - - /* - Insert the element into the right position. This is the same code - as we have in queue_insert() - */ - while ((next_index= (idx >> 1)) > start_idx && - queue->compare(queue->first_cmp_arg, - element+offset_to_key, - queue->root[next_index]+offset_to_key)* - queue->max_at_top < 0) - { + if ((queue->compare(queue->first_cmp_arg, + queue->root[next_index]+offset_to_key, + element+offset_to_key) * queue->max_at_top) >= 0) + break; queue->root[idx]= queue->root[next_index]; if (offset_to_queue_pos) (*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx; idx= next_index; } - queue->root[idx]= element; + queue->root[idx]=element; if (offset_to_queue_pos) (*(uint*) (element + offset_to_queue_pos-1))= idx; } @@ -352,7 +329,7 @@ void queue_fix(QUEUE *queue) { uint i; for (i= queue->elements >> 1; i > 0; i--) - _downheap(queue, i, queue_element(queue, i)); + _downheap(queue, i); } @@ -363,13 +340,47 @@ void queue_fix(QUEUE *queue) queue_replace() queue Queue to use idx Index of element to change - element Element to store at 'idx' + + NOTE + optimized for the case when the new position is close to the end of the + heap (typical for queue_remove() replacements). */ void queue_replace(QUEUE *queue, uint idx) { uchar *element= queue->root[idx]; - DBUG_ASSERT(idx >= 1 && idx <= queue->elements); - queue_remove(queue, idx); - queue_insert(queue, element); + uint next_index, + elements= queue->elements, + half_queue= elements>>1, + offset_to_key= queue->offset_to_key, + offset_to_queue_pos= queue->offset_to_queue_pos; + my_bool first= TRUE; + + while (idx <= half_queue) + { + next_index= idx + idx; + if (next_index < elements && + queue->compare(queue->first_cmp_arg, + queue->root[next_index]+offset_to_key, + queue->root[next_index+1]+offset_to_key) * + queue->max_at_top > 0) + next_index++; + if (first && + queue->compare(queue->first_cmp_arg, + queue->root[next_index]+offset_to_key, + element+offset_to_key) * queue->max_at_top >= 0) + { + queue->root[idx]= element; + if (offset_to_queue_pos) + (*(uint*) (element + offset_to_queue_pos-1))= idx; + break; + } + first= FALSE; + queue->root[idx]= queue->root[next_index]; + if (offset_to_queue_pos) + (*(uint*) (queue->root[idx] + offset_to_queue_pos-1))= idx; + idx=next_index; + } + + insert_at(queue, element, idx); } diff --git a/plugin/auth_gssapi/gssapi_errmsg.cc b/plugin/auth_gssapi/gssapi_errmsg.cc index b0eee0e992e..3e23c5733d6 100644 --- a/plugin/auth_gssapi/gssapi_errmsg.cc +++ b/plugin/auth_gssapi/gssapi_errmsg.cc @@ -26,7 +26,11 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#if defined(__FreeBSD__) || defined(SOLARIS) || defined(__sun) +#include <gssapi/gssapi.h> +#else #include <gssapi.h> +#endif #include <string.h> void gssapi_errmsg(OM_uint32 major, OM_uint32 minor, char *buf, size_t size) diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 9add1aab298..113a26804bf 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -2203,6 +2203,7 @@ static void auditing_v8(MYSQL_THD thd, struct mysql_event_general_v8 *ev_v8) #endif /*x86_64*/ #endif /*DBUG_OFF*/ #endif /* __linux__ */ + struct mysql_event_general event; if (ev_v8->event_class != MYSQL_AUDIT_GENERAL_CLASS) @@ -2263,6 +2264,7 @@ static void auditing_v13(MYSQL_THD thd, unsigned int *ev_v0) int get_db_mysql57(MYSQL_THD thd, char **name, size_t *len) { +#ifdef __linux__ int db_off; int db_len_off; if (debug_server_started) @@ -2286,7 +2288,6 @@ int get_db_mysql57(MYSQL_THD thd, char **name, size_t *len) #endif /*x86_64*/ } -#ifdef __linux__ *name= *(char **) (((char *) thd) + db_off); *len= *((size_t *) (((char*) thd) + db_len_off)); if (*name && (*name)[*len] != 0) diff --git a/sql-common/client.c b/sql-common/client.c index ee3ec65a233..1ce80a17d24 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1188,9 +1188,23 @@ unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, { if (field >= result + fields) goto err; + + /* + If any of the row->data[] below is NULL, it can result in a + crash. Error out early as it indicates a malformed packet. + For data[0], data[1] and data[5], strmake_root will handle + NULL values. + */ + if (!row->data[2] || !row->data[3] || !row->data[4]) + { + free_rows(data); + set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate); + DBUG_RETURN(0); + } + cli_fetch_lengths(&lengths[0], row->data, default_value ? 6 : 5); - field->org_table= field->table= strdup_root(alloc,(char*) row->data[0]); - field->name= strdup_root(alloc,(char*) row->data[1]); + field->org_table= field->table= strmake_root(alloc,(char*) row->data[0], lengths[0]); + field->name= strmake_root(alloc,(char*) row->data[1], lengths[1]); field->length= (uint) uint3korr(row->data[2]); field->type= (enum enum_field_types) (uchar) row->data[3][0]; @@ -1215,7 +1229,7 @@ unpack_fields(MYSQL *mysql, MYSQL_DATA *data,MEM_ROOT *alloc,uint fields, field->flags|= NUM_FLAG; if (default_value && row->data[5]) { - field->def=strdup_root(alloc,(char*) row->data[5]); + field->def= strmake_root(alloc,(char*) row->data[5], lengths[5]); field->def_length= lengths[5]; } else diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc index e842d95e3b0..4ecf19c389b 100644 --- a/sql/event_scheduler.cc +++ b/sql/event_scheduler.cc @@ -1,4 +1,5 @@ -/* Copyright (c) 2006, 2013, Oracle and/or its affiliates. +/* Copyright (c) 2006, 2019, Oracle and/or its affiliates. + Copyright (c) 2009, 2020, MariaDB Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -509,6 +510,7 @@ Event_scheduler::run(THD *thd) DBUG_PRINT("info", ("job_data is NULL, the thread was killed")); } DBUG_PRINT("info", ("state=%s", scheduler_states_names[state].str)); + free_root(thd->mem_root, MYF(0)); } LOCK_DATA(); diff --git a/sql/gen_win_tzname_data.ps1 b/sql/gen_win_tzname_data.ps1 index 13b6ce6ffd0..c0a37d21895 100644 --- a/sql/gen_win_tzname_data.ps1 +++ b/sql/gen_win_tzname_data.ps1 @@ -4,7 +4,7 @@ write-output "/* This file was generated using gen_win_tzname_data.ps1 */" $xdoc = new-object System.Xml.XmlDocument -$xdoc.load("https://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml") +$xdoc.load("https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplemental/windowsZones.xml") $nodes = $xdoc.SelectNodes("//mapZone[@territory='001']") # use default territory (001) foreach ($node in $nodes) { write-output ('{L"'+ $node.other + '","'+ $node.type+'"},') diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 29cf73aeea0..be907a0c4b3 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -355,9 +355,8 @@ QUICK_RANGE_SELECT *get_quick_select(PARAM *param,uint index, uint mrr_buf_size, MEM_ROOT *alloc); static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, bool index_read_must_be_used, - bool update_tbl_stats, - double read_time, - bool ror_scans_required); + bool for_range_access, + double read_time); static TRP_INDEX_INTERSECT *get_best_index_intersect(PARAM *param, SEL_TREE *tree, double read_time); @@ -2889,7 +2888,6 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, It is possible to use a range-based quick select (but it might be slower than 'all' table scan). */ - TRP_RANGE *range_trp; TRP_ROR_INTERSECT *rori_trp; TRP_INDEX_INTERSECT *intersect_trp; bool can_build_covering= FALSE; @@ -2902,9 +2900,9 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, remove_nonrange_trees(¶m, tree); /* Get best 'range' plan and prepare data for making other plans */ - if ((range_trp= get_key_scans_params(¶m, tree, - only_single_index_range_scan, TRUE, - best_read_time, FALSE))) + if (auto range_trp= get_key_scans_params(¶m, tree, + only_single_index_range_scan, + true, best_read_time)) { best_trp= range_trp; best_read_time= best_trp->read_cost; @@ -5097,9 +5095,6 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, n_child_scans))) DBUG_RETURN(NULL); - const bool only_ror_scans_required= !optimizer_flag(param->thd, - OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION); - Json_writer_object trace_best_disjunct(thd); Json_writer_array to_merge(thd, "indexes_to_merge"); /* @@ -5115,8 +5110,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick(PARAM *param, SEL_IMERGE *imerge, "tree in SEL_IMERGE");); Json_writer_object trace_idx(thd); if (!(*cur_child= get_key_scans_params(param, *ptree, TRUE, FALSE, - read_time, - only_ror_scans_required))) + read_time))) { /* One of index scans in this index_merge is more expensive than entire @@ -5474,9 +5468,12 @@ TABLE_READ_PLAN *merge_same_index_scans(PARAM *param, SEL_IMERGE *imerge, a random order 2. the functions that estimate the cost of a range scan and an index merge retrievals are not well calibrated + + As the best range access has been already chosen it does not + make sense to evaluate the one obtained from a degenerated + index merge. */ - trp= get_key_scans_params(param, *imerge->trees, FALSE, TRUE, - read_time, FALSE); + trp= 0; } DBUG_RETURN(trp); @@ -7361,9 +7358,9 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param, tree make range select for this SEL_TREE index_read_must_be_used if TRUE, assume 'index only' option will be set (except for clustered PK indexes) + for_range_access if TRUE the function is called to get the best range + plan for range access, not for index merge access read_time don't create read plans with cost > read_time. - only_ror_scans_required set to TRUE when we are only interested - in ROR scan RETURN Best range read plan NULL if no plan found or error occurred @@ -7371,9 +7368,8 @@ TRP_ROR_INTERSECT *get_best_covering_ror_intersect(PARAM *param, static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, bool index_read_must_be_used, - bool update_tbl_stats, - double read_time, - bool only_ror_scans_required) + bool for_range_access, + double read_time) { uint idx, UNINIT_VAR(best_idx); SEL_ARG *key_to_read= NULL; @@ -7401,7 +7397,8 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, (INDEX_SCAN_INFO **) alloc_root(param->mem_root, sizeof(INDEX_SCAN_INFO *) * param->keys); } - tree->index_scans_end= tree->index_scans; + tree->index_scans_end= tree->index_scans; + for (idx= 0; idx < param->keys; idx++) { SEL_ARG *key= tree->keys[idx]; @@ -7425,10 +7422,15 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, trace_idx.add("index", param->table->key_info[keynr].name); found_records= check_quick_select(param, idx, read_index_only, key, - update_tbl_stats, &mrr_flags, + for_range_access, &mrr_flags, &buf_size, &cost, &is_ror_scan); - if (only_ror_scans_required && !is_ror_scan) + + if (!for_range_access && !is_ror_scan && + !optimizer_flag(param->thd,OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION)) + { + /* The scan is not a ROR-scan, just skip it */ continue; + } if (found_records != HA_POS_ERROR && tree->index_scans && (index_scan= (INDEX_SCAN_INFO *)alloc_root(param->mem_root, @@ -7457,7 +7459,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree, .add("index_only", read_index_only) .add("rows", found_records) .add("cost", cost.total_cost()); - } + } if ((found_records != HA_POS_ERROR) && is_ror_scan) { tree->n_ror_scans++; diff --git a/sql/slave.cc b/sql/slave.cc index fb26856f811..9b9400bd7bc 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -4914,6 +4914,7 @@ connected: goto err; goto connected; } + DBUG_EXECUTE_IF("fail_com_register_slave", goto err;); } DBUG_PRINT("info",("Starting reading binary log from master")); diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc index 2cbbd83ec36..a1d235086db 100644 --- a/sql/sql_alter.cc +++ b/sql/sql_alter.cc @@ -71,6 +71,10 @@ bool Alter_info::set_requested_algorithm(const LEX_CSTRING *str) return false; } +void Alter_info::set_requested_algorithm(enum_alter_table_algorithm algo_val) +{ + requested_algorithm= algo_val; +} bool Alter_info::set_requested_lock(const LEX_CSTRING *str) { @@ -88,13 +92,16 @@ bool Alter_info::set_requested_lock(const LEX_CSTRING *str) return false; } -const char* Alter_info::algorithm() const +const char* Alter_info::algorithm_clause(THD *thd) const { - switch (requested_algorithm) { + switch (algorithm(thd)) { case ALTER_TABLE_ALGORITHM_INPLACE: return "ALGORITHM=INPLACE"; case ALTER_TABLE_ALGORITHM_COPY: return "ALGORITHM=COPY"; + case ALTER_TABLE_ALGORITHM_NONE: + DBUG_ASSERT(0); + /* Fall through */ case ALTER_TABLE_ALGORITHM_DEFAULT: return "ALGORITHM=DEFAULT"; case ALTER_TABLE_ALGORITHM_NOCOPY: @@ -125,9 +132,6 @@ const char* Alter_info::lock() const bool Alter_info::supports_algorithm(THD *thd, enum_alter_inplace_result result, const Alter_inplace_info *ha_alter_info) { - if (requested_algorithm == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT) - requested_algorithm = (Alter_info::enum_alter_table_algorithm) thd->variables.alter_algorithm; - switch (result) { case HA_ALTER_INPLACE_EXCLUSIVE_LOCK: case HA_ALTER_INPLACE_SHARED_LOCK: @@ -136,16 +140,16 @@ bool Alter_info::supports_algorithm(THD *thd, enum_alter_inplace_result result, return false; case HA_ALTER_INPLACE_COPY_NO_LOCK: case HA_ALTER_INPLACE_COPY_LOCK: - if (requested_algorithm >= Alter_info::ALTER_TABLE_ALGORITHM_NOCOPY) + if (algorithm(thd) >= Alter_info::ALTER_TABLE_ALGORITHM_NOCOPY) { - ha_alter_info->report_unsupported_error(algorithm(), + ha_alter_info->report_unsupported_error(algorithm_clause(thd), "ALGORITHM=INPLACE"); return true; } return false; case HA_ALTER_INPLACE_NOCOPY_NO_LOCK: case HA_ALTER_INPLACE_NOCOPY_LOCK: - if (requested_algorithm == Alter_info::ALTER_TABLE_ALGORITHM_INSTANT) + if (algorithm(thd) == Alter_info::ALTER_TABLE_ALGORITHM_INSTANT) { ha_alter_info->report_unsupported_error("ALGORITHM=INSTANT", "ALGORITHM=NOCOPY"); @@ -153,9 +157,9 @@ bool Alter_info::supports_algorithm(THD *thd, enum_alter_inplace_result result, } return false; case HA_ALTER_INPLACE_NOT_SUPPORTED: - if (requested_algorithm >= Alter_info::ALTER_TABLE_ALGORITHM_INPLACE) + if (algorithm(thd) >= Alter_info::ALTER_TABLE_ALGORITHM_INPLACE) { - ha_alter_info->report_unsupported_error(algorithm(), + ha_alter_info->report_unsupported_error(algorithm_clause(thd), "ALGORITHM=COPY"); return true; } @@ -176,7 +180,7 @@ bool Alter_info::supports_lock(THD *thd, enum_alter_inplace_result result, case HA_ALTER_INPLACE_EXCLUSIVE_LOCK: // If SHARED lock and no particular algorithm was requested, use COPY. if (requested_lock == Alter_info::ALTER_TABLE_LOCK_SHARED && - requested_algorithm == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT && + algorithm(thd) == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT && thd->variables.alter_algorithm == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT) return false; @@ -239,6 +243,14 @@ bool Alter_info::vers_prohibited(THD *thd) const return false; } +Alter_info::enum_alter_table_algorithm +Alter_info::algorithm(const THD *thd) const +{ + if (requested_algorithm == ALTER_TABLE_ALGORITHM_NONE) + return (Alter_info::enum_alter_table_algorithm) thd->variables.alter_algorithm; + return requested_algorithm; +} + Alter_table_ctx::Alter_table_ctx() : implicit_default_value_error_field(NULL), diff --git a/sql/sql_alter.h b/sql/sql_alter.h index a553c31346a..88873477c7c 100644 --- a/sql/sql_alter.h +++ b/sql/sql_alter.h @@ -58,7 +58,10 @@ public: ALTER_TABLE_ALGORITHM_NOCOPY, // Instant should allow any operation that changes metadata only. - ALTER_TABLE_ALGORITHM_INSTANT + ALTER_TABLE_ALGORITHM_INSTANT, + + // When there is no specification of algorithm during alter table. + ALTER_TABLE_ALGORITHM_NONE }; @@ -107,8 +110,11 @@ public: List<const char> partition_names; // Number of partitions. uint num_parts; +private: // Type of ALTER TABLE algorithm. enum_alter_table_algorithm requested_algorithm; + +public: // Type of ALTER TABLE lock. enum_alter_table_lock requested_lock; @@ -117,7 +123,7 @@ public: flags(0), partition_flags(0), keys_onoff(LEAVE_AS_IS), num_parts(0), - requested_algorithm(ALTER_TABLE_ALGORITHM_DEFAULT), + requested_algorithm(ALTER_TABLE_ALGORITHM_NONE), requested_lock(ALTER_TABLE_LOCK_DEFAULT) {} @@ -134,7 +140,7 @@ public: keys_onoff= LEAVE_AS_IS; num_parts= 0; partition_names.empty(); - requested_algorithm= ALTER_TABLE_ALGORITHM_DEFAULT; + requested_algorithm= ALTER_TABLE_ALGORITHM_NONE; requested_lock= ALTER_TABLE_LOCK_DEFAULT; } @@ -182,9 +188,15 @@ public: bool set_requested_lock(const LEX_CSTRING *str); /** + Set the requested algorithm to the given algorithm value + @param algo_value algorithm to be set + */ + void set_requested_algorithm(enum_alter_table_algorithm algo_value); + + /** Returns the algorithm value in the format "algorithm=value" */ - const char* algorithm() const; + const char* algorithm_clause(THD *thd) const; /** Returns the lock value in the format "lock=value" @@ -220,6 +232,12 @@ public: bool supports_lock(THD *thd, enum_alter_inplace_result result, const Alter_inplace_info *ha_alter_info); + /** + Return user requested algorithm. If user does not specify + algorithm then return alter_algorithm variable value. + */ + enum_alter_table_algorithm algorithm(const THD *thd) const; + private: Alter_info &operator=(const Alter_info &rhs); // not implemented Alter_info(const Alter_info &rhs); // not implemented diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 59990e11e71..12c3d0a153d 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. +/* Copyright (c) 2000, 2019, Oracle and/or its affiliates. Copyright (c) 2009, 2020, MariaDB Corporation This program is free software; you can redistribute it and/or modify @@ -1795,17 +1795,27 @@ static inline uint int_token(const char *str,uint length) */ bool Lex_input_stream::consume_comment(int remaining_recursions_permitted) { + // only one level of nested comments are allowed + DBUG_ASSERT(remaining_recursions_permitted == 0 || + remaining_recursions_permitted == 1); uchar c; while (!eof()) { c= yyGet(); - if (remaining_recursions_permitted > 0) + if (remaining_recursions_permitted == 1) { if ((c == '/') && (yyPeek() == '*')) { - yySkip(); // Eat asterisk - consume_comment(remaining_recursions_permitted - 1); + yyUnput('('); // Replace nested "/*..." with "(*..." + yySkip(); // and skip "(" + + yySkip(); /* Eat asterisk */ + if (consume_comment(0)) + return true; + + yyUnput(')'); // Replace "...*/" with "...*)" + yySkip(); // and skip ")" continue; } } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 273e5b79233..872dc8ce840 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2103,7 +2103,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, general_log_print(thd, command, "Log: '%s' Pos: %lu", name, pos); if (nlen < FN_REFLEN) mysql_binlog_send(thd, thd->strmake(name, nlen), (my_off_t)pos, flags); - thd->unregister_slave(); + thd->unregister_slave(); // todo: can be extraneous /* fake COM_QUIT -- if we get here, the thread needs to terminate */ error = TRUE; break; diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index c7b1efc89f3..5ce2ba1f407 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -5908,7 +5908,7 @@ the generated partition syntax in a correct manner. */ if (alter_info->partition_flags != ALTER_PARTITION_INFO || !table->part_info || - alter_info->requested_algorithm != + alter_info->algorithm(thd) != Alter_info::ALTER_TABLE_ALGORITHM_INPLACE || !table->part_info->has_same_partitioning(part_info)) { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 638f044be77..fcff6b6c3b1 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -10741,6 +10741,7 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, uchar *key_buff=j->ref.key_buff, *null_ref_key= 0; uint null_ref_part= NO_REF_PART; bool keyuse_uses_no_tables= TRUE; + uint not_null_keyparts= 0; if (ftkey) { j->ref.items[0]=((Item_func*)(keyuse->val))->key_item(); @@ -10770,6 +10771,8 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, j->ref.items[i]=keyuse->val; // Save for cond removal j->ref.cond_guards[i]= keyuse->cond_guard; + if (!keyuse->val->maybe_null || keyuse->null_rejecting) + not_null_keyparts++; /* Set ref.null_rejecting to true only if we are going to inject a "keyuse->val IS NOT NULL" predicate. @@ -10829,12 +10832,18 @@ static bool create_ref_for_key(JOIN *join, JOIN_TAB *j, ulong key_flags= j->table->actual_key_flags(keyinfo); if (j->type == JT_CONST) j->table->const_table= 1; - else if (!((keyparts == keyinfo->user_defined_key_parts && - ((key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME)) || - (keyparts > keyinfo->user_defined_key_parts && // true only for extended keys - MY_TEST(key_flags & HA_EXT_NOSAME) && - keyparts == keyinfo->ext_key_parts)) || - null_ref_key) + else if (!((keyparts == keyinfo->user_defined_key_parts && + ( + (key_flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME || + /* Unique key and all keyparts are NULL rejecting */ + ((key_flags & HA_NOSAME) && keyparts == not_null_keyparts) + )) || + /* true only for extended keys */ + (keyparts > keyinfo->user_defined_key_parts && + MY_TEST(key_flags & HA_EXT_NOSAME) && + keyparts == keyinfo->ext_key_parts) + ) || + null_ref_key) { /* Must read with repeat */ j->type= null_ref_key ? JT_REF_OR_NULL : JT_REF; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index b272a0f44b5..1434e0d61d4 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -10108,7 +10108,7 @@ do_continue:; */ if (!(alter_info->flags & ~(ALTER_RENAME | ALTER_KEYS_ONOFF)) && alter_info->partition_flags == 0 && - alter_info->requested_algorithm != + alter_info->algorithm(thd) != Alter_info::ALTER_TABLE_ALGORITHM_COPY) // No need to touch frm. { bool res; @@ -10182,7 +10182,7 @@ do_continue:; "LOCK=DEFAULT"); DBUG_RETURN(true); } - else if (alter_info->requested_algorithm != + else if (alter_info->algorithm(thd) != Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT) { my_error(ER_ALTER_OPERATION_NOT_SUPPORTED_REASON, MYF(0), @@ -10222,20 +10222,21 @@ do_continue:; using in-place API. */ if ((thd->variables.alter_algorithm == Alter_info::ALTER_TABLE_ALGORITHM_COPY && - alter_info->requested_algorithm != + alter_info->algorithm(thd) != Alter_info::ALTER_TABLE_ALGORITHM_INPLACE) || is_inplace_alter_impossible(table, create_info, alter_info) || IF_PARTITIONING((partition_changed && !(table->s->db_type()->partition_flags() & HA_USE_AUTO_PARTITION)), 0)) { - if (alter_info->requested_algorithm == + if (alter_info->algorithm(thd) == Alter_info::ALTER_TABLE_ALGORITHM_INPLACE) { my_error(ER_ALTER_OPERATION_NOT_SUPPORTED, MYF(0), "ALGORITHM=INPLACE", "ALGORITHM=COPY"); DBUG_RETURN(true); } - alter_info->requested_algorithm= Alter_info::ALTER_TABLE_ALGORITHM_COPY; + alter_info->set_requested_algorithm( + Alter_info::ALTER_TABLE_ALGORITHM_COPY); } /* @@ -10327,7 +10328,7 @@ do_continue:; DBUG_RETURN(true); } - if (alter_info->requested_algorithm != Alter_info::ALTER_TABLE_ALGORITHM_COPY) + if (alter_info->algorithm(thd) != Alter_info::ALTER_TABLE_ALGORITHM_COPY) { Alter_inplace_info ha_alter_info(create_info, alter_info, key_info, key_count, @@ -10425,7 +10426,7 @@ do_continue:; // If SHARED lock and no particular algorithm was requested, use COPY. if (inplace_supported == HA_ALTER_INPLACE_EXCLUSIVE_LOCK && alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_SHARED && - alter_info->requested_algorithm == + alter_info->algorithm(thd) == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT && thd->variables.alter_algorithm == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT) @@ -11368,7 +11369,8 @@ bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool table_copy) alter_info.flags= (ALTER_CHANGE_COLUMN | ALTER_RECREATE); if (table_copy) - alter_info.requested_algorithm= Alter_info::ALTER_TABLE_ALGORITHM_COPY; + alter_info.set_requested_algorithm( + Alter_info::ALTER_TABLE_ALGORITHM_COPY); bool res= mysql_alter_table(thd, &null_clex_str, &null_clex_str, &create_info, table_list, &alter_info, 0, diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 8d20193e518..b946b8a9ee0 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -7842,8 +7842,8 @@ opt_index_lock_algorithm: alter_algorithm_option: ALGORITHM_SYM opt_equal DEFAULT { - Lex->alter_info.requested_algorithm= - Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT; + Lex->alter_info.set_requested_algorithm( + Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT); } | ALGORITHM_SYM opt_equal ident { diff --git a/sql/win_tzname_data.h b/sql/win_tzname_data.h index 28a14ab7c11..03197227f8e 100644 --- a/sql/win_tzname_data.h +++ b/sql/win_tzname_data.h @@ -23,13 +23,13 @@ {L"Haiti Standard Time","America/Port-au-Prince"}, {L"Cuba Standard Time","America/Havana"}, {L"US Eastern Standard Time","America/Indianapolis"}, +{L"Turks And Caicos Standard Time","America/Grand_Turk"}, {L"Paraguay Standard Time","America/Asuncion"}, {L"Atlantic Standard Time","America/Halifax"}, {L"Venezuela Standard Time","America/Caracas"}, {L"Central Brazilian Standard Time","America/Cuiaba"}, {L"SA Western Standard Time","America/La_Paz"}, {L"Pacific SA Standard Time","America/Santiago"}, -{L"Turks And Caicos Standard Time","America/Grand_Turk"}, {L"Newfoundland Standard Time","America/St_Johns"}, {L"Tocantins Standard Time","America/Araguaina"}, {L"E. South America Standard Time","America/Sao_Paulo"}, @@ -46,11 +46,11 @@ {L"UTC","Etc/GMT"}, {L"GMT Standard Time","Europe/London"}, {L"Greenwich Standard Time","Atlantic/Reykjavik"}, +{L"Sao Tome Standard Time","Africa/Sao_Tome"}, +{L"Morocco Standard Time","Africa/Casablanca"}, {L"W. Europe Standard Time","Europe/Berlin"}, {L"Central Europe Standard Time","Europe/Budapest"}, {L"Romance Standard Time","Europe/Paris"}, -{L"Morocco Standard Time","Africa/Casablanca"}, -{L"Sao Tome Standard Time","Africa/Sao_Tome"}, {L"Central European Standard Time","Europe/Warsaw"}, {L"W. Central Africa Standard Time","Africa/Lagos"}, {L"Jordan Standard Time","Asia/Amman"}, @@ -81,11 +81,13 @@ {L"Mauritius Standard Time","Indian/Mauritius"}, {L"Saratov Standard Time","Europe/Saratov"}, {L"Georgian Standard Time","Asia/Tbilisi"}, +{L"Volgograd Standard Time","Europe/Volgograd"}, {L"Caucasus Standard Time","Asia/Yerevan"}, {L"Afghanistan Standard Time","Asia/Kabul"}, {L"West Asia Standard Time","Asia/Tashkent"}, {L"Ekaterinburg Standard Time","Asia/Yekaterinburg"}, {L"Pakistan Standard Time","Asia/Karachi"}, +{L"Qyzylorda Standard Time","Asia/Qyzylorda"}, {L"India Standard Time","Asia/Calcutta"}, {L"Sri Lanka Standard Time","Asia/Colombo"}, {L"Nepal Standard Time","Asia/Katmandu"}, diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp index cc67f825b87..b6260eb66ee 100644 --- a/storage/connect/tabxml.cpp +++ b/storage/connect/tabxml.cpp @@ -817,12 +817,15 @@ bool TDBXML::Initialize(PGLOBAL g) if (Void) return false; - if (Columns && !Bufdone) { + if (Columns) { // Allocate the buffers that will contain node values for (colp = (PXMLCOL)Columns; colp; colp = (PXMLCOL)colp->GetNext()) - if (!colp->IsSpecial()) // Not a pseudo column - if (colp->AllocBuf(g, Mode == MODE_INSERT)) - return true; + if (!colp->IsSpecial()) { // Not a pseudo column + if (!Bufdone && colp->AllocBuf(g, Mode == MODE_INSERT)) + return true; + + colp->Nx = colp->Sx = -1; + } // endif Special Bufdone = true; } // endif Bufdone diff --git a/storage/connect/tabxml.h b/storage/connect/tabxml.h index fb3913f08ea..42dbb038b47 100644 --- a/storage/connect/tabxml.h +++ b/storage/connect/tabxml.h @@ -157,6 +157,7 @@ class DllExport TDBXML : public TDBASE { /* Class XMLCOL: XDB table access method column descriptor. */ /***********************************************************************/ class XMLCOL : public COLBLK { + friend class TDBXML; public: // Constructors XMLCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am = "XML"); diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 5746ac05817..0a4fb9e1c2b 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -765,7 +765,7 @@ void btr_page_free(dict_index_t* index, buf_block_t* block, mtr_t* mtr, @param[in,out] mtr mini-transaction Sets the child node file address in a node pointer. */ inline void btr_node_ptr_set_child_page_no(buf_block_t *block, - rec_t *rec, const offset_t *offsets, + rec_t *rec, const rec_offs *offsets, ulint page_no, mtr_t *mtr) { ut_ad(rec_offs_validate(rec, NULL, offsets)); @@ -791,7 +791,7 @@ btr_node_ptr_get_child( /*===================*/ const rec_t* node_ptr,/*!< in: node pointer */ dict_index_t* index, /*!< in: index */ - const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ mtr_t* mtr) /*!< in: mtr */ { ut_ad(rec_offs_validate(node_ptr, index, offsets)); @@ -809,10 +809,10 @@ Returns the upper level node pointer to a page. It is assumed that mtr holds an sx-latch on the tree. @return rec_get_offsets() of the node pointer record */ static -offset_t* +rec_offs* btr_page_get_father_node_ptr_func( /*==============================*/ - offset_t* offsets,/*!< in: work area for the return value */ + rec_offs* offsets,/*!< in: work area for the return value */ mem_heap_t* heap, /*!< in: memory heap to use */ btr_cur_t* cursor, /*!< in: cursor pointing to user record, out: cursor on node pointer record, @@ -916,10 +916,10 @@ Returns the upper level node pointer to a page. It is assumed that mtr holds an x-latch on the tree. @return rec_get_offsets() of the node pointer record */ static -offset_t* +rec_offs* btr_page_get_father_block( /*======================*/ - offset_t* offsets,/*!< in: work area for the return value */ + rec_offs* offsets,/*!< in: work area for the return value */ mem_heap_t* heap, /*!< in: memory heap to use */ dict_index_t* index, /*!< in: b-tree index */ buf_block_t* block, /*!< in: child page in the index */ @@ -1853,7 +1853,7 @@ btr_root_raise_and_insert( on the root page; when the function returns, the cursor is positioned on the predecessor of the inserted record */ - offset_t** offsets,/*!< out: offsets on inserted record */ + rec_offs** offsets,/*!< out: offsets on inserted record */ mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ const dtuple_t* tuple, /*!< in: tuple to insert */ ulint n_ext, /*!< in: number of externally stored columns */ @@ -2190,7 +2190,7 @@ btr_page_get_split_rec( rec_t* next_rec; ulint n; mem_heap_t* heap; - offset_t* offsets; + rec_offs* offsets; page = btr_cur_get_page(cursor); @@ -2296,7 +2296,7 @@ btr_page_insert_fits( const rec_t* split_rec,/*!< in: suggestion for first record on upper half-page, or NULL if tuple to be inserted should be first */ - offset_t** offsets,/*!< in: rec_get_offsets( + rec_offs** offsets,/*!< in: rec_get_offsets( split_rec, cursor->index); out: garbage */ const dtuple_t* tuple, /*!< in: tuple to insert */ ulint n_ext, /*!< in: number of externally stored columns */ @@ -2396,8 +2396,8 @@ btr_insert_on_non_leaf_level_func( dberr_t err; rec_t* rec; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); rtr_info_t rtr_info; @@ -2497,7 +2497,7 @@ btr_attach_half_pages( if (direction == FSP_DOWN) { btr_cur_t cursor; - offset_t* offsets; + rec_offs* offsets; lower_block = new_block; upper_block = block; @@ -2599,7 +2599,7 @@ btr_page_tuple_smaller( /*===================*/ btr_cur_t* cursor, /*!< in: b-tree cursor */ const dtuple_t* tuple, /*!< in: tuple to consider */ - offset_t** offsets,/*!< in/out: temporary storage */ + rec_offs** offsets,/*!< in/out: temporary storage */ ulint n_uniq, /*!< in: number of unique fields in the index page records */ mem_heap_t** heap) /*!< in/out: heap for offsets */ @@ -2639,7 +2639,7 @@ rec_t* btr_insert_into_right_sibling( ulint flags, btr_cur_t* cursor, - offset_t** offsets, + rec_offs** offsets, mem_heap_t* heap, const dtuple_t* tuple, ulint n_ext, @@ -2775,7 +2775,7 @@ btr_page_split_and_insert( btr_cur_t* cursor, /*!< in: cursor at which to insert; when the function returns, the cursor is positioned on the predecessor of the inserted record */ - offset_t** offsets,/*!< out: offsets on inserted record */ + rec_offs** offsets,/*!< out: offsets on inserted record */ mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ const dtuple_t* tuple, /*!< in: tuple to insert */ ulint n_ext, /*!< in: number of externally stored columns */ @@ -3249,7 +3249,7 @@ btr_lift_page_up( { btr_cur_t cursor; - offset_t* offsets = NULL; + rec_offs* offsets = NULL; mem_heap_t* heap = mem_heap_create( sizeof(*offsets) * (REC_OFFS_HEADER_SIZE + 1 + 1 @@ -3432,7 +3432,7 @@ btr_compress( page_t* page; btr_cur_t father_cursor; mem_heap_t* heap; - offset_t* offsets; + rec_offs* offsets; ulint nth_rec = 0; /* remove bogus warning */ bool mbr_changed = false; #ifdef UNIV_DEBUG @@ -3573,7 +3573,7 @@ retry: if (is_left) { btr_cur_t cursor2; rtr_mbr_t new_mbr; - offset_t* offsets2 = NULL; + rec_offs* offsets2 = NULL; /* For rtree, we need to update father's mbr. */ if (dict_index_is_spatial(index)) { @@ -3768,7 +3768,7 @@ retry: /* For rtree, we need to update father's mbr. */ if (dict_index_is_spatial(index)) { - offset_t* offsets2; + rec_offs* offsets2; ulint rec_info; offsets2 = rec_get_offsets( @@ -3996,7 +3996,7 @@ btr_discard_only_page_on_level( mem_heap_t* heap = NULL; const rec_t* rec = NULL; - offset_t* offsets = NULL; + rec_offs* offsets = NULL; if (index->table->instant) { const rec_t* r = page_rec_get_next(page_get_infimum_rec( block->frame)); @@ -4226,7 +4226,7 @@ btr_print_recursive( ulint width, /*!< in: print this many entries from start and end */ mem_heap_t** heap, /*!< in/out: heap for rec_get_offsets() */ - offset_t** offsets,/*!< in/out: buffer for rec_get_offsets() */ + rec_offs** offsets,/*!< in/out: buffer for rec_get_offsets() */ mtr_t* mtr) /*!< in: mtr */ { const page_t* page = buf_block_get_frame(block); @@ -4290,8 +4290,8 @@ btr_print_index( mtr_t mtr; buf_block_t* root; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); fputs("--------------------------\n" @@ -4325,7 +4325,7 @@ btr_check_node_ptr( { mem_heap_t* heap; dtuple_t* tuple; - offset_t* offsets; + rec_offs* offsets; btr_cur_t cursor; page_t* page = buf_block_get_frame(block); @@ -4405,8 +4405,8 @@ btr_index_rec_validate( ulint len; const page_t* page; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); page = page_align(rec); @@ -4671,8 +4671,8 @@ btr_validate_level( bool ret = true; mtr_t mtr; mem_heap_t* heap = mem_heap_create(256); - offset_t* offsets = NULL; - offset_t* offsets2= NULL; + rec_offs* offsets = NULL; + rec_offs* offsets2= NULL; #ifdef UNIV_ZIP_DEBUG page_zip_des_t* page_zip; #endif /* UNIV_ZIP_DEBUG */ diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc index d199f1230dc..15f0335e819 100644 --- a/storage/innobase/btr/btr0bulk.cc +++ b/storage/innobase/btr/btr0bulk.cc @@ -153,7 +153,7 @@ PageBulk::init() @param[in,out] rec record @param[in] offsets record offsets */ template<PageBulk::format fmt> -inline void PageBulk::insertPage(rec_t *rec, offset_t *offsets) +inline void PageBulk::insertPage(rec_t *rec, rec_offs *offsets) { ut_ad((m_page_zip != nullptr) == (fmt == COMPRESSED)); ut_ad((fmt != REDUNDANT) == m_is_comp); @@ -171,7 +171,7 @@ inline void PageBulk::insertPage(rec_t *rec, offset_t *offsets) (fmt == REDUNDANT ? PAGE_OLD_INFIMUM : PAGE_NEW_INFIMUM)) { const rec_t *old_rec = m_cur_rec; - offset_t *old_offsets= rec_get_offsets(old_rec, m_index, nullptr, is_leaf, + rec_offs *old_offsets= rec_get_offsets(old_rec, m_index, nullptr, is_leaf, ULINT_UNDEFINED, &m_heap); ut_ad(cmp_rec_rec(rec, old_rec, offsets, old_offsets, m_index) > 0); } @@ -321,7 +321,7 @@ rec_done: /** Insert a record in the page. @param[in] rec record @param[in] offsets record offsets */ -inline void PageBulk::insert(const rec_t *rec, offset_t *offsets) +inline void PageBulk::insert(const rec_t *rec, rec_offs *offsets) { byte rec_hdr[REC_N_OLD_EXTRA_BYTES]; static_assert(REC_N_OLD_EXTRA_BYTES > REC_N_NEW_EXTRA_BYTES, "file format"); @@ -572,7 +572,7 @@ rec_t* PageBulk::getSplitRec() { rec_t* rec; - offset_t* offsets; + rec_offs* offsets; ulint total_used_size; ulint total_recs_size; ulint n_recs; @@ -618,7 +618,7 @@ PageBulk::copyIn( { rec_t* rec = split_rec; - offset_t* offsets = NULL; + rec_offs* offsets = NULL; ut_ad(m_rec_no == 0); ut_ad(page_rec_is_user_rec(rec)); @@ -664,7 +664,7 @@ PageBulk::copyOut( ut_ad(n > 0); /* Set last record's next in page */ - offset_t* offsets = NULL; + rec_offs* offsets = NULL; rec = page_rec_get_prev(split_rec); offsets = rec_get_offsets(rec, m_index, offsets, page_rec_is_leaf(split_rec), @@ -773,7 +773,7 @@ the blob data is logged first, then the record is logged in bulk mode. dberr_t PageBulk::storeExt( const big_rec_t* big_rec, - offset_t* offsets) + rec_offs* offsets) { /* Note: not all fileds are initialized in btr_pcur. */ btr_pcur_t btr_pcur; @@ -1028,7 +1028,7 @@ BtrBulk::insert( ulint rec_size = rec_get_converted_size(m_index, tuple, n_ext); big_rec_t* big_rec = NULL; rec_t* rec = NULL; - offset_t* offsets = NULL; + rec_offs* offsets = NULL; if (page_bulk->needExt(tuple, rec_size)) { /* The record is so big that we have to store some fields diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index d8e9436e34a..ab984252983 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -157,7 +157,7 @@ btr_cur_unmark_extern_fields( buf_block_t* block, /*!< in/out: index page */ rec_t* rec, /*!< in/out: record in a clustered index */ dict_index_t* index, /*!< in: index of the page */ - const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ mtr_t* mtr); /*!< in: mtr, or NULL if not logged */ /*******************************************************************//** Adds path information to the cursor for the current page, for which @@ -181,7 +181,7 @@ btr_rec_free_updated_extern_fields( X-latched */ rec_t* rec, /*!< in: record */ buf_block_t* block, /*!< in: index page of rec */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ const upd_t* update, /*!< in: update vector */ bool rollback,/*!< in: performing rollback? */ mtr_t* mtr); /*!< in: mini-transaction handle which contains @@ -195,7 +195,7 @@ btr_rec_free_externally_stored_fields( dict_index_t* index, /*!< in: index of the data, the index tree MUST be X-latched */ rec_t* rec, /*!< in: record */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ buf_block_t* block, /*!< in: index page of rec */ bool rollback,/*!< in: performing rollback? */ mtr_t* mtr); /*!< in: mini-transaction handle which contains @@ -590,7 +590,7 @@ incompatible: } mem_heap_t* heap = NULL; - offset_t* offsets = rec_get_offsets(rec, index, NULL, true, + rec_offs* offsets = rec_get_offsets(rec, index, NULL, true, ULINT_UNDEFINED, &heap); if (rec_offs_any_default(offsets)) { inconsistent: @@ -1286,10 +1286,10 @@ btr_cur_search_to_nth_level_func( btr_search_t* info; #endif /* BTR_CUR_ADAPT */ mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; - offset_t offsets2_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets2 = offsets2_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; + rec_offs offsets2_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets2 = offsets2_; rec_offs_init(offsets_); rec_offs_init(offsets2_); /* Currently, PAGE_CUR_LE is the only search mode used for searches @@ -2545,8 +2545,8 @@ btr_cur_open_at_index_side_func( ulint n_blocks = 0; ulint n_releases = 0; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; dberr_t err = DB_SUCCESS; rec_offs_init(offsets_); @@ -2896,8 +2896,8 @@ btr_cur_open_at_rnd_pos_func( ulint n_blocks = 0; ulint n_releases = 0; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); ut_ad(!index->is_spatial()); @@ -3185,7 +3185,7 @@ btr_cur_insert_if_possible( cursor stays valid */ const dtuple_t* tuple, /*!< in: tuple to insert; the size info need not have been stored to tuple */ - offset_t** offsets,/*!< out: offsets on *rec */ + rec_offs** offsets,/*!< out: offsets on *rec */ mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ ulint n_ext, /*!< in: number of externally stored columns */ mtr_t* mtr) /*!< in/out: mini-transaction */ @@ -3341,7 +3341,7 @@ btr_cur_optimistic_insert( specified */ btr_cur_t* cursor, /*!< in: cursor on page after which to insert; cursor stays valid */ - offset_t** offsets,/*!< out: offsets on *rec */ + rec_offs** offsets,/*!< out: offsets on *rec */ mem_heap_t** heap, /*!< in/out: pointer to memory heap */ dtuple_t* entry, /*!< in/out: entry to insert */ rec_t** rec, /*!< out: pointer to inserted record if @@ -3646,7 +3646,7 @@ btr_cur_pessimistic_insert( insertion will certainly succeed */ btr_cur_t* cursor, /*!< in: cursor after which to insert; cursor stays valid */ - offset_t** offsets,/*!< out: offsets on *rec */ + rec_offs** offsets,/*!< out: offsets on *rec */ mem_heap_t** heap, /*!< in/out: pointer to memory heap that can be emptied */ dtuple_t* entry, /*!< in/out: entry to insert */ @@ -3819,7 +3819,7 @@ btr_cur_upd_lock_and_undo( /*======================*/ ulint flags, /*!< in: undo logging and locking flags */ btr_cur_t* cursor, /*!< in: cursor on record to update */ - const offset_t* offsets,/*!< in: rec_get_offsets() on cursor */ + const rec_offs* offsets,/*!< in: rec_get_offsets() on cursor */ const upd_t* update, /*!< in: update vector */ ulint cmpl_info,/*!< in: compiler info on secondary index updates */ @@ -3900,7 +3900,7 @@ static void btr_cur_write_sys( @param[in] roll_ptr DB_ROLL_PTR value @param[in,out] mtr mini-transaction */ static void btr_cur_upd_rec_sys(buf_block_t *block, rec_t *rec, - dict_index_t *index, const offset_t *offsets, + dict_index_t *index, const rec_offs *offsets, const trx_t *trx, roll_ptr_t roll_ptr, mtr_t *mtr) { @@ -4001,7 +4001,7 @@ btr_cur_update_alloc_zip_func( page_cur_t* cursor, /*!< in/out: B-tree page cursor */ dict_index_t* index, /*!< in: the index corresponding to cursor */ #ifdef UNIV_DEBUG - offset_t* offsets,/*!< in/out: offsets of the cursor record */ + rec_offs* offsets,/*!< in/out: offsets of the cursor record */ #endif /* UNIV_DEBUG */ ulint length, /*!< in: size needed */ bool create, /*!< in: true=delete-and-insert, @@ -4081,7 +4081,7 @@ counterpart in ibuf_insert_to_index_page(). @param[in,out] block index page @param[in,out] mtr mini-transaction */ void btr_cur_upd_rec_in_place(rec_t *rec, const dict_index_t *index, - const offset_t *offsets, const upd_t *update, + const rec_offs *offsets, const upd_t *update, buf_block_t *block, mtr_t *mtr) { ut_ad(rec_offs_validate(rec, index, offsets)); @@ -4211,7 +4211,7 @@ btr_cur_update_in_place( btr_cur_t* cursor, /*!< in: cursor on the record to update; cursor stays valid and positioned on the same record */ - offset_t* offsets,/*!< in/out: offsets on cursor->page_cur.rec */ + rec_offs* offsets,/*!< in/out: offsets on cursor->page_cur.rec */ const upd_t* update, /*!< in: update vector */ ulint cmpl_info,/*!< in: compiler info on secondary index updates */ @@ -4499,7 +4499,7 @@ btr_cur_optimistic_update( btr_cur_t* cursor, /*!< in: cursor on the record to update; cursor stays valid and positioned on the same record */ - offset_t** offsets,/*!< out: offsets on cursor->page_cur.rec */ + rec_offs** offsets,/*!< out: offsets on cursor->page_cur.rec */ mem_heap_t** heap, /*!< in/out: pointer to NULL or memory heap */ const upd_t* update, /*!< in: update vector; this must also contain trx id and roll ptr fields */ @@ -4834,7 +4834,7 @@ btr_cur_pessimistic_update( btr_cur_t* cursor, /*!< in/out: cursor on the record to update; cursor may become invalid if *big_rec == NULL || !(flags & BTR_KEEP_POS_FLAG) */ - offset_t** offsets,/*!< out: offsets on cursor->page_cur.rec */ + rec_offs** offsets,/*!< out: offsets on cursor->page_cur.rec */ mem_heap_t** offsets_heap, /*!< in/out: pointer to memory heap that can be emptied */ @@ -5321,7 +5321,7 @@ btr_cur_del_mark_set_clust_rec( buf_block_t* block, /*!< in/out: buffer block of the record */ rec_t* rec, /*!< in/out: record */ dict_index_t* index, /*!< in: clustered index of the record */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec) */ que_thr_t* thr, /*!< in: query thread */ const dtuple_t* entry, /*!< in: dtuple for the deleting record, also contains the virtual cols if there are any */ @@ -5449,8 +5449,8 @@ btr_cur_optimistic_delete_func( buf_block_t* block; rec_t* rec; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; ibool no_compress_needed; rec_offs_init(offsets_); @@ -5632,7 +5632,7 @@ btr_cur_pessimistic_delete( bool success; ibool ret = FALSE; mem_heap_t* heap; - offset_t* offsets; + rec_offs* offsets; #ifdef UNIV_DEBUG bool parent_latched = false; #endif /* UNIV_DEBUG */ @@ -5784,7 +5784,7 @@ discard_page: rtr_mbr_t father_mbr; rec_t* father_rec; btr_cur_t father_cursor; - offset_t* offsets; + rec_offs* offsets; bool upd_ret; ulint len; @@ -6527,7 +6527,7 @@ btr_record_not_null_field_in_rec( ulint n_unique, /*!< in: dict_index_get_n_unique(index), number of columns uniquely determine an index entry */ - const offset_t* offsets, /*!< in: rec_get_offsets(rec, index), + const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index), its size could be for all fields or that of "n_unique" */ ib_uint64_t* n_not_null) /*!< in/out: array to record number of @@ -6581,8 +6581,8 @@ btr_estimate_number_of_different_key_vals( uintmax_t add_on; mtr_t mtr; mem_heap_t* heap = NULL; - offset_t* offsets_rec = NULL; - offset_t* offsets_next_rec = NULL; + rec_offs* offsets_rec = NULL; + rec_offs* offsets_next_rec = NULL; /* For spatial index, there is no such stats can be fetched. */ @@ -6771,7 +6771,7 @@ btr_estimate_number_of_different_key_vals( and assign the old offsets_rec buffer to offsets_next_rec. */ { - offset_t* offsets_tmp = offsets_rec; + rec_offs* offsets_tmp = offsets_rec; offsets_rec = offsets_next_rec; offsets_next_rec = offsets_tmp; } @@ -6856,7 +6856,7 @@ static ulint btr_rec_get_field_ref_offs( /*=======================*/ - const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ ulint n) /*!< in: index of the external field */ { ulint field_ref_offs; @@ -6885,7 +6885,7 @@ btr_rec_get_field_ref_offs( ulint btr_rec_get_externally_stored_len( const rec_t* rec, - const offset_t* offsets) + const rec_offs* offsets) { ulint n_fields; ulint total_extern_len = 0; @@ -6923,7 +6923,7 @@ btr_cur_set_ownership_of_extern_field( buf_block_t* block, /*!< in/out: index page */ rec_t* rec, /*!< in/out: clustered index record */ dict_index_t* index, /*!< in: index of the page */ - const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ ulint i, /*!< in: field number */ bool val, /*!< in: value to set */ mtr_t* mtr) /*!< in: mtr, or NULL if not logged */ @@ -6969,7 +6969,7 @@ btr_cur_disown_inherited_fields( buf_block_t* block, /*!< in/out: index page */ rec_t* rec, /*!< in/out: record in a clustered index */ dict_index_t* index, /*!< in: index of the page */ - const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ const upd_t* update, /*!< in: update vector */ mtr_t* mtr) /*!< in/out: mini-transaction */ { @@ -6997,7 +6997,7 @@ btr_cur_unmark_extern_fields( buf_block_t* block, /*!< in/out: index page */ rec_t* rec, /*!< in/out: record in a clustered index */ dict_index_t* index, /*!< in: index of the page */ - const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ mtr_t* mtr) /*!< in: mtr, or NULL if not logged */ { ut_ad(!rec_offs_comp(offsets) || !rec_get_node_ptr_flag(rec)); @@ -7067,7 +7067,7 @@ struct btr_blob_log_check_t { /** Mini transaction holding the latches for m_pcur */ mtr_t* m_mtr; /** rec_get_offsets(rec, index); offset of clust_rec */ - const offset_t* m_offsets; + const rec_offs* m_offsets; /** The block containing clustered record */ buf_block_t** m_block; /** The clustered record pointer */ @@ -7087,7 +7087,7 @@ struct btr_blob_log_check_t { btr_blob_log_check_t( btr_pcur_t* pcur, mtr_t* mtr, - const offset_t* offsets, + const rec_offs* offsets, buf_block_t** block, rec_t** rec, enum blob_op op) @@ -7152,7 +7152,7 @@ struct btr_blob_log_check_t { *m_rec = btr_pcur_get_rec(m_pcur); rec_offs_make_valid(*m_rec, index, true, - const_cast<offset_t*>(m_offsets)); + const_cast<rec_offs*>(m_offsets)); ut_ad(m_mtr->memo_contains_page_flagged( *m_rec, @@ -7183,7 +7183,7 @@ btr_store_big_rec_extern_fields( btr_pcur_t* pcur, /*!< in/out: a persistent cursor. if btr_mtr is restarted, then this can be repositioned. */ - offset_t* offsets, /*!< in/out: rec_get_offsets() on + rec_offs* offsets, /*!< in/out: rec_get_offsets() on pcur. the "external storage" flags in offsets will correctly correspond to rec when this function returns */ @@ -7615,7 +7615,7 @@ btr_free_externally_stored_field( byte* field_ref, /*!< in/out: field reference */ const rec_t* rec, /*!< in: record containing field_ref, for page_zip_write_blob_ptr(), or NULL */ - const offset_t* offsets, /*!< in: rec_get_offsets(rec, index), + const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index), or NULL */ buf_block_t* block, /*!< in/out: page of field_ref */ ulint i, /*!< in: field number of field_ref; @@ -7782,7 +7782,7 @@ btr_rec_free_externally_stored_fields( dict_index_t* index, /*!< in: index of the data, the index tree MUST be X-latched */ rec_t* rec, /*!< in/out: record */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ buf_block_t* block, /*!< in: index page of rec */ bool rollback,/*!< in: performing rollback? */ mtr_t* mtr) /*!< in: mini-transaction handle which contains @@ -7821,7 +7821,7 @@ btr_rec_free_updated_extern_fields( X-latched */ rec_t* rec, /*!< in/out: record */ buf_block_t* block, /*!< in: index page of rec */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ const upd_t* update, /*!< in: update vector */ bool rollback,/*!< in: performing rollback? */ mtr_t* mtr) /*!< in: mini-transaction handle which contains @@ -8218,7 +8218,7 @@ protected by a lock or a page latch byte* btr_rec_copy_externally_stored_field( const rec_t* rec, - const offset_t* offsets, + const rec_offs* offsets, ulint zip_size, ulint no, ulint* len, diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc index 5348e9a6b27..34099f2b11f 100644 --- a/storage/innobase/btr/btr0defragment.cc +++ b/storage/innobase/btr/btr0defragment.cc @@ -367,8 +367,8 @@ btr_defragment_calc_n_recs_for_size( { page_t* page = buf_block_get_frame(block); ulint n_recs = 0; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); mem_heap_t* heap = NULL; ulint size = 0; diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc index 77b27b8eb26..d2a51736793 100644 --- a/storage/innobase/btr/btr0pcur.cc +++ b/storage/innobase/btr/btr0pcur.cc @@ -326,10 +326,10 @@ btr_pcur_restore_position_func( if (cursor->rel_pos == BTR_PCUR_ON) { #ifdef UNIV_DEBUG const rec_t* rec; - offset_t offsets1_[REC_OFFS_NORMAL_SIZE]; - offset_t offsets2_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets1 = offsets1_; - offset_t* offsets2 = offsets2_; + rec_offs offsets1_[REC_OFFS_NORMAL_SIZE]; + rec_offs offsets2_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets1 = offsets1_; + rec_offs* offsets2 = offsets2_; rec = btr_pcur_get_rec(cursor); rec_offs_init(offsets1_); @@ -399,7 +399,7 @@ btr_pcur_restore_position_func( ut_ad(cursor->rel_pos == BTR_PCUR_ON || cursor->rel_pos == BTR_PCUR_BEFORE || cursor->rel_pos == BTR_PCUR_AFTER); - offset_t offsets[REC_OFFS_NORMAL_SIZE]; + rec_offs offsets[REC_OFFS_NORMAL_SIZE]; rec_offs_init(offsets); if (cursor->rel_pos == BTR_PCUR_ON && btr_pcur_is_on_user_rec(cursor) diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index c01752a0051..3891d3963b8 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -97,7 +97,7 @@ static inline ulint rec_fold( const rec_t* rec, - const offset_t* offsets, + const rec_offs* offsets, ulint n_fields, ulint n_bytes, index_id_t tree_id) @@ -665,7 +665,7 @@ btr_search_update_hash_ref( && (block->curr_n_bytes == info->n_bytes) && (block->curr_left_side == info->left_side)) { mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs_init(offsets_); rec = btr_cur_get_rec(cursor); @@ -718,8 +718,8 @@ btr_search_check_guess( ulint match; int cmp; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; ibool success = FALSE; rec_offs_init(offsets_); @@ -1177,7 +1177,7 @@ void btr_search_drop_page_hash_index(buf_block_t* block) ulint i; mem_heap_t* heap; const dict_index_t* index; - offset_t* offsets; + rec_offs* offsets; rw_lock_t* latch; btr_search_t* info; @@ -1432,8 +1432,8 @@ btr_search_build_page_hash_index( const rec_t** recs; ulint i; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; #ifdef MYSQL_INDEX_DISABLE_AHI if (index->disable_ahi) return; @@ -1737,7 +1737,7 @@ void btr_search_update_hash_on_delete(btr_cur_t* cursor) const rec_t* rec; ulint fold; dict_index_t* index; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; mem_heap_t* heap = NULL; rec_offs_init(offsets_); @@ -1892,8 +1892,8 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor, rw_lock_t* ahi_latch) ibool left_side; bool locked = false; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); ut_ad(ahi_latch == btr_get_search_latch(cursor->index)); @@ -2050,8 +2050,8 @@ btr_search_hash_table_validate(ulint hash_table_id) ulint i; ulint cell_count; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; if (!btr_search_enabled) { return(TRUE); diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 652215e7f67..c9a85084c21 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1027,11 +1027,12 @@ buf_madvise_do_dump() /* mirrors allocation in log_t::create() */ if (log_sys.buf) { - ret+= madvise(log_sys.first_in_use - ? log_sys.buf - : log_sys.buf - srv_log_buffer_size, - srv_log_buffer_size * 2, - MADV_DODUMP); + ret += madvise(log_sys.buf, + srv_log_buffer_size, + MADV_DODUMP); + ret += madvise(log_sys.flush_buf, + srv_log_buffer_size, + MADV_DODUMP); } /* mirrors recv_sys_t::create() */ if (recv_sys.buf) diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index c3b4ae76dd4..a119dd84b56 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -606,17 +606,15 @@ dict_mem_table_col_rename_low( } } - dict_index_t* new_index = dict_foreign_find_index( + /* New index can be null if InnoDB already dropped + the foreign index when FOREIGN_KEY_CHECKS is + disabled */ + foreign->foreign_index = dict_foreign_find_index( foreign->foreign_table, NULL, foreign->foreign_col_names, foreign->n_fields, NULL, true, false, NULL, NULL, NULL); - /* New index can be null if InnoDB already dropped - the foreign index when FOREIGN_KEY_CHECKS is - disabled */ - foreign->foreign_index = new_index; - } else { for (unsigned f = 0; f < foreign->n_fields; f++) { @@ -638,7 +636,41 @@ dict_mem_table_col_rename_low( foreign = *it; - ut_ad(foreign->referenced_index != NULL); + if (!foreign->referenced_index) { + /* Referenced index could have been dropped + when foreign_key_checks is disabled. In that case, + rename the corresponding referenced_col_names and + find the equivalent referenced index also */ + for (unsigned f = 0; f < foreign->n_fields; f++) { + + const char*& rc = + foreign->referenced_col_names[f]; + if (strcmp(rc, from)) { + continue; + } + + if (to_len <= strlen(rc)) { + memcpy(const_cast<char*>(rc), to, + to_len + 1); + } else { + rc = static_cast<char*>( + mem_heap_dup( + foreign->heap, + to, to_len + 1)); + } + } + + /* New index can be null if InnoDB already dropped + the referenced index when FOREIGN_KEY_CHECKS is + disabled */ + foreign->referenced_index = dict_foreign_find_index( + foreign->referenced_table, NULL, + foreign->referenced_col_names, + foreign->n_fields, NULL, true, false, + NULL, NULL, NULL); + return; + } + for (unsigned f = 0; f < foreign->n_fields; f++) { /* foreign->referenced_col_names[] need to be @@ -1288,7 +1320,7 @@ bool dict_table_t::deserialise_columns(const byte* metadata, ulint len) bool dict_index_t::vers_history_row( const rec_t* rec, - const offset_t* offsets) + const rec_offs* offsets) { ut_ad(is_primary()); @@ -1319,8 +1351,8 @@ dict_index_t::vers_history_row( bool error = false; mem_heap_t* heap = NULL; dict_index_t* clust_index = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); mtr_t mtr; diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index f1fbd54296d..a63798dc321 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -1010,8 +1010,8 @@ dict_stats_analyze_index_level( bool prev_rec_is_copied; byte* prev_rec_buf = NULL; ulint prev_rec_buf_size = 0; - offset_t* rec_offsets; - offset_t* prev_rec_offsets; + rec_offs* rec_offsets; + rec_offs* prev_rec_offsets; ulint i; DEBUG_PRINTF(" %s(table=%s, index=%s, level=" ULINTPF ")\n", @@ -1032,9 +1032,9 @@ dict_stats_analyze_index_level( i = (REC_OFFS_HEADER_SIZE + 1 + 1) + n_uniq; heap = mem_heap_create((2 * sizeof *rec_offsets) * i); - rec_offsets = static_cast<offset_t*>( + rec_offsets = static_cast<rec_offs*>( mem_heap_alloc(heap, i * sizeof *rec_offsets)); - prev_rec_offsets = static_cast<offset_t*>( + prev_rec_offsets = static_cast<rec_offs*>( mem_heap_alloc(heap, i * sizeof *prev_rec_offsets)); rec_offs_set_n_alloc(rec_offsets, i); rec_offs_set_n_alloc(prev_rec_offsets, i); @@ -1323,11 +1323,11 @@ to the number of externally stored pages which were encountered @return offsets1 or offsets2 (the offsets of *out_rec), or NULL if the page is empty and does not contain user records. */ UNIV_INLINE -offset_t* +rec_offs* dict_stats_scan_page( const rec_t** out_rec, - offset_t* offsets1, - offset_t* offsets2, + rec_offs* offsets1, + rec_offs* offsets2, const dict_index_t* index, const page_t* page, ulint n_prefix, @@ -1335,8 +1335,8 @@ dict_stats_scan_page( ib_uint64_t* n_diff, ib_uint64_t* n_external_pages) { - offset_t* offsets_rec = offsets1; - offset_t* offsets_next_rec = offsets2; + rec_offs* offsets_rec = offsets1; + rec_offs* offsets_next_rec = offsets2; const rec_t* rec; const rec_t* next_rec; /* A dummy heap, to be passed to rec_get_offsets(). @@ -1449,9 +1449,9 @@ dict_stats_analyze_index_below_cur( const page_t* page; mem_heap_t* heap; const rec_t* rec; - offset_t* offsets1; - offset_t* offsets2; - offset_t* offsets_rec; + rec_offs* offsets1; + rec_offs* offsets2; + rec_offs* offsets_rec; ulint size; mtr_t mtr; @@ -1469,10 +1469,10 @@ dict_stats_analyze_index_below_cur( heap = mem_heap_create(size * (sizeof *offsets1 + sizeof *offsets2)); - offsets1 = static_cast<offset_t*>(mem_heap_alloc( + offsets1 = static_cast<rec_offs*>(mem_heap_alloc( heap, size * sizeof *offsets1)); - offsets2 = static_cast<offset_t*>(mem_heap_alloc( + offsets2 = static_cast<rec_offs*>(mem_heap_alloc( heap, size * sizeof *offsets2)); rec_offs_set_n_alloc(offsets1, size); diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index f43fb7511bc..18a9db369c4 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -3177,7 +3177,7 @@ fts_fetch_doc_from_rec( dict_index_t* clust_index, /*!< in: cluster index */ btr_pcur_t* pcur, /*!< in: cursor whose position has been stored */ - offset_t* offsets, /*!< in: offsets */ + rec_offs* offsets, /*!< in: offsets */ fts_doc_t* doc) /*!< out: fts doc to hold parsed documents */ { @@ -3451,7 +3451,7 @@ fts_add_doc_by_id( btr_pcur_t* doc_pcur; const rec_t* clust_rec; btr_pcur_t clust_pcur; - offset_t* offsets = NULL; + rec_offs* offsets = NULL; ulint num_idx = ib_vector_size(cache->get_docs); rec = btr_pcur_get_rec(&pcur); @@ -5120,7 +5120,7 @@ doc_id_t fts_get_doc_id_from_rec( const rec_t* rec, const dict_index_t* index, - const offset_t* offsets) + const rec_offs* offsets) { ulint f = dict_col_get_index_pos( &index->table->cols[index->table->fts->doc_col], index); diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc index de8046cd94c..abb7c20c1db 100644 --- a/storage/innobase/gis/gis0rtree.cc +++ b/storage/innobase/gis/gis0rtree.cc @@ -51,7 +51,7 @@ rtr_page_split_initialize_nodes( btr_cur_t* cursor, /*!< in: cursor at which to insert; when the function returns, the cursor is positioned on the predecessor of the inserted record */ - offset_t** offsets,/*!< in: offsets on inserted record */ + rec_offs** offsets,/*!< in: offsets on inserted record */ const dtuple_t* tuple, /*!< in: tuple to insert */ double** buf_pos)/*!< in/out: current buffer position */ { @@ -190,7 +190,7 @@ bool rtr_update_mbr_field( /*=================*/ btr_cur_t* cursor, /*!< in/out: cursor pointed to rec.*/ - offset_t* offsets, /*!< in/out: offsets on rec. */ + rec_offs* offsets, /*!< in/out: offsets on rec. */ btr_cur_t* cursor2, /*!< in/out: cursor pointed to rec that should be deleted. this cursor is for btr_compress to @@ -218,7 +218,7 @@ rtr_update_mbr_field( bool ins_suc = true; ulint cur2_pos = 0; ulint del_page_no = 0; - offset_t* offsets2; + rec_offs* offsets2; rec = btr_cur_get_rec(cursor); page = page_align(rec); @@ -306,7 +306,7 @@ rtr_update_mbr_field( } if (cursor2) { - offset_t* offsets2; + rec_offs* offsets2; if (UNIV_LIKELY_NULL(page_zip)) { cursor2->page_cur.rec @@ -328,7 +328,7 @@ rtr_update_mbr_field( page_cur_t page_cur; rec_t* insert_rec; - offset_t* insert_offsets = NULL; + rec_offs* insert_offsets = NULL; ulint old_pos; rec_t* old_rec; @@ -360,7 +360,7 @@ update_mbr: /* When there're not only 1 rec in the page, we do delete/insert to avoid page split. */ rec_t* insert_rec; - offset_t* insert_offsets = NULL; + rec_offs* insert_offsets = NULL; rec_t* next_rec; /* Delete the rec which cursor point to. */ @@ -556,7 +556,7 @@ rtr_adjust_upper_level( ulint new_page_no; dict_index_t* index = sea_cur->index; btr_cur_t cursor; - offset_t* offsets; + rec_offs* offsets; mem_heap_t* heap; ulint level; dtuple_t* node_ptr_upper; @@ -713,8 +713,8 @@ rtr_split_page_move_rec_list( page_cur_t new_page_cursor; page_t* page; page_t* new_page; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; page_zip_des_t* new_page_zip = buf_block_get_page_zip(new_block); rec_t* rec; @@ -872,7 +872,7 @@ rtr_page_split_and_insert( btr_cur_t* cursor, /*!< in/out: cursor at which to insert; when the function returns, the cursor is positioned on the predecessor of the inserted record */ - offset_t** offsets,/*!< out: offsets on inserted record */ + rec_offs** offsets,/*!< out: offsets on inserted record */ mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ const dtuple_t* tuple, /*!< in: tuple to insert */ ulint n_ext, /*!< in: number of externally stored columns */ @@ -1229,7 +1229,7 @@ rtr_ins_enlarge_mbr( mem_heap_t* heap; dict_index_t* index = btr_cur->index; page_cur_t* page_cursor; - offset_t* offsets; + rec_offs* offsets; node_visit_t* node_visit; btr_cur_t cursor; page_t* page; @@ -1313,10 +1313,10 @@ rtr_page_copy_rec_list_end_no_locks( page_cur_t page_cur; page_cur_t cur1; rec_t* cur_rec; - offset_t offsets_1[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets1 = offsets_1; - offset_t offsets_2[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets2 = offsets_2; + rec_offs offsets_1[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets1 = offsets_1; + rec_offs offsets_2[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets2 = offsets_2; ulint moved = 0; bool is_leaf = page_is_leaf(new_page); @@ -1439,10 +1439,10 @@ rtr_page_copy_rec_list_start_no_locks( { page_cur_t cur1; rec_t* cur_rec; - offset_t offsets_1[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets1 = offsets_1; - offset_t offsets_2[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets2 = offsets_2; + rec_offs offsets_1[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets1 = offsets_1; + rec_offs offsets_2[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets2 = offsets_2; page_cur_t page_cur; ulint moved = 0; bool is_leaf = page_is_leaf(buf_block_get_frame(block)); @@ -1546,8 +1546,8 @@ rtr_merge_mbr_changed( /*==================*/ btr_cur_t* cursor, /*!< in/out: cursor */ btr_cur_t* cursor2, /*!< in: the other cursor */ - offset_t* offsets, /*!< in: rec offsets */ - offset_t* offsets2, /*!< in: rec offsets */ + rec_offs* offsets, /*!< in: rec offsets */ + rec_offs* offsets2, /*!< in: rec offsets */ rtr_mbr_t* new_mbr) /*!< out: MBR to update */ { double* mbr; @@ -1590,8 +1590,8 @@ rtr_merge_and_update_mbr( /*=====================*/ btr_cur_t* cursor, /*!< in/out: cursor */ btr_cur_t* cursor2, /*!< in: the other cursor */ - offset_t* offsets, /*!< in: rec offsets */ - offset_t* offsets2, /*!< in: rec offsets */ + rec_offs* offsets, /*!< in: rec offsets */ + rec_offs* offsets2, /*!< in: rec offsets */ page_t* child_page, /*!< in: the page. */ mtr_t* mtr) /*!< in: mtr */ { @@ -1654,7 +1654,7 @@ rtr_check_same_block( { ulint page_no = childb->page.id.page_no(); - offset_t* offsets; + rec_offs* offsets; rec_t* rec = page_rec_get_next(page_get_infimum_rec( buf_block_get_frame(parentb))); diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index 8da1960601f..4128be7f27d 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -524,7 +524,7 @@ rtr_compare_cursor_rec( mem_heap_t** heap) /*!< in: memory heap */ { const rec_t* rec; - offset_t* offsets; + rec_offs* offsets; rec = btr_cur_get_rec(cursor); @@ -666,7 +666,7 @@ rtr_page_get_father( { mem_heap_t* heap = mem_heap_create(100); #ifdef UNIV_DEBUG - offset_t* offsets; + rec_offs* offsets; offsets = rtr_page_get_father_block( NULL, heap, index, block, mtr, sea_cur, cursor); @@ -802,9 +802,9 @@ func_exit: that mtr holds an SX-latch or X-latch on the tree. @return rec_get_offsets() of the node pointer record */ static -offset_t* +rec_offs* rtr_page_get_father_node_ptr( - offset_t* offsets,/*!< in: work area for the return value */ + rec_offs* offsets,/*!< in: work area for the return value */ mem_heap_t* heap, /*!< in: memory heap to use */ btr_cur_t* sea_cur,/*!< in: search cursor */ btr_cur_t* cursor, /*!< in: cursor pointing to user record, @@ -897,10 +897,10 @@ rtr_page_get_father_node_ptr( Returns the father block to a page. It is assumed that mtr holds an X or SX latch on the tree. @return rec_get_offsets() of the node pointer record */ -offset_t* +rec_offs* rtr_page_get_father_block( /*======================*/ - offset_t* offsets,/*!< in: work area for the return value */ + rec_offs* offsets,/*!< in: work area for the return value */ mem_heap_t* heap, /*!< in: memory heap to use */ dict_index_t* index, /*!< in: b-tree index */ buf_block_t* block, /*!< in: child page in the index */ @@ -1284,8 +1284,8 @@ rtr_cur_restore_position( #ifdef UNIV_DEBUG do { const rec_t* rec; - const offset_t* offsets1; - const offset_t* offsets2; + const rec_offs* offsets1; + const rec_offs* offsets2; ulint comp; rec = btr_pcur_get_rec(r_cursor); @@ -1356,8 +1356,8 @@ search_again: if (low_match == r_cursor->old_n_fields) { const rec_t* rec; - const offset_t* offsets1; - const offset_t* offsets2; + const rec_offs* offsets1; + const rec_offs* offsets2; ulint comp; rec = btr_pcur_get_rec(r_cursor); @@ -1403,7 +1403,7 @@ rtr_leaf_push_match_rec( /*====================*/ const rec_t* rec, /*!< in: record to copy */ rtr_info_t* rtr_info, /*!< in/out: search stack */ - offset_t* offsets, /*!< in: offsets */ + rec_offs* offsets, /*!< in: offsets */ bool is_comp) /*!< in: is compact format */ { byte* buf; @@ -1588,7 +1588,7 @@ void rtr_get_mbr_from_rec( /*=================*/ const rec_t* rec, /*!< in: data tuple */ - const offset_t* offsets,/*!< in: offsets array */ + const rec_offs* offsets,/*!< in: offsets array */ rtr_mbr_t* mbr) /*!< out MBR */ { ulint rec_f_len; @@ -1689,8 +1689,8 @@ rtr_cur_search_with_match( const page_t* page; const rec_t* rec; const rec_t* last_rec; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; mem_heap_t* heap = NULL; int cmp = 1; double least_inc = DBL_MAX; @@ -1970,8 +1970,8 @@ rtr_cur_search_with_match( test_rec = match_rec->matched_recs->back(); #ifdef UNIV_DEBUG - offset_t offsets_2[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets2 = offsets_2; + rec_offs offsets_2[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets2 = offsets_2; rec_offs_init(offsets_2); ut_ad(found); diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index efa2732f774..af61eecee89 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -2435,7 +2435,8 @@ next_column: } } - if (supports_instant) { + if (supports_instant && !(ha_alter_info->handler_flags + & INNOBASE_ALTER_NOREBUILD)) { DBUG_RETURN(HA_ALTER_INPLACE_INSTANT); } @@ -2545,7 +2546,7 @@ cannot_create_many_fulltext_index: online = false; } - if (need_rebuild || fts_need_rebuild) { + if ((need_rebuild && !supports_instant) || fts_need_rebuild) { ha_alter_info->handler_flags |= ALTER_RECREATE_TABLE; DBUG_RETURN(online ? HA_ALTER_INPLACE_COPY_NO_LOCK @@ -3215,7 +3216,7 @@ innobase_rec_to_mysql( struct TABLE* table, /*!< in/out: MySQL table */ const rec_t* rec, /*!< in: record */ const dict_index_t* index, /*!< in: index */ - const offset_t* offsets)/*!< in: rec_get_offsets( + const rec_offs* offsets)/*!< in: rec_get_offsets( rec, index, ...) */ { uint n_fields = table->s->fields; @@ -5766,6 +5767,14 @@ add_all_virtual: return true; } + if (!user_table->space) { + /* In case of ALTER TABLE...DISCARD TABLESPACE, + update only the metadata and transform the dictionary + cache entry to the canonical format. */ + index->clear_instant_alter(); + return false; + } + unsigned i = unsigned(user_table->n_cols) - DATA_N_SYS_COLS; DBUG_ASSERT(i >= altered_table->s->stored_fields); DBUG_ASSERT(i <= altered_table->s->stored_fields + 1); @@ -5867,7 +5876,7 @@ add_all_virtual: ut_ad(j == n + f); - offset_t* offsets = NULL; + rec_offs* offsets = NULL; mem_heap_t* offsets_heap = NULL; big_rec_t* big_rec; err = btr_cur_pessimistic_update( diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 1f00649babc..442768e6a2c 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -3206,7 +3206,7 @@ ibuf_insert_low( dtuple_t* ibuf_entry; mem_heap_t* offsets_heap = NULL; mem_heap_t* heap; - offset_t* offsets = NULL; + rec_offs* offsets = NULL; ulint buffered; lint min_n_recs; rec_t* ins_rec; @@ -3643,7 +3643,7 @@ ibuf_insert_to_index_page_low( buf_block_t* block, /*!< in/out: index page where the buffered entry should be placed */ dict_index_t* index, /*!< in: record descriptor */ - offset_t** offsets,/*!< out: offsets on *rec */ + rec_offs** offsets,/*!< out: offsets on *rec */ mem_heap_t* heap, /*!< in/out: memory heap */ mtr_t* mtr, /*!< in/out: mtr */ page_cur_t* page_cur)/*!< in/out: cursor positioned on the record @@ -3719,7 +3719,7 @@ ibuf_insert_to_index_page( ulint low_match; page_t* page = buf_block_get_frame(block); rec_t* rec; - offset_t* offsets; + rec_offs* offsets; mem_heap_t* heap; DBUG_ENTER("ibuf_insert_to_index_page"); @@ -3961,8 +3961,8 @@ ibuf_delete( /* TODO: the below should probably be a separate function, it's a bastardized version of btr_cur_optimistic_delete. */ - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; mem_heap_t* heap = NULL; ulint max_ins_size = 0; diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index 6eb07d6c225..81db9432ac6 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -326,7 +326,7 @@ ulint btr_node_ptr_get_child_page_no( /*===========================*/ const rec_t* rec, /*!< in: node pointer record */ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ MY_ATTRIBUTE((warn_unused_result)); /** Create the root node for a new index tree. @@ -417,7 +417,7 @@ btr_root_raise_and_insert( on the root page; when the function returns, the cursor is positioned on the predecessor of the inserted record */ - offset_t** offsets,/*!< out: offsets on inserted record */ + rec_offs** offsets,/*!< out: offsets on inserted record */ mem_heap_t** heap, /*!< in/out: pointer to memory heap that can be emptied, or NULL */ const dtuple_t* tuple, /*!< in: tuple to insert */ @@ -475,7 +475,7 @@ btr_page_split_and_insert( btr_cur_t* cursor, /*!< in: cursor at which to insert; when the function returns, the cursor is positioned on the predecessor of the inserted record */ - offset_t** offsets,/*!< out: offsets on inserted record */ + rec_offs** offsets,/*!< out: offsets on inserted record */ mem_heap_t** heap, /*!< in/out: pointer to memory heap that can be emptied, or NULL */ const dtuple_t* tuple, /*!< in: tuple to insert */ diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic index ee78ab1b1d9..cd97a4e0142 100644 --- a/storage/innobase/include/btr0btr.ic +++ b/storage/innobase/include/btr0btr.ic @@ -94,7 +94,7 @@ ulint btr_node_ptr_get_child_page_no( /*===========================*/ const rec_t* rec, /*!< in: node pointer record */ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ { const byte* field; ulint len; diff --git a/storage/innobase/include/btr0bulk.h b/storage/innobase/include/btr0bulk.h index 32fdc86313f..d345e7b254f 100644 --- a/storage/innobase/include/btr0bulk.h +++ b/storage/innobase/include/btr0bulk.h @@ -99,7 +99,7 @@ public: /** Insert a record in the page. @param[in] rec record @param[in] offsets record offsets */ - inline void insert(const rec_t* rec, offset_t* offsets); + inline void insert(const rec_t* rec, rec_offs* offsets); private: /** Page format */ enum format { REDUNDANT, DYNAMIC, COMPRESSED }; @@ -111,7 +111,7 @@ private: @tparam format the page format @param[in,out] rec record @param[in] offsets record offsets */ - template<format> inline void insertPage(rec_t* rec, offset_t* offsets); + template<format> inline void insertPage(rec_t* rec, rec_offs* offsets); public: /** Mark end of insertion to the page. Scan all records to set page @@ -136,7 +136,7 @@ public: @param[in] big_rec external recrod @param[in] offsets record offsets @return error code */ - dberr_t storeExt(const big_rec_t* big_rec, offset_t* offsets); + dberr_t storeExt(const big_rec_t* big_rec, rec_offs* offsets); /** Get node pointer @return node pointer */ diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index 9d5c9283e3b..99aa787df79 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -272,7 +272,7 @@ btr_cur_optimistic_insert( specified */ btr_cur_t* cursor, /*!< in: cursor on page after which to insert; cursor stays valid */ - offset_t** offsets,/*!< out: offsets on *rec */ + rec_offs** offsets,/*!< out: offsets on *rec */ mem_heap_t** heap, /*!< in/out: pointer to memory heap */ dtuple_t* entry, /*!< in/out: entry to insert */ rec_t** rec, /*!< out: pointer to inserted record if @@ -308,7 +308,7 @@ btr_cur_pessimistic_insert( insertion will certainly succeed */ btr_cur_t* cursor, /*!< in: cursor after which to insert; cursor stays valid */ - offset_t** offsets,/*!< out: offsets on *rec */ + rec_offs** offsets,/*!< out: offsets on *rec */ mem_heap_t** heap, /*!< in/out: pointer to memory heap that can be emptied */ dtuple_t* entry, /*!< in/out: entry to insert */ @@ -342,7 +342,7 @@ btr_cur_update_alloc_zip_func( page_cur_t* cursor, /*!< in/out: B-tree page cursor */ dict_index_t* index, /*!< in: the index corresponding to cursor */ #ifdef UNIV_DEBUG - offset_t* offsets,/*!< in/out: offsets of the cursor record */ + rec_offs* offsets,/*!< in/out: offsets of the cursor record */ #endif /* UNIV_DEBUG */ ulint length, /*!< in: size needed */ bool create, /*!< in: true=delete-and-insert, @@ -369,7 +369,7 @@ counterpart in ibuf_insert_to_index_page(). @param[in,out] block index page @param[in,out] mtr mini-transaction */ void btr_cur_upd_rec_in_place(rec_t *rec, const dict_index_t *index, - const offset_t *offsets, const upd_t *update, + const rec_offs *offsets, const upd_t *update, buf_block_t *block, mtr_t *mtr) MY_ATTRIBUTE((nonnull)); /*************************************************************//** @@ -385,7 +385,7 @@ btr_cur_update_in_place( btr_cur_t* cursor, /*!< in: cursor on the record to update; cursor stays valid and positioned on the same record */ - offset_t* offsets,/*!< in/out: offsets on cursor->page_cur.rec */ + rec_offs* offsets,/*!< in/out: offsets on cursor->page_cur.rec */ const upd_t* update, /*!< in: update vector */ ulint cmpl_info,/*!< in: compiler info on secondary index updates */ @@ -414,7 +414,7 @@ btr_cur_optimistic_update( btr_cur_t* cursor, /*!< in: cursor on the record to update; cursor stays valid and positioned on the same record */ - offset_t** offsets,/*!< out: offsets on cursor->page_cur.rec */ + rec_offs** offsets,/*!< out: offsets on cursor->page_cur.rec */ mem_heap_t** heap, /*!< in/out: pointer to NULL or memory heap */ const upd_t* update, /*!< in: update vector; this must also contain trx id and roll ptr fields */ @@ -441,7 +441,7 @@ btr_cur_pessimistic_update( btr_cur_t* cursor, /*!< in/out: cursor on the record to update; cursor may become invalid if *big_rec == NULL || !(flags & BTR_KEEP_POS_FLAG) */ - offset_t** offsets,/*!< out: offsets on cursor->page_cur.rec */ + rec_offs** offsets,/*!< out: offsets on cursor->page_cur.rec */ mem_heap_t** offsets_heap, /*!< in/out: pointer to memory heap that can be emptied */ @@ -473,7 +473,7 @@ btr_cur_del_mark_set_clust_rec( buf_block_t* block, /*!< in/out: buffer block of the record */ rec_t* rec, /*!< in/out: record */ dict_index_t* index, /*!< in: clustered index of the record */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec) */ que_thr_t* thr, /*!< in: query thread */ const dtuple_t* entry, /*!< in: dtuple for the deleting record */ mtr_t* mtr) /*!< in/out: mini-transaction */ @@ -614,7 +614,7 @@ btr_estimate_number_of_different_key_vals( ulint btr_rec_get_externally_stored_len( const rec_t* rec, - const offset_t* offsets); + const rec_offs* offsets); /*******************************************************************//** Marks non-updated off-page fields as disowned by this record. The ownership @@ -627,7 +627,7 @@ btr_cur_disown_inherited_fields( buf_block_t* block, /*!< in/out: index page */ rec_t* rec, /*!< in/out: record in a clustered index */ dict_index_t* index, /*!< in: index of the page */ - const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ const upd_t* update, /*!< in: update vector */ mtr_t* mtr) /*!< in/out: mini-transaction */ MY_ATTRIBUTE((nonnull(2,3,4,5,6))); @@ -666,7 +666,7 @@ btr_store_big_rec_extern_fields( btr_pcur_t* pcur, /*!< in/out: a persistent cursor. if btr_mtr is restarted, then this can be repositioned. */ - offset_t* offsets, /*!< in/out: rec_get_offsets() on + rec_offs* offsets, /*!< in/out: rec_get_offsets() on pcur. the "external storage" flags in offsets will correctly correspond to rec when this function returns */ @@ -697,7 +697,7 @@ btr_free_externally_stored_field( byte* field_ref, /*!< in/out: field reference */ const rec_t* rec, /*!< in: record containing field_ref, for page_zip_write_blob_ptr(), or NULL */ - const offset_t* offsets, /*!< in: rec_get_offsets(rec, index), + const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index), or NULL */ buf_block_t* block, /*!< in/out: page of field_ref */ ulint i, /*!< in: field number of field_ref; @@ -755,7 +755,7 @@ protected by a lock or a page latch byte* btr_rec_copy_externally_stored_field( const rec_t* rec, - const offset_t* offsets, + const rec_offs* offsets, ulint zip_size, ulint no, ulint* len, diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 464fe263350..747d2f171b1 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1256,7 +1256,7 @@ struct dict_index_t { @param[in] offsets offsets @return true if row is historical */ bool - vers_history_row(const rec_t* rec, const offset_t* offsets); + vers_history_row(const rec_t* rec, const rec_offs* offsets); /** Check if record in secondary index is historical row. @param[in] rec record in a secondary index diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h index f83f65827d3..0f3a568a048 100644 --- a/storage/innobase/include/fts0fts.h +++ b/storage/innobase/include/fts0fts.h @@ -596,7 +596,7 @@ doc_id_t fts_get_doc_id_from_rec( const rec_t* rec, const dict_index_t* index, - const offset_t* offsets); + const rec_offs* offsets); /** Add new fts doc id to the update vector. @param[in] table the table that contains the FTS index. diff --git a/storage/innobase/include/gis0rtree.h b/storage/innobase/include/gis0rtree.h index 4bf1b4fedb7..861f2562dcf 100644 --- a/storage/innobase/include/gis0rtree.h +++ b/storage/innobase/include/gis0rtree.h @@ -89,7 +89,7 @@ rtr_page_split_and_insert( btr_cur_t* cursor, /*!< in/out: cursor at which to insert; when the function returns, the cursor is positioned on the predecessor of the inserted record */ - offset_t** offsets,/*!< out: offsets on inserted record */ + rec_offs** offsets,/*!< out: offsets on inserted record */ mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ const dtuple_t* tuple, /*!< in: tuple to insert */ ulint n_ext, /*!< in: number of externally stored columns */ @@ -257,7 +257,7 @@ void rtr_get_mbr_from_rec( /*=================*/ const rec_t* rec, /*!< in: data tuple */ - const offset_t* offsets,/*!< in: offsets array */ + const rec_offs* offsets,/*!< in: offsets array */ rtr_mbr_t* mbr); /*!< out MBR */ /****************************************************************//** @@ -289,10 +289,10 @@ rtr_page_get_father( Returns the father block to a page. It is assumed that mtr holds an X or SX latch on the tree. @return rec_get_offsets() of the node pointer record */ -offset_t* +rec_offs* rtr_page_get_father_block( /*======================*/ - offset_t* offsets,/*!< in: work area for the return value */ + rec_offs* offsets,/*!< in: work area for the return value */ mem_heap_t* heap, /*!< in: memory heap to use */ dict_index_t* index, /*!< in: b-tree index */ buf_block_t* block, /*!< in: child page in the index */ @@ -399,8 +399,8 @@ rtr_merge_and_update_mbr( /*=====================*/ btr_cur_t* cursor, /*!< in/out: cursor */ btr_cur_t* cursor2, /*!< in: the other cursor */ - offset_t* offsets, /*!< in: rec offsets */ - offset_t* offsets2, /*!< in: rec offsets */ + rec_offs* offsets, /*!< in: rec offsets */ + rec_offs* offsets2, /*!< in: rec offsets */ page_t* child_page, /*!< in: the child page. */ mtr_t* mtr); /*!< in: mtr */ @@ -420,8 +420,8 @@ rtr_merge_mbr_changed( /*==================*/ btr_cur_t* cursor, /*!< in: cursor */ btr_cur_t* cursor2, /*!< in: the other cursor */ - offset_t* offsets, /*!< in: rec offsets */ - offset_t* offsets2, /*!< in: rec offsets */ + rec_offs* offsets, /*!< in: rec offsets */ + rec_offs* offsets2, /*!< in: rec offsets */ rtr_mbr_t* new_mbr); /*!< out: MBR to update */ @@ -432,7 +432,7 @@ bool rtr_update_mbr_field( /*=================*/ btr_cur_t* cursor, /*!< in: cursor pointed to rec.*/ - offset_t* offsets, /*!< in: offsets on rec. */ + rec_offs* offsets, /*!< in: offsets on rec. */ btr_cur_t* cursor2, /*!< in/out: cursor pointed to rec that should be deleted. this cursor is for btr_compress to diff --git a/storage/innobase/include/gis0rtree.ic b/storage/innobase/include/gis0rtree.ic index 03e23830e70..f01bc3fc9c9 100644 --- a/storage/innobase/include/gis0rtree.ic +++ b/storage/innobase/include/gis0rtree.ic @@ -40,7 +40,7 @@ rtr_page_cal_mbr( rec_t* rec; const byte* field; ulint len; - offset_t* offsets = NULL; + rec_offs* offsets = NULL; double bmin, bmax; double* amin; double* amax; diff --git a/storage/innobase/include/handler0alter.h b/storage/innobase/include/handler0alter.h index 9b70c607459..add983a0a9b 100644 --- a/storage/innobase/include/handler0alter.h +++ b/storage/innobase/include/handler0alter.h @@ -32,7 +32,7 @@ innobase_rec_to_mysql( struct TABLE* table, /*!< in/out: MySQL table */ const rec_t* rec, /*!< in: record */ const dict_index_t* index, /*!< in: index */ - const offset_t* offsets)/*!< in: rec_get_offsets( + const rec_offs* offsets)/*!< in: rec_get_offsets( rec, index, ...) */ MY_ATTRIBUTE((nonnull)); diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index 8be6f7a453d..c05fc1541b7 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -300,7 +300,7 @@ lock_clust_rec_modify_check_and_lock( const rec_t* rec, /*!< in: record which should be modified */ dict_index_t* index, /*!< in: clustered index */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ que_thr_t* thr) /*!< in: query thread */ MY_ATTRIBUTE((warn_unused_result)); /*********************************************************************//** @@ -338,7 +338,7 @@ lock_sec_rec_read_check_and_lock( be read or passed over by a read cursor */ dict_index_t* index, /*!< in: secondary index */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ lock_mode mode, /*!< in: mode of the lock which the read cursor should set on records: LOCK_S or LOCK_X; the @@ -366,7 +366,7 @@ lock_clust_rec_read_check_and_lock( be read or passed over by a read cursor */ dict_index_t* index, /*!< in: clustered index */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ lock_mode mode, /*!< in: mode of the lock which the read cursor should set on records: LOCK_S or LOCK_X; the @@ -415,7 +415,7 @@ lock_clust_rec_cons_read_sees( const rec_t* rec, /*!< in: user record which should be read or passed over by a read cursor */ dict_index_t* index, /*!< in: clustered index */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ ReadView* view); /*!< in: consistent read view */ /*********************************************************************//** Checks that a non-clustered index record is seen in a consistent read. @@ -547,7 +547,7 @@ lock_report_trx_id_insanity( trx_id_t trx_id, /*!< in: trx id */ const rec_t* rec, /*!< in: user record */ dict_index_t* index, /*!< in: index */ - const offset_t* offsets, /*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index) */ trx_id_t max_trx_id); /*!< in: trx_sys.get_max_trx_id() */ /*********************************************************************//** Prints info of locks for all transactions. @@ -714,7 +714,7 @@ lock_check_trx_id_sanity( trx_id_t trx_id, /*!< in: trx id */ const rec_t* rec, /*!< in: user record */ dict_index_t* index, /*!< in: index */ - const offset_t* offsets); /*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets); /*!< in: rec_get_offsets(rec, index) */ #ifdef UNIV_DEBUG /*******************************************************************//** Check if the transaction holds any locks on the sys tables diff --git a/storage/innobase/include/lock0priv.h b/storage/innobase/include/lock0priv.h index 29e1a95e10f..2743becea8f 100644 --- a/storage/innobase/include/lock0priv.h +++ b/storage/innobase/include/lock0priv.h @@ -469,7 +469,7 @@ lock_clust_rec_some_has_impl( /*=========================*/ const rec_t* rec, /*!< in: user record */ const dict_index_t* index, /*!< in: clustered index */ - const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */ MY_ATTRIBUTE((warn_unused_result)); /*********************************************************************//** diff --git a/storage/innobase/include/lock0priv.ic b/storage/innobase/include/lock0priv.ic index 1abba6457b3..217b61e3625 100644 --- a/storage/innobase/include/lock0priv.ic +++ b/storage/innobase/include/lock0priv.ic @@ -59,7 +59,7 @@ lock_clust_rec_some_has_impl( /*=========================*/ const rec_t* rec, /*!< in: user record */ const dict_index_t* index, /*!< in: clustered index */ - const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */ { ut_ad(dict_index_is_clust(index)); ut_ad(page_rec_is_user_rec(rec)); diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 7b5816838a6..a2c23d0bd89 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -537,33 +537,22 @@ private: std::atomic<bool> check_flush_or_checkpoint_; public: - MY_ALIGNED(CACHE_LINE_SIZE) - LogSysMutex mutex; /*!< mutex protecting the log */ - MY_ALIGNED(CACHE_LINE_SIZE) - FlushOrderMutex log_flush_order_mutex;/*!< mutex to serialize access to - the flush list when we are putting - dirty blocks in the list. The idea - behind this mutex is to be able - to release log_sys.mutex during - mtr_commit and still ensure that - insertions in the flush_list happen - in the LSN order. */ - byte* buf; /*!< Memory of double the - srv_log_buffer_size is - allocated here. This pointer will change - however to either the first half or the - second half in turns, so that log - write/flush to disk don't block - concurrent mtrs which will write - log to this buffer. Care to switch back - to the first half before freeing/resizing - must be undertaken. */ - bool first_in_use; /*!< true if buf points to the first - half of the buffer, false - if the second half */ - size_t max_buf_free; /*!< recommended maximum value of - buf_free for the buffer in use, after - which the buffer is flushed */ + /** mutex protecting the log */ + MY_ALIGNED(CACHE_LINE_SIZE) + LogSysMutex mutex; + /** mutex to serialize access to the flush list when we are putting + dirty blocks in the list. The idea behind this mutex is to be able + to release log_sys.mutex during mtr_commit and still ensure that + insertions in the flush_list happen in the LSN order. */ + MY_ALIGNED(CACHE_LINE_SIZE) FlushOrderMutex + log_flush_order_mutex; + /** log_buffer, append data here */ + byte *buf; + /** log_buffer, writing data to file from this buffer. + Before flushing write_buf is swapped with flush_buf */ + byte *flush_buf; + /** recommended maximum size of buf, after which the buffer is flushed */ + size_t max_buf_free; /** Log file stuff. Protected by mutex or write_mutex. */ struct file { /** format of the redo log: e.g., FORMAT_10_5 */ diff --git a/storage/innobase/include/page0cur.h b/storage/innobase/include/page0cur.h index 2e57b792349..57c3a8f66fc 100644 --- a/storage/innobase/include/page0cur.h +++ b/storage/innobase/include/page0cur.h @@ -147,7 +147,7 @@ page_cur_tuple_insert( page_cur_t* cursor, /*!< in/out: a page cursor */ const dtuple_t* tuple, /*!< in: pointer to a data tuple */ dict_index_t* index, /*!< in: record descriptor */ - offset_t** offsets,/*!< out: offsets on *rec */ + rec_offs** offsets,/*!< out: offsets on *rec */ mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ ulint n_ext, /*!< in: number of externally stored columns */ mtr_t* mtr) /*!< in/out: mini-transaction */ @@ -163,7 +163,7 @@ page_cur_insert_rec_low( const page_cur_t*cur, /*!< in: page cursor */ dict_index_t* index, /*!< in: record descriptor */ const rec_t* rec, /*!< in: record to insert after cur */ - offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */ + rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */ mtr_t* mtr) /*!< in/out: mini-transaction */ MY_ATTRIBUTE((nonnull, warn_unused_result)); @@ -185,7 +185,7 @@ page_cur_insert_rec_zip( page_cur_t* cursor, /*!< in/out: page cursor */ dict_index_t* index, /*!< in: record descriptor */ const rec_t* rec, /*!< in: pointer to a physical record */ - offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */ + rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */ mtr_t* mtr) /*!< in/out: mini-transaction */ MY_ATTRIBUTE((nonnull, warn_unused_result)); /***********************************************************//** @@ -196,7 +196,7 @@ page_cur_delete_rec( /*================*/ page_cur_t* cursor, /*!< in/out: a page cursor */ const dict_index_t* index, /*!< in: record descriptor */ - const offset_t* offsets,/*!< in: rec_get_offsets( + const rec_offs* offsets,/*!< in: rec_get_offsets( cursor->rec, index) */ mtr_t* mtr) /*!< in/out: mini-transaction */ MY_ATTRIBUTE((nonnull)); @@ -341,7 +341,7 @@ page_cur_open_on_rnd_user_rec( struct page_cur_t{ const dict_index_t* index; rec_t* rec; /*!< pointer to a record on page */ - offset_t* offsets; + rec_offs* offsets; buf_block_t* block; /*!< pointer to the block containing rec */ }; diff --git a/storage/innobase/include/page0cur.ic b/storage/innobase/include/page0cur.ic index 67d64ada6a8..e8f7afcaf01 100644 --- a/storage/innobase/include/page0cur.ic +++ b/storage/innobase/include/page0cur.ic @@ -254,7 +254,7 @@ page_cur_tuple_insert( page_cur_t* cursor, /*!< in/out: a page cursor */ const dtuple_t* tuple, /*!< in: pointer to a data tuple */ dict_index_t* index, /*!< in: record descriptor */ - offset_t** offsets,/*!< out: offsets on *rec */ + rec_offs** offsets,/*!< out: offsets on *rec */ mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ ulint n_ext, /*!< in: number of externally stored columns */ mtr_t* mtr) /*!< in/out: mini-transaction */ diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index 561267d0e56..2aae5ed6989 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -1066,7 +1066,7 @@ void page_rec_print( /*===========*/ const rec_t* rec, /*!< in: physical record */ - const offset_t* offsets);/*!< in: record descriptor */ + const rec_offs* offsets);/*!< in: record descriptor */ # ifdef UNIV_BTR_PRINT /***************************************************************//** This is used to print the contents of the directory for @@ -1113,7 +1113,7 @@ ibool page_rec_validate( /*==============*/ const rec_t* rec, /*!< in: physical record */ - const offset_t* offsets);/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets);/*!< in: array returned by rec_get_offsets() */ #ifdef UNIV_DEBUG /***************************************************************//** Checks that the first directory slot points to the infimum record and diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h index 990c8142704..5a70e995a1e 100644 --- a/storage/innobase/include/page0zip.h +++ b/storage/innobase/include/page0zip.h @@ -239,7 +239,7 @@ The data must already have been written to the uncompressed page. @param[in] create nonzero=insert, zero=update @param[in,out] mtr mini-transaction */ void page_zip_write_rec(buf_block_t *block, const byte *rec, - const dict_index_t *index, const offset_t *offsets, + const dict_index_t *index, const rec_offs *offsets, ulint create, mtr_t *mtr) MY_ATTRIBUTE((nonnull)); @@ -253,7 +253,7 @@ page_zip_write_blob_ptr( const byte* rec, /*!< in/out: record whose data is being written */ dict_index_t* index, /*!< in: index of the page */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ ulint n, /*!< in: column index */ mtr_t* mtr) /*!< in/out: mini-transaction */ MY_ATTRIBUTE((nonnull)); @@ -282,7 +282,7 @@ void page_zip_write_trx_id_and_roll_ptr( buf_block_t* block, byte* rec, - const offset_t* offsets, + const rec_offs* offsets, ulint trx_id_col, trx_id_t trx_id, roll_ptr_t roll_ptr, @@ -319,7 +319,7 @@ when a record is deleted. @param[in] free previous start of the free list @param[in,out] mtr mini-transaction */ void page_zip_dir_delete(buf_block_t *block, byte *rec, - const dict_index_t *index, const offset_t *offsets, + const dict_index_t *index, const rec_offs *offsets, const byte *free, mtr_t *mtr) MY_ATTRIBUTE((nonnull(1,2,3,4,6))); diff --git a/storage/innobase/include/rem0cmp.h b/storage/innobase/include/rem0cmp.h index 644454651ee..8d770405fcc 100644 --- a/storage/innobase/include/rem0cmp.h +++ b/storage/innobase/include/rem0cmp.h @@ -148,7 +148,7 @@ int cmp_dtuple_rec_with_match_low( const dtuple_t* dtuple, const rec_t* rec, - const offset_t* offsets, + const rec_offs* offsets, ulint n_cmp, ulint* matched_fields) MY_ATTRIBUTE((nonnull)); @@ -172,7 +172,7 @@ cmp_dtuple_rec_with_match_bytes( const dtuple_t* dtuple, const rec_t* rec, const dict_index_t* index, - const offset_t* offsets, + const rec_offs* offsets, ulint* matched_fields, ulint* matched_bytes) MY_ATTRIBUTE((warn_unused_result)); @@ -189,7 +189,7 @@ int cmp_dtuple_rec( const dtuple_t* dtuple, const rec_t* rec, - const offset_t* offsets); + const rec_offs* offsets); /**************************************************************//** Checks if a dtuple is a prefix of a record. The last field in dtuple is allowed to be a prefix of the corresponding field in the record. @@ -199,7 +199,7 @@ cmp_dtuple_is_prefix_of_rec( /*========================*/ const dtuple_t* dtuple, /*!< in: data tuple */ const rec_t* rec, /*!< in: physical record */ - const offset_t* offsets);/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets);/*!< in: array returned by rec_get_offsets() */ /** Compare two physical records that contain the same number of columns, none of which are stored externally. @retval positive if rec1 (including non-ordering columns) is greater than rec2 @@ -210,8 +210,8 @@ cmp_rec_rec_simple( /*===============*/ const rec_t* rec1, /*!< in: physical record */ const rec_t* rec2, /*!< in: physical record */ - const offset_t* offsets1,/*!< in: rec_get_offsets(rec1, ...) */ - const offset_t* offsets2,/*!< in: rec_get_offsets(rec2, ...) */ + const rec_offs* offsets1,/*!< in: rec_get_offsets(rec1, ...) */ + const rec_offs* offsets2,/*!< in: rec_get_offsets(rec2, ...) */ const dict_index_t* index, /*!< in: data dictionary index */ struct TABLE* table) /*!< in: MySQL table, for reporting duplicate key value if applicable, @@ -238,8 +238,8 @@ int cmp_rec_rec( const rec_t* rec1, const rec_t* rec2, - const offset_t* offsets1, - const offset_t* offsets2, + const rec_offs* offsets1, + const rec_offs* offsets2, const dict_index_t* index, bool nulls_unequal = false, ulint* matched_fields = NULL) diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h index 428503d3c09..197375b6301 100644 --- a/storage/innobase/include/rem0rec.h +++ b/storage/innobase/include/rem0rec.h @@ -63,25 +63,25 @@ The status is stored in the low-order bits. */ #ifndef UNIV_INNOCHECKSUM /** SQL null flag in a 1-byte offset of ROW_FORMAT=REDUNDANT records */ -constexpr offset_t REC_1BYTE_SQL_NULL_MASK= 0x80; +constexpr rec_offs REC_1BYTE_SQL_NULL_MASK= 0x80; /** SQL null flag in a 2-byte offset of ROW_FORMAT=REDUNDANT records */ -constexpr offset_t REC_2BYTE_SQL_NULL_MASK= 0x8000; +constexpr rec_offs REC_2BYTE_SQL_NULL_MASK= 0x8000; /** In a 2-byte offset of ROW_FORMAT=REDUNDANT records, the second most significant bit denotes that the tail of a field is stored off-page. */ -constexpr offset_t REC_2BYTE_EXTERN_MASK= 0x4000; +constexpr rec_offs REC_2BYTE_EXTERN_MASK= 0x4000; constexpr size_t RECORD_OFFSET= 2; constexpr size_t INDEX_OFFSET= - RECORD_OFFSET + sizeof(rec_t *) / sizeof(offset_t); + RECORD_OFFSET + sizeof(rec_t *) / sizeof(rec_offs); #endif /* UNIV_INNOCHECKSUM */ /* Length of the rec_get_offsets() header */ constexpr size_t REC_OFFS_HEADER_SIZE= #ifdef UNIV_DEBUG #ifndef UNIV_INNOCHECKSUM - sizeof(rec_t *) / sizeof(offset_t) + - sizeof(dict_index_t *) / sizeof(offset_t) + + sizeof(rec_t *) / sizeof(rec_offs) + + sizeof(dict_index_t *) / sizeof(rec_offs) + #endif /* UNIV_INNOCHECKSUM */ #endif /* UNIV_DEBUG */ 2; @@ -117,30 +117,30 @@ enum field_type_t }; /** without 2 upper bits */ -static constexpr offset_t DATA_MASK= 0x3fff; +static constexpr rec_offs DATA_MASK= 0x3fff; /** 2 upper bits */ -static constexpr offset_t TYPE_MASK= ~DATA_MASK; -inline field_type_t get_type(offset_t n) +static constexpr rec_offs TYPE_MASK= ~DATA_MASK; +inline field_type_t get_type(rec_offs n) { return static_cast<field_type_t>(n & TYPE_MASK); } -inline void set_type(offset_t &n, field_type_t type) +inline void set_type(rec_offs &n, field_type_t type) { - n= static_cast<offset_t>((n & DATA_MASK) | type); + n= static_cast<rec_offs>((n & DATA_MASK) | type); } -inline offset_t get_value(offset_t n) { return n & DATA_MASK; } -inline offset_t combine(offset_t value, field_type_t type) +inline rec_offs get_value(rec_offs n) { return n & DATA_MASK; } +inline rec_offs combine(rec_offs value, field_type_t type) { - return static_cast<offset_t>(get_value(value) | type); + return static_cast<rec_offs>(get_value(value) | type); } /** Compact flag ORed to the extra size returned by rec_get_offsets() */ -constexpr offset_t REC_OFFS_COMPACT= offset_t(~(offset_t(~0) >> 1)); +constexpr rec_offs REC_OFFS_COMPACT= rec_offs(~(rec_offs(~0) >> 1)); /** External flag in offsets returned by rec_get_offsets() */ -constexpr offset_t REC_OFFS_EXTERNAL= REC_OFFS_COMPACT >> 1; +constexpr rec_offs REC_OFFS_EXTERNAL= REC_OFFS_COMPACT >> 1; /** Default value flag in offsets returned by rec_get_offsets() */ -constexpr offset_t REC_OFFS_DEFAULT= REC_OFFS_COMPACT >> 2; -constexpr offset_t REC_OFFS_MASK= REC_OFFS_DEFAULT - 1; +constexpr rec_offs REC_OFFS_DEFAULT= REC_OFFS_COMPACT >> 2; +constexpr rec_offs REC_OFFS_MASK= REC_OFFS_DEFAULT - 1; /******************************************************//** The following function is used to get the pointer of the next chained record on the same page. @@ -471,11 +471,11 @@ rec_get_n_extern_new( (ULINT_UNDEFINED to compute all offsets) @param[in,out] heap memory heap @return the new offsets */ -offset_t* +rec_offs* rec_get_offsets_func( const rec_t* rec, const dict_index_t* index, - offset_t* offsets, + rec_offs* offsets, bool leaf, ulint n_fields, #ifdef UNIV_DEBUG @@ -510,7 +510,7 @@ rec_get_offsets_reverse( const dict_index_t* index, /*!< in: record descriptor */ ulint node_ptr,/*!< in: nonzero=node pointer, 0=leaf node */ - offset_t* offsets)/*!< in/out: array consisting of + rec_offs* offsets)/*!< in/out: array consisting of offsets[0] allocated elements */ MY_ATTRIBUTE((nonnull)); #ifdef UNIV_DEBUG @@ -523,7 +523,7 @@ bool rec_offs_validate( const rec_t* rec, const dict_index_t* index, - const offset_t* offsets) + const rec_offs* offsets) MY_ATTRIBUTE((nonnull(3), warn_unused_result)); /** Update debug data in offsets, in order to tame rec_offs_validate(). @param[in] rec record @@ -535,7 +535,7 @@ rec_offs_make_valid( const rec_t* rec, const dict_index_t* index, bool leaf, - offset_t* offsets) + rec_offs* offsets) MY_ATTRIBUTE((nonnull)); #else # define rec_offs_make_valid(rec, index, leaf, offsets) @@ -572,10 +572,10 @@ The following function is used to get an offset to the nth data field in a record. @return offset from the origin of rec */ UNIV_INLINE -offset_t +rec_offs rec_get_nth_field_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 field */ ulint* len) /*!< out: length of the field; UNIV_SQL_NULL if SQL null */ @@ -590,7 +590,7 @@ const byte* rec_offs_any_null_extern( /*=====================*/ const rec_t* rec, /*!< in: record */ - const offset_t* offsets) /*!< in: rec_get_offsets(rec) */ + const rec_offs* offsets) /*!< in: rec_get_offsets(rec) */ MY_ATTRIBUTE((warn_unused_result)); /** Mark the nth field as externally stored. @@ -598,7 +598,7 @@ rec_offs_any_null_extern( @param[in] n nth field */ void rec_offs_make_nth_extern( - offset_t* offsets, + rec_offs* offsets, const ulint n); /** Determine the number of allocated elements for an array of offsets. @@ -606,7 +606,7 @@ rec_offs_make_nth_extern( @return number of elements */ inline ulint -rec_offs_get_n_alloc(const offset_t* offsets) +rec_offs_get_n_alloc(const rec_offs* offsets) { ulint n_alloc; ut_ad(offsets); @@ -621,7 +621,7 @@ rec_offs_get_n_alloc(const offset_t* offsets) @return number of fields */ inline ulint -rec_offs_n_fields(const offset_t* offsets) +rec_offs_n_fields(const rec_offs* offsets) { ulint n_fields; ut_ad(offsets); @@ -638,7 +638,7 @@ rec_offs_n_fields(const offset_t* offsets) @param[in] n nth field @param[in] flag flag to extract @return type of the record field */ -inline field_type_t rec_offs_nth_type(const offset_t *offsets, ulint n) +inline field_type_t rec_offs_nth_type(const rec_offs *offsets, ulint n) { ut_ad(rec_offs_validate(NULL, NULL, offsets)); ut_ad(n < rec_offs_n_fields(offsets)); @@ -650,7 +650,7 @@ inline field_type_t rec_offs_nth_type(const offset_t *offsets, ulint n) @param[in] offsets rec_get_offsets() @param[in] n nth field @return nonzero if default bit is set */ -inline ulint rec_offs_nth_default(const offset_t *offsets, ulint n) +inline ulint rec_offs_nth_default(const rec_offs *offsets, ulint n) { return rec_offs_nth_type(offsets, n) == DEFAULT; } @@ -660,7 +660,7 @@ inline ulint rec_offs_nth_default(const offset_t *offsets, ulint n) @param[in] offsets rec_get_offsets() @param[in] n nth field @return nonzero if SQL NULL set */ -inline ulint rec_offs_nth_sql_null(const offset_t *offsets, ulint n) +inline ulint rec_offs_nth_sql_null(const rec_offs *offsets, ulint n) { return rec_offs_nth_type(offsets, n) == SQL_NULL; } @@ -670,7 +670,7 @@ inline ulint rec_offs_nth_sql_null(const offset_t *offsets, ulint n) @param[in] n nth field Returns nonzero if the extern bit is set in nth field of rec. @return nonzero if externally stored */ -inline ulint rec_offs_nth_extern(const offset_t *offsets, ulint n) +inline ulint rec_offs_nth_extern(const rec_offs *offsets, ulint n) { return rec_offs_nth_type(offsets, n) == STORED_OFFPAGE; } @@ -679,7 +679,7 @@ inline ulint rec_offs_nth_extern(const offset_t *offsets, ulint n) @param[in] offsets rec_get_offsets() @param[in] flag flag to extract @return the flag of the record field */ -inline ulint rec_offs_any_flag(const offset_t *offsets, ulint flag) +inline ulint rec_offs_any_flag(const rec_offs *offsets, ulint flag) { ut_ad(rec_offs_validate(NULL, NULL, offsets)); return *rec_offs_base(offsets) & flag; @@ -688,7 +688,7 @@ inline ulint rec_offs_any_flag(const offset_t *offsets, ulint flag) /** Determine if the offsets are for a record containing off-page columns. @param[in] offsets rec_get_offsets() @return nonzero if any off-page columns exist */ -inline bool rec_offs_any_extern(const offset_t *offsets) +inline bool rec_offs_any_extern(const rec_offs *offsets) { return rec_offs_any_flag(offsets, REC_OFFS_EXTERNAL); } @@ -697,7 +697,7 @@ inline bool rec_offs_any_extern(const offset_t *offsets) @param[in] offsets rec_get_offsets() @return nonzero if any fields need to be replaced with dict_index_t::instant_field_value() */ -inline ulint rec_offs_any_default(const offset_t *offsets) +inline ulint rec_offs_any_default(const rec_offs *offsets) { return rec_offs_any_flag(offsets, REC_OFFS_DEFAULT); } @@ -706,7 +706,7 @@ inline ulint rec_offs_any_default(const offset_t *offsets) @param[in] offsets rec_get_offsets() @return nonzero if ROW_FORMAT is COMPACT,DYNAMIC or COMPRESSED @retval 0 if ROW_FORMAT=REDUNDANT */ -inline ulint rec_offs_comp(const offset_t *offsets) +inline ulint rec_offs_comp(const rec_offs *offsets) { ut_ad(rec_offs_validate(NULL, NULL, offsets)); return (*rec_offs_base(offsets) & REC_OFFS_COMPACT); @@ -808,7 +808,7 @@ const byte* rec_get_nth_cfield( const rec_t* rec, const dict_index_t* index, - const offset_t* offsets, + const rec_offs* offsets, ulint n, ulint* len) { @@ -827,7 +827,7 @@ UNIV_INLINE ulint rec_offs_nth_size( /*==============*/ - 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: nth field */ MY_ATTRIBUTE((warn_unused_result)); @@ -838,7 +838,7 @@ UNIV_INLINE ulint rec_offs_n_extern( /*==============*/ - 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)); /**********************************************************//** The following function returns the data size of an old-style physical @@ -859,7 +859,7 @@ UNIV_INLINE void rec_offs_set_n_alloc( /*=================*/ - offset_t*offsets, /*!< out: array for rec_get_offsets(), + rec_offs*offsets, /*!< out: array for rec_get_offsets(), must be allocated */ ulint n_alloc) /*!< in: number of elements */ MY_ATTRIBUTE((nonnull)); @@ -875,7 +875,7 @@ UNIV_INLINE ulint rec_offs_data_size( /*===============*/ - 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)); /**********************************************************//** Returns the total size of record minus data size of record. @@ -886,7 +886,7 @@ UNIV_INLINE ulint rec_offs_extra_size( /*================*/ - 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)); /**********************************************************//** Returns the total size of a physical record. @@ -895,7 +895,7 @@ UNIV_INLINE ulint rec_offs_size( /*==========*/ - 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)); #ifdef UNIV_DEBUG /**********************************************************//** @@ -906,7 +906,7 @@ byte* rec_get_start( /*==========*/ const rec_t* rec, /*!< in: pointer to 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)); /**********************************************************//** Returns a pointer to the end of the record. @@ -916,7 +916,7 @@ byte* rec_get_end( /*========*/ const rec_t* rec, /*!< in: pointer to 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)); #else /* UNIV_DEBUG */ # define rec_get_start(rec, offsets) ((rec) - rec_offs_extra_size(offsets)) @@ -933,7 +933,7 @@ rec_t* rec_copy( void* buf, const rec_t* rec, - const offset_t* offsets); + const rec_offs* offsets); /** Determine the size of a data tuple prefix in a temporary file. @param[in] index clustered or secondary index @@ -962,7 +962,7 @@ void rec_init_offsets_temp( const rec_t* rec, const dict_index_t* index, - offset_t* offsets, + rec_offs* offsets, ulint n_core, const dict_col_t::def_t*def_val, rec_comp_status_t status = REC_STATUS_ORDINARY) @@ -976,7 +976,7 @@ void rec_init_offsets_temp( const rec_t* rec, const dict_index_t* index, - offset_t* offsets) + rec_offs* offsets) MY_ATTRIBUTE((nonnull)); /** Convert a data tuple prefix to the temporary file format. @@ -1096,7 +1096,7 @@ ibool rec_validate( /*=========*/ const rec_t* rec, /*!< in: physical record */ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ MY_ATTRIBUTE((nonnull)); /***************************************************************//** Prints an old-style physical record. */ @@ -1113,7 +1113,7 @@ rec_print_mbr_rec( /*==========*/ FILE* file, /*!< in: file where to print */ 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() */ MY_ATTRIBUTE((nonnull)); /***************************************************************//** Prints a physical record. */ @@ -1122,7 +1122,7 @@ rec_print_new( /*==========*/ FILE* file, /*!< in: file where to print */ 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() */ MY_ATTRIBUTE((nonnull)); /***************************************************************//** Prints a physical record. */ @@ -1144,7 +1144,7 @@ rec_print( std::ostream& o, const rec_t* rec, ulint info, - const offset_t* offsets); + const rec_offs* offsets); /** Wrapper for pretty-printing a record */ struct rec_index_print @@ -1171,14 +1171,14 @@ operator<<(std::ostream& o, const rec_index_print& r); struct rec_offsets_print { /** Constructor */ - rec_offsets_print(const rec_t* rec, const offset_t* offsets) : + rec_offsets_print(const rec_t* rec, const rec_offs* offsets) : m_rec(rec), m_offsets(offsets) {} /** Record */ const rec_t* m_rec; /** Offsets to each field */ - const offset_t* m_offsets; + const rec_offs* m_offsets; }; /** Display a record. @@ -1195,7 +1195,7 @@ public: /** Construct a pretty-printed record. @param rec record with header @param offsets rec_get_offsets(rec, ...) */ - rec_printer(const rec_t* rec, const offset_t* offsets) + rec_printer(const rec_t* rec, const rec_offs* offsets) : std::ostringstream () { @@ -1208,7 +1208,7 @@ public: @param rec record, possibly lacking header @param info rec_get_info_bits(rec) @param offsets rec_get_offsets(rec, ...) */ - rec_printer(const rec_t* rec, ulint info, const offset_t* offsets) + rec_printer(const rec_t* rec, ulint info, const rec_offs* offsets) : std::ostringstream () { diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.ic index 94bd497ac23..6d0a1771f6d 100644 --- a/storage/innobase/include/rem0rec.ic +++ b/storage/innobase/include/rem0rec.ic @@ -698,13 +698,13 @@ UNIV_INLINE void rec_offs_set_n_alloc( /*=================*/ - offset_t*offsets, /*!< out: array for rec_get_offsets(), + rec_offs*offsets, /*!< out: array for rec_get_offsets(), must be allocated */ ulint n_alloc) /*!< in: number of elements */ { ut_ad(n_alloc > REC_OFFS_HEADER_SIZE); UNIV_MEM_ALLOC(offsets, n_alloc * sizeof *offsets); - offsets[0] = static_cast<offset_t>(n_alloc); + offsets[0] = static_cast<rec_offs>(n_alloc); } /************************************************************//** @@ -712,18 +712,18 @@ The following function is used to get an offset to the nth data field in a record. @return offset from the origin of rec */ UNIV_INLINE -offset_t +rec_offs rec_get_nth_field_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 field */ ulint* len) /*!< out: length of the field; UNIV_SQL_NULL if SQL null; UNIV_SQL_DEFAULT is default value */ { ut_ad(n < rec_offs_n_fields(offsets)); - offset_t offs = n == 0 ? 0 : get_value(rec_offs_base(offsets)[n]); - offset_t next_offs = rec_offs_base(offsets)[1 + n]; + rec_offs offs = n == 0 ? 0 : get_value(rec_offs_base(offsets)[n]); + rec_offs next_offs = rec_offs_base(offsets)[1 + n]; if (get_type(next_offs) == SQL_NULL) { *len = UNIV_SQL_NULL; @@ -744,7 +744,7 @@ const byte* rec_offs_any_null_extern( /*=====================*/ const rec_t* rec, /*!< in: record */ - const offset_t* offsets) /*!< in: rec_get_offsets(rec) */ + const rec_offs* offsets) /*!< in: rec_get_offsets(rec) */ { ulint i; ut_ad(rec_offs_validate(rec, NULL, offsets)); @@ -779,7 +779,7 @@ UNIV_INLINE ulint rec_offs_nth_size( /*==============*/ - 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: nth field */ { ut_ad(rec_offs_validate(NULL, NULL, offsets)); @@ -798,7 +798,7 @@ UNIV_INLINE ulint rec_offs_n_extern( /*==============*/ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ { ulint n = 0; @@ -1008,7 +1008,7 @@ UNIV_INLINE void rec_offs_set_n_fields( /*==================*/ - offset_t* offsets, /*!< in/out: array returned by + rec_offs* offsets, /*!< in/out: array returned by rec_get_offsets() */ ulint n_fields) /*!< in: number of fields */ { @@ -1017,7 +1017,7 @@ rec_offs_set_n_fields( ut_ad(n_fields <= REC_MAX_N_FIELDS); ut_ad(n_fields + REC_OFFS_HEADER_SIZE <= rec_offs_get_n_alloc(offsets)); - offsets[1] = static_cast<offset_t>(n_fields); + offsets[1] = static_cast<rec_offs>(n_fields); } /**********************************************************//** @@ -1030,7 +1030,7 @@ UNIV_INLINE ulint rec_offs_data_size( /*===============*/ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ { ulint size; @@ -1049,7 +1049,7 @@ UNIV_INLINE ulint rec_offs_extra_size( /*================*/ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ { ulint size; ut_ad(rec_offs_validate(NULL, NULL, offsets)); @@ -1065,7 +1065,7 @@ UNIV_INLINE ulint rec_offs_size( /*==========*/ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ { return(rec_offs_data_size(offsets) + rec_offs_extra_size(offsets)); } @@ -1079,7 +1079,7 @@ byte* rec_get_end( /*========*/ const rec_t* rec, /*!< in: pointer to record */ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ { ut_ad(rec_offs_validate(rec, NULL, offsets)); return(const_cast<rec_t*>(rec + rec_offs_data_size(offsets))); @@ -1093,7 +1093,7 @@ byte* rec_get_start( /*==========*/ const rec_t* rec, /*!< in: pointer to record */ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ { ut_ad(rec_offs_validate(rec, NULL, offsets)); return(const_cast<rec_t*>(rec - rec_offs_extra_size(offsets))); @@ -1110,7 +1110,7 @@ rec_t* rec_copy( void* buf, const rec_t* rec, - const offset_t* offsets) + const rec_offs* offsets) { ulint extra_len; ulint data_len; diff --git a/storage/innobase/include/rem0types.h b/storage/innobase/include/rem0types.h index 5a9f5945d6a..0e4075a94c3 100644 --- a/storage/innobase/include/rem0types.h +++ b/storage/innobase/include/rem0types.h @@ -31,7 +31,7 @@ Created 5/30/1994 Heikki Tuuri typedef byte rec_t; /** This type represents a field offset in a rec_t* */ -typedef unsigned short int offset_t; +typedef unsigned short int rec_offs; /* Maximum values for various fields (for non-blob tuples) */ #define REC_MAX_N_FIELDS (1024 - 1) diff --git a/storage/innobase/include/row0ftsort.h b/storage/innobase/include/row0ftsort.h index d5658d21ce8..99c85601d5d 100644 --- a/storage/innobase/include/row0ftsort.h +++ b/storage/innobase/include/row0ftsort.h @@ -247,7 +247,7 @@ row_merge_fts_sel_propagate( int* sel_tree, /*<! in: selection tree */ ulint level, /*<! in: selection tree level */ const mrec_t** mrec, /*<! in: sort record */ - offset_t** offsets, /*<! in: record offsets */ + rec_offs** offsets, /*<! in: record offsets */ dict_index_t* index); /*<! in: FTS index */ /********************************************************************//** Read sorted file containing index data tuples and insert these data diff --git a/storage/innobase/include/row0log.h b/storage/innobase/include/row0log.h index c4c78b392af..63fd877691c 100644 --- a/storage/innobase/include/row0log.h +++ b/storage/innobase/include/row0log.h @@ -136,7 +136,7 @@ row_log_table_delete( page X-latched */ dict_index_t* index, /*!< in/out: clustered index, S-latched or X-latched */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec,index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index) */ const byte* sys) /*!< in: DB_TRX_ID,DB_ROLL_PTR that should be logged, or NULL to use those in rec */ ATTRIBUTE_COLD __attribute__((nonnull(1,2,3))); @@ -151,7 +151,7 @@ row_log_table_update( page X-latched */ dict_index_t* index, /*!< in/out: clustered index, S-latched or X-latched */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec,index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index) */ const dtuple_t* old_pk);/*!< in: row_log_table_get_pk() before the update */ @@ -167,7 +167,7 @@ row_log_table_get_pk( page X-latched */ dict_index_t* index, /*!< in/out: clustered index, S-latched or X-latched */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec,index), + const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index), or NULL */ byte* sys, /*!< out: DB_TRX_ID,DB_ROLL_PTR for row_log_table_delete(), or NULL */ @@ -184,7 +184,7 @@ row_log_table_insert( page X-latched */ dict_index_t* index, /*!< in/out: clustered index, S-latched or X-latched */ - const offset_t* offsets);/*!< in: rec_get_offsets(rec,index) */ + const rec_offs* offsets);/*!< in: rec_get_offsets(rec,index) */ /******************************************************//** Notes that a BLOB is being freed during online ALTER TABLE. */ void diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h index 5a2e63d6d23..d9410298c01 100644 --- a/storage/innobase/include/row0merge.h +++ b/storage/innobase/include/row0merge.h @@ -455,7 +455,7 @@ row_merge_read_rec( const mrec_t** mrec, /*!< out: pointer to merge record, or NULL on end of list (non-NULL on I/O error) */ - offset_t* offsets,/*!< out: offsets of mrec */ + rec_offs* offsets,/*!< out: offsets of mrec */ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */ ulint space) /*!< in: space id */ MY_ATTRIBUTE((warn_unused_result)); diff --git a/storage/innobase/include/row0row.h b/storage/innobase/include/row0row.h index be451751f56..b4dab3c2f1b 100644 --- a/storage/innobase/include/row0row.h +++ b/storage/innobase/include/row0row.h @@ -44,7 +44,7 @@ ulint row_get_trx_id_offset( /*==================*/ const dict_index_t* index, /*!< in: clustered index */ - const offset_t* offsets)/*!< in: record offsets */ + const rec_offs* offsets)/*!< in: record offsets */ MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Reads the trx id field from a clustered index record. @@ -55,7 +55,7 @@ row_get_rec_trx_id( /*===============*/ const rec_t* rec, /*!< in: record */ const dict_index_t* index, /*!< in: clustered index */ - const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */ MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Reads the roll pointer field from a clustered index record. @@ -66,7 +66,7 @@ row_get_rec_roll_ptr( /*=================*/ const rec_t* rec, /*!< in: record */ const dict_index_t* index, /*!< in: clustered index */ - const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */ MY_ATTRIBUTE((nonnull, warn_unused_result)); /* Flags for row build type. */ @@ -139,7 +139,7 @@ row_build( this record must be at least s-latched and the latch held as long as the row dtuple is used! */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec,index) + const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index) or NULL, in which case this function will invoke rec_get_offsets() */ const dict_table_t* col_table, @@ -190,7 +190,7 @@ row_build_w_add_vcol( ulint type, const dict_index_t* index, const rec_t* rec, - const offset_t* offsets, + const rec_offs* offsets, const dict_table_t* col_table, const dtuple_t* defaults, const dict_add_v_col_t* add_v, @@ -207,7 +207,7 @@ row_rec_to_index_entry_low( /*=======================*/ const rec_t* rec, /*!< in: record in the index */ const 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) */ mem_heap_t* heap) /*!< in: memory heap from which the memory needed is allocated */ MY_ATTRIBUTE((warn_unused_result)); @@ -220,7 +220,7 @@ row_rec_to_index_entry( /*===================*/ const rec_t* rec, /*!< in: record in the index */ const dict_index_t* index, /*!< in: index */ - const offset_t* offsets,/*!< in/out: rec_get_offsets(rec) */ + const rec_offs* offsets,/*!< in/out: rec_get_offsets(rec) */ mem_heap_t* heap) /*!< in: memory heap from which the memory needed is allocated */ MY_ATTRIBUTE((warn_unused_result)); @@ -236,7 +236,7 @@ dtuple_t* row_metadata_to_tuple( const rec_t* rec, const dict_index_t* index, - const offset_t* offsets, + const rec_offs* offsets, mem_heap_t* heap, ulint info_bits, bool pad) @@ -281,7 +281,7 @@ row_build_row_ref_in_tuple( held as long as the row reference is used! */ const dict_index_t* index, /*!< in: secondary index */ - offset_t* offsets)/*!< in: rec_get_offsets(rec, index) + rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) or NULL */ MY_ATTRIBUTE((nonnull(1,2,3))); /*******************************************************************//** @@ -299,7 +299,7 @@ row_build_row_ref_fast( const rec_t* rec, /*!< in: secondary index record; must be preserved while ref is used, as we do not copy field values to heap */ - const offset_t* offsets);/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets);/*!< in: array returned by rec_get_offsets() */ /***************************************************************//** Searches the clustered index record for a row, if we have the row reference. diff --git a/storage/innobase/include/row0row.ic b/storage/innobase/include/row0row.ic index c1e9e74ada3..e89adb581f4 100644 --- a/storage/innobase/include/row0row.ic +++ b/storage/innobase/include/row0row.ic @@ -37,7 +37,7 @@ ulint row_get_trx_id_offset( /*==================*/ const dict_index_t* index, /*!< in: clustered index */ - const offset_t* offsets)/*!< in: record offsets */ + const rec_offs* offsets)/*!< in: record offsets */ { ulint offset; ulint len; @@ -60,7 +60,7 @@ row_get_rec_trx_id( /*===============*/ const rec_t* rec, /*!< in: record */ const dict_index_t* index, /*!< in: clustered index */ - const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */ { ulint offset; @@ -85,7 +85,7 @@ row_get_rec_roll_ptr( /*=================*/ const rec_t* rec, /*!< in: record */ const dict_index_t* index, /*!< in: clustered index */ - const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */ { ulint offset; @@ -144,7 +144,7 @@ row_build_row_ref_fast( const rec_t* rec, /*!< in: secondary index record; must be preserved while ref is used, as we do not copy field values to heap */ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ { dfield_t* dfield; const byte* field; diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h index 4c80ec9b9e7..65f70be7134 100644 --- a/storage/innobase/include/row0upd.h +++ b/storage/innobase/include/row0upd.h @@ -116,7 +116,7 @@ ibool row_upd_changes_field_size_or_external( /*===================================*/ 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) */ const upd_t* update);/*!< in: update vector */ /***********************************************************//** Returns true if row update contains disowned external fields. @@ -137,7 +137,7 @@ row_upd_build_sec_rec_difference_binary( /*====================================*/ const rec_t* rec, /*!< in: secondary index record */ dict_index_t* index, /*!< in: index */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ const dtuple_t* entry, /*!< in: entry to insert */ mem_heap_t* heap) /*!< in: memory heap from which allocated */ MY_ATTRIBUTE((warn_unused_result, nonnull)); @@ -163,7 +163,7 @@ row_upd_build_difference_binary( dict_index_t* index, const dtuple_t* entry, const rec_t* rec, - const offset_t* offsets, + const rec_offs* offsets, bool no_sys, trx_t* trx, mem_heap_t* heap, diff --git a/storage/innobase/include/row0vers.h b/storage/innobase/include/row0vers.h index 1b0e5ea7168..d54384f837c 100644 --- a/storage/innobase/include/row0vers.h +++ b/storage/innobase/include/row0vers.h @@ -52,7 +52,7 @@ row_vers_impl_x_locked( trx_t* caller_trx, const rec_t* rec, dict_index_t* index, - const offset_t* offsets); + const rec_offs* offsets); /** Finds out if a version of the record, where the version >= the current purge view, should have ientry as its secondary index entry. We check @@ -96,7 +96,7 @@ row_vers_build_for_consistent_read( mtr_t* mtr, /*!< in: mtr holding the latch on rec; it will also hold the latch on purge_view */ dict_index_t* index, /*!< in: the clustered index */ - offset_t** offsets,/*!< in/out: offsets returned by + rec_offs** offsets,/*!< in/out: offsets returned by rec_get_offsets(rec, index) */ ReadView* view, /*!< in: the consistent read view */ mem_heap_t** offset_heap,/*!< in/out: memory heap from which @@ -124,7 +124,7 @@ row_vers_build_for_semi_consistent_read( of this records */ mtr_t* mtr, /*!< in: mtr holding the latch on rec */ dict_index_t* index, /*!< in: the clustered index */ - offset_t** offsets,/*!< in/out: offsets returned by + rec_offs** offsets,/*!< in/out: offsets returned by rec_get_offsets(rec, index) */ mem_heap_t** offset_heap,/*!< in/out: memory heap from which the offsets are allocated */ diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h index 885cd94045b..9aeff6312f6 100644 --- a/storage/innobase/include/trx0rec.h +++ b/storage/innobase/include/trx0rec.h @@ -191,7 +191,7 @@ trx_undo_report_row_operation( const rec_t* rec, /*!< in: case of an update or delete marking, the record in the clustered index; NULL if insert */ - const offset_t* offsets, /*!< in: rec_get_offsets(rec) */ + const rec_offs* offsets, /*!< in: rec_get_offsets(rec) */ roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the undo log record */ MY_ATTRIBUTE((nonnull(1,2,8), warn_unused_result)); @@ -224,7 +224,7 @@ trx_undo_prev_version_build( index_rec page and purge_view */ const rec_t* rec, /*!< in: version of a clustered index record */ dict_index_t* index, /*!< in: clustered index */ - offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */ + rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */ mem_heap_t* heap, /*!< in: memory heap from which the memory needed is allocated */ rec_t** old_vers,/*!< out, own: previous version, or NULL if diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index db7a39a2281..938df53ec49 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -324,7 +324,7 @@ lock_report_trx_id_insanity( trx_id_t trx_id, /*!< in: trx id */ const rec_t* rec, /*!< in: user record */ dict_index_t* index, /*!< in: index */ - const offset_t* offsets, /*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index) */ trx_id_t max_trx_id) /*!< in: trx_sys.get_max_trx_id() */ { ut_ad(rec_offs_validate(rec, index, offsets)); @@ -348,7 +348,7 @@ lock_check_trx_id_sanity( trx_id_t trx_id, /*!< in: trx id */ const rec_t* rec, /*!< in: user record */ dict_index_t* index, /*!< in: index */ - const offset_t* offsets) /*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets) /*!< in: rec_get_offsets(rec, index) */ { ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(!rec_is_metadata(rec, *index)); @@ -374,7 +374,7 @@ lock_clust_rec_cons_read_sees( const rec_t* rec, /*!< in: user record which should be read or passed over by a read cursor */ dict_index_t* index, /*!< in: clustered index */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ ReadView* view) /*!< in: consistent read view */ { ut_ad(dict_index_is_clust(index)); @@ -1185,7 +1185,7 @@ lock_sec_rec_some_has_impl( trx_t* caller_trx,/*!<in/out: trx of current thread */ const rec_t* rec, /*!< in: user record */ 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) */ { trx_t* trx; trx_id_t max_trx_id; @@ -4447,8 +4447,8 @@ static void lock_rec_print(FILE* file, const lock_t* lock, mtr_t& mtr) putc('\n', file); mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); mtr.start(); @@ -4796,7 +4796,7 @@ lock_rec_queue_validate( const buf_block_t* block, /*!< in: buffer block containing rec */ const rec_t* rec, /*!< in: record to look at */ const dict_index_t* index, /*!< in: index, or NULL if not known */ - const offset_t* offsets)/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) */ { const lock_t* lock; ulint heap_no; @@ -4963,8 +4963,8 @@ lock_rec_validate_page( ulint nth_bit = 0; ulint i; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); ut_ad(!lock_mutex_own()); @@ -5333,8 +5333,8 @@ lock_rec_insert_check_and_lock( #ifdef UNIV_DEBUG { mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - const offset_t* offsets; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + const rec_offs* offsets; rec_offs_init(offsets_); offsets = rec_get_offsets(next_rec, index, offsets_, true, @@ -5493,7 +5493,7 @@ lock_rec_convert_impl_to_expl( const buf_block_t* block, const rec_t* rec, dict_index_t* index, - const offset_t* offsets) + const rec_offs* offsets) { trx_t* trx; @@ -5564,7 +5564,7 @@ lock_clust_rec_modify_check_and_lock( const rec_t* rec, /*!< in: record which should be modified */ dict_index_t* index, /*!< in: clustered index */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ que_thr_t* thr) /*!< in: query thread */ { dberr_t err; @@ -5656,8 +5656,8 @@ lock_sec_rec_modify_check_and_lock( #ifdef UNIV_DEBUG { mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - const offset_t* offsets; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + const rec_offs* offsets; rec_offs_init(offsets_); offsets = rec_get_offsets(rec, index, offsets_, true, @@ -5701,7 +5701,7 @@ lock_sec_rec_read_check_and_lock( be read or passed over by a read cursor */ dict_index_t* index, /*!< in: secondary index */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ lock_mode mode, /*!< in: mode of the lock which the read cursor should set on records: LOCK_S or LOCK_X; the @@ -5771,7 +5771,7 @@ lock_clust_rec_read_check_and_lock( be read or passed over by a read cursor */ dict_index_t* index, /*!< in: clustered index */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ lock_mode mode, /*!< in: mode of the lock which the read cursor should set on records: LOCK_S or LOCK_X; the @@ -5849,8 +5849,8 @@ lock_clust_rec_read_check_and_lock_alt( que_thr_t* thr) /*!< in: query thread */ { mem_heap_t* tmp_heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; dberr_t err; rec_offs_init(offsets_); diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 3c30bae6ad9..c67767aaddb 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -119,16 +119,20 @@ log_buf_pool_get_oldest_modification(void) void log_buffer_extend(ulong len) { const size_t new_buf_size = ut_calc_align(len, srv_page_size); - byte* new_buf = static_cast<byte*>( - ut_malloc_dontdump(new_buf_size * 2, PSI_INSTRUMENT_ME)); - TRASH_ALLOC(new_buf, new_buf_size * 2); + byte* new_buf = static_cast<byte*> + (ut_malloc_dontdump(new_buf_size, PSI_INSTRUMENT_ME)); + TRASH_ALLOC(new_buf, new_buf_size); + byte* new_flush_buf = static_cast<byte*> + (ut_malloc_dontdump(new_buf_size, PSI_INSTRUMENT_ME)); + TRASH_ALLOC(new_flush_buf, new_buf_size); log_mutex_enter(); if (len <= srv_log_buffer_size) { /* Already extended enough by the others */ log_mutex_exit(); - ut_free_dodump(new_buf, new_buf_size * 2); + ut_free_dodump(new_buf, new_buf_size); + ut_free_dodump(new_flush_buf, new_buf_size); return; } @@ -136,14 +140,13 @@ void log_buffer_extend(ulong len) " exceeds innodb_log_buffer_size=" << srv_log_buffer_size << " / 2). Trying to extend it."; - const byte* old_buf_begin = log_sys.buf; + byte* old_buf = log_sys.buf; + byte* old_flush_buf = log_sys.flush_buf; const ulong old_buf_size = srv_log_buffer_size; - byte* old_buf = log_sys.first_in_use - ? log_sys.buf : log_sys.buf - old_buf_size; srv_log_buffer_size = static_cast<ulong>(new_buf_size); log_sys.buf = new_buf; - log_sys.first_in_use = true; - memcpy_aligned<OS_FILE_LOG_BLOCK_SIZE>(log_sys.buf, old_buf_begin, + log_sys.flush_buf = new_flush_buf; + memcpy_aligned<OS_FILE_LOG_BLOCK_SIZE>(new_buf, old_buf, log_sys.buf_free); log_sys.max_buf_free = new_buf_size / LOG_BUF_FLUSH_RATIO @@ -152,6 +155,7 @@ void log_buffer_extend(ulong len) log_mutex_exit(); ut_free_dodump(old_buf, old_buf_size); + ut_free_dodump(old_flush_buf, old_buf_size); ib::info() << "innodb_log_buffer_size was extended to " << new_buf_size << "."; @@ -501,10 +505,12 @@ void log_t::create() ut_ad(srv_log_buffer_size >= 16 * OS_FILE_LOG_BLOCK_SIZE); ut_ad(srv_log_buffer_size >= 4U << srv_page_size_shift); - buf= static_cast<byte*>(ut_malloc_dontdump(srv_log_buffer_size * 2, PSI_INSTRUMENT_ME)); - TRASH_ALLOC(buf, srv_log_buffer_size * 2); - - first_in_use= true; + buf= static_cast<byte*>(ut_malloc_dontdump(srv_log_buffer_size, + PSI_INSTRUMENT_ME)); + TRASH_ALLOC(buf, srv_log_buffer_size); + flush_buf= static_cast<byte*>(ut_malloc_dontdump(srv_log_buffer_size, + PSI_INSTRUMENT_ME)); + TRASH_ALLOC(flush_buf, srv_log_buffer_size); max_buf_free= srv_log_buffer_size / LOG_BUF_FLUSH_RATIO - LOG_BUF_FLUSH_MARGIN; @@ -941,8 +947,8 @@ static void log_write_flush_to_disk_low(lsn_t lsn) log_sys.set_flushed_lsn(lsn); } -/** Switch the log buffer in use, and copy the content of last block -from old log buffer to the head of the to be used one. Thus, buf_free and +/** Swap log buffers, and copy the content of last block +from old buf to the head of the new buf. Thus, buf_free and buf_next_to_write would be changed accordingly */ static inline void @@ -951,27 +957,17 @@ log_buffer_switch() ut_ad(log_mutex_own()); ut_ad(log_write_lock_own()); - const byte* old_buf = log_sys.buf; size_t area_end = ut_calc_align<size_t>( log_sys.buf_free, OS_FILE_LOG_BLOCK_SIZE); - if (log_sys.first_in_use) { - log_sys.first_in_use = false; - ut_ad(log_sys.buf == ut_align_down(log_sys.buf, - OS_FILE_LOG_BLOCK_SIZE)); - log_sys.buf += srv_log_buffer_size; - } else { - log_sys.first_in_use = true; - log_sys.buf -= srv_log_buffer_size; - ut_ad(log_sys.buf == ut_align_down(log_sys.buf, - OS_FILE_LOG_BLOCK_SIZE)); - } - /* Copy the last block to new buf */ memcpy_aligned<OS_FILE_LOG_BLOCK_SIZE>( - log_sys.buf, old_buf + area_end - OS_FILE_LOG_BLOCK_SIZE, + log_sys.flush_buf, + log_sys.buf + area_end - OS_FILE_LOG_BLOCK_SIZE, OS_FILE_LOG_BLOCK_SIZE); + std::swap(log_sys.buf, log_sys.flush_buf); + log_sys.buf_free %= OS_FILE_LOG_BLOCK_SIZE; log_sys.buf_next_to_write = log_sys.buf_free; } @@ -1851,10 +1847,10 @@ void log_t::close() m_initialised = false; log.close(); - if (!first_in_use) - buf -= srv_log_buffer_size; - ut_free_dodump(buf, srv_log_buffer_size * 2); + ut_free_dodump(buf, srv_log_buffer_size); buf = NULL; + ut_free_dodump(flush_buf, srv_log_buffer_size); + flush_buf = NULL; mutex_free(&mutex); mutex_free(&log_flush_order_mutex); diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc index 1f59da16410..fed2f8f4657 100644 --- a/storage/innobase/page/page0cur.cc +++ b/storage/innobase/page/page0cur.cc @@ -67,8 +67,8 @@ page_cur_try_search_shortcut( ibool success = FALSE; const page_t* page = buf_block_get_frame(block); mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); ut_ad(dtuple_check_typed(tuple)); @@ -151,8 +151,8 @@ page_cur_try_search_shortcut_bytes( ibool success = FALSE; const page_t* page = buf_block_get_frame(block); mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); ut_ad(dtuple_check_typed(tuple)); @@ -223,7 +223,7 @@ page_cur_rec_field_extends( /*=======================*/ const dtuple_t* tuple, /*!< in: data tuple */ const rec_t* rec, /*!< in: record */ - 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: compare nth field */ { const dtype_t* type; @@ -299,8 +299,8 @@ page_cur_search_with_match( const page_zip_des_t* page_zip = buf_block_get_page_zip(block); #endif /* UNIV_ZIP_DEBUG */ mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); ut_ad(dtuple_validate(tuple)); @@ -558,8 +558,8 @@ page_cur_search_with_match_bytes( const page_zip_des_t* page_zip = buf_block_get_page_zip(block); #endif /* UNIV_ZIP_DEBUG */ mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); ut_ad(dtuple_validate(tuple)); @@ -1278,7 +1278,7 @@ page_cur_insert_rec_low( const page_cur_t*cur, /*!< in: page cursor */ dict_index_t* index, /*!< in: record descriptor */ const rec_t* rec, /*!< in: record to insert after cur */ - offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */ + rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */ mtr_t* mtr) /*!< in/out: mini-transaction */ { buf_block_t* block= cur->block; @@ -1328,12 +1328,12 @@ page_cur_insert_rec_low( if (rec_t* free_rec= page_header_get_ptr(block->frame, PAGE_FREE)) { /* Try to reuse the head of PAGE_FREE. */ - offset_t foffsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs foffsets_[REC_OFFS_NORMAL_SIZE]; mem_heap_t *heap= nullptr; rec_offs_init(foffsets_); - offset_t *foffsets= rec_get_offsets(free_rec, index, foffsets_, + rec_offs *foffsets= rec_get_offsets(free_rec, index, foffsets_, page_is_leaf(block->frame), ULINT_UNDEFINED, &heap); const ulint fextra_size= rec_offs_extra_size(foffsets); @@ -1679,7 +1679,7 @@ page_cur_insert_rec_zip( page_cur_t* cursor, /*!< in/out: page cursor */ dict_index_t* index, /*!< in: record descriptor */ const rec_t* rec, /*!< in: pointer to a physical record */ - offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */ + rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */ mtr_t* mtr) /*!< in/out: mini-transaction */ { page_zip_des_t * const page_zip= page_cur_get_page_zip(cursor); @@ -1816,12 +1816,12 @@ page_cur_insert_rec_zip( if (free_rec) { /* Try to allocate from the head of the free list. */ - offset_t foffsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs foffsets_[REC_OFFS_NORMAL_SIZE]; mem_heap_t *heap= nullptr; rec_offs_init(foffsets_); - offset_t *foffsets= rec_get_offsets(cursor->block->frame + free_rec, index, + rec_offs *foffsets= rec_get_offsets(cursor->block->frame + free_rec, index, foffsets_, page_is_leaf(cursor->block->frame), ULINT_UNDEFINED, &heap); @@ -2107,7 +2107,7 @@ page_cur_delete_rec( /*================*/ page_cur_t* cursor, /*!< in/out: a page cursor */ const dict_index_t* index, /*!< in: record descriptor */ - const offset_t* offsets,/*!< in: rec_get_offsets( + const rec_offs* offsets,/*!< in: rec_get_offsets( cursor->rec, index) */ mtr_t* mtr) /*!< in/out: mini-transaction */ { diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc index f402792671b..fb6fc5858e3 100644 --- a/storage/innobase/page/page0page.cc +++ b/storage/innobase/page/page0page.cc @@ -467,8 +467,8 @@ page_copy_rec_list_end_no_locks( page_cur_t cur1; page_cur_t cur2; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); page_cur_position(rec, block, &cur1); @@ -699,8 +699,8 @@ page_copy_rec_list_start( rtr_rec_move_t* rec_move = NULL; rec_t* ret = page_rec_get_prev(page_get_supremum_rec(new_page)); - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); /* Here, "ret" may be pointing to a user record or the @@ -889,8 +889,8 @@ page_delete_rec_list_end( const bool is_leaf= page_is_leaf(block->frame); mem_heap_t *heap= nullptr; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t *offsets= offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs *offsets= offsets_; rec_offs_init(offsets_); #if 1 // FIXME: remove this, and write minimal amount of log! */ @@ -1060,8 +1060,8 @@ page_delete_rec_list_start( mtr_t* mtr) /*!< in: mtr */ { page_cur_t cur1; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; mem_heap_t* heap = NULL; rec_offs_init(offsets_); @@ -1325,7 +1325,7 @@ void page_rec_print( /*===========*/ const rec_t* rec, /*!< in: physical record */ - const offset_t* offsets)/*!< in: record descriptor */ + const rec_offs* offsets)/*!< in: record descriptor */ { ut_a(!page_rec_is_comp(rec) == !rec_offs_comp(offsets)); rec_print_new(stderr, rec, offsets); @@ -1400,8 +1400,8 @@ page_print_list( ulint count; ulint n_recs; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); ut_a((ibool)!!page_is_comp(page) == dict_table_is_comp(index->table)); @@ -1513,7 +1513,7 @@ ibool page_rec_validate( /*==============*/ const rec_t* rec, /*!< in: physical record */ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ { ulint n_owned; ulint heap_no; @@ -1998,10 +1998,10 @@ bool page_validate(const page_t* page, const dict_index_t* index) ulint n_slots; ibool ret = TRUE; ulint i; - offset_t offsets_1[REC_OFFS_NORMAL_SIZE]; - offset_t offsets_2[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_1; - offset_t* old_offsets = offsets_2; + rec_offs offsets_1[REC_OFFS_NORMAL_SIZE]; + rec_offs offsets_2[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_1; + rec_offs* old_offsets = offsets_2; rec_offs_init(offsets_1); rec_offs_init(offsets_2); diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index 34bb61210f5..788f63bc9e9 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -898,7 +898,7 @@ page_zip_compress_node_ptrs( mem_heap_t* heap) /*!< in: temporary memory heap */ { int err = Z_OK; - offset_t* offsets = NULL; + rec_offs* offsets = NULL; do { const rec_t* rec = *recs++; @@ -1003,7 +1003,7 @@ page_zip_compress_clust_ext( FILE_LOGFILE z_stream* c_stream, /*!< in/out: compressed page stream */ const rec_t* rec, /*!< in: record */ - const offset_t* offsets, /*!< in: rec_get_offsets(rec) */ + const rec_offs* offsets, /*!< in: rec_get_offsets(rec) */ ulint trx_id_col, /*!< in: position of of DB_TRX_ID */ byte* deleted, /*!< in: dense directory entry pointing to the head of the free list */ @@ -1142,7 +1142,7 @@ page_zip_compress_clust( mem_heap_t* heap) /*!< in: temporary memory heap */ { int err = Z_OK; - offset_t* offsets = NULL; + rec_offs* offsets = NULL; /* BTR_EXTERN_FIELD_REF storage */ byte* externs = storage - n_dense * (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); @@ -1958,7 +1958,7 @@ const byte* page_zip_apply_log_ext( /*===================*/ rec_t* rec, /*!< in/out: record */ - const offset_t* offsets, /*!< in: rec_get_offsets(rec) */ + const rec_offs* offsets, /*!< in: rec_get_offsets(rec) */ ulint trx_id_col, /*!< in: position of of DB_TRX_ID */ const byte* data, /*!< in: modification log */ const byte* end) /*!< in: end of modification log */ @@ -2059,7 +2059,7 @@ page_zip_apply_log( /*!< in: heap_no and status bits for the next record to uncompress */ dict_index_t* index, /*!< in: index of the page */ - offset_t* offsets)/*!< in/out: work area for + rec_offs* offsets)/*!< in/out: work area for rec_get_offsets_reverse() */ { const byte* const end = data + size; @@ -2127,7 +2127,7 @@ page_zip_apply_log( if (val & 1) { /* Clear the data bytes of the record. */ mem_heap_t* heap = NULL; - offset_t* offs; + rec_offs* offs; offs = rec_get_offsets(rec, index, offsets, is_leaf, ULINT_UNDEFINED, &heap); memset(rec, 0, rec_offs_data_size(offs)); @@ -2281,7 +2281,7 @@ page_zip_decompress_node_ptrs( sorted by address */ ulint n_dense, /*!< in: size of recs[] */ dict_index_t* index, /*!< in: the index of the page */ - offset_t* offsets, /*!< in/out: temporary offsets */ + rec_offs* offsets, /*!< in/out: temporary offsets */ mem_heap_t* heap) /*!< in: temporary memory heap */ { ulint heap_status = REC_STATUS_NODE_PTR @@ -2471,7 +2471,7 @@ page_zip_decompress_sec( sorted by address */ ulint n_dense, /*!< in: size of recs[] */ dict_index_t* index, /*!< in: the index of the page */ - offset_t* offsets) /*!< in/out: temporary offsets */ + rec_offs* offsets) /*!< in/out: temporary offsets */ { ulint heap_status = REC_STATUS_ORDINARY | PAGE_HEAP_NO_USER_LOW << REC_HEAP_NO_SHIFT; @@ -2604,7 +2604,7 @@ page_zip_decompress_clust_ext( /*==========================*/ z_stream* d_stream, /*!< in/out: compressed page stream */ rec_t* rec, /*!< in/out: record */ - const offset_t* offsets, /*!< in: rec_get_offsets(rec) */ + const rec_offs* offsets, /*!< in: rec_get_offsets(rec) */ ulint trx_id_col) /*!< in: position of of DB_TRX_ID */ { ulint i; @@ -2719,7 +2719,7 @@ page_zip_decompress_clust( ulint n_dense, /*!< in: size of recs[] */ dict_index_t* index, /*!< in: the index of the page */ ulint trx_id_col, /*!< index of the trx_id column */ - offset_t* offsets, /*!< in/out: temporary offsets */ + rec_offs* offsets, /*!< in/out: temporary offsets */ mem_heap_t* heap) /*!< in: temporary memory heap */ { int err; @@ -3023,7 +3023,7 @@ page_zip_decompress_low( ulint n_dense;/* number of user records on the page */ ulint trx_id_col = ULINT_UNDEFINED; mem_heap_t* heap; - offset_t* offsets; + rec_offs* offsets; ut_ad(page_zip_simple_validate(page_zip)); UNIV_MEM_ASSERT_W(page, srv_page_size); @@ -3149,7 +3149,7 @@ zlib_error: ulint n = 1 + 1/* node ptr */ + REC_OFFS_HEADER_SIZE + dict_index_get_n_fields(index); - offsets = static_cast<offset_t*>( + offsets = static_cast<rec_offs*>( mem_heap_alloc(heap, n * sizeof(ulint))); rec_offs_set_n_alloc(offsets, n); @@ -3386,7 +3386,7 @@ page_zip_validate_low( committed. Let us tolerate that difference when we are performing a sloppy validation. */ - offset_t* offsets; + rec_offs* offsets; mem_heap_t* heap; const rec_t* rec; const rec_t* trec; @@ -3553,7 +3553,7 @@ page_zip_write_rec_ext( buf_block_t* block, /*!< in/out: compressed page */ const byte* rec, /*!< in: record being written */ const dict_index_t*index, /*!< in: record descriptor */ - const offset_t* offsets, /*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index) */ ulint create, /*!< in: nonzero=insert, zero=update */ ulint trx_id_col, /*!< in: position of DB_TRX_ID */ ulint heap_no, /*!< in: heap number of rec */ @@ -3681,7 +3681,7 @@ The data must already have been written to the uncompressed page. @param[in] create nonzero=insert, zero=update @param[in,out] mtr mini-transaction */ void page_zip_write_rec(buf_block_t *block, const byte *rec, - const dict_index_t *index, const offset_t *offsets, + const dict_index_t *index, const rec_offs *offsets, ulint create, mtr_t *mtr) { const page_t* const page = block->frame; @@ -3862,7 +3862,7 @@ page_zip_write_blob_ptr( const byte* rec, /*!< in/out: record whose data is being written */ dict_index_t* index, /*!< in: index of the page */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ ulint n, /*!< in: column index */ mtr_t* mtr) /*!< in/out: mini-transaction */ { @@ -3971,7 +3971,7 @@ void page_zip_write_trx_id_and_roll_ptr( buf_block_t* block, byte* rec, - const offset_t* offsets, + const rec_offs* offsets, ulint trx_id_col, trx_id_t trx_id, roll_ptr_t roll_ptr, @@ -4072,7 +4072,7 @@ page_zip_clear_rec( buf_block_t* block, /*!< in/out: compressed page */ byte* rec, /*!< in: record to clear */ const dict_index_t* index, /*!< in: index of rec */ - const offset_t* offsets, /*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets, /*!< in: rec_get_offsets(rec, index) */ mtr_t* mtr) /*!< in/out: mini-transaction */ { ulint heap_no; @@ -4297,7 +4297,7 @@ when a record is deleted. @param[in] free previous start of the free list @param[in,out] mtr mini-transaction */ void page_zip_dir_delete(buf_block_t *block, byte *rec, - const dict_index_t *index, const offset_t *offsets, + const dict_index_t *index, const rec_offs *offsets, const byte *free, mtr_t *mtr) { ut_ad(page_align(rec) == block->frame); diff --git a/storage/innobase/rem/rem0cmp.cc b/storage/innobase/rem/rem0cmp.cc index 7e6e14753f9..70c0255d46a 100644 --- a/storage/innobase/rem/rem0cmp.cc +++ b/storage/innobase/rem/rem0cmp.cc @@ -392,7 +392,7 @@ int cmp_dtuple_rec_with_match_low( const dtuple_t* dtuple, const rec_t* rec, - const offset_t* offsets, + const rec_offs* offsets, ulint n_cmp, ulint* matched_fields) { @@ -526,7 +526,7 @@ cmp_dtuple_rec_with_match_bytes( const dtuple_t* dtuple, const rec_t* rec, const dict_index_t* index, - const offset_t* offsets, + const rec_offs* offsets, ulint* matched_fields, ulint* matched_bytes) { @@ -694,7 +694,7 @@ int cmp_dtuple_rec( const dtuple_t* dtuple, const rec_t* rec, - const offset_t* offsets) + const rec_offs* offsets) { ulint matched_fields = 0; @@ -712,7 +712,7 @@ cmp_dtuple_is_prefix_of_rec( /*========================*/ const dtuple_t* dtuple, /*!< in: data tuple */ const rec_t* rec, /*!< in: physical record */ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ { ulint n_fields; ulint matched_fields = 0; @@ -740,8 +740,8 @@ cmp_rec_rec_simple_field( /*=====================*/ const rec_t* rec1, /*!< in: physical record */ const rec_t* rec2, /*!< in: physical record */ - const offset_t* offsets1,/*!< in: rec_get_offsets(rec1, ...) */ - const offset_t* offsets2,/*!< in: rec_get_offsets(rec2, ...) */ + const rec_offs* offsets1,/*!< in: rec_get_offsets(rec1, ...) */ + const rec_offs* offsets2,/*!< in: rec_get_offsets(rec2, ...) */ const dict_index_t* index, /*!< in: data dictionary index */ ulint n) /*!< in: field to compare */ { @@ -771,8 +771,8 @@ cmp_rec_rec_simple( /*===============*/ const rec_t* rec1, /*!< in: physical record */ const rec_t* rec2, /*!< in: physical record */ - const offset_t* offsets1,/*!< in: rec_get_offsets(rec1, ...) */ - const offset_t* offsets2,/*!< in: rec_get_offsets(rec2, ...) */ + const rec_offs* offsets1,/*!< in: rec_get_offsets(rec1, ...) */ + const rec_offs* offsets2,/*!< in: rec_get_offsets(rec2, ...) */ const dict_index_t* index, /*!< in: data dictionary index */ struct TABLE* table) /*!< in: MySQL table, for reporting duplicate key value if applicable, @@ -858,8 +858,8 @@ int cmp_rec_rec( const rec_t* rec1, const rec_t* rec2, - const offset_t* offsets1, - const offset_t* offsets2, + const rec_offs* offsets1, + const rec_offs* offsets2, const dict_index_t* index, bool nulls_unequal, ulint* matched_fields) diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc index abced2f4e64..e98448624b3 100644 --- a/storage/innobase/rem/rem0rec.cc +++ b/storage/innobase/rem/rem0rec.cc @@ -260,13 +260,13 @@ void rec_init_offsets_comp_ordinary( const rec_t* rec, const dict_index_t* index, - offset_t* offsets, + rec_offs* offsets, ulint n_core, const dict_col_t::def_t*def_val, rec_leaf_format format) { - offset_t offs = 0; - offset_t any = 0; + rec_offs offs = 0; + rec_offs any = 0; const byte* nulls = rec; const byte* lens = NULL; ulint n_fields = n_core; @@ -344,14 +344,14 @@ start: #endif /* UNIV_DEBUG */ /* read the lengths of fields 0..n_fields */ - offset_t len; + rec_offs len; ulint i = 0; const dict_field_t* field = index->fields; do { if (mblob) { if (i == index->first_user_field()) { - offs = static_cast<offset_t>(offs + offs = static_cast<rec_offs>(offs + FIELD_REF_SIZE); len = combine(offs, STORED_OFFPAGE); any |= REC_OFFS_EXTERNAL; @@ -425,9 +425,9 @@ start: more, or when the field is stored externally. */ if ((len & 0x80) && DATA_BIG_COL(col)) { /* 1exxxxxxx xxxxxxxx */ - len = static_cast<offset_t>(len << 8 + len = static_cast<rec_offs>(len << 8 | *lens--); - offs = static_cast<offset_t>(offs + offs = static_cast<rec_offs>(offs + get_value(len)); if (UNIV_UNLIKELY(len & 0x4000)) { ut_ad(index->is_primary()); @@ -440,15 +440,15 @@ start: continue; } - len = offs = static_cast<offset_t>(offs + len); + len = offs = static_cast<rec_offs>(offs + len); } else { - len = offs = static_cast<offset_t>(offs + len = offs = static_cast<rec_offs>(offs + field->fixed_len); } } while (field++, rec_offs_base(offsets)[++i] = len, i < rec_offs_n_fields(offsets)); - *rec_offs_base(offsets) = static_cast<offset_t>((rec - (lens + 1)) + *rec_offs_base(offsets) = static_cast<rec_offs>((rec - (lens + 1)) | REC_OFFS_COMPACT | any); } @@ -464,7 +464,7 @@ rec_offs_make_valid( const rec_t* rec, const dict_index_t* index, bool leaf, - offset_t* offsets) + rec_offs* offsets) { const bool is_alter_metadata = leaf && rec_is_alter_metadata(rec, *index); @@ -504,7 +504,7 @@ bool rec_offs_validate( const rec_t* rec, const dict_index_t* index, - const offset_t* offsets) + const rec_offs* offsets) { ulint i = rec_offs_n_fields(offsets); ulint last = ULINT_MAX; @@ -595,10 +595,10 @@ rec_init_offsets( const rec_t* rec, const dict_index_t* index, bool leaf, - offset_t* offsets) + rec_offs* offsets) { ulint i = 0; - offset_t offs; + rec_offs offs; /* This assertion was relaxed for the btr_cur_open_at_index_side() call in btr_cur_instant_init_low(). We cannot invoke @@ -666,9 +666,9 @@ rec_init_offsets( /* read the lengths of fields 0..n */ do { - offset_t len; + rec_offs len; if (UNIV_UNLIKELY(i == n_node_ptr_field)) { - len = offs = static_cast<offset_t>( + len = offs = static_cast<rec_offs>( offs + REC_NODE_PTR_SIZE); goto resolved; } @@ -712,7 +712,7 @@ rec_init_offsets( if (DATA_BIG_COL(col)) { if (len & 0x80) { /* 1exxxxxxx xxxxxxxx */ - len = static_cast<offset_t>( + len = static_cast<rec_offs>( len << 8 | *lens--); /* B-tree node pointers @@ -720,7 +720,7 @@ rec_init_offsets( stored columns. Thus the "e" flag must be 0. */ ut_a(!(len & 0x4000)); - offs = static_cast<offset_t>( + offs = static_cast<rec_offs>( offs + get_value(len)); len = offs; @@ -728,9 +728,9 @@ rec_init_offsets( } } - len = offs = static_cast<offset_t>(offs + len); + len = offs = static_cast<rec_offs>(offs + len); } else { - len = offs = static_cast<offset_t>( + len = offs = static_cast<rec_offs>( offs + field->fixed_len); } resolved: @@ -738,41 +738,41 @@ resolved: } while (++i < rec_offs_n_fields(offsets)); *rec_offs_base(offsets) - = static_cast<offset_t>((rec - (lens + 1)) + = static_cast<rec_offs>((rec - (lens + 1)) | REC_OFFS_COMPACT); } else { /* Old-style record: determine extra size and end offsets */ offs = REC_N_OLD_EXTRA_BYTES; const ulint n_fields = rec_get_n_fields_old(rec); const ulint n = std::min(n_fields, rec_offs_n_fields(offsets)); - offset_t any; + rec_offs any; if (rec_get_1byte_offs_flag(rec)) { - offs = static_cast<offset_t>(offs + n_fields); + offs = static_cast<rec_offs>(offs + n_fields); any = offs; /* Determine offsets to fields */ do { offs = rec_1_get_field_end_info(rec, i); if (offs & REC_1BYTE_SQL_NULL_MASK) { - offs &= static_cast<offset_t>( + offs &= static_cast<rec_offs>( ~REC_1BYTE_SQL_NULL_MASK); set_type(offs, SQL_NULL); } rec_offs_base(offsets)[1 + i] = offs; } while (++i < n); } else { - offs = static_cast<offset_t>(offs + 2 * n_fields); + offs = static_cast<rec_offs>(offs + 2 * n_fields); any = offs; /* Determine offsets to fields */ do { offs = rec_2_get_field_end_info(rec, i); if (offs & REC_2BYTE_SQL_NULL_MASK) { - offs &= static_cast<offset_t>( + offs &= static_cast<rec_offs>( ~REC_2BYTE_SQL_NULL_MASK); set_type(offs, SQL_NULL); } if (offs & REC_2BYTE_EXTERN_MASK) { - offs &= static_cast<offset_t>( + offs &= static_cast<rec_offs>( ~REC_2BYTE_EXTERN_MASK); set_type(offs, STORED_OFFPAGE); any |= REC_OFFS_EXTERNAL; @@ -810,11 +810,11 @@ resolved: (ULINT_UNDEFINED to compute all offsets) @param[in,out] heap memory heap @return the new offsets */ -offset_t* +rec_offs* rec_get_offsets_func( const rec_t* rec, const dict_index_t* index, - offset_t* offsets, + rec_offs* offsets, bool leaf, ulint n_fields, #ifdef UNIV_DEBUG @@ -903,7 +903,7 @@ rec_get_offsets_func( *heap = mem_heap_create_at(size * sizeof(*offsets), file, line); } - offsets = static_cast<offset_t*>( + offsets = static_cast<rec_offs*>( mem_heap_alloc(*heap, size * sizeof(*offsets))); rec_offs_set_n_alloc(offsets, size); @@ -944,13 +944,13 @@ rec_get_offsets_reverse( const dict_index_t* index, /*!< in: record descriptor */ ulint node_ptr,/*!< in: nonzero=node pointer, 0=leaf node */ - offset_t* offsets)/*!< in/out: array consisting of + rec_offs* offsets)/*!< in/out: array consisting of offsets[0] allocated elements */ { ulint n; ulint i; - offset_t offs; - offset_t any_ext = 0; + rec_offs offs; + rec_offs any_ext = 0; const byte* nulls; const byte* lens; dict_field_t* field; @@ -979,9 +979,9 @@ rec_get_offsets_reverse( /* read the lengths of fields 0..n */ do { - offset_t len; + rec_offs len; if (UNIV_UNLIKELY(i == n_node_ptr_field)) { - len = offs = static_cast<offset_t>( + len = offs = static_cast<rec_offs>( offs + REC_NODE_PTR_SIZE); goto resolved; } @@ -1022,10 +1022,10 @@ rec_get_offsets_reverse( if (DATA_BIG_COL(col)) { if (len & 0x80) { /* 1exxxxxxx xxxxxxxx */ - len = static_cast<offset_t>( + len = static_cast<rec_offs>( len << 8 | *lens++); - offs = static_cast<offset_t>( + offs = static_cast<rec_offs>( offs + get_value(len)); if (UNIV_UNLIKELY(len & 0x4000)) { any_ext = REC_OFFS_EXTERNAL; @@ -1039,9 +1039,9 @@ rec_get_offsets_reverse( } } - len = offs = static_cast<offset_t>(offs + len); + len = offs = static_cast<rec_offs>(offs + len); } else { - len = offs = static_cast<offset_t>(offs + len = offs = static_cast<rec_offs>(offs + field->fixed_len); } resolved: @@ -1050,7 +1050,7 @@ resolved: ut_ad(lens >= extra); *rec_offs_base(offsets) - = static_cast<offset_t>(lens - extra + REC_N_NEW_EXTRA_BYTES) + = static_cast<rec_offs>(lens - extra + REC_N_NEW_EXTRA_BYTES) | REC_OFFS_COMPACT | any_ext; } @@ -1770,7 +1770,7 @@ void rec_init_offsets_temp( const rec_t* rec, const dict_index_t* index, - offset_t* offsets, + rec_offs* offsets, ulint n_core, const dict_col_t::def_t*def_val, rec_comp_status_t status) @@ -1796,7 +1796,7 @@ void rec_init_offsets_temp( const rec_t* rec, const dict_index_t* index, - offset_t* offsets) + rec_offs* offsets) { ut_ad(!index->is_instant()); rec_init_offsets_comp_ordinary(rec, index, offsets, @@ -1839,8 +1839,8 @@ rec_copy_prefix_to_dtuple( ulint n_fields, mem_heap_t* heap) { - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); ut_ad(is_leaf || n_fields - 1 @@ -2138,7 +2138,7 @@ ibool rec_validate( /*=========*/ const rec_t* rec, /*!< in: physical record */ - const offset_t* offsets)/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets)/*!< in: array returned by rec_get_offsets() */ { ulint len; ulint n_fields; @@ -2247,7 +2247,7 @@ rec_print_comp( /*===========*/ FILE* file, /*!< in: file where to print */ 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() */ { ulint i; @@ -2373,7 +2373,7 @@ rec_print_mbr_rec( /*==============*/ FILE* file, /*!< in: file where to print */ 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() */ { ut_ad(rec_offs_validate(rec, NULL, offsets)); ut_ad(!rec_offs_any_default(offsets)); @@ -2441,7 +2441,7 @@ rec_print_new( /*==========*/ FILE* file, /*!< in: file where to print */ 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() */ { ut_ad(rec_offs_validate(rec, NULL, offsets)); @@ -2481,7 +2481,7 @@ rec_print( return; } else { mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs_init(offsets_); rec_print_new(file, rec, @@ -2504,7 +2504,7 @@ rec_print( std::ostream& o, const rec_t* rec, ulint info, - const offset_t* offsets) + const rec_offs* offsets) { const ulint comp = rec_offs_comp(offsets); const ulint n = rec_offs_n_fields(offsets); @@ -2561,7 +2561,7 @@ std::ostream& operator<<(std::ostream& o, const rec_index_print& r) { mem_heap_t* heap = NULL; - offset_t* offsets = rec_get_offsets( + rec_offs* offsets = rec_get_offsets( r.m_rec, r.m_index, NULL, page_rec_is_leaf(r.m_rec), ULINT_UNDEFINED, &heap); rec_print(o, r.m_rec, @@ -2597,9 +2597,9 @@ rec_get_trx_id( const byte* trx_id; ulint len; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2]; + rec_offs offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2]; rec_offs_init(offsets_); - offset_t* offsets = offsets_; + rec_offs* offsets = offsets_; offsets = rec_get_offsets(rec, index, offsets, true, index->db_trx_id() + 1, &heap); @@ -2621,7 +2621,7 @@ rec_get_trx_id( @param[in] n nth field */ void rec_offs_make_nth_extern( - offset_t* offsets, + rec_offs* offsets, const ulint n) { ut_ad(!rec_offs_nth_sql_null(offsets, n)); @@ -2645,8 +2645,8 @@ wsrep_rec_get_foreign_key( ulint i; uint key_parts; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - const offset_t* offsets; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + const rec_offs* offsets; ut_ad(index_for); ut_ad(index_ref); diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc index a8e4a06b8ea..9993ab0fa62 100644 --- a/storage/innobase/row/row0ftsort.cc +++ b/storage/innobase/row/row0ftsort.cc @@ -1341,7 +1341,7 @@ row_fts_sel_tree_propagate( ulint propogated, /*<! in: tree node propagated */ int* sel_tree, /*<! in: selection tree */ const mrec_t** mrec, /*<! in: sort record */ - offset_t** offsets, /*<! in: record offsets */ + rec_offs** offsets, /*<! in: record offsets */ dict_index_t* index) /*<! in/out: FTS index */ { ulint parent; @@ -1391,7 +1391,7 @@ row_fts_sel_tree_update( ulint propagated, /*<! in: node to propagate up */ ulint height, /*<! in: tree height */ const mrec_t** mrec, /*<! in: sort record */ - offset_t** offsets, /*<! in: record offsets */ + rec_offs** offsets, /*<! in: record offsets */ dict_index_t* index) /*<! in: index dictionary */ { ulint i; @@ -1413,7 +1413,7 @@ row_fts_build_sel_tree_level( int* sel_tree, /*<! in/out: selection tree */ ulint level, /*<! in: selection tree level */ const mrec_t** mrec, /*<! in: sort record */ - offset_t** offsets, /*<! in: record offsets */ + rec_offs** offsets, /*<! in: record offsets */ dict_index_t* index) /*<! in: index dictionary */ { ulint start; @@ -1473,7 +1473,7 @@ row_fts_build_sel_tree( /*===================*/ int* sel_tree, /*<! in/out: selection tree */ const mrec_t** mrec, /*<! in: sort record */ - offset_t** offsets, /*<! in: record offsets */ + rec_offs** offsets, /*<! in: record offsets */ dict_index_t* index) /*<! in: index dictionary */ { ulint treelevel = 1; @@ -1523,7 +1523,7 @@ row_fts_merge_insert( mem_heap_t* heap; dberr_t error = DB_SUCCESS; ulint* foffs; - offset_t** offsets; + rec_offs** offsets; fts_tokenizer_word_t new_word; ib_vector_t* positions; doc_id_t last_doc_id; @@ -1562,7 +1562,7 @@ row_fts_merge_insert( heap, sizeof (*b) * fts_sort_pll_degree); foffs = (ulint*) mem_heap_alloc( heap, sizeof(*foffs) * fts_sort_pll_degree); - offsets = (offset_t**) mem_heap_alloc( + offsets = (rec_offs**) mem_heap_alloc( heap, sizeof(*offsets) * fts_sort_pll_degree); buf = (mrec_buf_t**) mem_heap_alloc( heap, sizeof(*buf) * fts_sort_pll_degree); @@ -1586,7 +1586,7 @@ row_fts_merge_insert( num = 1 + REC_OFFS_HEADER_SIZE + dict_index_get_n_fields(index); - offsets[i] = static_cast<offset_t*>(mem_heap_zalloc( + offsets[i] = static_cast<rec_offs*>(mem_heap_zalloc( heap, num * sizeof *offsets[i])); rec_offs_set_n_alloc(offsets[i], num); rec_offs_set_n_fields(offsets[i], dict_index_get_n_fields(index)); diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 7feac380076..39a3855ac44 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -271,7 +271,7 @@ public: @return true on success */ bool remove( const dict_index_t* index, - offset_t* offsets) UNIV_NOTHROW + rec_offs* offsets) UNIV_NOTHROW { ut_ad(page_is_leaf(m_cur.block->frame)); /* We can't end up with an empty page unless it is root. */ @@ -879,7 +879,7 @@ private: @return DB_SUCCESS or error code */ dberr_t adjust_cluster_index_blob_column( rec_t* rec, - const offset_t* offsets, + const rec_offs* offsets, ulint i) UNIV_NOTHROW; /** Adjusts the BLOB reference in the clustered index row for all @@ -889,7 +889,7 @@ private: @return DB_SUCCESS or error code */ dberr_t adjust_cluster_index_blob_columns( rec_t* rec, - const offset_t* offsets) UNIV_NOTHROW; + const rec_offs* offsets) UNIV_NOTHROW; /** In the clustered index, adjist the BLOB pointers as needed. Also update the BLOB reference, write the new space id. @@ -898,7 +898,7 @@ private: @return DB_SUCCESS or error code */ dberr_t adjust_cluster_index_blob_ref( rec_t* rec, - const offset_t* offsets) UNIV_NOTHROW; + const rec_offs* offsets) UNIV_NOTHROW; /** Purge delete-marked records, only if it is possible to do so without re-organising the B+tree. @@ -911,7 +911,7 @@ private: @return DB_SUCCESS or error code. */ dberr_t adjust_cluster_record( rec_t* rec, - const offset_t* offsets) UNIV_NOTHROW; + const rec_offs* offsets) UNIV_NOTHROW; /** Find an index with the matching id. @return row_index_t* instance or 0 */ @@ -939,10 +939,10 @@ private: RecIterator m_rec_iter; /** Record offset */ - offset_t m_offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs m_offsets_[REC_OFFS_NORMAL_SIZE]; /** Pointer to m_offsets_ */ - offset_t* m_offsets; + rec_offs* m_offsets; /** Memory heap for the record offsets */ mem_heap_t* m_heap; @@ -1667,7 +1667,7 @@ inline dberr_t PageConverter::adjust_cluster_index_blob_column( rec_t* rec, - const offset_t* offsets, + const rec_offs* offsets, ulint i) UNIV_NOTHROW { ulint len; @@ -1712,7 +1712,7 @@ inline dberr_t PageConverter::adjust_cluster_index_blob_columns( rec_t* rec, - const offset_t* offsets) UNIV_NOTHROW + const rec_offs* offsets) UNIV_NOTHROW { ut_ad(rec_offs_any_extern(offsets)); @@ -1745,7 +1745,7 @@ inline dberr_t PageConverter::adjust_cluster_index_blob_ref( rec_t* rec, - const offset_t* offsets) UNIV_NOTHROW + const rec_offs* offsets) UNIV_NOTHROW { if (rec_offs_any_extern(offsets)) { dberr_t err; @@ -1788,7 +1788,7 @@ inline dberr_t PageConverter::adjust_cluster_record( rec_t* rec, - const offset_t* offsets) UNIV_NOTHROW + const rec_offs* offsets) UNIV_NOTHROW { dberr_t err; diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index f446f213e17..e5b697dbe31 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -188,7 +188,7 @@ row_ins_sec_index_entry_by_modify( depending on whether mtr holds just a leaf latch or also a tree latch */ btr_cur_t* cursor, /*!< in: B-tree cursor */ - offset_t** offsets,/*!< in/out: offsets on cursor->page_cur.rec */ + rec_offs** offsets,/*!< in/out: offsets on cursor->page_cur.rec */ mem_heap_t* offsets_heap, /*!< in/out: memory heap that can be emptied */ mem_heap_t* heap, /*!< in/out: memory heap */ @@ -283,7 +283,7 @@ row_ins_clust_index_entry_by_modify( ulint mode, /*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE, depending on whether mtr holds just a leaf latch or also a tree latch */ - offset_t** offsets,/*!< out: offsets on cursor->page_cur.rec */ + rec_offs** offsets,/*!< out: offsets on cursor->page_cur.rec */ mem_heap_t** offsets_heap, /*!< in/out: pointer to memory heap that can be emptied, or NULL */ @@ -905,9 +905,9 @@ row_ins_foreign_fill_virtual( { THD* thd = current_thd; row_ext_t* ext; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs_init(offsets_); - const offset_t* offsets = + const rec_offs* offsets = rec_get_offsets(rec, index, offsets_, true, ULINT_UNDEFINED, &cascade->heap); mem_heap_t* v_heap = NULL; @@ -1461,7 +1461,7 @@ row_ins_set_shared_rec_lock( const buf_block_t* block, /*!< in: buffer block of rec */ const rec_t* rec, /*!< in: record */ dict_index_t* index, /*!< in: index */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ que_thr_t* thr) /*!< in: query thread */ { dberr_t err; @@ -1492,7 +1492,7 @@ row_ins_set_exclusive_rec_lock( const buf_block_t* block, /*!< in: buffer block of rec */ const rec_t* rec, /*!< in: record */ dict_index_t* index, /*!< in: index */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ que_thr_t* thr) /*!< in: query thread */ { dberr_t err; @@ -1539,8 +1539,8 @@ row_ins_check_foreign_constraint( mtr_t mtr; trx_t* trx = thr_get_trx(thr); mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; bool skip_gap_lock; @@ -2027,7 +2027,7 @@ row_ins_dupl_error_with_rec( the record! */ const dtuple_t* entry, /*!< in: entry to insert */ 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) */ { ulint matched_fields; ulint n_unique; @@ -2086,8 +2086,8 @@ row_ins_scan_sec_index_for_duplicate( btr_pcur_t pcur; dberr_t err = DB_SUCCESS; ulint allow_duplicates; - offset_t offsets_[REC_OFFS_SEC_INDEX_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_SEC_INDEX_SIZE]; + rec_offs* offsets = offsets_; DBUG_ENTER("row_ins_scan_sec_index_for_duplicate"); rec_offs_init(offsets_); @@ -2220,7 +2220,7 @@ row_ins_duplicate_online( ulint n_uniq, /*!< in: offset of DB_TRX_ID */ const dtuple_t* entry, /*!< in: entry that is being inserted */ const rec_t* rec, /*!< in: clustered index record */ - offset_t* offsets)/*!< in/out: rec_get_offsets(rec) */ + rec_offs* offsets)/*!< in/out: rec_get_offsets(rec) */ { ulint fields = 0; @@ -2259,7 +2259,7 @@ row_ins_duplicate_error_in_clust_online( ulint n_uniq, /*!< in: offset of DB_TRX_ID */ const dtuple_t* entry, /*!< in: entry that is being inserted */ const btr_cur_t*cursor, /*!< in: cursor on insert position */ - offset_t** offsets,/*!< in/out: rec_get_offsets(rec) */ + rec_offs** offsets,/*!< in/out: rec_get_offsets(rec) */ mem_heap_t** heap) /*!< in/out: heap for offsets */ { dberr_t err = DB_SUCCESS; @@ -2308,8 +2308,8 @@ row_ins_duplicate_error_in_clust( ulint n_unique; trx_t* trx = thr_get_trx(thr); mem_heap_t*heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); ut_ad(dict_index_is_clust(cursor->index)); @@ -2482,7 +2482,7 @@ dberr_t row_ins_index_entry_big_rec( const dtuple_t* entry, const big_rec_t* big_rec, - offset_t* offsets, + rec_offs* offsets, mem_heap_t** heap, dict_index_t* index, const void* thd __attribute__((unused))) @@ -2557,8 +2557,8 @@ row_ins_clust_index_entry_low( mtr_t mtr; ib_uint64_t auto_inc = 0; mem_heap_t* offsets_heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); DBUG_ENTER("row_ins_clust_index_entry_low"); @@ -2869,8 +2869,8 @@ row_ins_sec_index_entry_low( dberr_t err = DB_SUCCESS; ulint n_unique; mtr_t mtr; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); rtr_info_t rtr_info; diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 693e81e4341..a654f221f38 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -646,7 +646,7 @@ row_log_table_delete( page X-latched */ dict_index_t* index, /*!< in/out: clustered index, S-latched or X-latched */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec,index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index) */ const byte* sys) /*!< in: DB_TRX_ID,DB_ROLL_PTR that should be logged, or NULL to use those in rec */ { @@ -937,7 +937,7 @@ row_log_table_low( page X-latched */ dict_index_t* index, /*!< in/out: clustered index, S-latched or X-latched */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec,index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index) */ bool insert, /*!< in: true if insert, false if update */ const dtuple_t* old_pk) /*!< in: old PRIMARY KEY value (if !insert and a PRIMARY KEY is being created) */ @@ -1106,7 +1106,7 @@ row_log_table_update( page X-latched */ dict_index_t* index, /*!< in/out: clustered index, S-latched or X-latched */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec,index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index) */ const dtuple_t* old_pk) /*!< in: row_log_table_get_pk() before the update */ { @@ -1158,7 +1158,7 @@ row_log_table_get_pk_col( dfield_t* dfield, mem_heap_t* heap, const rec_t* rec, - const offset_t* offsets, + const rec_offs* offsets, ulint i, ulint zip_size, ulint max_len, @@ -1233,7 +1233,7 @@ row_log_table_get_pk( page X-latched */ dict_index_t* index, /*!< in/out: clustered index, S-latched or X-latched */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec,index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index) */ byte* sys, /*!< out: DB_TRX_ID,DB_ROLL_PTR for row_log_table_delete(), or NULL */ mem_heap_t** heap) /*!< in/out: memory heap where allocated */ @@ -1437,7 +1437,7 @@ row_log_table_insert( page X-latched */ dict_index_t* index, /*!< in/out: clustered index, S-latched or X-latched */ - const offset_t* offsets)/*!< in: rec_get_offsets(rec,index) */ + const rec_offs* offsets)/*!< in: rec_get_offsets(rec,index) */ { row_log_table_low(rec, index, offsets, true, NULL); } @@ -1528,7 +1528,7 @@ row_log_table_apply_convert_mrec( /*=============================*/ const mrec_t* mrec, /*!< in: merge record */ dict_index_t* index, /*!< in: index of mrec */ - const offset_t* offsets, /*!< in: offsets of mrec */ + const rec_offs* offsets, /*!< in: offsets of mrec */ row_log_t* log, /*!< in: rebuild context */ mem_heap_t* heap, /*!< in/out: memory heap */ dberr_t* error) /*!< out: DB_SUCCESS or @@ -1780,7 +1780,7 @@ row_log_table_apply_insert( /*=======================*/ que_thr_t* thr, /*!< in: query graph */ const mrec_t* mrec, /*!< in: record to insert */ - const offset_t* offsets, /*!< in: offsets of mrec */ + const rec_offs* offsets, /*!< in: offsets of mrec */ mem_heap_t* offsets_heap, /*!< in/out: memory heap that can be emptied */ mem_heap_t* heap, /*!< in/out: memory heap */ @@ -1832,7 +1832,7 @@ row_log_table_apply_delete_low( /*===========================*/ btr_pcur_t* pcur, /*!< in/out: B-tree cursor, will be trashed */ - const offset_t* offsets, /*!< in: offsets on pcur */ + const rec_offs* offsets, /*!< in: offsets on pcur */ mem_heap_t* heap, /*!< in/out: memory heap */ mtr_t* mtr) /*!< in/out: mini-transaction, will be committed */ @@ -1925,7 +1925,7 @@ row_log_table_apply_delete( DB_TRX_ID in the new clustered index */ const mrec_t* mrec, /*!< in: merge record */ - const offset_t* moffsets, /*!< in: offsets of mrec */ + const rec_offs* moffsets, /*!< in: offsets of mrec */ mem_heap_t* offsets_heap, /*!< in/out: memory heap that can be emptied */ mem_heap_t* heap, /*!< in/out: memory heap */ @@ -1936,7 +1936,7 @@ row_log_table_apply_delete( dtuple_t* old_pk; mtr_t mtr; btr_pcur_t pcur; - offset_t* offsets; + rec_offs* offsets; ut_ad(rec_offs_n_fields(moffsets) == index->first_user_field()); ut_ad(!rec_offs_any_extern(moffsets)); @@ -2047,7 +2047,7 @@ row_log_table_apply_update( DB_TRX_ID in the new clustered index */ const mrec_t* mrec, /*!< in: new value */ - const offset_t* offsets, /*!< in: offsets of mrec */ + const rec_offs* offsets, /*!< in: offsets of mrec */ mem_heap_t* offsets_heap, /*!< in/out: memory heap that can be emptied */ mem_heap_t* heap, /*!< in/out: memory heap */ @@ -2184,7 +2184,7 @@ func_exit_committed: } /* Prepare to update (or delete) the record. */ - offset_t* cur_offsets = rec_get_offsets( + rec_offs* cur_offsets = rec_get_offsets( btr_pcur_get_rec(&pcur), index, NULL, true, ULINT_UNDEFINED, &offsets_heap); @@ -2422,7 +2422,7 @@ row_log_table_apply_op( mem_heap_t* heap, /*!< in/out: memory heap */ const mrec_t* mrec, /*!< in: merge record */ const mrec_t* mrec_end, /*!< in: end of buffer */ - offset_t* offsets) /*!< in/out: work area + rec_offs* offsets) /*!< in/out: work area for parsing mrec */ { row_log_t* log = dup->index->online_log; @@ -2754,7 +2754,7 @@ row_log_table_apply_ops( const mrec_t* next_mrec_end; mem_heap_t* heap; mem_heap_t* offsets_heap; - offset_t* offsets; + rec_offs* offsets; bool has_index_lock; dict_index_t* index = const_cast<dict_index_t*>( dup->index); @@ -2781,7 +2781,7 @@ row_log_table_apply_ops( UNIV_MEM_INVALID(&mrec_end, sizeof mrec_end); - offsets = static_cast<offset_t*>(ut_malloc_nokey(i * sizeof *offsets)); + offsets = static_cast<rec_offs*>(ut_malloc_nokey(i * sizeof *offsets)); rec_offs_set_n_alloc(offsets, i); rec_offs_set_n_fields(offsets, dict_index_get_n_fields(index)); @@ -3330,7 +3330,7 @@ row_log_apply_op_low( { mtr_t mtr; btr_cur_t cursor; - offset_t* offsets = NULL; + rec_offs* offsets = NULL; ut_ad(!dict_index_is_clust(index)); @@ -3564,7 +3564,7 @@ row_log_apply_op( in exclusive mode */ const mrec_t* mrec, /*!< in: merge record */ const mrec_t* mrec_end, /*!< in: end of buffer */ - offset_t* offsets) /*!< in/out: work area for + rec_offs* offsets) /*!< in/out: work area for rec_init_offsets_temp() */ { @@ -3682,7 +3682,7 @@ row_log_apply_ops( const mrec_t* next_mrec_end; mem_heap_t* offsets_heap; mem_heap_t* heap; - offset_t* offsets; + rec_offs* offsets; bool has_index_lock; const ulint i = 1 + REC_OFFS_HEADER_SIZE + dict_index_get_n_fields(index); @@ -3693,7 +3693,7 @@ row_log_apply_ops( ut_ad(index->online_log); UNIV_MEM_INVALID(&mrec_end, sizeof mrec_end); - offsets = static_cast<offset_t*>(ut_malloc_nokey(i * sizeof *offsets)); + offsets = static_cast<rec_offs*>(ut_malloc_nokey(i * sizeof *offsets)); rec_offs_set_n_alloc(offsets, i); rec_offs_set_n_fields(offsets, dict_index_get_n_fields(index)); diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 93d86a96067..0508b92e6d0 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -114,7 +114,7 @@ public: btr_cur_t ins_cur; mtr_t mtr; rtr_info_t rtr_info; - offset_t* ins_offsets = NULL; + rec_offs* ins_offsets = NULL; dberr_t error = DB_SUCCESS; dtuple_t* dtuple; ulint count = 0; @@ -1040,8 +1040,8 @@ row_merge_heap_create( /*==================*/ const dict_index_t* index, /*!< in: record descriptor */ mrec_buf_t** buf, /*!< out: 3 buffers */ - offset_t** offsets1, /*!< out: offsets */ - offset_t** offsets2) /*!< out: offsets */ + rec_offs** offsets1, /*!< out: offsets */ + rec_offs** offsets2) /*!< out: offsets */ { ulint i = 1 + REC_OFFS_HEADER_SIZE + dict_index_get_n_fields(index); @@ -1050,9 +1050,9 @@ row_merge_heap_create( *buf = static_cast<mrec_buf_t*>( mem_heap_alloc(heap, 3 * sizeof **buf)); - *offsets1 = static_cast<offset_t*>( + *offsets1 = static_cast<rec_offs*>( mem_heap_alloc(heap, i * sizeof **offsets1)); - *offsets2 = static_cast<offset_t*>( + *offsets2 = static_cast<rec_offs*>( mem_heap_alloc(heap, i * sizeof **offsets2)); rec_offs_set_n_alloc(*offsets1, i); @@ -1174,7 +1174,7 @@ row_merge_read_rec( const mrec_t** mrec, /*!< out: pointer to merge record, or NULL on end of list (non-NULL on I/O error) */ - offset_t* offsets,/*!< out: offsets of mrec */ + rec_offs* offsets,/*!< out: offsets of mrec */ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */ ulint space) /*!< in: space id */ { @@ -1331,7 +1331,7 @@ row_merge_write_rec_low( ulint foffs, /*!< in: file offset */ #endif /* !DBUG_OFF */ const mrec_t* mrec, /*!< in: record to write */ - const offset_t* offsets)/*!< in: offsets of mrec */ + const rec_offs* offsets)/*!< in: offsets of mrec */ #ifdef DBUG_OFF # define row_merge_write_rec_low(b, e, size, fd, foffs, mrec, offsets) \ row_merge_write_rec_low(b, e, mrec, offsets) @@ -1373,7 +1373,7 @@ row_merge_write_rec( const pfs_os_file_t& fd, /*!< in: file descriptor */ ulint* foffs, /*!< in/out: file offset */ const mrec_t* mrec, /*!< in: record to write */ - const offset_t* offsets,/*!< in: offsets of mrec */ + const rec_offs* offsets,/*!< in: offsets of mrec */ row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */ ulint space) /*!< in: space id */ { @@ -1915,7 +1915,7 @@ row_merge_read_clustered_index( const rec_t* rec; trx_id_t rec_trx_id; - offset_t* offsets; + rec_offs* offsets; dtuple_t* row; row_ext_t* ext; page_cur_t* cur = btr_pcur_get_page_cur(&pcur); @@ -2922,8 +2922,8 @@ row_merge_blocks( const mrec_t* mrec0; /*!< merge rec, points to block[0] or buf[0] */ const mrec_t* mrec1; /*!< merge rec, points to block[srv_sort_buf_size] or buf[1] */ - offset_t* offsets0;/* offsets of mrec0 */ - offset_t* offsets1;/* offsets of mrec1 */ + rec_offs* offsets0;/* offsets of mrec0 */ + rec_offs* offsets1;/* offsets of mrec1 */ DBUG_ENTER("row_merge_blocks"); DBUG_LOG("ib_merge_sort", @@ -3040,8 +3040,8 @@ row_merge_blocks_copy( const byte* b0; /*!< pointer to block[0] */ byte* b2; /*!< pointer to block[2 * srv_sort_buf_size] */ const mrec_t* mrec0; /*!< merge rec, points to block[0] */ - offset_t* offsets0;/* offsets of mrec0 */ - offset_t* offsets1;/* dummy offsets */ + rec_offs* offsets0;/* offsets of mrec0 */ + rec_offs* offsets1;/* dummy offsets */ DBUG_ENTER("row_merge_blocks_copy"); DBUG_LOG("ib_merge_sort", @@ -3381,7 +3381,7 @@ static void row_merge_copy_blobs( const mrec_t* mrec, - const offset_t* offsets, + const rec_offs* offsets, ulint zip_size, dtuple_t* tuple, mem_heap_t* heap) @@ -3490,7 +3490,7 @@ row_merge_insert_index_tuples( mem_heap_t* tuple_heap; dberr_t error = DB_SUCCESS; ulint foffs = 0; - offset_t* offsets; + rec_offs* offsets; mrec_buf_t* buf; ulint n_rows = 0; dtuple_t* dtuple; @@ -3517,7 +3517,7 @@ row_merge_insert_index_tuples( ulint i = 1 + REC_OFFS_HEADER_SIZE + dict_index_get_n_fields(index); heap = mem_heap_create(sizeof *buf + i * sizeof *offsets); - offsets = static_cast<offset_t*>( + offsets = static_cast<rec_offs*>( mem_heap_alloc(heap, i * sizeof *offsets)); rec_offs_set_n_alloc(offsets, i); rec_offs_set_n_fields(offsets, dict_index_get_n_fields(index)); diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 5104392aab1..9e945da79d8 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -2054,8 +2054,8 @@ row_unlock_for_mysql( + index->trx_id_offset); } else { mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); offsets = rec_get_offsets(rec, index, offsets, true, @@ -4683,8 +4683,8 @@ row_scan_index_for_mysql( ulint i; ulint cnt; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets; rec_offs_init(offsets_); *n_rows = 0; @@ -4817,7 +4817,7 @@ not_ok: tmp_heap = mem_heap_create(size); - offsets = static_cast<offset_t*>( + offsets = static_cast<rec_offs*>( mem_heap_dup(tmp_heap, offsets, size)); } diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index cbef674dfcb..9f1a7bc702e 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -118,10 +118,10 @@ row_purge_remove_clust_if_poss_low( } rec_t* rec = btr_pcur_get_rec(&node->pcur); - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs_init(offsets_); mem_heap_t* heap = NULL; - offset_t* offsets = rec_get_offsets( + rec_offs* offsets = rec_get_offsets( rec, index, offsets_, true, ULINT_UNDEFINED, &heap); bool success = true; @@ -665,9 +665,9 @@ static void row_purge_reset_trx_id(purge_node_t* node, mtr_t* mtr) mem_heap_t* heap = NULL; /* Reserve enough offsets for the PRIMARY KEY and 2 columns so that we can access DB_TRX_ID, DB_ROLL_PTR. */ - offset_t offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2]; + rec_offs offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2]; rec_offs_init(offsets_); - offset_t* offsets = rec_get_offsets( + rec_offs* offsets = rec_get_offsets( rec, index, offsets_, true, trx_id_pos + 2, &heap); ut_ad(heap == NULL); @@ -1199,7 +1199,7 @@ purge_node_t::validate_pcur() dict_index_t* clust_index = pcur.btr_cur.index; - offset_t* offsets = rec_get_offsets( + rec_offs* offsets = rec_get_offsets( pcur.old_rec, clust_index, NULL, true, pcur.old_n_fields, &heap); diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc index 1af9638412c..08572b2a3a1 100644 --- a/storage/innobase/row/row0row.cc +++ b/storage/innobase/row/row0row.cc @@ -412,7 +412,7 @@ row_build_low( ulint type, const dict_index_t* index, const rec_t* rec, - const offset_t* offsets, + const rec_offs* offsets, const dict_table_t* col_table, const dtuple_t* defaults, const dict_add_v_col_t* add_v, @@ -428,7 +428,7 @@ row_build_low( byte* buf; ulint j; mem_heap_t* tmp_heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs_init(offsets_); ut_ad(index != NULL); @@ -476,7 +476,7 @@ row_build_low( } /* Avoid a debug assertion in rec_offs_validate(). */ - rec_offs_make_valid(copy, index, true, const_cast<offset_t*>(offsets)); + rec_offs_make_valid(copy, index, true, const_cast<rec_offs*>(offsets)); if (!col_table) { ut_ad(!col_map); @@ -584,7 +584,7 @@ row_build_low( } } - rec_offs_make_valid(rec, index, true, const_cast<offset_t*>(offsets)); + rec_offs_make_valid(rec, index, true, const_cast<rec_offs*>(offsets)); ut_ad(dtuple_check_typed(row)); @@ -637,7 +637,7 @@ row_build( this record must be at least s-latched and the latch held as long as the row dtuple is used! */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec,index) + const rec_offs* offsets,/*!< in: rec_get_offsets(rec,index) or NULL, in which case this function will invoke rec_get_offsets() */ const dict_table_t* col_table, @@ -690,7 +690,7 @@ row_build_w_add_vcol( ulint type, const dict_index_t* index, const rec_t* rec, - const offset_t* offsets, + const rec_offs* offsets, const dict_table_t* col_table, const dtuple_t* defaults, const dict_add_v_col_t* add_v, @@ -721,7 +721,7 @@ dtuple_t* row_rec_to_index_entry_impl( const rec_t* rec, const dict_index_t* index, - const offset_t* offsets, + const rec_offs* offsets, mem_heap_t* heap, ulint info_bits = 0, bool pad = false) @@ -869,7 +869,7 @@ dtuple_t* row_rec_to_index_entry_low( const rec_t* rec, const dict_index_t* index, - const offset_t* offsets, + const rec_offs* offsets, mem_heap_t* heap) { return row_rec_to_index_entry_impl<false>(rec, index, offsets, heap); @@ -884,7 +884,7 @@ row_rec_to_index_entry( /*===================*/ const rec_t* rec, /*!< in: record in the index */ const dict_index_t* index, /*!< in: index */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec) */ mem_heap_t* heap) /*!< in: memory heap from which the memory needed is allocated */ { @@ -900,7 +900,7 @@ row_rec_to_index_entry( rec, offsets); rec_offs_make_valid(copy_rec, index, true, - const_cast<offset_t*>(offsets)); + const_cast<rec_offs*>(offsets)); dtuple_t* entry = rec_is_alter_metadata(copy_rec, *index) ? row_rec_to_index_entry_impl<true,1>( @@ -909,7 +909,7 @@ row_rec_to_index_entry( copy_rec, index, offsets, heap); rec_offs_make_valid(rec, index, true, - const_cast<offset_t*>(offsets)); + const_cast<rec_offs*>(offsets)); dtuple_set_info_bits(entry, rec_get_info_bits(rec, rec_offs_comp(offsets))); @@ -928,7 +928,7 @@ dtuple_t* row_metadata_to_tuple( const rec_t* rec, const dict_index_t* index, - const offset_t* offsets, + const rec_offs* offsets, mem_heap_t* heap, ulint info_bits, bool pad) @@ -944,7 +944,7 @@ row_metadata_to_tuple( rec, offsets); rec_offs_make_valid(copy_rec, index, true, - const_cast<offset_t*>(offsets)); + const_cast<rec_offs*>(offsets)); dtuple_t* entry = info_bits == REC_INFO_METADATA_ALTER || rec_is_alter_metadata(copy_rec, *index) @@ -954,7 +954,7 @@ row_metadata_to_tuple( copy_rec, index, offsets, heap); rec_offs_make_valid(rec, index, true, - const_cast<offset_t*>(offsets)); + const_cast<rec_offs*>(offsets)); dtuple_set_info_bits(entry, info_bits); return entry; @@ -994,8 +994,8 @@ row_build_row_ref( ulint clust_col_prefix_len; ulint i; mem_heap_t* tmp_heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); ut_ad(index != NULL); @@ -1090,7 +1090,7 @@ row_build_row_ref_in_tuple( held as long as the row reference is used! */ const dict_index_t* index, /*!< in: secondary index */ - offset_t* offsets)/*!< in: rec_get_offsets(rec, index) + rec_offs* offsets)/*!< in: rec_get_offsets(rec, index) or NULL */ { const dict_index_t* clust_index; @@ -1102,7 +1102,7 @@ row_build_row_ref_in_tuple( ulint clust_col_prefix_len; ulint i; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs_init(offsets_); ut_ad(!dict_index_is_clust(index)); diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 05a84fb2662..200bed0f04f 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -174,10 +174,10 @@ row_sel_sec_rec_is_for_clust_rec( ulint n; ulint i; mem_heap_t* heap = NULL; - offset_t clust_offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t sec_offsets_[REC_OFFS_SMALL_SIZE]; - offset_t* clust_offs = clust_offsets_; - offset_t* sec_offs = sec_offsets_; + rec_offs clust_offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs sec_offsets_[REC_OFFS_SMALL_SIZE]; + rec_offs* clust_offs = clust_offsets_; + rec_offs* sec_offs = sec_offsets_; ibool is_equal = TRUE; VCOL_STORAGE* vcol_storage= 0; byte* record; @@ -495,7 +495,7 @@ row_sel_fetch_columns( dict_index_t* index, /*!< in: record index */ const rec_t* rec, /*!< in: record in a clustered or non-clustered index; must be protected by a page latch */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ sym_node_t* column) /*!< in: first column in a column list, or NULL */ { @@ -761,7 +761,7 @@ row_sel_build_prev_vers( ReadView* read_view, /*!< in: read view */ dict_index_t* index, /*!< in: plan node for table */ rec_t* rec, /*!< in: record in a clustered index */ - offset_t** offsets, /*!< in/out: offsets returned by + rec_offs** offsets, /*!< in/out: offsets returned by rec_get_offsets(rec, plan->index) */ mem_heap_t** offset_heap, /*!< in/out: memory heap from which the offsets are allocated */ @@ -796,7 +796,7 @@ row_sel_build_committed_vers_for_mysql( dict_index_t* clust_index, /*!< in: clustered index */ row_prebuilt_t* prebuilt, /*!< in: prebuilt struct */ const rec_t* rec, /*!< in: record in a clustered index */ - offset_t** offsets, /*!< in/out: offsets returned by + rec_offs** offsets, /*!< in/out: offsets returned by rec_get_offsets(rec, clust_index) */ mem_heap_t** offset_heap, /*!< in/out: memory heap from which the offsets are allocated */ @@ -910,8 +910,8 @@ row_sel_get_clust_rec( rec_t* old_vers; dberr_t err; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); *out_rec = NULL; @@ -1060,7 +1060,7 @@ sel_set_rtr_rec_lock( btr_pcur_t* pcur, /*!< in: cursor */ const rec_t* first_rec,/*!< in: record */ dict_index_t* index, /*!< in: index */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ unsigned mode, /*!< in: lock mode */ unsigned type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or LOC_REC_NOT_GAP */ @@ -1072,8 +1072,8 @@ sel_set_rtr_rec_lock( dberr_t err = DB_SUCCESS; trx_t* trx = thr_get_trx(thr); buf_block_t* cur_block = btr_pcur_get_block(pcur); - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* my_offsets = const_cast<offset_t*>(offsets); + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* my_offsets = const_cast<rec_offs*>(offsets); rec_t* rec = const_cast<rec_t*>(first_rec); rtr_rec_vector* match_rec; rtr_rec_vector::iterator end; @@ -1226,7 +1226,7 @@ sel_set_rec_lock( btr_pcur_t* pcur, /*!< in: cursor */ const rec_t* rec, /*!< in: record */ dict_index_t* index, /*!< in: index */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ unsigned mode, /*!< in: lock mode */ unsigned type, /*!< in: LOCK_ORDINARY, LOCK_GAP, or LOC_REC_NOT_GAP */ @@ -1501,8 +1501,8 @@ exhausted: a previous version of the record */ mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); offsets = rec_get_offsets(rec, index, offsets, true, ULINT_UNDEFINED, &heap); @@ -1585,8 +1585,8 @@ row_sel( to the next non-clustered record */ dberr_t err; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); ut_ad(thr->run_node == node); @@ -2870,7 +2870,7 @@ row_sel_store_mysql_field( row_prebuilt_t* prebuilt, const rec_t* rec, const dict_index_t* index, - const offset_t* offsets, + const rec_offs* offsets, ulint field_no, const mysql_row_templ_t*templ) { @@ -3032,7 +3032,7 @@ static bool row_sel_store_mysql_rec( const dtuple_t* vrow, bool rec_clust, const dict_index_t* index, - const offset_t* offsets) + const rec_offs* offsets) { DBUG_ENTER("row_sel_store_mysql_rec"); @@ -3178,7 +3178,7 @@ row_sel_build_prev_vers_for_mysql( dict_index_t* clust_index, /*!< in: clustered index */ row_prebuilt_t* prebuilt, /*!< in: prebuilt struct */ const rec_t* rec, /*!< in: record in a clustered index */ - offset_t** offsets, /*!< in/out: offsets returned by + rec_offs** offsets, /*!< in/out: offsets returned by rec_get_offsets(rec, clust_index) */ mem_heap_t** offset_heap, /*!< in/out: memory heap from which the offsets are allocated */ @@ -3216,7 +3216,7 @@ public: dberr_t operator()(row_prebuilt_t *prebuilt, dict_index_t *sec_index, const rec_t *rec, que_thr_t *thr, const rec_t **out_rec, - offset_t **offsets, mem_heap_t **offset_heap, + rec_offs **offsets, mem_heap_t **offset_heap, dtuple_t **vrow, mtr_t *mtr); }; @@ -3239,7 +3239,7 @@ Row_sel_get_clust_rec_for_mysql::operator()( it, NULL if the old version did not exist in the read view, i.e., it was a fresh inserted version */ - offset_t** offsets,/*!< in: offsets returned by + rec_offs** offsets,/*!< in: offsets returned by rec_get_offsets(rec, sec_index); out: offsets returned by rec_get_offsets(out_rec, clust_index) */ @@ -3826,7 +3826,7 @@ row_sel_try_search_shortcut_for_mysql( /*==================================*/ const rec_t** out_rec,/*!< out: record if found */ row_prebuilt_t* prebuilt,/*!< in: prebuilt struct */ - offset_t** offsets,/*!< in/out: for rec_get_offsets(*out_rec) */ + rec_offs** offsets,/*!< in/out: for rec_get_offsets(*out_rec) */ mem_heap_t** heap, /*!< in/out: heap for rec_get_offsets() */ mtr_t* mtr) /*!< in: started mtr */ { @@ -3900,7 +3900,7 @@ row_search_idx_cond_check( row_prebuilt_t* prebuilt, /*!< in/out: prebuilt struct for the table handle */ const rec_t* rec, /*!< in: InnoDB record */ - const offset_t* offsets) /*!< in: rec_get_offsets() */ + const rec_offs* offsets) /*!< in: rec_get_offsets() */ { ulint i; @@ -4011,8 +4011,8 @@ row_sel_fill_vrow( dtuple_t** vrow, mem_heap_t* heap) { - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); ut_ad(!(*vrow)); @@ -4066,7 +4066,7 @@ rec_field_len_in_chars( const dict_col_t* col, const ulint field_no, const rec_t* rec, - const offset_t* offsets) + const rec_offs* offsets) { const ulint cset = dtype_get_charset_coll(col->prtype); const CHARSET_INFO* cs = all_charsets[cset]; @@ -4093,7 +4093,7 @@ static bool row_search_with_covering_prefix( row_prebuilt_t* prebuilt, const rec_t* rec, - const offset_t* offsets) + const rec_offs* offsets) { const dict_index_t* index = prebuilt->index; ut_ad(!dict_index_is_clust(index)); @@ -4370,8 +4370,8 @@ early_not_found: mtr.start(); mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); #ifdef BTR_CUR_HASH_ADAPT @@ -5879,8 +5879,8 @@ row_search_autoinc_read_column( const byte* data; ib_uint64_t value; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); ut_ad(page_rec_is_leaf(rec)); diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc index d356ce75c20..63edbd9b86d 100644 --- a/storage/innobase/row/row0uins.cc +++ b/storage/innobase/row/row0uins.cc @@ -118,7 +118,7 @@ row_undo_ins_remove_clust_rec( if (online && dict_index_is_online_ddl(index)) { mem_heap_t* heap = NULL; - const offset_t* offsets = rec_get_offsets( + const rec_offs* offsets = rec_get_offsets( rec, index, NULL, true, ULINT_UNDEFINED, &heap); row_log_table_delete(rec, index, offsets, NULL); mem_heap_free(heap); diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc index d44c74b2236..3df17365560 100644 --- a/storage/innobase/row/row0umod.cc +++ b/storage/innobase/row/row0umod.cc @@ -76,7 +76,7 @@ dberr_t row_undo_mod_clust_low( /*===================*/ undo_node_t* node, /*!< in: row undo node */ - offset_t** offsets,/*!< out: rec_get_offsets() on the record */ + rec_offs** offsets,/*!< out: rec_get_offsets() on the record */ mem_heap_t** offsets_heap, /*!< in/out: memory heap that can be emptied */ mem_heap_t* heap, /*!< in/out: memory heap */ @@ -185,11 +185,11 @@ static ulint row_trx_id_offset(const rec_t* rec, const dict_index_t* index) if (!trx_id_offset) { /* Reserve enough offsets for the PRIMARY KEY and 2 columns so that we can access DB_TRX_ID, DB_ROLL_PTR. */ - offset_t offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2]; + rec_offs offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2]; rec_offs_init(offsets_); mem_heap_t* heap = NULL; const ulint trx_id_pos = index->n_uniq ? index->n_uniq : 1; - offset_t* offsets = rec_get_offsets(rec, index, offsets_, true, + rec_offs* offsets = rec_get_offsets(rec, index, offsets_, true, trx_id_pos + 1, &heap); ut_ad(!heap); ulint len; @@ -270,7 +270,7 @@ row_undo_mod_clust( mem_heap_t* heap = mem_heap_create(1024); mem_heap_t* offsets_heap = NULL; - offset_t* offsets = NULL; + rec_offs* offsets = NULL; const dtuple_t* rebuilt_old_pk; byte sys[DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN]; @@ -431,7 +431,7 @@ row_undo_mod_clust( ulint trx_id_pos = index->n_uniq ? index->n_uniq : 1; /* Reserve enough offsets for the PRIMARY KEY and 2 columns so that we can access DB_TRX_ID, DB_ROLL_PTR. */ - offset_t offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2]; + rec_offs offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2]; if (trx_id_offset) { #ifdef UNIV_DEBUG ut_ad(rec_offs_validate(NULL, index, offsets)); @@ -753,7 +753,7 @@ try_again: switch (search_result) { mem_heap_t* heap; mem_heap_t* offsets_heap; - offset_t* offsets; + rec_offs* offsets; case ROW_BUFFERED: case ROW_NOT_DELETED_REF: /* These are invalid outcomes, because the mode passed diff --git a/storage/innobase/row/row0undo.cc b/storage/innobase/row/row0undo.cc index e7f4d6dde69..8fca99a44b8 100644 --- a/storage/innobase/row/row0undo.cc +++ b/storage/innobase/row/row0undo.cc @@ -168,8 +168,8 @@ row_undo_search_clust_to_pcur( row_ext_t** ext; const rec_t* rec; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; rec_offs_init(offsets_); ut_ad(!node->table->skip_alter_undo); diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index a7ed35a645e..06c18e15ef3 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -214,7 +214,7 @@ row_upd_check_references_constraints( cursor position is lost in this function! */ dict_table_t* table, /*!< in: table in question */ dict_index_t* index, /*!< in: index of the cursor */ - offset_t* offsets,/*!< in/out: rec_get_offsets(pcur.rec, index) */ + rec_offs* offsets,/*!< in/out: rec_get_offsets(pcur.rec, index) */ que_thr_t* thr, /*!< in: query thread */ mtr_t* mtr) /*!< in: mtr */ { @@ -331,7 +331,7 @@ wsrep_row_upd_check_foreign_constraints( cursor position is lost in this function! */ dict_table_t* table, /*!< in: table in question */ dict_index_t* index, /*!< in: index of the cursor */ - offset_t* offsets,/*!< in/out: rec_get_offsets(pcur.rec, index) */ + rec_offs* offsets,/*!< in/out: rec_get_offsets(pcur.rec, index) */ que_thr_t* thr, /*!< in: query thread */ mtr_t* mtr) /*!< in: mtr */ { @@ -471,7 +471,7 @@ ibool row_upd_changes_field_size_or_external( /*===================================*/ 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) */ const upd_t* update) /*!< in: update vector */ { const upd_field_t* upd_field; @@ -590,7 +590,7 @@ row_upd_build_sec_rec_difference_binary( /*====================================*/ const rec_t* rec, /*!< in: secondary index record */ dict_index_t* index, /*!< in: index */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec, index) */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec, index) */ const dtuple_t* entry, /*!< in: entry to insert */ mem_heap_t* heap) /*!< in: memory heap from which allocated */ { @@ -670,7 +670,7 @@ row_upd_build_difference_binary( dict_index_t* index, const dtuple_t* entry, const rec_t* rec, - const offset_t* offsets, + const rec_offs* offsets, bool no_sys, trx_t* trx, mem_heap_t* heap, @@ -680,7 +680,7 @@ row_upd_build_difference_binary( ulint len; upd_t* update; ulint n_diff; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; const ulint n_v_fld = dtuple_get_n_v_fields(entry); rec_offs_init(offsets_); @@ -1742,7 +1742,7 @@ void row_upd_copy_columns( /*=================*/ rec_t* rec, /*!< in: record in a clustered index */ - const offset_t* offsets,/*!< in: array returned by rec_get_offsets() */ + const rec_offs* offsets,/*!< in: array returned by rec_get_offsets() */ const dict_index_t* index, /*!< in: index of rec */ sym_node_t* column) /*!< in: first column in a column list, or NULL */ @@ -1895,8 +1895,8 @@ row_upd_store_row( rec_t* rec; mem_heap_t* heap = NULL; row_ext_t** ext; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - const offset_t* offsets; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + const rec_offs* offsets; rec_offs_init(offsets_); ut_ad(node->pcur->latch_mode != BTR_NO_LATCHES); @@ -2141,7 +2141,7 @@ row_upd_sec_index_entry( && wsrep_must_process_fk(node, trx) && !wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { - offset_t* offsets = rec_get_offsets( + rec_offs* offsets = rec_get_offsets( rec, index, NULL, true, ULINT_UNDEFINED, &heap); @@ -2186,7 +2186,7 @@ row_upd_sec_index_entry( if (referenced) { - offset_t* offsets; + rec_offs* offsets; offsets = rec_get_offsets( rec, index, NULL, true, ULINT_UNDEFINED, @@ -2269,7 +2269,7 @@ row_upd_clust_rec_by_insert_inherit_func( const rec_t* rec, /*!< in: old record, or NULL */ #ifdef UNIV_DEBUG dict_index_t* index, /*!< in: index, or NULL */ - const offset_t* offsets,/*!< in: rec_get_offsets(rec), or NULL */ + const rec_offs* offsets,/*!< in: rec_get_offsets(rec), or NULL */ #endif /* UNIV_DEBUG */ dtuple_t* entry, /*!< in/out: updated entry to be inserted into the clustered index */ @@ -2374,8 +2374,8 @@ row_upd_clust_rec_by_insert( dtuple_t* entry; dberr_t err; rec_t* rec; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets = offsets_; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets = offsets_; ut_ad(dict_index_is_clust(index)); @@ -2520,7 +2520,7 @@ row_upd_clust_rec( ulint flags, /*!< in: undo logging and locking flags */ upd_node_t* node, /*!< in: row update node */ dict_index_t* index, /*!< in: clustered index */ - offset_t* offsets,/*!< in: rec_get_offsets() on node->pcur */ + rec_offs* offsets,/*!< in: rec_get_offsets() on node->pcur */ mem_heap_t** offsets_heap, /*!< in/out: memory heap, can be emptied */ que_thr_t* thr, /*!< in: query thread */ @@ -2651,7 +2651,7 @@ row_upd_del_mark_clust_rec( /*=======================*/ upd_node_t* node, /*!< in: row update node */ dict_index_t* index, /*!< in: clustered index */ - offset_t* offsets,/*!< in/out: rec_get_offsets() for the + rec_offs* offsets,/*!< in/out: rec_get_offsets() for the record under the cursor */ que_thr_t* thr, /*!< in: query thread */ ibool referenced, @@ -2746,8 +2746,8 @@ row_upd_clust_step( mtr_t mtr; rec_t* rec; mem_heap_t* heap = NULL; - offset_t offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets; + rec_offs offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets; ibool referenced; ulint flags; trx_t* trx = thr_get_trx(thr); diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc index ab51c6be79b..a0d0d5d1ad4 100644 --- a/storage/innobase/row/row0vers.cc +++ b/storage/innobase/row/row0vers.cc @@ -87,13 +87,13 @@ row_vers_impl_x_locked_low( dict_index_t* clust_index, const rec_t* rec, dict_index_t* index, - const offset_t* offsets, + const rec_offs* offsets, mtr_t* mtr) { trx_id_t trx_id; rec_t* prev_version = NULL; - offset_t clust_offsets_[REC_OFFS_NORMAL_SIZE]; - offset_t* clust_offsets = clust_offsets_; + rec_offs clust_offsets_[REC_OFFS_NORMAL_SIZE]; + rec_offs* clust_offsets = clust_offsets_; mem_heap_t* heap; dtuple_t* ientry = NULL; mem_heap_t* v_heap = NULL; @@ -388,7 +388,7 @@ row_vers_impl_x_locked( trx_t* caller_trx, const rec_t* rec, dict_index_t* index, - const offset_t* offsets) + const rec_offs* offsets) { mtr_t mtr; trx_t* trx; @@ -510,7 +510,7 @@ row_vers_build_cur_vrow_low( bool in_purge, const rec_t* rec, dict_index_t* clust_index, - offset_t* clust_offsets, + rec_offs* clust_offsets, dict_index_t* index, roll_ptr_t roll_ptr, trx_id_t trx_id, @@ -624,7 +624,7 @@ row_vers_vc_matches_cluster( const rec_t* rec, const dtuple_t* icentry, dict_index_t* clust_index, - offset_t* clust_offsets, + rec_offs* clust_offsets, dict_index_t* index, const dtuple_t* ientry, roll_ptr_t roll_ptr, @@ -793,7 +793,7 @@ row_vers_build_cur_vrow( bool in_purge, const rec_t* rec, dict_index_t* clust_index, - offset_t** clust_offsets, + rec_offs** clust_offsets, dict_index_t* index, roll_ptr_t roll_ptr, trx_id_t trx_id, @@ -866,7 +866,7 @@ row_vers_old_has_index_entry( const rec_t* version; rec_t* prev_version; dict_index_t* clust_index; - offset_t* clust_offsets; + rec_offs* clust_offsets; mem_heap_t* heap; mem_heap_t* heap2; dtuple_t* row; @@ -1107,7 +1107,7 @@ row_vers_build_for_consistent_read( of this records */ mtr_t* mtr, /*!< in: mtr holding the latch on rec */ dict_index_t* index, /*!< in: the clustered index */ - offset_t** offsets,/*!< in/out: offsets returned by + rec_offs** offsets,/*!< in/out: offsets returned by rec_get_offsets(rec, index) */ ReadView* view, /*!< in: the consistent read view */ mem_heap_t** offset_heap,/*!< in/out: memory heap from which @@ -1223,7 +1223,7 @@ row_vers_build_for_semi_consistent_read( of this records */ mtr_t* mtr, /*!< in: mtr holding the latch on rec */ dict_index_t* index, /*!< in: the clustered index */ - offset_t** offsets,/*!< in/out: offsets returned by + rec_offs** offsets,/*!< in/out: offsets returned by rec_get_offsets(rec, index) */ mem_heap_t** offset_heap,/*!< in/out: memory heap from which the offsets are allocated */ diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 5c23be15a13..c234a3c8782 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -337,6 +337,7 @@ static dberr_t create_log_file(lsn_t lsn, std::string& logfile0) memset(log_sys.buf, 0, srv_log_buffer_size); log_block_init(log_sys.buf, lsn); log_block_set_first_rec_group(log_sys.buf, LOG_BLOCK_HDR_SIZE); + memset(log_sys.flush_buf, 0, srv_log_buffer_size); log_sys.buf_free = LOG_BLOCK_HDR_SIZE; diff --git a/storage/innobase/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc index d95d6367531..9f622af37da 100644 --- a/storage/innobase/trx/trx0i_s.cc +++ b/storage/innobase/trx/trx0i_s.cc @@ -546,7 +546,7 @@ put_nth_field( ulint n, /*!< in: number of field */ const dict_index_t* index, /*!< in: index */ const rec_t* rec, /*!< in: record */ - const offset_t* offsets)/*!< in: record offsets, returned + const rec_offs* offsets)/*!< in: record offsets, returned by rec_get_offsets() */ { const byte* data; @@ -627,8 +627,8 @@ fill_lock_data( const dict_index_t* index; ulint n_fields; mem_heap_t* heap; - offset_t offsets_onstack[REC_OFFS_NORMAL_SIZE]; - offset_t* offsets; + rec_offs offsets_onstack[REC_OFFS_NORMAL_SIZE]; + rec_offs* offsets; char buf[TRX_I_S_LOCK_DATA_MAX_LEN]; ulint buf_used; ulint i; diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index 5ade4c7dc7a..cf18c249a3b 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -761,7 +761,7 @@ trx_undo_page_report_modify( delete marking is done */ const rec_t* rec, /*!< in: clustered index record which has NOT yet been modified */ - 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 which tells the columns to be updated; in the case of a delete, this should be set to NULL */ @@ -1947,7 +1947,7 @@ trx_undo_report_row_operation( const rec_t* rec, /*!< in: case of an update or delete marking, the record in the clustered index; NULL if insert */ - const offset_t* offsets, /*!< in: rec_get_offsets(rec) */ + const rec_offs* offsets, /*!< in: rec_get_offsets(rec) */ roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the undo log record */ { @@ -2212,7 +2212,7 @@ trx_undo_prev_version_build( index_rec page and purge_view */ const rec_t* rec, /*!< in: version of a clustered index record */ dict_index_t* index, /*!< in: clustered index */ - offset_t* offsets,/*!< in/out: rec_get_offsets(rec, index) */ + rec_offs* offsets,/*!< in/out: rec_get_offsets(rec, index) */ mem_heap_t* heap, /*!< in: memory heap from which the memory needed is allocated */ rec_t** old_vers,/*!< out, own: previous version, or NULL if @@ -2440,7 +2440,7 @@ trx_undo_prev_version_build( } #if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG - offset_t offsets_dbg[REC_OFFS_NORMAL_SIZE]; + rec_offs offsets_dbg[REC_OFFS_NORMAL_SIZE]; rec_offs_init(offsets_dbg); ut_a(!rec_offs_any_null_extern( *old_vers, rec_get_offsets(*old_vers, index, offsets_dbg, true, diff --git a/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake b/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake index 741ca9c64b2..3c607d9eb3a 100644 --- a/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake +++ b/storage/tokudb/PerconaFT/cmake_modules/TokuSetupCompiler.cmake @@ -161,9 +161,9 @@ if (NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang) set_cflags_if_supported(-Wcast-align) endif () -## always want these in debug builds -set(CMAKE_C_FLAGS_DEBUG "-Wall -Werror ${CMAKE_C_FLAGS_DEBUG}") -set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Werror ${CMAKE_CXX_FLAGS_DEBUG}") +## never want these +set(CMAKE_C_FLAGS "-Wno-error ${CMAKE_C_FLAGS}") +set(CMAKE_CXX_FLAGS "-Wno-error ${CMAKE_CXX_FLAGS}") # pick language dialect set(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}") diff --git a/storage/tokudb/PerconaFT/portability/portability.cc b/storage/tokudb/PerconaFT/portability/portability.cc index 81115a516aa..556a34fb861 100644 --- a/storage/tokudb/PerconaFT/portability/portability.cc +++ b/storage/tokudb/PerconaFT/portability/portability.cc @@ -60,7 +60,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #if defined(HAVE_SYS_SYSCALL_H) # include <sys/syscall.h> #endif -#if defined(HAVE_SYS_SYSCTL_H) +#if defined(HAVE_SYS_SYSCTL_H) && !defined(_SC_PHYS_PAGES) # include <sys/sysctl.h> #endif #if defined(HAVE_PTHREAD_H) diff --git a/unittest/mysys/CMakeLists.txt b/unittest/mysys/CMakeLists.txt index 1d97340784d..ec4e0b91626 100644 --- a/unittest/mysys/CMakeLists.txt +++ b/unittest/mysys/CMakeLists.txt @@ -15,7 +15,7 @@ MY_ADD_TESTS(bitmap base64 my_atomic my_rdtsc lf my_malloc my_getopt dynstring byte_order - LINK_LIBRARIES mysys) + queues LINK_LIBRARIES mysys) MY_ADD_TESTS(my_vsnprintf LINK_LIBRARIES strings mysys) MY_ADD_TESTS(aes LINK_LIBRARIES mysys mysys_ssl) ADD_DEFINITIONS(${SSL_DEFINES}) diff --git a/unittest/mysys/queues-t.c b/unittest/mysys/queues-t.c new file mode 100644 index 00000000000..23cb0da1a32 --- /dev/null +++ b/unittest/mysys/queues-t.c @@ -0,0 +1,139 @@ +/* Copyright (c) 2020, MariaDB Corporation + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ + +#include <my_global.h> +#include <my_sys.h> +#include <queues.h> +#include <my_rnd.h> +#include "tap.h" + +int cmp(void *arg __attribute__((unused)), uchar *a, uchar *b) +{ + return *a < *b ? -1 : *a > *b; +} + +#define rnd(R) ((uint)(my_rnd(R) * INT_MAX32)) + +#define el(Q,I) ((uint)*queue_element(Q, I)) + +my_bool verbose; + +my_bool check_queue(QUEUE *queue) +{ + char b[1024]={0}, *s, *e=b+sizeof(b)-2; + my_bool ok=1; + uint i; + + s= b + my_snprintf(b, e-b, "%x", el(queue, 1)); + for (i=2; i <= queue->elements; i++) + { + s+= my_snprintf(s, e-s, ", %x", el(queue, i)); + ok &= el(queue, i) <= el(queue, i>>1); + } + if (!ok || verbose) + diag("%s", b); + return ok; +} + +int main(int argc __attribute__((unused)), char *argv[]) +{ + QUEUE q, *queue=&q; + MY_INIT(argv[0]); + plan(19); + + verbose=1; + + init_queue(queue, 256, 0, 1, cmp, NULL, 0, 0); + queue_insert(queue, (uchar*)"\x99"); + queue_insert(queue, (uchar*)"\x19"); + queue_insert(queue, (uchar*)"\x36"); + queue_insert(queue, (uchar*)"\x17"); + queue_insert(queue, (uchar*)"\x12"); + queue_insert(queue, (uchar*)"\x05"); + queue_insert(queue, (uchar*)"\x25"); + queue_insert(queue, (uchar*)"\x09"); + queue_insert(queue, (uchar*)"\x15"); + queue_insert(queue, (uchar*)"\x06"); + queue_insert(queue, (uchar*)"\x11"); + queue_insert(queue, (uchar*)"\x01"); + queue_insert(queue, (uchar*)"\x04"); + queue_insert(queue, (uchar*)"\x13"); + queue_insert(queue, (uchar*)"\x24"); + ok(check_queue(queue), "after insert"); + queue_remove(queue, 5); + ok(check_queue(queue), "after remove 5th"); + + queue_element(queue, 1) = (uchar*)"\x01"; + queue_element(queue, 2) = (uchar*)"\x10"; + queue_element(queue, 3) = (uchar*)"\x04"; + queue_element(queue, 4) = (uchar*)"\x09"; + queue_element(queue, 5) = (uchar*)"\x13"; + queue_element(queue, 6) = (uchar*)"\x03"; + queue_element(queue, 7) = (uchar*)"\x08"; + queue_element(queue, 8) = (uchar*)"\x07"; + queue_element(queue, 9) = (uchar*)"\x06"; + queue_element(queue,10) = (uchar*)"\x12"; + queue_element(queue,11) = (uchar*)"\x05"; + queue_element(queue,12) = (uchar*)"\x02"; + queue_element(queue,13) = (uchar*)"\x11"; + queue->elements= 13; + ok(!check_queue(queue), "manually filled (queue property violated)"); + + queue_fix(queue); + ok(check_queue(queue), "fixed"); + + ok(*queue_remove_top(queue) == 0x13, "remove top 13"); + ok(*queue_remove_top(queue) == 0x12, "remove top 12"); + ok(*queue_remove_top(queue) == 0x11, "remove top 11"); + ok(*queue_remove_top(queue) == 0x10, "remove top 10"); + ok(*queue_remove_top(queue) == 0x09, "remove top 9"); + ok(*queue_remove_top(queue) == 0x08, "remove top 8"); + ok(*queue_remove_top(queue) == 0x07, "remove top 7"); + ok(*queue_remove_top(queue) == 0x06, "remove top 6"); + ok(*queue_remove_top(queue) == 0x05, "remove top 5"); + ok(*queue_remove_top(queue) == 0x04, "remove top 4"); + ok(*queue_remove_top(queue) == 0x03, "remove top 3"); + ok(*queue_remove_top(queue) == 0x02, "remove top 2"); + ok(*queue_remove_top(queue) == 0x01, "remove top 1"); + + /* random test */ + { + int i, res; + struct my_rnd_struct rand; + my_rnd_init(&rand, (ulong)(intptr)&i, (ulong)(intptr)argv); + verbose=0; + + for (res= i=1; i <= 250; i++) + { + uchar *s=alloca(2); + *s= rnd(&rand) % 251; + queue_insert(queue, s); + res &= check_queue(queue); + } + ok(res, "inserted 250"); + + while (queue->elements) + { + queue_remove(queue, (rnd(&rand) % queue->elements) + 1); + res &= check_queue(queue); + } + ok(res, "removed 250"); + } + + delete_queue(queue); + my_end(0); + return exit_status(); +} + diff --git a/vio/viosocket.c b/vio/viosocket.c index c4d55901a16..2d240688ce0 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -934,7 +934,7 @@ static my_bool socket_peek_read(Vio *vio, uint *bytes) @param timeout Interval (in milliseconds) to wait for an I/O event. A negative timeout value means an infinite timeout. - @remark sock_errno is set to SOCKET_ETIMEDOUT on timeout. + @remark socket_errno is set to SOCKET_ETIMEDOUT on timeout. @return A three-state value which indicates the operation status. @retval -1 Failure, socket_errno indicates the error. |